diff --git a/app.json b/app.json
index e9b7255..3e8effb 100644
--- a/app.json
+++ b/app.json
@@ -10,15 +10,16 @@
"splash": {
"image": "./assets/splash-icon.png",
"resizeMode": "contain",
- "backgroundColor": "#ffffff"
+ "backgroundColor": "#0c0c0e"
},
"ios": {
- "supportsTablet": true
+ "supportsTablet": true,
+ "bundleIdentifier": "app.netlify.kasane"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
- "backgroundColor": "#ffffff"
+ "backgroundColor": "#0c0c0e"
},
"edgeToEdgeEnabled": true,
"predictiveBackGestureEnabled": false
@@ -29,7 +30,31 @@
"output": "single"
},
"scheme": "kasane",
- "plugins": ["expo-router", "expo-font"],
+ "plugins": [
+ "expo-router",
+ "expo-font",
+ [
+ "expo-alternate-app-icons",
+ [
+ {
+ "name": "Split",
+ "ios": "./assets/icons/icon-split.png",
+ "android": {
+ "foregroundImage": "./assets/icons/icon-split-foreground.png",
+ "backgroundColor": "#5cdfff"
+ }
+ },
+ {
+ "name": "Light",
+ "ios": "./assets/icons/icon-light.png",
+ "android": {
+ "foregroundImage": "./assets/icons/icon-light-foreground.png",
+ "backgroundColor": "#f5f5f5"
+ }
+ }
+ ]
+ ]
+ ],
"experiments": {
"typedRoutes": true,
"tsconfigPaths": true
diff --git a/app/settings.tsx b/app/settings.tsx
index 17e8591..5945ad2 100644
--- a/app/settings.tsx
+++ b/app/settings.tsx
@@ -1,11 +1,15 @@
+import { AppIconPicker } from "@/components/AppIconPicker";
import { Page } from "@/components/Page";
+import { canChangeAppIcon } from "@/state/appIcon";
export default function SettingsScreen() {
return (
+ blurb={canChangeAppIcon ? undefined : "Settings are coming soon."}
+ >
+ {canChangeAppIcon && }
+
);
}
diff --git a/assets/adaptive-icon.png b/assets/adaptive-icon.png
index 03d6f6b..f3e51f7 100644
Binary files a/assets/adaptive-icon.png and b/assets/adaptive-icon.png differ
diff --git a/assets/favicon.png b/assets/favicon.png
index e75f697..29760ae 100644
Binary files a/assets/favicon.png and b/assets/favicon.png differ
diff --git a/assets/icon.png b/assets/icon.png
index a0b1526..510e593 100644
Binary files a/assets/icon.png and b/assets/icon.png differ
diff --git a/assets/icons/icon-light-foreground.png b/assets/icons/icon-light-foreground.png
new file mode 100644
index 0000000..a30d481
Binary files /dev/null and b/assets/icons/icon-light-foreground.png differ
diff --git a/assets/icons/icon-light.png b/assets/icons/icon-light.png
new file mode 100644
index 0000000..77203d9
Binary files /dev/null and b/assets/icons/icon-light.png differ
diff --git a/assets/icons/icon-split-foreground.png b/assets/icons/icon-split-foreground.png
new file mode 100644
index 0000000..6227df3
Binary files /dev/null and b/assets/icons/icon-split-foreground.png differ
diff --git a/assets/icons/icon-split.png b/assets/icons/icon-split.png
new file mode 100644
index 0000000..21e7d5b
Binary files /dev/null and b/assets/icons/icon-split.png differ
diff --git a/assets/logo-mark.png b/assets/logo-mark.png
new file mode 100644
index 0000000..b089175
Binary files /dev/null and b/assets/logo-mark.png differ
diff --git a/assets/splash-icon.png b/assets/splash-icon.png
index 03d6f6b..a52e14c 100644
Binary files a/assets/splash-icon.png and b/assets/splash-icon.png differ
diff --git a/bun.lock b/bun.lock
index bf617c1..45b96cd 100644
--- a/bun.lock
+++ b/bun.lock
@@ -14,6 +14,7 @@
"@tanstack/react-query": "5.103.1",
"@tanstack/react-query-persist-client": "5.103.1",
"expo": "57.0.23",
+ "expo-alternate-app-icons": "11.0.0",
"expo-constants": "57.0.18",
"expo-font": "57.0.4",
"expo-linking": "57.0.10",
@@ -268,8 +269,6 @@
"@expo/ui": ["@expo/ui@57.0.18", "", { "dependencies": { "sf-symbols-typescript": "^2.1.0", "vaul": "^1.1.2" }, "peerDependencies": { "@babel/core": "*", "expo": "*", "react": "*", "react-dom": "*", "react-native": "*", "react-native-worklets": "*" }, "optionalPeers": ["@babel/core", "react-dom", "react-native-worklets"] }, "sha512-9RkA26v0FSyHlkQCyavZrT8EzsALfkNHIFO5uC+IsAxzWzItdOWdy6asjpg1yaCvBEGMYkP17FUZxluhVbeleA=="],
- "@expo/ws-tunnel": ["@expo/ws-tunnel@2.0.0", "", { "peerDependencies": { "ws": "^8.0.0" } }, "sha512-j+JfTRdCk820J9dU0sA2SqshQIKFOMo7ED84w9MJFcebfbNQgsLztEY/SABDkGnjatrW4xGqnUhVRxSBVyCkXw=="],
-
"@expo/xcpretty": ["@expo/xcpretty@4.4.5", "", { "dependencies": { "@babel/code-frame": "^7.20.0", "chalk": "^4.1.0", "js-yaml": "^4.1.0" }, "bin": { "excpretty": "build/cli.js" } }, "sha512-J3eL4n4h5QTwfD0SIz8OIk6/+sOL/hFZAMacgCM07UNlxBQfJipEpIC2AQxvGkbYeStByJ0TVhQAJo+DeNgaSQ=="],
"@graphql-typed-document-node/core": ["@graphql-typed-document-node/core@3.2.0", "", { "peerDependencies": { "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ=="],
@@ -804,6 +803,8 @@
"expo": ["expo@57.0.23", "", { "dependencies": { "@babel/runtime": "^7.20.0", "@expo/cli": "^57.0.25", "@expo/config": "~57.0.9", "@expo/config-plugins": "~57.0.9", "@expo/devtools": "~57.0.1", "@expo/dom-webview": "~57.0.1", "@expo/fingerprint": "^0.20.13", "@expo/local-build-cache-provider": "^57.0.8", "@expo/log-box": "^57.0.4", "@expo/metro": "~56.0.2", "@expo/metro-config": "~57.0.12", "@ungap/structured-clone": "^1.3.0", "babel-preset-expo": "~57.0.12", "expo-asset": "~57.0.17", "expo-constants": "~57.0.18", "expo-file-system": "~57.0.7", "expo-font": "~57.0.4", "expo-keep-awake": "~57.0.2", "expo-modules-autolinking": "~57.0.13", "expo-modules-core": "~57.0.18", "pretty-format": "^29.7.0", "react-refresh": "^0.14.2", "whatwg-url-minimum": "^0.1.2" }, "peerDependencies": { "@expo/metro-runtime": "*", "react": "*", "react-dom": "*", "react-native": "*", "react-native-web": "*", "react-native-webview": "*" }, "optionalPeers": ["@expo/metro-runtime", "react-dom", "react-native-web", "react-native-webview"], "bin": { "expo": "bin/cli", "fingerprint": "bin/fingerprint", "expo-modules-autolinking": "bin/autolinking" } }, "sha512-/aBLZFTD7+BNHWV/q5XbNRFqMhW/CrHsYeq8CcS/iGz6lJHYwEMm4XFcdoaeliuMdo6ZjNrsTHkBIdGB8VMHTg=="],
+ "expo-alternate-app-icons": ["expo-alternate-app-icons@11.0.0", "", { "peerDependencies": { "expo": ">=53", "react": "*", "react-native": "*" } }, "sha512-9k25v/LIaX52FSOwKTZcCvh/VrpuITEtn9ini4Rs8k08YGDA26LIx7Jum6tngWfRQn9RbQD3uGA7vDTUEGUWFg=="],
+
"expo-asset": ["expo-asset@57.0.17", "", { "dependencies": { "@expo/image-utils": "^0.11.5", "expo-constants": "~57.0.18" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-qSdWZBSfEg06o3GJMwcj36tw0vXkB6eYjqkQistWmyJkHxhUOKnsKJnev6OraXxLdoI+KOd1+qgp/ENx8gcqYA=="],
"expo-constants": ["expo-constants@57.0.18", "", { "dependencies": { "@expo/env": "~2.4.3" }, "peerDependencies": { "expo": "*", "react-native": "*" } }, "sha512-cLDwDOniPfuCZPHNY++cAY2ZkK97u5aobbBvilPK2LLmaWxR4ZpD31LWUIzUDLrwMPxLjmh1uURnbeYEf0Mivw=="],
@@ -1516,14 +1517,14 @@
"@babel/plugin-transform-runtime/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
+ "@expo/cli/@expo/ws-tunnel": ["@expo/ws-tunnel@2.0.0", "", { "peerDependencies": { "ws": "^8.0.0" } }, "sha512-j+JfTRdCk820J9dU0sA2SqshQIKFOMo7ED84w9MJFcebfbNQgsLztEY/SABDkGnjatrW4xGqnUhVRxSBVyCkXw=="],
+
"@expo/cli/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
"@expo/devcert/debug": ["debug@3.2.7", "", { "dependencies": { "ms": "^2.1.1" } }, "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ=="],
"@expo/plist/xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="],
- "@expo/ws-tunnel/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
-
"@react-native/babel-preset/@react-native/babel-plugin-codegen": ["@react-native/babel-plugin-codegen@0.87.1", "", { "dependencies": { "@babel/traverse": "^7.29.0", "@react-native/codegen": "0.87.1" } }, "sha512-DfnyLAHG7jH4pqeID7ib6AeD6gG8T+KvM3c/w/yEa5ONkfRcHvTC8JMIRdhUqs4ruA+8xbYcNVQzewYRCPm1Xw=="],
"@react-native/babel-preset/babel-plugin-syntax-hermes-parser": ["babel-plugin-syntax-hermes-parser@0.36.1", "", { "dependencies": { "hermes-parser": "0.36.1" } }, "sha512-ycduwJbvdvIMmVvlAZqGggS+pm5Eu4Bk9pcV9Sm2Z4PJNRVsKkv0g7vHj+LeuC1gHTeF67sJXFOq61IlqCa2hA=="],
diff --git a/e2e/side-menu.spec.ts b/e2e/side-menu.spec.ts
new file mode 100644
index 0000000..1351cf7
--- /dev/null
+++ b/e2e/side-menu.spec.ts
@@ -0,0 +1,48 @@
+import { expect, test, type Page } from "@playwright/test";
+
+/**
+ * The navigation drawer, end to end against the real export. Everything is
+ * found by accessible name, so a lost `accessibilityLabel` fails here too.
+ */
+
+const openMenu = async (page: Page): Promise => {
+ await page.goto("/");
+ await page.getByRole("button", { name: "Open menu" }).click();
+ await expect(page.getByText("Menu", { exact: true })).toBeVisible();
+};
+
+test.describe("side menu", () => {
+ test("opens from the header and lists every destination", async ({
+ page,
+ }) => {
+ await openMenu(page);
+ await expect(page.getByRole("link", { name: "All mapped" })).toBeVisible();
+ await expect(page.getByRole("link", { name: "My shows" })).toBeVisible();
+ await expect(page.getByRole("link", { name: "Settings" })).toBeVisible();
+ });
+
+ test("closes from its close button", async ({ page }) => {
+ await openMenu(page);
+ await page.getByRole("button", { name: "Close menu" }).last().click();
+ await expect(page.getByText("Menu", { exact: true })).toBeHidden();
+ });
+
+ test("closes when the scrim is pressed", async ({ page }) => {
+ await openMenu(page);
+ await page
+ .getByRole("button", { name: "Close menu" })
+ .first()
+ .click({
+ // The drawer covers the scrim's left edge, so press well to its right.
+ position: { x: 600, y: 300 },
+ });
+ await expect(page.getByText("Menu", { exact: true })).toBeHidden();
+ });
+
+ test("navigates to a destination and closes", async ({ page }) => {
+ await openMenu(page);
+ await page.getByRole("link", { name: "Settings" }).click();
+ await expect(page).toHaveURL(/\/settings$/);
+ await expect(page.getByText("Menu", { exact: true })).toBeHidden();
+ });
+});
diff --git a/package.json b/package.json
index 0425ebd..eccddb7 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"format": "oxfmt",
"format:check": "oxfmt --check",
"system-check": "run-s typecheck format:check lint lint:actions spellcheck test build:web",
+ "icons:render": "bun scripts/render-icons.ts",
"prepare": "husky",
"desktop:init": "tauri init",
"desktop:dev": "tauri dev",
@@ -40,6 +41,7 @@
"@tanstack/react-query": "5.103.1",
"@tanstack/react-query-persist-client": "5.103.1",
"expo": "57.0.23",
+ "expo-alternate-app-icons": "11.0.0",
"expo-constants": "57.0.18",
"expo-font": "57.0.4",
"expo-linking": "57.0.10",
diff --git a/scripts/render-icons.ts b/scripts/render-icons.ts
new file mode 100644
index 0000000..842e003
--- /dev/null
+++ b/scripts/render-icons.ts
@@ -0,0 +1,169 @@
+// Renders every icon in `assets/` from the logo's definition below, so the
+// images are never edited by hand. Needs network access for the Noto Sans JP
+// glyph and the Playwright Chromium from `bun run e2e:install`.
+//
+// bun run icons:render
+import { mkdirSync } from "node:fs";
+import { dirname, join } from "node:path";
+import { chromium } from "@playwright/test";
+import { COLOR } from "@/theme";
+
+const OUT_DIR = "assets";
+const GLYPH = "重";
+const FONT_FAMILY = "Noto Sans JP";
+const FONT_URL =
+ "https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@900&display=swap";
+// The glyph sits low in its em box; this lifts it to the optical centre.
+const LIFT_EM = -0.038;
+const FULL = 1024;
+
+const CYAN = COLOR.sideAnime;
+const CORAL = COLOR.sideManga;
+const WHITE = COLOR.textPrimary;
+const BLACK = COLOR.background;
+
+const SPLIT_FILL = `linear-gradient(135deg, ${CYAN} 0%, ${CYAN} 40%, ${WHITE} 40%, ${WHITE} 60%, ${CORAL} 60%, ${CORAL} 100%)`;
+const SPLIT_GROUND = `linear-gradient(135deg, ${CYAN} 0%, ${CYAN} 50%, ${CORAL} 50%, ${CORAL} 100%)`;
+
+type Frame = { size: number; background: string; radius: number; mark: string };
+type Icon = Frame & { file: string };
+type Overlap = { px: number; shift: number };
+
+const lifted = (style: string) =>
+ `${GLYPH}`;
+
+/** The primary mark: one glyph filled with the three colours on the diagonal. */
+const layeredMark = (px: number) =>
+ lifted(
+ `font-size:${px}px;color:transparent;background-image:${SPLIT_FILL};-webkit-background-clip:text;background-clip:text`,
+ );
+
+const solidMark = (px: number) => lifted(`font-size:${px}px;color:${BLACK}`);
+
+/** Two offset glyphs, black where they overlap. */
+const overlapMark = ({ px, shift }: Overlap) => {
+ const near = FULL / 2 - shift;
+ const far = FULL / 2 + shift;
+ const at = (xy: number) =>
+ `x="${xy}" y="${xy}" text-anchor="middle" dominant-baseline="central"`;
+ return ``;
+};
+
+const TRANSPARENT = "transparent";
+
+// Android masks an adaptive foreground to roughly its middle two thirds, so
+// the foreground marks are drawn smaller than their full-bleed counterparts.
+const ICONS: readonly Icon[] = [
+ {
+ file: "icon.png",
+ size: FULL,
+ background: BLACK,
+ radius: 0,
+ mark: layeredMark(640),
+ },
+ {
+ file: "adaptive-icon.png",
+ size: FULL,
+ background: TRANSPARENT,
+ radius: 0,
+ mark: layeredMark(420),
+ },
+ {
+ file: "splash-icon.png",
+ size: FULL,
+ background: TRANSPARENT,
+ radius: 0,
+ mark: layeredMark(560),
+ },
+ // The mark alone, cropped close, for the in-app header.
+ {
+ file: "logo-mark.png",
+ size: 512,
+ background: TRANSPARENT,
+ radius: 0,
+ mark: layeredMark(540),
+ },
+ {
+ file: "favicon.png",
+ size: 256,
+ background: BLACK,
+ radius: 56,
+ mark: layeredMark(168),
+ },
+ {
+ file: "icons/icon-split.png",
+ size: FULL,
+ background: SPLIT_GROUND,
+ radius: 0,
+ mark: solidMark(600),
+ },
+ {
+ file: "icons/icon-split-foreground.png",
+ size: FULL,
+ background: SPLIT_GROUND,
+ radius: 0,
+ mark: solidMark(400),
+ },
+ {
+ file: "icons/icon-light.png",
+ size: FULL,
+ background: WHITE,
+ radius: 0,
+ mark: overlapMark({ px: 600, shift: 28 }),
+ },
+ {
+ file: "icons/icon-light-foreground.png",
+ size: FULL,
+ background: TRANSPARENT,
+ radius: 0,
+ mark: overlapMark({ px: 390, shift: 18 }),
+ },
+];
+
+const html = ({ size, background, radius, mark }: Frame) =>
+ `
+
+
+${mark}
`;
+
+const browser = await chromium.launch();
+
+// One page at a time: every icon waits on the same web font, and a shared
+// browser keeps it cached after the first.
+await ICONS.reduce(async (previous, icon) => {
+ await previous;
+ const path = join(OUT_DIR, icon.file);
+ mkdirSync(dirname(path), { recursive: true });
+ const page = await browser.newPage({
+ viewport: { width: icon.size, height: icon.size },
+ deviceScaleFactor: 1,
+ });
+ await page.setContent(html(icon), { waitUntil: "networkidle" });
+ const hasFont = await page.evaluate(
+ async ({ family, glyph }) => {
+ const font = `900 100px '${family}'`;
+ await document.fonts.load(font, glyph);
+ return document.fonts.check(font, glyph);
+ },
+ { family: FONT_FAMILY, glyph: GLYPH },
+ );
+ if (!hasFont) {
+ throw new Error(`${FONT_FAMILY} did not load; ${icon.file} not rendered`);
+ }
+ await page.screenshot({
+ path,
+ omitBackground: icon.background === TRANSPARENT,
+ clip: { x: 0, y: 0, width: icon.size, height: icon.size },
+ });
+ await page.close();
+ console.log(`rendered ${path}`);
+}, Promise.resolve());
+
+await browser.close();
diff --git a/src/components/AppIconPicker.tsx b/src/components/AppIconPicker.tsx
new file mode 100644
index 0000000..080ad51
--- /dev/null
+++ b/src/components/AppIconPicker.tsx
@@ -0,0 +1,93 @@
+import { useState } from "react";
+import {
+ Image,
+ Pressable,
+ StyleSheet,
+ Text,
+ View,
+ type ImageSourcePropType,
+} from "react-native";
+import iconLayered from "@assets/icon.png";
+import iconLight from "@assets/icons/icon-light.png";
+import iconSplit from "@assets/icons/icon-split.png";
+import { APP_ICONS, type AppIcon, type AppIconId } from "@/data/appIcons";
+import { useAppIcon } from "@/state/appIcon";
+import { COLOR, FONT, pressFeedback, SPACE, TEXT } from "@/theme";
+
+const ICON_SOURCE: Record = {
+ layered: iconLayered,
+ split: iconSplit,
+ light: iconLight,
+};
+
+const ICON_SIZE = 72;
+
+/**
+ * Lets the user choose which of the Kasane icons sits on their home screen.
+ * Only meaningful where `canChangeAppIcon` is true; the screen decides
+ * whether to mount it.
+ */
+export function AppIconPicker() {
+ const iconId = useAppIcon((s) => s.iconId);
+ const setIcon = useAppIcon((s) => s.setIcon);
+ const [hasFailed, setHasFailed] = useState(false);
+
+ const choose = (icon: AppIcon) => {
+ setHasFailed(false);
+ setIcon(icon).catch(() => setHasFailed(true));
+ };
+
+ return (
+
+ App icon
+
+ {APP_ICONS.map((icon) => (
+ choose(icon)}
+ accessibilityRole="radio"
+ accessibilityLabel={`${icon.label} app icon`}
+ accessibilityState={{ checked: icon.id === iconId }}
+ style={(state) => [styles.option, pressFeedback(state)]}
+ >
+
+
+
+
+ {icon.label}
+
+
+ ))}
+
+ {hasFailed && (
+
+ The icon could not be changed. Try again.
+
+ )}
+
+ );
+}
+
+const styles = StyleSheet.create({
+ section: { gap: SPACE.lg },
+ heading: { ...TEXT.eyebrow, color: COLOR.textMuted },
+ options: { flexDirection: "row", flexWrap: "wrap", gap: SPACE.xl },
+ option: { alignItems: "center", gap: SPACE.md },
+ // The frame keeps its width whether or not it is selected, so choosing an
+ // icon never shifts its neighbours.
+ frame: {
+ padding: SPACE.xs,
+ borderWidth: 2,
+ borderRadius: 22,
+ borderColor: COLOR.borderInactive,
+ },
+ frameActive: { borderColor: COLOR.accent },
+ icon: { width: ICON_SIZE, height: ICON_SIZE, borderRadius: 16 },
+ label: { ...TEXT.chipLabel, color: COLOR.textMuted },
+ labelActive: { color: COLOR.accent },
+ error: { color: COLOR.danger, fontSize: 14, fontFamily: FONT.medium },
+});
diff --git a/src/components/HeaderWordmark.tsx b/src/components/HeaderWordmark.tsx
index 99c4dcc..d643798 100644
--- a/src/components/HeaderWordmark.tsx
+++ b/src/components/HeaderWordmark.tsx
@@ -1,13 +1,15 @@
import { useEffect, useState } from "react";
import { Animated, Pressable, StyleSheet, Text, View } from "react-native";
+import logoMark from "@assets/logo-mark.png";
import { COLOR, FONT, pressFeedback, SPACE } from "@/theme";
const SHRINK_MS = 180;
/**
- * The "Kasane" wordmark and its subheading in the global header, linking
- * home. `compact` animates the wordmark down to its phone size and drops the
- * subheading, which the home screen asks for while its grid is being scrolled.
+ * The logo mark, the "Kasane" wordmark and its subheading in the global
+ * header, linking home. `compact` animates the mark and wordmark down to their
+ * phone size and drops the subheading, which the home screen asks for while
+ * its grid is being scrolled.
*/
export function HeaderWordmark({
narrow,
@@ -41,6 +43,13 @@ export function HeaderWordmark({
}),
};
+ // The mark is a square as tall as the wordmark's line, so the two shrink
+ // together.
+ const markSize = {
+ width: wordmarkSize.lineHeight,
+ height: wordmarkSize.lineHeight,
+ };
+
return (
[styles.pressable, pressFeedback(state)]}
>
-
- Kasane
-
+
+
+
+ Kasane
+
+
{/* The wide-tracked subheading is what pushes the header past a phone
viewport once the back arrow is present, so drop it when narrow. */}
{!narrow && !compact && (
<>
- anime + manga
+ anime +{" "}
+ manga
-
+ {/* The logo's three colours, in the order they cross the mark. */}
+
+
+
+
+
>
)}
@@ -74,6 +96,7 @@ const styles = StyleSheet.create({
gap: SPACE.xs,
flexShrink: 1,
},
+ lockup: { flexDirection: "row", alignItems: "center", gap: SPACE.lg },
// Scaled down rather than allowed to shrink-wrap, which broke "Kasane"
// across two lines on a phone.
wordmarkNarrow: { fontSize: 34, lineHeight: 38, letterSpacing: -1 },
@@ -93,13 +116,11 @@ const styles = StyleSheet.create({
fontFamily: FONT.bold,
paddingBottom: SPACE.sm,
},
- subAccent: {
- color: COLOR.accent,
- fontFamily: FONT.bold,
- },
- rule: {
- height: 4,
- width: 64,
- backgroundColor: COLOR.accent,
- },
+ subAnime: { color: COLOR.sideAnime },
+ subManga: { color: COLOR.sideManga },
+ rule: { flexDirection: "row", height: 4, width: 96 },
+ ruleSegment: { flex: 1 },
+ ruleAnime: { backgroundColor: COLOR.sideAnime },
+ ruleOverlap: { backgroundColor: COLOR.textPrimary },
+ ruleManga: { backgroundColor: COLOR.sideManga },
});
diff --git a/src/components/SideMenu.tsx b/src/components/SideMenu.tsx
index eddb26c..4e97b43 100644
--- a/src/components/SideMenu.tsx
+++ b/src/components/SideMenu.tsx
@@ -21,7 +21,9 @@ const SLIDE_MS = 220;
*/
export function SideMenu() {
const open = useSideMenu((s) => s.open);
+ const present = useSideMenu((s) => s.present);
const close = useSideMenu((s) => s.close);
+ const settle = useSideMenu((s) => s.settle);
const router = useRouter();
const pathname = usePathname();
const { width } = useWindowDimensions();
@@ -30,30 +32,22 @@ export function SideMenu() {
? Math.min(width * 0.82, PANEL_MAX_WIDTH)
: PANEL_MAX_WIDTH;
- // Kept mounted through the closing animation so the panel slides out rather
- // than vanishing.
- const [mounted, setMounted] = useState(open);
- const [wasOpen, setWasOpen] = useState(open);
const [slide] = useState(() => new Animated.Value(open ? 1 : 0));
- // Adjusting state during render rather than in an effect: the panel has to
- // be mounted before the opening animation runs.
- if (wasOpen !== open) {
- setWasOpen(open);
- if (open) setMounted(true);
- }
-
+ // The store keeps the drawer `present` through the closing slide, so the
+ // panel slides out rather than vanishing; `settle` ends that once the slide
+ // has run its course.
useEffect(() => {
Animated.timing(slide, {
toValue: open ? 1 : 0,
duration: SLIDE_MS,
useNativeDriver: true,
}).start(({ finished }) => {
- if (finished && !open) setMounted(false);
+ if (finished) settle();
});
- }, [open, slide]);
+ }, [open, slide, settle]);
- if (!mounted) return null;
+ if (!present) return null;
const translateX = slide.interpolate({
inputRange: [0, 1],
diff --git a/src/components/VolumesGrid.tsx b/src/components/VolumesGrid.tsx
index 763d6ff..f07e99a 100644
--- a/src/components/VolumesGrid.tsx
+++ b/src/components/VolumesGrid.tsx
@@ -207,7 +207,7 @@ const styles = StyleSheet.create({
backgroundColor: COLOR.accentTranslucent,
},
variantBadgeText: {
- color: COLOR.textOnAccent,
+ color: COLOR.textOnBright,
fontSize: 10,
letterSpacing: 0.6,
fontFamily: FONT.bold,
diff --git a/src/data/appIcons.test.ts b/src/data/appIcons.test.ts
new file mode 100644
index 0000000..3785655
--- /dev/null
+++ b/src/data/appIcons.test.ts
@@ -0,0 +1,57 @@
+import { describe, expect, it } from "bun:test";
+import { isRecord } from "@/data/guards";
+import { APP_ICONS, appIconFromNative, DEFAULT_APP_ICON } from "./appIcons";
+
+const PLUGIN = "expo-alternate-app-icons";
+
+/** The alternate icon names `app.json` registers with the native projects. */
+const registeredNames = async (): Promise => {
+ const config: unknown = await Bun.file("app.json").json();
+ const plugins: unknown =
+ isRecord(config) && isRecord(config.expo) ? config.expo.plugins : [];
+ const entry = (Array.isArray(plugins) ? plugins : []).find(
+ (plugin) => Array.isArray(plugin) && plugin[0] === PLUGIN,
+ );
+ const icons: unknown = Array.isArray(entry) ? entry[1] : [];
+ return (Array.isArray(icons) ? icons : []).map((icon: unknown) =>
+ isRecord(icon) ? icon.name : undefined,
+ );
+};
+
+describe("APP_ICONS", () => {
+ it("gives the default icon the primary slot and no other", () => {
+ expect(APP_ICONS.filter((icon) => icon.nativeName === null)).toEqual([
+ DEFAULT_APP_ICON,
+ ]);
+ });
+
+ it("identifies and labels every icon distinctly", () => {
+ expect(new Set(APP_ICONS.map((icon) => icon.id)).size).toBe(
+ APP_ICONS.length,
+ );
+ expect(new Set(APP_ICONS.map((icon) => icon.label)).size).toBe(
+ APP_ICONS.length,
+ );
+ });
+
+ it("names exactly the alternates app.json registers", async () => {
+ const alternates = APP_ICONS.flatMap((icon) => icon.nativeName ?? []);
+ expect(await registeredNames()).toEqual(alternates);
+ });
+});
+
+describe("appIconFromNative", () => {
+ it("reads the primary icon as the default", () => {
+ expect(appIconFromNative(null)).toBe(DEFAULT_APP_ICON);
+ });
+
+ it("round-trips every icon", () => {
+ APP_ICONS.forEach((icon) => {
+ expect(appIconFromNative(icon.nativeName)).toBe(icon);
+ });
+ });
+
+ it("falls back to the default for a name it does not know", () => {
+ expect(appIconFromNative("Retired")).toBe(DEFAULT_APP_ICON);
+ });
+});
diff --git a/src/data/appIcons.ts b/src/data/appIcons.ts
new file mode 100644
index 0000000..f4f1618
--- /dev/null
+++ b/src/data/appIcons.ts
@@ -0,0 +1,23 @@
+/**
+ * The home-screen icons a user can pick between on iOS and Android, in the
+ * order the picker shows them. `nativeName` is what the OS knows the icon by:
+ * `null` is the icon the app ships with, and every other value must match the
+ * `name` of an `expo-alternate-app-icons` entry in `app.json`.
+ */
+export const APP_ICONS = [
+ { id: "layered", label: "Layered", nativeName: null },
+ { id: "split", label: "Split", nativeName: "Split" },
+ { id: "light", label: "Light", nativeName: "Light" },
+] as const;
+
+export type AppIcon = (typeof APP_ICONS)[number];
+export type AppIconId = AppIcon["id"];
+
+export const [DEFAULT_APP_ICON] = APP_ICONS;
+
+/**
+ * Maps what the OS reports as the active icon back to an entry. An unknown
+ * name, such as an alternate a later build removed, falls back to the default.
+ */
+export const appIconFromNative = (name: string | null): AppIcon =>
+ APP_ICONS.find((icon) => icon.nativeName === name) ?? DEFAULT_APP_ICON;
diff --git a/src/state/appIcon.test.ts b/src/state/appIcon.test.ts
new file mode 100644
index 0000000..915836b
--- /dev/null
+++ b/src/state/appIcon.test.ts
@@ -0,0 +1,54 @@
+import { beforeEach, describe, expect, it, mock } from "bun:test";
+import { APP_ICONS } from "@/data/appIcons";
+
+const setAlternateAppIcon = mock((name: string | null) =>
+ Promise.resolve(name),
+);
+
+// The real module is native-only. It reports "Split" as the icon the OS
+// currently shows, so the store's launch read has something to map.
+mock.module("expo-alternate-app-icons", () => ({
+ supportsAlternateIcons: true,
+ getAppIconName: () => "Split",
+ setAlternateAppIcon,
+}));
+
+const { canChangeAppIcon, useAppIcon } = await import("./appIcon");
+
+const [layered, split, light] = APP_ICONS;
+
+beforeEach(() => {
+ useAppIcon.setState({ iconId: split.id });
+});
+
+describe("canChangeAppIcon", () => {
+ it("mirrors what the platform supports", () => {
+ expect(canChangeAppIcon).toBe(true);
+ });
+});
+
+describe("useAppIcon", () => {
+ it("starts from the icon the OS reports", () => {
+ expect(useAppIcon.getInitialState().iconId).toBe(split.id);
+ });
+
+ it("asks the OS for an alternate by its native name", async () => {
+ await useAppIcon.getState().setIcon(light);
+ expect(setAlternateAppIcon).toHaveBeenCalledWith(light.nativeName);
+ expect(useAppIcon.getState().iconId).toBe(light.id);
+ });
+
+ it("resets to the primary icon with null", async () => {
+ await useAppIcon.getState().setIcon(layered);
+ expect(setAlternateAppIcon).toHaveBeenCalledWith(null);
+ expect(useAppIcon.getState().iconId).toBe(layered.id);
+ });
+
+ it("keeps the current icon when the OS refuses the change", async () => {
+ setAlternateAppIcon.mockRejectedValueOnce(new Error("denied"));
+ await expect(useAppIcon.getState().setIcon(light)).rejects.toThrow(
+ "denied",
+ );
+ expect(useAppIcon.getState().iconId).toBe(split.id);
+ });
+});
diff --git a/src/state/appIcon.ts b/src/state/appIcon.ts
new file mode 100644
index 0000000..8b56cb4
--- /dev/null
+++ b/src/state/appIcon.ts
@@ -0,0 +1,34 @@
+import {
+ getAppIconName,
+ setAlternateAppIcon,
+ supportsAlternateIcons,
+} from "expo-alternate-app-icons";
+import { create } from "zustand";
+import {
+ appIconFromNative,
+ DEFAULT_APP_ICON,
+ type AppIcon,
+ type AppIconId,
+} from "@/data/appIcons";
+
+/** False on web and desktop, where there is no home-screen icon to swap. */
+export const canChangeAppIcon = supportsAlternateIcons;
+
+type State = {
+ iconId: AppIconId;
+ setIcon: (icon: AppIcon) => Promise;
+};
+
+// Deliberately not persisted: the OS remembers the active icon, so it is read
+// back at launch. The module throws when asked on an unsupported platform,
+// which is why the read is gated rather than attempted.
+export const useAppIcon = create()((set) => ({
+ iconId: (canChangeAppIcon
+ ? appIconFromNative(getAppIconName())
+ : DEFAULT_APP_ICON
+ ).id,
+ setIcon: async ({ id, nativeName }) => {
+ await setAlternateAppIcon(nativeName);
+ set({ iconId: id });
+ },
+}));
diff --git a/src/state/sideMenu.test.ts b/src/state/sideMenu.test.ts
index eb6a5a8..f6062ea 100644
--- a/src/state/sideMenu.test.ts
+++ b/src/state/sideMenu.test.ts
@@ -2,12 +2,34 @@ import { beforeEach, describe, expect, it } from "bun:test";
import { MENU_LINKS, useSideMenu } from "./sideMenu";
beforeEach(() => {
- useSideMenu.setState({ open: false });
+ useSideMenu.setState({ open: false, present: false });
});
describe("useSideMenu", () => {
- it("starts closed", () => {
+ it("starts closed and off screen", () => {
expect(useSideMenu.getState().open).toBe(false);
+ expect(useSideMenu.getState().present).toBe(false);
+ });
+
+ it("is on screen as soon as it opens", () => {
+ useSideMenu.getState().openMenu();
+ expect(useSideMenu.getState().present).toBe(true);
+ });
+
+ it("stays on screen after closing until the slide settles", () => {
+ useSideMenu.getState().openMenu();
+ useSideMenu.getState().close();
+ expect(useSideMenu.getState().present).toBe(true);
+ useSideMenu.getState().settle();
+ expect(useSideMenu.getState().present).toBe(false);
+ });
+
+ it("stays on screen when reopened before the slide settles", () => {
+ useSideMenu.getState().openMenu();
+ useSideMenu.getState().close();
+ useSideMenu.getState().openMenu();
+ useSideMenu.getState().settle();
+ expect(useSideMenu.getState().present).toBe(true);
});
it("opens and closes", () => {
diff --git a/src/state/sideMenu.ts b/src/state/sideMenu.ts
index df36981..eff1f89 100644
--- a/src/state/sideMenu.ts
+++ b/src/state/sideMenu.ts
@@ -16,13 +16,20 @@ export const MENU_LINKS: readonly {
type State = {
open: boolean;
+ // True while the drawer is on screen at all, which outlasts `open` by the
+ // closing slide. The drawer mounts on this, so it can animate out.
+ present: boolean;
openMenu: () => void;
close: () => void;
+ // Called when the closing slide ends. A drawer reopened mid-slide stays.
+ settle: () => void;
};
// Deliberately not persisted — the drawer should never be open on launch.
export const useSideMenu = create()((set) => ({
open: false,
- openMenu: () => set({ open: true }),
+ present: false,
+ openMenu: () => set({ open: true, present: true }),
close: () => set({ open: false }),
+ settle: () => set((s) => ({ present: s.open })),
}));
diff --git a/src/theme.ts b/src/theme.ts
index a9ce65b..fed20df 100644
--- a/src/theme.ts
+++ b/src/theme.ts
@@ -24,12 +24,12 @@ export const COLOR = {
surface: "#17181b",
/** Raised blocks that need to separate from `surface`. */
surfaceRaised: "#2a2a2a",
- /** Tinted background for notice banners (violet-shifted). */
- surfaceNotice: "#1f1a2e",
+ /** Tinted background for notice banners (cyan-shifted). */
+ surfaceNotice: "#14212a",
/** Barely-lifted panel: the side menu drawer. */
surfaceSubtle: "#0f1013",
/** Tinted background for a `danger`-accented callout. */
- surfaceCallout: "#1b1524",
+ surfaceCallout: "#241815",
/** Hairline dividers and input borders. */
border: "#2a2c30",
/** Edge of a panel that floats over the page, like the side menu. */
@@ -53,13 +53,14 @@ export const COLOR = {
textFaint: "#6b7177",
/** Text sitting on a bright fill: arc segments, badges, popovers. */
textOnBright: "#000000",
- /** Text sitting on the violet accent, such as the variant badge. */
- textOnAccent: "#ffffff",
- /** Brand violet: wordmark rule, links, active state, focus. */
- accent: "#7c5cff",
+ /**
+ * Brand cyan: links, active state, focus. With `sideManga` coral and
+ * `textPrimary` white it makes up the three colours of the logo.
+ */
+ accent: "#5cdfff",
/** Accent laid over cover art, where the art must still read through. */
- accentTranslucent: "rgba(124, 92, 255, 0.92)",
+ accentTranslucent: "rgba(92, 223, 255, 0.92)",
/** Advisory state: "arcs behind", "auto-estimated", "no mapping". */
notice: "#ffd65c",
/** Error text. Shares its value with `ARC_COLORS[1]`, which is unrelated. */
@@ -90,7 +91,9 @@ export const COLOR = {
/** Fill of the badge naming which sides a series has. */
export const BADGE_COLOR: Record = {
- both: COLOR.accent,
+ // White is where the logo's cyan and coral overlap, and it keeps this badge
+ // apart from `anime-only`, which shares its cyan with the accent.
+ both: COLOR.textPrimary,
"manga-only": COLOR.sideManga,
"anime-only": COLOR.sideAnime,
};
diff --git a/src/types/assets.d.ts b/src/types/assets.d.ts
new file mode 100644
index 0000000..19bacdb
--- /dev/null
+++ b/src/types/assets.d.ts
@@ -0,0 +1,7 @@
+// Metro resolves an imported image to an asset reference `Image` accepts.
+declare module "*.png" {
+ import type { ImageSourcePropType } from "react-native";
+
+ const source: ImageSourcePropType;
+ export default source;
+}
diff --git a/tsconfig.json b/tsconfig.json
index 27d07b9..829f65b 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -4,6 +4,7 @@
"strict": true,
"paths": {
"@/*": ["./src/*"],
+ "@assets/*": ["./assets/*"],
"@test/*": ["./test/*"],
"@scripts/*": ["./scripts/*"],
"@pkg": ["./package.json"]