From b900ac6582f5d1cff9b67d46bbd833084ad5a1c2 Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 1 Oct 2024 17:02:31 -0700 Subject: [PATCH] update types --- src/components/Dialog/index.tsx | 5 ++- src/components/Dialog/types.ts | 6 +-- src/components/Menu/index.tsx | 4 +- src/components/ReportDialog/index.tsx | 5 +-- .../Wizard/WizardEditListDialog.tsx | 5 +-- src/components/dialogs/GifSelect.tsx | 5 +-- src/components/dms/ConvoMenu.tsx | 6 +-- src/components/dms/MessageMenu.tsx | 10 ++--- src/components/dms/ReportDialog.tsx | 5 +-- src/components/dms/dialogs/NewChatDialog.tsx | 7 +-- .../dms/dialogs/ShareViaChatDialog.tsx | 7 +-- src/screens/StarterPack/StarterPackScreen.tsx | 44 +++++++++---------- src/view/com/auth/server-input/index.tsx | 5 +-- src/view/com/composer/GifAltText.tsx | 5 +-- .../com/composer/videos/SubtitleDialog.tsx | 6 +-- src/view/com/util/forms/PostDropdownBtn.tsx | 12 ++--- src/view/screens/Storybook/Dialogs.tsx | 4 +- 17 files changed, 59 insertions(+), 82 deletions(-) diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index 4cb431462b..b22e2903c9 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -33,7 +33,7 @@ export function Outer({ children, control, onClose, - nativeOptions: _nativeOptions, // @TODO DIALOG REFACTOR + nativeOptions, testID, }: React.PropsWithChildren) { const t = useTheme() @@ -111,7 +111,8 @@ export function Outer({ onCloseAnimationComplete() } }} - cornerRadius={20}> + cornerRadius={20} + {...nativeOptions}> {children} diff --git a/src/components/Dialog/types.ts b/src/components/Dialog/types.ts index 1ddab02eea..ed83bd02b1 100644 --- a/src/components/Dialog/types.ts +++ b/src/components/Dialog/types.ts @@ -4,7 +4,7 @@ import type { GestureResponderEvent, ScrollViewProps, } from 'react-native' -import {BottomSheetProps} from '@discord/bottom-sheet/src' +import {BlueskyBottomSheetViewProps} from '@haileyok/bluesky-bottom-sheet' import {ViewStyleProp} from '#/alf' @@ -52,9 +52,7 @@ export type DialogControlOpenOptions = { export type DialogOuterProps = { control: DialogControlProps onClose?: () => void - nativeOptions?: { - sheet?: Omit - } + nativeOptions?: Omit webOptions?: {} testID?: string } diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 88b4167842..c48d6f9bd0 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -85,7 +85,9 @@ export function Outer({ const context = React.useContext(Context) return ( - + {/* Re-wrap with context since Dialogs are portal-ed to root */} diff --git a/src/components/ReportDialog/index.tsx b/src/components/ReportDialog/index.tsx index a9f4a63b07..b942659380 100644 --- a/src/components/ReportDialog/index.tsx +++ b/src/components/ReportDialog/index.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {Pressable, View} from 'react-native' +import {Pressable, ScrollView, View} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -8,7 +8,6 @@ import {useMyLabelersQuery} from '#/state/queries/preferences' export {useDialogControl as useReportDialogControl} from '#/components/Dialog' import {AppBskyLabelerDefs} from '@atproto/api' -import {BottomSheetScrollViewMethods} from '@discord/bottom-sheet/src' import {atoms as a} from '#/alf' import * as Dialog from '#/components/Dialog' @@ -38,7 +37,7 @@ function ReportDialogInner(props: ReportDialogProps) { } = useMyLabelersQuery() const isLoading = useDelayedLoading(500, isLabelerLoading) - const ref = React.useRef(null) + const ref = React.useRef(null) useOnKeyboardDidShow(() => { ref.current?.scrollToEnd({animated: true}) }) diff --git a/src/components/StarterPack/Wizard/WizardEditListDialog.tsx b/src/components/StarterPack/Wizard/WizardEditListDialog.tsx index 1d69e4f4a0..fab60fc6aa 100644 --- a/src/components/StarterPack/Wizard/WizardEditListDialog.tsx +++ b/src/components/StarterPack/Wizard/WizardEditListDialog.tsx @@ -76,10 +76,7 @@ export function WizardEditListDialog({ ) return ( - + + diff --git a/src/components/dms/ConvoMenu.tsx b/src/components/dms/ConvoMenu.tsx index a4fa625fae..affc292c18 100644 --- a/src/components/dms/ConvoMenu.tsx +++ b/src/components/dms/ConvoMenu.tsx @@ -136,7 +136,7 @@ let ConvoMenu = ({ + onPress={() => leaveConvoControl.open()}> Leave conversation @@ -195,7 +195,7 @@ let ConvoMenu = ({ + onPress={() => reportControl.open()}> Report conversation @@ -206,7 +206,7 @@ let ConvoMenu = ({ + onPress={() => leaveConvoControl.open()}> Leave conversation diff --git a/src/components/dms/MessageMenu.tsx b/src/components/dms/MessageMenu.tsx index 2978d2b220..8680a68bfb 100644 --- a/src/components/dms/MessageMenu.tsx +++ b/src/components/dms/MessageMenu.tsx @@ -7,11 +7,11 @@ import {useLingui} from '@lingui/react' import {richTextToString} from '#/lib/strings/rich-text-helpers' import {getTranslatorLink} from '#/locale/helpers' +import {isWeb} from '#/platform/detection' +import {useConvoActive} from '#/state/messages/convo' import {useLanguagePrefs} from '#/state/preferences' import {useOpenLink} from '#/state/preferences/in-app-browser' -import {isWeb} from 'platform/detection' -import {useConvoActive} from 'state/messages/convo' -import {useSession} from 'state/session' +import {useSession} from '#/state/session' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useTheme} from '#/alf' import {ReportDialog} from '#/components/dms/ReportDialog' @@ -120,7 +120,7 @@ export let MessageMenu = ({ + onPress={() => deleteControl.open()}> {_(msg`Delete for me`)} @@ -128,7 +128,7 @@ export let MessageMenu = ({ + onPress={() => reportControl.open()}> {_(msg`Report`)} diff --git a/src/components/dms/ReportDialog.tsx b/src/components/dms/ReportDialog.tsx index 28b5e86202..60a18723b0 100644 --- a/src/components/dms/ReportDialog.tsx +++ b/src/components/dms/ReportDialog.tsx @@ -10,7 +10,6 @@ import {useLingui} from '@lingui/react' import {useMutation} from '@tanstack/react-query' import {ReportOption} from '#/lib/moderation/useReportOptions' -import {isAndroid} from '#/platform/detection' import {useAgent} from '#/state/session' import {CharProgress} from '#/view/com/composer/char-progress/CharProgress' import * as Toast from '#/view/com/util/Toast' @@ -41,9 +40,7 @@ let ReportDialog = ({ }): React.ReactNode => { const {_} = useLingui() return ( - + diff --git a/src/components/dms/dialogs/NewChatDialog.tsx b/src/components/dms/dialogs/NewChatDialog.tsx index 19f6eb6dfc..e838236e1e 100644 --- a/src/components/dms/dialogs/NewChatDialog.tsx +++ b/src/components/dms/dialogs/NewChatDialog.tsx @@ -2,9 +2,9 @@ import React, {useCallback} from 'react' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {logEvent} from '#/lib/statsig/statsig' import {logger} from '#/logger' import {useGetConvoForMembers} from '#/state/queries/messages/get-convo-for-members' -import {logEvent} from 'lib/statsig/statsig' import {FAB} from '#/view/com/util/fab/FAB' import * as Toast from '#/view/com/util/Toast' import {useTheme} from '#/alf' @@ -55,10 +55,7 @@ export function NewChat({ accessibilityHint="" /> - + void }) { return ( - + ) diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx index 0aa863f7b2..68803ac005 100644 --- a/src/screens/StarterPack/StarterPackScreen.tsx +++ b/src/screens/StarterPack/StarterPackScreen.tsx @@ -15,35 +15,35 @@ import {useNavigation} from '@react-navigation/native' import {NativeStackScreenProps} from '@react-navigation/native-stack' import {useQueryClient} from '@tanstack/react-query' +import {batchedUpdates} from '#/lib/batchedUpdates' +import {HITSLOP_20} from '#/lib/constants' +import {isBlockedOrBlocking, isMuted} from '#/lib/moderation/blocked-and-muted' +import {makeProfileLink, makeStarterPackLink} from '#/lib/routes/links' +import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types' +import {logEvent} from '#/lib/statsig/statsig' import {cleanError} from '#/lib/strings/errors' +import {getStarterPackOgCard} from '#/lib/strings/starter-pack' import {logger} from '#/logger' +import {isWeb} from '#/platform/detection' +import {updateProfileShadow} from '#/state/cache/profile-shadow' +import {useModerationOpts} from '#/state/preferences/moderation-opts' +import {getAllListMembers} from '#/state/queries/list-members' +import {useResolvedStarterPackShortLink} from '#/state/queries/resolve-short-link' +import {useResolveDidQuery} from '#/state/queries/resolve-uri' +import {useShortenLink} from '#/state/queries/shorten-link' import {useDeleteStarterPackMutation} from '#/state/queries/starter-packs' +import {useStarterPackQuery} from '#/state/queries/starter-packs' +import {useAgent, useSession} from '#/state/session' +import {useLoggedOutViewControls} from '#/state/shell/logged-out' import { ProgressGuideAction, useProgressGuideControls, } from '#/state/shell/progress-guide' -import {batchedUpdates} from 'lib/batchedUpdates' -import {HITSLOP_20} from 'lib/constants' -import {isBlockedOrBlocking, isMuted} from 'lib/moderation/blocked-and-muted' -import {makeProfileLink, makeStarterPackLink} from 'lib/routes/links' -import {CommonNavigatorParams, NavigationProp} from 'lib/routes/types' -import {logEvent} from 'lib/statsig/statsig' -import {getStarterPackOgCard} from 'lib/strings/starter-pack' -import {isWeb} from 'platform/detection' -import {updateProfileShadow} from 'state/cache/profile-shadow' -import {useModerationOpts} from 'state/preferences/moderation-opts' -import {getAllListMembers} from 'state/queries/list-members' -import {useResolvedStarterPackShortLink} from 'state/queries/resolve-short-link' -import {useResolveDidQuery} from 'state/queries/resolve-uri' -import {useShortenLink} from 'state/queries/shorten-link' -import {useStarterPackQuery} from 'state/queries/starter-packs' -import {useAgent, useSession} from 'state/session' -import {useLoggedOutViewControls} from 'state/shell/logged-out' -import {useSetActiveStarterPack} from 'state/shell/starter-pack' +import {useSetActiveStarterPack} from '#/state/shell/starter-pack' +import {PagerWithHeader} from '#/view/com/pager/PagerWithHeader' +import {ProfileSubpageHeader} from '#/view/com/profile/ProfileSubpageHeader' import * as Toast from '#/view/com/util/Toast' -import {PagerWithHeader} from 'view/com/pager/PagerWithHeader' -import {ProfileSubpageHeader} from 'view/com/profile/ProfileSubpageHeader' -import {CenteredView} from 'view/com/util/Views' +import {CenteredView} from '#/view/com/util/Views' import {bulkWriteFollows} from '#/screens/Onboarding/util' import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' @@ -591,7 +591,7 @@ function OverflowMenu({ + onPress={() => reportDialogControl.open()}> Report starter pack diff --git a/src/view/com/auth/server-input/index.tsx b/src/view/com/auth/server-input/index.tsx index 4e36688aec..de7ed6d15b 100644 --- a/src/view/com/auth/server-input/index.tsx +++ b/src/view/com/auth/server-input/index.tsx @@ -66,10 +66,7 @@ export function ServerInputDialog({ ]) return ( - + diff --git a/src/view/com/composer/GifAltText.tsx b/src/view/com/composer/GifAltText.tsx index 53db2da941..1737fc29ca 100644 --- a/src/view/com/composer/GifAltText.tsx +++ b/src/view/com/composer/GifAltText.tsx @@ -12,7 +12,6 @@ import { parseEmbedPlayerFromUrl, } from '#/lib/strings/embed-player' import {enforceLen} from '#/lib/strings/helpers' -import {isAndroid} from '#/platform/detection' import {Gif} from '#/state/queries/tenor' import {atoms as a, native, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' @@ -96,9 +95,7 @@ export function GifAltText({ - + Captions & alt text : Alt text} - + diff --git a/src/view/com/util/forms/PostDropdownBtn.tsx b/src/view/com/util/forms/PostDropdownBtn.tsx index fe6efc02fa..ef87c24533 100644 --- a/src/view/com/util/forms/PostDropdownBtn.tsx +++ b/src/view/com/util/forms/PostDropdownBtn.tsx @@ -437,7 +437,7 @@ let PostDropdownBtn = ({ + onPress={() => sendViaChatControl.open()}> Send via direct message @@ -465,7 +465,7 @@ let PostDropdownBtn = ({ + onPress={() => embedPostControl.open()}> {_(msg`Embed post`)} @@ -540,7 +540,7 @@ let PostDropdownBtn = ({ ? _(msg`Hide reply for me`) : _(msg`Hide post for me`) } - onPress={hidePromptControl.open}> + onPress={() => hidePromptControl.open()}> {isReply ? _(msg`Hide reply for me`) @@ -628,7 +628,9 @@ let PostDropdownBtn = ({ + postInteractionSettingsDialogControl.open() + } {...(isAuthor ? Platform.select({ web: { @@ -647,7 +649,7 @@ let PostDropdownBtn = ({ + onPress={() => deletePromptControl.open()}> {_(msg`Delete post`)} diff --git a/src/view/screens/Storybook/Dialogs.tsx b/src/view/screens/Storybook/Dialogs.tsx index bb13831046..a0a2a27551 100644 --- a/src/view/screens/Storybook/Dialogs.tsx +++ b/src/view/screens/Storybook/Dialogs.tsx @@ -185,9 +185,7 @@ export function Dialogs() { - +