feat(app): change traffic light position, fix sequoia bug (#35081)

This commit is contained in:
Aarav Sareen 2026-07-07 10:19:28 +05:30 committed by GitHub
commit 50374abab8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 12 deletions

View file

@ -173,7 +173,10 @@ function cacheThemeVariants(theme: DesktopTheme, themeId: string) {
export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
name: "Theme",
init: (props: { defaultTheme?: string; onThemeApplied?: (theme: DesktopTheme, mode: "light" | "dark") => void }) => {
init: (props: {
defaultTheme?: string
onThemeApplied?: (theme: DesktopTheme, mode: "light" | "dark", scheme: ColorScheme) => void
}) => {
const themeId = normalize(read(STORAGE_KEYS.THEME_ID) ?? props.defaultTheme) ?? "oc-2"
const colorScheme = (read(STORAGE_KEYS.COLOR_SCHEME) as ColorScheme | null) ?? "system"
const mode = colorScheme === "system" ? getSystemMode() : colorScheme
@ -212,9 +215,9 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
return task
}
const applyTheme = (theme: DesktopTheme, themeId: string, mode: "light" | "dark") => {
const applyTheme = (theme: DesktopTheme, themeId: string, mode: "light" | "dark", scheme: ColorScheme) => {
applyThemeCss(theme, themeId, mode)
props.onThemeApplied?.(theme, mode)
props.onThemeApplied?.(theme, mode, scheme)
}
const ids = () => {
@ -278,7 +281,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
createEffect(() => {
const theme = store.themes[store.themeId]
if (!theme) return
applyTheme(theme, store.themeId, store.mode)
applyTheme(theme, store.themeId, store.mode, store.colorScheme)
})
const setTheme = (id: string) => {
@ -333,7 +336,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
? getSystemMode()
: store.previewScheme
: store.mode
applyTheme(theme, next, mode)
applyTheme(theme, next, mode, store.previewScheme ?? store.colorScheme)
})
},
previewColorScheme: (scheme: ColorScheme) => {
@ -344,7 +347,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
if (!theme) return
if ((store.previewThemeId ?? store.themeId) !== id) return
if (store.previewScheme !== scheme) return
applyTheme(theme, id, mode)
applyTheme(theme, id, mode, scheme)
})
},
commitPreview: () => {
@ -362,7 +365,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
setStore("previewScheme", null)
void load(store.themeId).then((theme) => {
if (!theme) return
applyTheme(theme, store.themeId, store.mode)
applyTheme(theme, store.themeId, store.mode, store.colorScheme)
})
},
}