From b1cac1fca9559210a169fd5a1eb5563b1a87a305 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Fri, 26 Feb 2021 17:35:05 -0500 Subject: [PATCH] hark-fe: remove former preferences nav Fixes urbit/landscape#494 --- .../apps/notifications/notifications.tsx | 20 ----- .../views/apps/notifications/preferences.tsx | 86 ------------------- 2 files changed, 106 deletions(-) delete mode 100644 pkg/interface/src/views/apps/notifications/preferences.tsx diff --git a/pkg/interface/src/views/apps/notifications/notifications.tsx b/pkg/interface/src/views/apps/notifications/notifications.tsx index 3f9bd75558..c41847afd0 100644 --- a/pkg/interface/src/views/apps/notifications/notifications.tsx +++ b/pkg/interface/src/views/apps/notifications/notifications.tsx @@ -8,7 +8,6 @@ import { Box, Col, Text, Row } from '@tlon/indigo-react'; import { Body } from '~/views/components/Body'; import { PropFunc } from '~/types/util'; import Inbox from './inbox'; -import NotificationPreferences from './preferences'; import { Dropdown } from '~/views/components/Dropdown'; import { FormikOnBlur } from '~/views/components/FormikOnBlur'; import GroupSearch from '~/views/components/GroupSearch'; @@ -76,18 +75,6 @@ export default function NotificationsScreen(props: any): ReactElement { borderBottomColor="washedGray" > Updates - - - - Inbox - - - - - Preferences - - - @@ -137,13 +124,6 @@ export default function NotificationsScreen(props: any): ReactElement { - {view === 'preferences' && ( - - )} {!view && } diff --git a/pkg/interface/src/views/apps/notifications/preferences.tsx b/pkg/interface/src/views/apps/notifications/preferences.tsx deleted file mode 100644 index d67ee18e1b..0000000000 --- a/pkg/interface/src/views/apps/notifications/preferences.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import React, { ReactElement, useCallback } from 'react'; -import { Form, FormikHelpers } from 'formik'; -import _ from 'lodash'; - -import { Col, ManagedCheckboxField as Checkbox } from '@tlon/indigo-react'; -import { NotificationGraphConfig } from '@urbit/api'; - -import { FormikOnBlur } from '~/views/components/FormikOnBlur'; -import GlobalApi from '~/logic/api/global'; - -interface FormSchema { - mentions: boolean; - dnd: boolean; - watchOnSelf: boolean; - watching: string[]; -} - -interface NotificationPreferencesProps { - graphConfig: NotificationGraphConfig; - dnd: boolean; - api: GlobalApi; -} - -export default function NotificationPreferences( - props: NotificationPreferencesProps -): ReactElement { - const { graphConfig, api, dnd } = props; - - const initialValues: FormSchema = { - mentions: graphConfig.mentions, - watchOnSelf: graphConfig.watchOnSelf, - dnd, - }; - - const onSubmit = useCallback( - async (values: FormSchema, actions: FormikHelpers) => { - try { - const promises: Promise[] = []; - if (values.mentions !== graphConfig.mentions) { - promises.push(api.hark.setMentions(values.mentions)); - } - if (values.watchOnSelf !== graphConfig.watchOnSelf) { - promises.push(api.hark.setWatchOnSelf(values.watchOnSelf)); - } - if (values.dnd !== dnd && !_.isUndefined(values.dnd)) { - promises.push(api.hark.setDoNotDisturb(values.dnd)); - } - - await Promise.all(promises); - actions.setStatus({ success: null }); - actions.resetForm({ values: initialValues }); - } catch (e) { - console.error(e); - actions.setStatus({ error: e.message }); - } - }, - [api, graphConfig] - ); - - return ( - -
- - - - - - -
- ); -}