Enable public website sharing.

This commit is contained in:
Mike Cao 2020-08-15 01:17:15 -07:00
parent 48a524e09c
commit 560f1316c1
36 changed files with 294 additions and 61 deletions

View file

@ -8,10 +8,12 @@ import FormLayout, {
FormMessage,
FormRow,
} from 'components/layout/FormLayout';
import Checkbox from '../common/Checkbox';
const initialValues = {
name: '',
domain: '',
public: false,
};
const validate = ({ name, domain }) => {
@ -43,7 +45,7 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
return (
<FormLayout>
<Formik
initialValues={{ ...initialValues, ...values }}
initialValues={{ ...initialValues, ...values, make_public: !!values?.share_id }}
validate={validate}
onSubmit={handleSubmit}
>
@ -59,6 +61,12 @@ export default function WebsiteEditForm({ values, onSave, onClose }) {
<Field name="domain" type="text" />
<FormError name="domain" />
</FormRow>
<FormRow>
<label></label>
<Field name="make_public">
{({ field }) => <Checkbox {...field} label="Make public" />}
</Field>
</FormRow>
<FormButtons>
<Button type="submit" variant="action">
Save