TypeScript
fix(mobile): separate unfolded thread list from header (#13088)
Alex80cd57585d7e
diff --git a/apps/mobile/src/lib/mobileTheme.test.ts b/apps/mobile/src/lib/mobileTheme.test.tsindex 1c7643f9895..c1b4ce553fd 100644--- a/apps/mobile/src/lib/mobileTheme.test.ts+++ b/apps/mobile/src/lib/mobileTheme.test.ts@@ -158,6 +158,21 @@ describe("mobile themes", () => {}});+ it.each(MOBILE_THEME_IDS)("keeps %s sidebar text readable on Android", (themeId) => {+ for (const appearance of ["light", "dark"] as const) {+ const variables = getMobileThemeRuntimeVariables(themeId, appearance, "android");+ for (const foreground of [+ "--color-drawer-foreground",+ "--color-drawer-foreground-muted",+ ] as const) {+ expect(+ contrastRatio(variables[foreground], variables["--color-drawer"]),+ `${appearance}: ${foreground}`,+ ).toBeGreaterThanOrEqual(4.5);+ }+ }+ });+it("applies palette overrides on top of the selected built-in theme", () => {const variables = getMobileThemeVariables("ocean", "dark", {"--color-primary": "#123456",@@ -182,9 +197,11 @@ describe("mobile themes", () => {runtime[platform === "android" ? "--color-header" : "--color-drawer"],runtime["--color-screen"],);- expect(relativeLuminance(sidebar)).toBeLessThan(- relativeLuminance(runtime["--color-thread-canvas"]),- );+ if (platform === "ios") {+ expect(relativeLuminance(sidebar)).toBeLessThan(+ relativeLuminance(runtime["--color-thread-canvas"]),+ );+ }expect(contrastRatio(chrome, runtime["--color-screen"])).toBeGreaterThanOrEqual(1.06);const foregroundRoles =platform === "android"diff --git a/apps/mobile/src/lib/mobileThemeVariables.test.ts b/apps/mobile/src/lib/mobileThemeVariables.test.tsindex 1fecf3074b4..c3e275f3dc0 100644--- a/apps/mobile/src/lib/mobileThemeVariables.test.ts+++ b/apps/mobile/src/lib/mobileThemeVariables.test.ts@@ -24,7 +24,7 @@ describe("mobile theme runtime variables", () => {});it.each(MOBILE_THEME_IDS)(- "keeps %s colors on Android with an opaque Material frame",+ "uses a screen-colored %s sidebar beneath an opaque Android frame",(themeId) => {for (const appearance of ["light", "dark"] as const) {const base = getMobileThemeVariables(@@ -43,6 +43,7 @@ describe("mobile theme runtime variables", () => {1,),"--color-header-foreground": base["--color-drawer-foreground"],+ "--color-drawer": base["--color-screen"],});expect(android["--color-header"]).toMatch(/^rgba\(\d+, \d+, \d+, 1\)$/);}@@ -76,7 +77,6 @@ describe("mobile theme runtime variables", () => {expect(ios["--color-header-foreground"]).toBe(ios["--color-drawer-foreground"]);} else {expect(ios).toEqual(getMobileThemeVariables("t3-code", appearance));- expect(ios["--color-drawer"]).toBe(android["--color-drawer"]);expect(ios["--color-drawer"]).toBe("#000000");expect(ios["--color-thread-canvas"]).toBe("#0a0a0a");}diff --git a/apps/mobile/src/lib/mobileThemeVariables.ts b/apps/mobile/src/lib/mobileThemeVariables.tsindex 15096c0fd1b..8fd82955b73 100644--- a/apps/mobile/src/lib/mobileThemeVariables.ts+++ b/apps/mobile/src/lib/mobileThemeVariables.ts@@ -48,5 +48,6 @@ export function getMobileThemeRuntimeVariables(...variables,"--color-header": frame,"--color-header-foreground": variables["--color-drawer-foreground"],+ "--color-drawer": variables["--color-screen"],};}