From b9b89a81471c7513cd979b92dfab566dac1a5e73 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 7 Jan 2026 18:17:56 -0600 Subject: [PATCH] =?UTF-8?q?Mr=20Worldwide=E2=84=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/dialogs/Context.tsx | 7 ++++++ src/components/live/LiveStatusDialog.tsx | 22 +++++++------------ .../moderation/ReportDialog/index.tsx | 15 +++++++++++++ src/view/shell/index.tsx | 2 ++ src/view/shell/index.web.tsx | 2 ++ 5 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/components/dialogs/Context.tsx b/src/components/dialogs/Context.tsx index bc802482fd..f1e4705df5 100644 --- a/src/components/dialogs/Context.tsx +++ b/src/components/dialogs/Context.tsx @@ -3,6 +3,7 @@ import {createContext, useContext, useMemo, useState} from 'react' import {type AgeAssuranceRedirectDialogState} from '#/components/ageAssurance/AgeAssuranceRedirectDialog' import * as Dialog from '#/components/Dialog' import {type Screen} from '#/components/dialogs/EmailDialog/types' +import {type ReportSubject} from '#/components/moderation/ReportDialog' type Control = Dialog.DialogControlProps @@ -24,6 +25,7 @@ type ControlsContext = { share?: boolean }> ageAssuranceRedirectDialogControl: StatefulControl + reportDialogControl: StatefulControl<{subject: ReportSubject}> } const ControlsContext = createContext(null) @@ -51,6 +53,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) { }>() const ageAssuranceRedirectDialogControl = useStatefulDialogControl() + const reportDialogControl = useStatefulDialogControl<{ + subject: ReportSubject + }>() const ctx = useMemo( () => ({ @@ -60,6 +65,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { emailDialogControl, linkWarningDialogControl, ageAssuranceRedirectDialogControl, + reportDialogControl, }), [ mutedWordsDialogControl, @@ -68,6 +74,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { emailDialogControl, linkWarningDialogControl, ageAssuranceRedirectDialogControl, + reportDialogControl, ], ) diff --git a/src/components/live/LiveStatusDialog.tsx b/src/components/live/LiveStatusDialog.tsx index 2d84275478..2a8709e07b 100644 --- a/src/components/live/LiveStatusDialog.tsx +++ b/src/components/live/LiveStatusDialog.tsx @@ -19,10 +19,7 @@ import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfoIcon} from '#/components/icons/CircleInfo' import {createStaticClick, SimpleInlineLinkText} from '#/components/Link' -import { - ReportDialog, - useReportDialogControl, -} from '#/components/moderation/ReportDialog' +import {useGlobalReportDialogControl} from '#/components/moderation/ReportDialog' import * as ProfileCard from '#/components/ProfileCard' import {Text} from '#/components/Typography' import type * as bsky from '#/types/bsky' @@ -100,7 +97,7 @@ export function LiveStatus({ const queryClient = useQueryClient() const openLink = useOpenLink() const moderationOpts = useModerationOpts() - const reportDialogControl = useReportDialogControl() + const reportDialogControl = useGlobalReportDialogControl() return ( <> @@ -229,21 +226,18 @@ export function LiveStatus({ { - reportDialogControl.open() + reportDialogControl.open({ + subject: { + ...profile.status, + $type: 'app.bsky.actor.defs#statusView', + }, + }) })} style={[a.text_sm, a.underline, t.atoms.text_contrast_medium]}> Report - - ) } diff --git a/src/components/moderation/ReportDialog/index.tsx b/src/components/moderation/ReportDialog/index.tsx index 157ad18fb4..1cd56af88e 100644 --- a/src/components/moderation/ReportDialog/index.tsx +++ b/src/components/moderation/ReportDialog/index.tsx @@ -16,6 +16,7 @@ import {atoms as a, useGutters, useTheme} from '#/alf' import * as Admonition from '#/components/Admonition' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' +import {useGlobalDialogsControlContext} from '#/components/dialogs/Context' import {useDelayedLoading} from '#/components/hooks/useDelayedLoading' import {ArrowRotateCounterClockwise_Stroke2_Corner0_Rounded as Retry} from '#/components/icons/ArrowRotate' import { @@ -44,10 +45,24 @@ import { useReportOptions, } from './utils/useReportOptions' +export {type ReportSubject} from './types' export {useDialogControl as useReportDialogControl} from '#/components/Dialog' +export function useGlobalReportDialogControl() { + return useGlobalDialogsControlContext().reportDialogControl +} + const logger = Logger.create(Logger.Context.ReportDialog) +export function GlobalReportDialog() { + const {value, control, clear} = useGlobalReportDialogControl() + if (!value) { + clear() + return null + } + return +} + export function ReportDialog( props: Omit & { subject: ReportSubject diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx index e316537bc0..b2021c2467 100644 --- a/src/view/shell/index.tsx +++ b/src/view/shell/index.tsx @@ -34,6 +34,7 @@ import {LinkWarningDialog} from '#/components/dialogs/LinkWarning' import {MutedWordsDialog} from '#/components/dialogs/MutedWords' import {NuxDialogs} from '#/components/dialogs/nuxs' import {SigninDialog} from '#/components/dialogs/Signin' +import {GlobalReportDialog} from '#/components/moderation/ReportDialog' import { Outlet as PolicyUpdateOverlayPortalOutlet, usePolicyUpdateContext, @@ -117,6 +118,7 @@ function ShellInner() { + {/* Until policy update has been completed by the user, don't render anything that is portaled */} {policyUpdateState.completed && ( diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx index 4dee3d17bd..1f687a1b98 100644 --- a/src/view/shell/index.web.tsx +++ b/src/view/shell/index.web.tsx @@ -24,6 +24,7 @@ import {MutedWordsDialog} from '#/components/dialogs/MutedWords' import {NuxDialogs} from '#/components/dialogs/nuxs' import {SigninDialog} from '#/components/dialogs/Signin' import {useWelcomeModal} from '#/components/hooks/useWelcomeModal' +import {GlobalReportDialog} from '#/components/moderation/ReportDialog' import { Outlet as PolicyUpdateOverlayPortalOutlet, usePolicyUpdateContext, @@ -73,6 +74,7 @@ function ShellInner() { + {welcomeModalControl.isOpen && (