[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.6 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. // create-group-form.tsx
  2. // Copyright (C) 2020 Dwayne Harris
  3. // This program is free software: you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation, either version 3 of the License, or
  6. // (at your option) any later version.
  7. // This program is distributed in the hope that it will be useful,
  8. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. // GNU General Public License for more details.
  11. // You should have received a copy of the GNU General Public License
  12. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. import React, { FC } from 'react'
  14. import { useDispatch } from 'react-redux'
  15. import { Link } from 'react-router-dom'
  16. import { faIdCard } from '@fortawesome/free-solid-svg-icons'
  17. import { checkGroupAvailability } from '../actions/registration'
  18. import { useTheme } from '../hooks'
  19. import CheckboxField from '../components/controls/checkbox-field'
  20. import TextField from '../components/controls/text-field'
  21. import SelectField from '../components/controls/select-field'
  22. import ImageField from '../components/controls/image-field'
  23. import CoverImageField from '../components/controls/cover-image-field'
  24. import IconImageField from '../components/controls/icon-image-field'
  25. import ThemeField from '../components/controls/theme-field'
  26. const CreateGroupForm: FC = () => {
  27. const theme = useTheme()
  28. const dispatch = useDispatch()
  29. const checkAvailability = (value: string) => {
  30. if (value.length > 3) {
  31. dispatch(checkGroupAvailability(value))
  32. }
  33. }
  34. const registrationOptions = {
  35. open: 'Anyone can join',
  36. approval: 'Users must be approved',
  37. closed: 'Registration closed',
  38. }
  39. return (
  40. <div>
  41. <TextField name="group-name" label="Community Name" onBlur={e => checkAvailability(e.target.value)} />
  42. <SelectField name="group-registration" label="Registration" options={registrationOptions} icon={faIdCard} />
  43. <ThemeField name="group-theme" label="Color" />
  44. <ImageField name="group-image" label="Community Image" />
  45. <CoverImageField name="group-cover-image" />
  46. <IconImageField name="group-icon-image" />
  47. <CheckboxField name="group-agree">
  48. I agree to the Communities <Link style={{ color: theme.secondary }} to="/terms/communities">terms and conditions</Link>.
  49. </CheckboxField>
  50. </div>
  51. )
  52. }
  53. export default CreateGroupForm