clean up external media popup

This commit is contained in:
Samuel Newman
2025-11-25 14:13:19 +02:00
parent 360ddb5dfb
commit 87e1b3ae00
+9 -14
View File
@@ -9,7 +9,8 @@ import {
externalEmbedLabels, externalEmbedLabels,
} from '#/lib/strings/embed-player' } from '#/lib/strings/embed-player'
import {useSetExternalEmbedPref} from '#/state/preferences' import {useSetExternalEmbedPref} from '#/state/preferences'
import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {atoms as a, web} from '#/alf'
import {Admonition} from '#/components/Admonition'
import {Button, ButtonText} from '#/components/Button' import {Button, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -24,9 +25,7 @@ export function EmbedConsentDialog({
onAccept: () => void onAccept: () => void
}) { }) {
const {_} = useLingui() const {_} = useLingui()
const t = useTheme()
const setExternalEmbedPref = useSetExternalEmbedPref() const setExternalEmbedPref = useSetExternalEmbedPref()
const {gtMobile} = useBreakpoints()
const onShowAllPress = useCallback(() => { const onShowAllPress = useCallback(() => {
for (const key of embedPlayerSources) { for (const key of embedPlayerSources) {
@@ -52,50 +51,46 @@ export function EmbedConsentDialog({
<Dialog.Handle /> <Dialog.Handle />
<Dialog.ScrollableInner <Dialog.ScrollableInner
label={_(msg`External Media`)} label={_(msg`External Media`)}
style={[gtMobile ? {width: 'auto', maxWidth: 400} : a.w_full]}> style={web({maxWidth: 400})}>
<View style={a.gap_sm}> <View style={a.gap_sm}>
<Text style={[a.text_2xl, a.font_semi_bold]}> <Text style={[a.text_2xl, a.font_bold]}>
<Trans>External Media</Trans> <Trans>External Media</Trans>
</Text> </Text>
<View style={[a.mt_sm, a.mb_2xl, a.gap_lg]}> <View style={[a.mt_sm, a.mb_2xl, a.gap_lg]}>
<Text> <Text style={[a.text_md, a.leading_snug]}>
<Trans> <Trans>
This content is hosted by {externalEmbedLabels[source]}. Do you This content is hosted by {externalEmbedLabels[source]}. Do you
want to enable external media? want to enable external media?
</Trans> </Trans>
</Text> </Text>
<Text style={t.atoms.text_contrast_medium}> <Admonition type="info">
<Trans> <Trans>
External media may allow websites to collect information about External media may allow websites to collect information about
you and your device. No information is sent or requested until you and your device. No information is sent or requested until
you press the "play" button. you press the "play" button.
</Trans> </Trans>
</Text> </Admonition>
</View> </View>
</View> </View>
<View style={a.gap_md}> <View style={a.gap_md}>
<Button <Button
style={gtMobile && a.flex_1}
label={_(msg`Enable external media`)} label={_(msg`Enable external media`)}
onPress={onShowAllPress} onPress={onShowAllPress}
onAccessibilityEscape={control.close} onAccessibilityEscape={control.close}
color="primary" color="primary"
size="large" size="large">
variant="solid">
<ButtonText> <ButtonText>
<Trans>Enable external media</Trans> <Trans>Enable external media</Trans>
</ButtonText> </ButtonText>
</Button> </Button>
<Button <Button
style={gtMobile && a.flex_1}
label={_(msg`Enable this source only`)} label={_(msg`Enable this source only`)}
onPress={onShowPress} onPress={onShowPress}
onAccessibilityEscape={control.close} onAccessibilityEscape={control.close}
color="secondary" color="secondary"
size="large" size="large">
variant="solid">
<ButtonText> <ButtonText>
<Trans>Enable {externalEmbedLabels[source]} only</Trans> <Trans>Enable {externalEmbedLabels[source]} only</Trans>
</ButtonText> </ButtonText>