mirror of
https://github.com/urbit/shrub.git
synced 2024-12-24 20:47:27 +03:00
notifications: add submit button for preferences
Fixes urbit/landscape#535
This commit is contained in:
parent
f20da46745
commit
4133869957
@ -4,12 +4,12 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
ManagedToggleSwitchField as Toggle,
|
ManagedToggleSwitchField as Toggle,
|
||||||
} from "@tlon/indigo-react";
|
} from "@tlon/indigo-react";
|
||||||
import { Form, FormikHelpers } from "formik";
|
import { Formik, Form, FormikHelpers } from "formik";
|
||||||
import { FormikOnBlur } from "~/views/components/FormikOnBlur";
|
|
||||||
import { BackButton } from "./BackButton";
|
import { BackButton } from "./BackButton";
|
||||||
import GlobalApi from "~/logic/api/global";
|
import GlobalApi from "~/logic/api/global";
|
||||||
import useHarkState from "~/logic/state/hark";
|
import useHarkState from "~/logic/state/hark";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import {AsyncButton} from "~/views/components/AsyncButton";
|
||||||
|
|
||||||
interface FormSchema {
|
interface FormSchema {
|
||||||
mentions: boolean;
|
mentions: boolean;
|
||||||
@ -44,12 +44,11 @@ export function NotificationPreferences(props: {
|
|||||||
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
actions.setStatus({ success: null });
|
actions.setStatus({ success: null });
|
||||||
actions.resetForm({ values: initialValues });
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
actions.setStatus({ error: e.message });
|
actions.setStatus({ error: e.message });
|
||||||
}
|
}
|
||||||
}, [api]);
|
}, [api, graphConfig, dnd]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -64,7 +63,7 @@ export function NotificationPreferences(props: {
|
|||||||
messaging
|
messaging
|
||||||
</Text>
|
</Text>
|
||||||
</Col>
|
</Col>
|
||||||
<FormikOnBlur initialValues={initialValues} onSubmit={onSubmit}>
|
<Formik initialValues={initialValues} onSubmit={onSubmit}>
|
||||||
<Form>
|
<Form>
|
||||||
<Col gapY="4">
|
<Col gapY="4">
|
||||||
<Toggle
|
<Toggle
|
||||||
@ -82,9 +81,12 @@ export function NotificationPreferences(props: {
|
|||||||
id="mentions"
|
id="mentions"
|
||||||
caption="Notify me if someone mentions my @p in a channel I've joined"
|
caption="Notify me if someone mentions my @p in a channel I've joined"
|
||||||
/>
|
/>
|
||||||
|
<AsyncButton primary width="fit-content">
|
||||||
|
Save
|
||||||
|
</AsyncButton>
|
||||||
</Col>
|
</Col>
|
||||||
</Form>
|
</Form>
|
||||||
</FormikOnBlur>
|
</Formik>
|
||||||
</Col>
|
</Col>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user