import {useCallback} from 'react' import {View} from 'react-native' import {Image} from 'expo-image' import {type AppBskyActorDefs, type AppBskyEmbedExternal} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useNavigation} from '@react-navigation/native' import {useQueryClient} from '@tanstack/react-query' import {useOpenLink} from '#/lib/hooks/useOpenLink' import {type NavigationProp} from '#/lib/routes/types' import {sanitizeHandle} from '#/lib/strings/handles' import {toNiceDomain} from '#/lib/strings/url-helpers' import {logger} from '#/logger' import {useModerationOpts} from '#/state/preferences/moderation-opts' import {unstableCacheProfileView} from '#/state/queries/profile' import {android, atoms as a, platform, tokens, useTheme, web} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as ProfileCard from '#/components/ProfileCard' import {Text} from '#/components/Typography' import type * as bsky from '#/types/bsky' import {Globe_Stroke2_Corner0_Rounded} from '../icons/Globe' import {SquareArrowTopRight_Stroke2_Corner0_Rounded as SquareArrowTopRightIcon} from '../icons/SquareArrowTopRight' import {LiveIndicator} from './LiveIndicator' export function LiveStatusDialog({ control, profile, embed, }: { control: Dialog.DialogControlProps profile: bsky.profile.AnyProfileView status: AppBskyActorDefs.StatusView embed: AppBskyEmbedExternal.View }) { const navigation = useNavigation() return ( ) } function DialogInner({ profile, embed, navigation, }: { profile: bsky.profile.AnyProfileView embed: AppBskyEmbedExternal.View navigation: NavigationProp }) { const {_} = useLingui() const control = Dialog.useDialogContext() const onPressOpenProfile = useCallback(() => { control.close(() => { navigation.push('Profile', { name: profile.handle, }) }) }, [navigation, profile.handle, control]) return ( ) } export function LiveStatus({ profile, embed, padding = 'xl', onPressOpenProfile, }: { profile: bsky.profile.AnyProfileView embed: AppBskyEmbedExternal.View padding?: 'lg' | 'xl' onPressOpenProfile: () => void }) { const {_} = useLingui() const t = useTheme() const queryClient = useQueryClient() const openLink = useOpenLink() const moderationOpts = useModerationOpts() return ( <> {embed.external.thumb && ( )} {embed.external.title || embed.external.uri} {toNiceDomain(embed.external.uri)} {moderationOpts && ( {/* Ensure wide enough on web hover */} )} Live feature is in beta testing ) }