diff --git a/bskyembed/snippet/embed.ts b/bskyembed/snippet/embed.ts index 4a56539b3c..3c1b14b955 100644 --- a/bskyembed/snippet/embed.ts +++ b/bskyembed/snippet/embed.ts @@ -68,7 +68,6 @@ function scan(node = document) { if (ref_url.startsWith('http')) { searchParams.set('ref_url', encodeURIComponent(ref_url)) } - searchParams.set('colorMode', embed.dataset.blueskyColorMode || 'auto') const iframe = document.createElement('iframe') iframe.setAttribute('data-bluesky-id', id) diff --git a/bskyembed/src/color-mode.ts b/bskyembed/src/color-mode.ts index 7cbdfd4801..2b392c6178 100644 --- a/bskyembed/src/color-mode.ts +++ b/bskyembed/src/color-mode.ts @@ -1,9 +1,3 @@ -export type ColorModeValues = 'auto' | 'light' | 'dark' - -export function assertColorModeValues(value: string): value is ColorModeValues { - return ['auto', 'light', 'dark'].includes(value) -} - export function applyTheme(theme: 'light' | 'dark') { document.documentElement.classList.remove('light', 'dark') document.documentElement.classList.add(theme) diff --git a/bskyembed/src/screens/landing.tsx b/bskyembed/src/screens/landing.tsx index 82e8c9d394..a3448e90ac 100644 --- a/bskyembed/src/screens/landing.tsx +++ b/bskyembed/src/screens/landing.tsx @@ -6,11 +6,7 @@ import {useEffect, useMemo, useRef, useState} from 'preact/hooks' import arrowBottom from '../../assets/arrowBottom_stroke2_corner0_rounded.svg' import logo from '../../assets/logo.svg' -import { - assertColorModeValues, - ColorModeValues, - initColorMode, -} from '../color-mode' +import {initColorMode} from '../color-mode' import {Container} from '../components/container' import {Link} from '../components/link' import {Post} from '../components/post' @@ -36,7 +32,6 @@ render(, root) function LandingPage() { const [uri, setUri] = useState('') - const [colorMode, setColorMode] = useState('auto') const [error, setError] = useState(null) const [loading, setLoading] = useState(false) const [thread, setThread] = useState( @@ -133,44 +128,16 @@ function LandingPage() { placeholder={DEFAULT_POST} /> -
- - Want to customize more? - -
-
- - -
-
-
- {loading ? ( -
+
) : (
- {!error && thread && uri && ( - - )} -
- {!error && thread && } -
+ {!error && thread && uri && } + {!error && thread && } {error && (

{error}

@@ -201,13 +168,7 @@ function Skeleton() { ) } -function Snippet({ - thread, - colorMode, -}: { - thread: AppBskyFeedDefs.ThreadViewPost - colorMode: ColorModeValues -}) { +function Snippet({thread}: {thread: AppBskyFeedDefs.ThreadViewPost}) { const ref = useRef(null) const [copied, setCopied] = useState(false) @@ -243,11 +204,9 @@ function Snippet({ // x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x return `

${escapeHtml(record.text)}${ + )}" data-bluesky-cid="${escapeHtml(thread.post.cid)}">

${escapeHtml(record.text)}${ record.embed ? `

[image or embed]` : '' @@ -258,7 +217,7 @@ function Snippet({ )}) ${escapeHtml( niceDate(thread.post.indexedAt), )}

` - }, [thread, colorMode]) + }, [thread]) return (
diff --git a/bskyembed/src/screens/post.tsx b/bskyembed/src/screens/post.tsx index 5eacc3e632..1764442b73 100644 --- a/bskyembed/src/screens/post.tsx +++ b/bskyembed/src/screens/post.tsx @@ -4,7 +4,7 @@ import {AppBskyFeedDefs, AtpAgent} from '@atproto/api' import {h, render} from 'preact' import logo from '../../assets/logo.svg' -import {applyTheme, assertColorModeValues, initColorMode} from '../color-mode' +import {initColorMode} from '../color-mode' import {Container} from '../components/container' import {Link} from '../components/link' import {Post} from '../components/post' @@ -22,18 +22,7 @@ if (!uri) { throw new Error('No uri in path') } -const query = new URLSearchParams(window.location.search) -const colorMode = query.get('colorMode') - -if ( - colorMode != null && - assertColorModeValues(colorMode) && - colorMode !== 'auto' -) { - applyTheme(colorMode) -} else { - initColorMode() -} +initColorMode() agent .getPostThread({