Mr Worldwide™

This commit is contained in:
Eric Bailey
2026-01-07 18:17:56 -06:00
parent 57646523fb
commit b9b89a8147
5 changed files with 34 additions and 14 deletions
+7
View File
@@ -3,6 +3,7 @@ import {createContext, useContext, useMemo, useState} from 'react'
import {type AgeAssuranceRedirectDialogState} from '#/components/ageAssurance/AgeAssuranceRedirectDialog' import {type AgeAssuranceRedirectDialogState} from '#/components/ageAssurance/AgeAssuranceRedirectDialog'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {type Screen} from '#/components/dialogs/EmailDialog/types' import {type Screen} from '#/components/dialogs/EmailDialog/types'
import {type ReportSubject} from '#/components/moderation/ReportDialog'
type Control = Dialog.DialogControlProps type Control = Dialog.DialogControlProps
@@ -24,6 +25,7 @@ type ControlsContext = {
share?: boolean share?: boolean
}> }>
ageAssuranceRedirectDialogControl: StatefulControl<AgeAssuranceRedirectDialogState> ageAssuranceRedirectDialogControl: StatefulControl<AgeAssuranceRedirectDialogState>
reportDialogControl: StatefulControl<{subject: ReportSubject}>
} }
const ControlsContext = createContext<ControlsContext | null>(null) const ControlsContext = createContext<ControlsContext | null>(null)
@@ -51,6 +53,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
}>() }>()
const ageAssuranceRedirectDialogControl = const ageAssuranceRedirectDialogControl =
useStatefulDialogControl<AgeAssuranceRedirectDialogState>() useStatefulDialogControl<AgeAssuranceRedirectDialogState>()
const reportDialogControl = useStatefulDialogControl<{
subject: ReportSubject
}>()
const ctx = useMemo<ControlsContext>( const ctx = useMemo<ControlsContext>(
() => ({ () => ({
@@ -60,6 +65,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
emailDialogControl, emailDialogControl,
linkWarningDialogControl, linkWarningDialogControl,
ageAssuranceRedirectDialogControl, ageAssuranceRedirectDialogControl,
reportDialogControl,
}), }),
[ [
mutedWordsDialogControl, mutedWordsDialogControl,
@@ -68,6 +74,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
emailDialogControl, emailDialogControl,
linkWarningDialogControl, linkWarningDialogControl,
ageAssuranceRedirectDialogControl, ageAssuranceRedirectDialogControl,
reportDialogControl,
], ],
) )
+8 -14
View File
@@ -19,10 +19,7 @@ import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfoIcon} from '#/components/icons/CircleInfo' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfoIcon} from '#/components/icons/CircleInfo'
import {createStaticClick, SimpleInlineLinkText} from '#/components/Link' import {createStaticClick, SimpleInlineLinkText} from '#/components/Link'
import { import {useGlobalReportDialogControl} from '#/components/moderation/ReportDialog'
ReportDialog,
useReportDialogControl,
} from '#/components/moderation/ReportDialog'
import * as ProfileCard from '#/components/ProfileCard' import * as ProfileCard from '#/components/ProfileCard'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import type * as bsky from '#/types/bsky' import type * as bsky from '#/types/bsky'
@@ -100,7 +97,7 @@ export function LiveStatus({
const queryClient = useQueryClient() const queryClient = useQueryClient()
const openLink = useOpenLink() const openLink = useOpenLink()
const moderationOpts = useModerationOpts() const moderationOpts = useModerationOpts()
const reportDialogControl = useReportDialogControl() const reportDialogControl = useGlobalReportDialogControl()
return ( return (
<> <>
@@ -229,21 +226,18 @@ export function LiveStatus({
<SimpleInlineLinkText <SimpleInlineLinkText
label={_(msg`Report`)} label={_(msg`Report`)}
{...createStaticClick(() => { {...createStaticClick(() => {
reportDialogControl.open() reportDialogControl.open({
subject: {
...profile.status,
$type: 'app.bsky.actor.defs#statusView',
},
})
})} })}
style={[a.text_sm, a.underline, t.atoms.text_contrast_medium]}> style={[a.text_sm, a.underline, t.atoms.text_contrast_medium]}>
<Trans>Report</Trans> <Trans>Report</Trans>
</SimpleInlineLinkText> </SimpleInlineLinkText>
</View> </View>
</View> </View>
<ReportDialog
control={reportDialogControl}
subject={{
...profile.status,
$type: 'app.bsky.actor.defs#statusView',
}}
/>
</> </>
) )
} }
@@ -16,6 +16,7 @@ import {atoms as a, useGutters, useTheme} from '#/alf'
import * as Admonition from '#/components/Admonition' import * as Admonition from '#/components/Admonition'
import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {useGlobalDialogsControlContext} from '#/components/dialogs/Context'
import {useDelayedLoading} from '#/components/hooks/useDelayedLoading' import {useDelayedLoading} from '#/components/hooks/useDelayedLoading'
import {ArrowRotateCounterClockwise_Stroke2_Corner0_Rounded as Retry} from '#/components/icons/ArrowRotate' import {ArrowRotateCounterClockwise_Stroke2_Corner0_Rounded as Retry} from '#/components/icons/ArrowRotate'
import { import {
@@ -44,10 +45,24 @@ import {
useReportOptions, useReportOptions,
} from './utils/useReportOptions' } from './utils/useReportOptions'
export {type ReportSubject} from './types'
export {useDialogControl as useReportDialogControl} from '#/components/Dialog' export {useDialogControl as useReportDialogControl} from '#/components/Dialog'
export function useGlobalReportDialogControl() {
return useGlobalDialogsControlContext().reportDialogControl
}
const logger = Logger.create(Logger.Context.ReportDialog) const logger = Logger.create(Logger.Context.ReportDialog)
export function GlobalReportDialog() {
const {value, control, clear} = useGlobalReportDialogControl()
if (!value) {
clear()
return null
}
return <ReportDialog control={control} subject={value.subject} />
}
export function ReportDialog( export function ReportDialog(
props: Omit<ReportDialogProps, 'subject'> & { props: Omit<ReportDialogProps, 'subject'> & {
subject: ReportSubject subject: ReportSubject
+2
View File
@@ -34,6 +34,7 @@ import {LinkWarningDialog} from '#/components/dialogs/LinkWarning'
import {MutedWordsDialog} from '#/components/dialogs/MutedWords' import {MutedWordsDialog} from '#/components/dialogs/MutedWords'
import {NuxDialogs} from '#/components/dialogs/nuxs' import {NuxDialogs} from '#/components/dialogs/nuxs'
import {SigninDialog} from '#/components/dialogs/Signin' import {SigninDialog} from '#/components/dialogs/Signin'
import {GlobalReportDialog} from '#/components/moderation/ReportDialog'
import { import {
Outlet as PolicyUpdateOverlayPortalOutlet, Outlet as PolicyUpdateOverlayPortalOutlet,
usePolicyUpdateContext, usePolicyUpdateContext,
@@ -117,6 +118,7 @@ function ShellInner() {
<LinkWarningDialog /> <LinkWarningDialog />
<Lightbox /> <Lightbox />
<NuxDialogs /> <NuxDialogs />
<GlobalReportDialog />
{/* Until policy update has been completed by the user, don't render anything that is portaled */} {/* Until policy update has been completed by the user, don't render anything that is portaled */}
{policyUpdateState.completed && ( {policyUpdateState.completed && (
+2
View File
@@ -24,6 +24,7 @@ import {MutedWordsDialog} from '#/components/dialogs/MutedWords'
import {NuxDialogs} from '#/components/dialogs/nuxs' import {NuxDialogs} from '#/components/dialogs/nuxs'
import {SigninDialog} from '#/components/dialogs/Signin' import {SigninDialog} from '#/components/dialogs/Signin'
import {useWelcomeModal} from '#/components/hooks/useWelcomeModal' import {useWelcomeModal} from '#/components/hooks/useWelcomeModal'
import {GlobalReportDialog} from '#/components/moderation/ReportDialog'
import { import {
Outlet as PolicyUpdateOverlayPortalOutlet, Outlet as PolicyUpdateOverlayPortalOutlet,
usePolicyUpdateContext, usePolicyUpdateContext,
@@ -73,6 +74,7 @@ function ShellInner() {
<LinkWarningDialog /> <LinkWarningDialog />
<Lightbox /> <Lightbox />
<NuxDialogs /> <NuxDialogs />
<GlobalReportDialog />
{welcomeModalControl.isOpen && ( {welcomeModalControl.isOpen && (
<WelcomeModal control={welcomeModalControl} /> <WelcomeModal control={welcomeModalControl} />