From 4f0f1e2d1a2a620cf157672db4e7eb339c44b867 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 14 Jan 2026 16:03:30 -0600 Subject: [PATCH] Feedback --- src/components/live/queries.ts | 2 +- src/components/live/utils.ts | 4 ++-- src/features/nuxs/components/Gradient.tsx | 5 +++++ src/lib/actor-status.ts | 2 +- src/state/service-config.tsx | 8 +++++--- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/live/queries.ts b/src/components/live/queries.ts index ccfc8ca033..7db944d06d 100644 --- a/src/components/live/queries.ts +++ b/src/components/live/queries.ts @@ -31,7 +31,7 @@ export function useLiveLinkMetaQuery(url: string | null) { queryFn: async () => { if (!url) return undefined const urlp = new URL(url) - if (!liveNowConfig.allowedDomains.includes(urlp.hostname)) { + if (!liveNowConfig.allowedDomains.has(urlp.hostname)) { const {formatted} = getLiveServiceNames(liveNowConfig.allowedDomains) throw new Error( _( diff --git a/src/components/live/utils.ts b/src/components/live/utils.ts index f8c0bba488..10b0ba8f90 100644 --- a/src/components/live/utils.ts +++ b/src/components/live/utils.ts @@ -51,9 +51,9 @@ const serviceUrlToNameMap: Record = { 'skylight.social': 'Skylight', } -export function getLiveServiceNames(domains: string[]) { +export function getLiveServiceNames(domains: Set) { const names = Array.from( - new Set(domains.map(d => serviceUrlToNameMap[d] || d)), + new Set(Array.from(domains.values()).map(d => serviceUrlToNameMap[d] || d)), ) return { names, diff --git a/src/features/nuxs/components/Gradient.tsx b/src/features/nuxs/components/Gradient.tsx index 80309f2e14..5da8b4aca3 100644 --- a/src/features/nuxs/components/Gradient.tsx +++ b/src/features/nuxs/components/Gradient.tsx @@ -2,6 +2,11 @@ import {LinearGradient} from 'expo-linear-gradient' import {atoms as a, useTheme, utils, type ViewStyleProp} from '#/alf' +/** + * A gradient overlay using the primary color at low opacity. This component is + * absolutely positioned and intended to be composed within other components, + * with optional styling allowed, such as adjusting border radius. + */ export function Gradient({style}: ViewStyleProp) { const t = useTheme() return ( diff --git a/src/lib/actor-status.ts b/src/lib/actor-status.ts index 39ab011875..7c18b5dc66 100644 --- a/src/lib/actor-status.ts +++ b/src/lib/actor-status.ts @@ -72,7 +72,7 @@ export function validateStatus( try { if (AppBskyEmbedExternal.isView(status.embed)) { const url = new URL(status.embed.external.uri) - return config.allowedDomains.includes(url.hostname) + return config.allowedDomains.has(url.hostname) } else { return false } diff --git a/src/state/service-config.tsx b/src/state/service-config.tsx index a30952bd5b..a04cbb51ee 100644 --- a/src/state/service-config.tsx +++ b/src/state/service-config.tsx @@ -87,16 +87,18 @@ export function useTrendingConfig() { const DEFAULT_LIVE_ALLOWED_DOMAINS = ['twitch.tv', 'www.twitch.tv'] export type LiveNowConfig = { - allowedDomains: string[] + allowedDomains: Set } export function useLiveNowConfig(): LiveNowConfig { const ctx = useContext(LiveNowContext) const canGoLive = useCanGoLive() const {currentAccount} = useSession() - if (!currentAccount?.did || !canGoLive) return {allowedDomains: []} + if (!currentAccount?.did || !canGoLive) return {allowedDomains: new Set()} const vip = ctx.find(live => live.did === currentAccount.did) return { - allowedDomains: DEFAULT_LIVE_ALLOWED_DOMAINS.concat(vip ? vip.domains : []), + allowedDomains: new Set( + DEFAULT_LIVE_ALLOWED_DOMAINS.concat(vip ? vip.domains : []), + ), } }