diff --git a/src/components/ReportDialog/SelectReportOptionView.tsx b/src/components/ReportDialog/SelectReportOptionView.tsx index 4413cbe890..169c07d732 100644 --- a/src/components/ReportDialog/SelectReportOptionView.tsx +++ b/src/components/ReportDialog/SelectReportOptionView.tsx @@ -55,6 +55,9 @@ export function SelectReportOptionView({ } else if (props.params.type === 'feedgen') { title = _(msg`Report this feed`) description = _(msg`Why should this feed be reviewed?`) + } else if (props.params.type === 'starterpack') { + title = _(msg`Report this starter pack`) + description = _(msg`Why should this starter pack be reviewed?`) } else if (props.params.type === 'convoMessage') { title = _(msg`Report this message`) description = _(msg`Why should this message be reviewed?`) diff --git a/src/components/ReportDialog/types.ts b/src/components/ReportDialog/types.ts index ceabe0b901..3f43db4a19 100644 --- a/src/components/ReportDialog/types.ts +++ b/src/components/ReportDialog/types.ts @@ -4,7 +4,7 @@ export type ReportDialogProps = { control: Dialog.DialogOuterProps['control'] params: | { - type: 'post' | 'list' | 'feedgen' | 'other' + type: 'post' | 'list' | 'feedgen' | 'starterpack' | 'other' uri: string cid: string } diff --git a/src/components/StarterPack/Main/ProfilesList.tsx b/src/components/StarterPack/Main/ProfilesList.tsx index 92cabf4d4c..cce14f59ab 100644 --- a/src/components/StarterPack/Main/ProfilesList.tsx +++ b/src/components/StarterPack/Main/ProfilesList.tsx @@ -39,7 +39,8 @@ export const ProfilesList = React.forwardRef( const bottomBarOffset = useBottomBarOffset(20) const {currentAccount} = useSession() - const {data} = useListMembersQuery(listUri) + const [isPTRing, setIsPTRing] = React.useState(false) + const {data, refetch} = useListMembersQuery(listUri) const profiles = data?.pages.flatMap(p => p.items.map(i => i.subject)) const isOwn = new AtUri(listUri).host === currentAccount?.did @@ -76,6 +77,12 @@ export const ProfilesList = React.forwardRef( } showsVerticalScrollIndicator={false} desktopFixedHeight + refreshing={isPTRing} + onRefresh={async () => { + setIsPTRing(true) + await refetch() + setIsPTRing(false) + }} /> ) }, diff --git a/src/lib/moderation/useReportOptions.ts b/src/lib/moderation/useReportOptions.ts index 54b727b76b..91656857e4 100644 --- a/src/lib/moderation/useReportOptions.ts +++ b/src/lib/moderation/useReportOptions.ts @@ -13,6 +13,7 @@ interface ReportOptions { account: ReportOption[] post: ReportOption[] list: ReportOption[] + starterpack: ReportOption[] feedgen: ReportOption[] other: ReportOption[] convoMessage: ReportOption[] @@ -94,6 +95,14 @@ export function useReportOptions(): ReportOptions { }, ...common, ], + starterpack: [ + { + reason: ComAtprotoModerationDefs.REASONVIOLATION, + title: _(msg`Name or Description Violates Community Standards`), + description: _(msg`Terms used violate community standards`), + }, + ...common, + ], feedgen: [ { reason: ComAtprotoModerationDefs.REASONVIOLATION, diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx index cdae202c79..0abcab7be3 100644 --- a/src/screens/StarterPack/StarterPackScreen.tsx +++ b/src/screens/StarterPack/StarterPackScreen.tsx @@ -7,6 +7,7 @@ import {useNavigation} from '@react-navigation/native' import {NativeStackScreenProps} from '@react-navigation/native-stack' import {useQueryClient} from '@tanstack/react-query' +import {HITSLOP_20} from 'lib/constants' import {makeProfileLink, makeStarterPackLink} from 'lib/routes/links' import {CommonNavigatorParams, NavigationProp} from 'lib/routes/types' import {shareUrl} from 'lib/sharing' @@ -23,12 +24,15 @@ import {CenteredView} from 'view/com/util/Views' import {bulkWriteFollows} from '#/screens/Onboarding/util' import {atoms as a, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' -import {useDialogControl} from '#/components/Dialog' +import {DialogControlProps, useDialogControl} from '#/components/Dialog' import {ArrowOutOfBox_Stroke2_Corner0_Rounded as ArrowOutOfBox} from '#/components/icons/ArrowOutOfBox' +import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' +import {DotGrid_Stroke2_Corner0_Rounded as Ellipsis} from '#/components/icons/DotGrid' import {QrCode_Stroke2_Corner0_Rounded as QrCode} from '#/components/icons/QrCode' import {ListMaybePlaceholder} from '#/components/Lists' import {Loader} from '#/components/Loader' import * as Menu from '#/components/Menu' +import {ReportDialog, useReportDialogControl} from '#/components/ReportDialog' import {FeedsList} from '#/components/StarterPack/Main/FeedsList' import {ProfilesList} from '#/components/StarterPack/Main/ProfilesList' import {QrCodeDialog} from '#/components/StarterPack/QrCodeDialog' @@ -126,6 +130,7 @@ function Header({ const agent = useAgent() const queryClient = useQueryClient() const qrCodeDialogControl = useDialogControl() + const reportDialogControl = useReportDialogControl() const [isProcessing, setIsProcessing] = React.useState(false) @@ -177,72 +182,7 @@ function Header({ avatar={undefined} creator={creator} avatarType="starter-pack"> - - - - {({props, state}) => ( - - - Share - - - )} - - - - { - logEvent('starterPack:share', { - starterPack: starterPack.uri, - shareType: 'link', - }) - shareUrl(makeStarterPackLink(name, rkey)) - }}> - - Share link - - - - - - Create QR code - - - - - - + {isOwn ? ( )} + @@ -282,6 +229,131 @@ function Header({ ) : null} + ) } + +function Dropdown({ + name, + rkey, + starterPack, + qrCodeDialogControl, + reportDialogControl, +}: { + name: string + rkey: string + starterPack: AppBskyGraphDefs.StarterPackView + qrCodeDialogControl: DialogControlProps + reportDialogControl: DialogControlProps +}) { + const {_} = useLingui() + const t = useTheme() + const {currentAccount} = useSession() + + const isOwn = starterPack.creator.did === currentAccount?.did + + return ( + + + {({props, state}) => ( + <> + {isOwn ? ( + + + Share + + + ) : ( + + + + )} + + )} + + + + { + logEvent('starterPack:share', { + starterPack: starterPack.uri, + shareType: 'link', + }) + shareUrl(makeStarterPackLink(name, rkey)) + }}> + + Share link + + + + + + Create QR code + + + + + {!isOwn && ( + + + Report starter pack + + + + )} + + + ) +}