Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
41c0637
fix(layouts): type contentContainerStyle from the Tamagui View
claude Nov 30, 2026
cf8e4ca
feat(router): enable typed routes and generate them before typecheck
claude Nov 30, 2026
5686244
chore(lint): forbid any and enable suspicious and perf rules
claude Nov 30, 2026
eba0079
chore(ts): enable noUncheckedIndexedAccess and drop redundant flags
claude Nov 30, 2026
87da48c
fix(error-boundary): use the shared gesture-handler Pressable
claude Nov 30, 2026
1197552
feat(i18n): type translation keys from the English locale
claude Nov 30, 2026
9a83a68
feat(env): read runtime config through a typed env module
claude Nov 30, 2026
04cded5
perf(startup): stop holding the splash screen for RevenueCat
claude Nov 30, 2026
be50ad6
fix(revenuecat): give the limit paywall its own placement
claude Nov 30, 2026
88c5582
fix(revenuecat): read messages from plain PurchasesError objects
claude Nov 30, 2026
677d2f3
refactor(storage): export the MMKV instance instead of a wrapper
claude Nov 30, 2026
d0fb0c6
perf(settings): track only the fields a selector reads
claude Nov 30, 2026
b030161
feat(data): add a useQuery hook for live WatermelonDB queries
claude Nov 30, 2026
b7cec78
fix(logger): bind the standalone log functions to the logger
claude Nov 30, 2026
6046acb
feat(sentry): tag events by variant, trace routes and keep log breadc…
claude Nov 30, 2026
603abb6
feat(icons): add a settings glyph to the ui icon font
claude Nov 30, 2026
2b7f01c
feat(settings): add a settings tab wired to the existing stores
claude Nov 30, 2026
9aa7993
chore(ci): run locale check, lint and typecheck on pull requests
claude Nov 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#DO NOT COMMIT THIS
# Copy to .env and fill in. Never commit .env.

# Read by the app at runtime (inlined at build time); see src/utils/env.ts.
EXPO_PUBLIC_REVENUECAT_IOS_API_KEY=
EXPO_PUBLIC_REVENUECAT_ANDROID_API_KEY=
EXPO_PUBLIC_SENTRY_DSN=

# Build-time only: lets the Sentry Expo plugin upload source maps during
# EAS / release builds. Store it as an EAS secret for cloud builds.
SENTRY_AUTH_TOKEN=
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
push:
branches: [master]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
name: Lint, typecheck and locales
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.4

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Verify locales
run: bun run verify:locales

- name: Lint
run: bun run lint

# Generates Expo Router's typed routes first, so hrefs are checked too.
- name: Typecheck
run: bun run typecheck
28 changes: 24 additions & 4 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "unicorn", "oxc", "react", "react-hooks"],
"plugins": [
"typescript",
"unicorn",
"oxc",
"react",
"react-hooks"
],
"categories": {
"correctness": "error"
"correctness": "error",
"suspicious": "error",
"perf": "error"
},
"rules": {
"no-explicit-any": "off"
"typescript/no-explicit-any": "error",
"react/react-in-jsx-scope": "off",
"react/style-prop-object": "off",
"react/no-unstable-nested-components": [
"error",
{
"allowAsProps": true
}
],
"no-underscore-dangle": "off"
},
"ignorePatterns": [".agents/**"],
"ignorePatterns": [
".agents/**",
".expo/**"
],
"env": {
"builtin": true
}
Expand Down
8 changes: 5 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,24 @@ app/
├── (tabs)/
│ ├── _layout.tsx # bottom tabs layout
│ ├── index.tsx # route wrapper -> @/screens/tab-one
│ └── tab-two.tsx # route wrapper -> @/screens/tab-two
│ ├── tab-two.tsx # route wrapper -> @/screens/tab-two
│ └── settings.tsx # route wrapper -> @/screens/settings
├── stack-one.tsx # route wrapper -> @/screens/stack-one
├── modal-one.tsx # route wrapper -> @/screens/modal-one
└── +not-found.tsx # route wrapper -> @/screens/not-found
src/
├── screens/ # screen UI rendered by routes
│ ├── tab-one/
│ ├── tab-two/
│ ├── settings/
│ ├── stack-one/
│ ├── modal-one/
│ └── not-found/
├── components/
│ ├── common/ # shared primitives (pressable, error-boundary, legend-list)
│ └── layouts/ # Layout.Base / Bare / Modal
├── data/ # WatermelonDB schema, migrations, models/, database instance
├── hooks/ # app-wide hooks (refresh control)
├── hooks/ # app-wide hooks (refresh control, WatermelonDB useQuery)
├── i18n/ # initializeI18n + locales/<lang>/<ns>.json
├── providers/ # MainProvider (TamaguiProvider + ErrorBoundary + DatabaseProvider + theme tracking)
├── stores/ # app observables (settings$)
Expand Down Expand Up @@ -235,7 +237,7 @@ Do not persist derived data, functions, or React nodes. Do not create a new MMKV
- Everything lives in `src/data/`: `schema.ts`, `migrations.ts`, `models/<name>.ts`, `database.ts` (Nitro SQLite adapter, plus `define-columns.ts`). Export from `src/data/index.ts`; `DatabaseProvider` is composed into `MainProvider`.
- Changing a table: bump `version` in `schema.ts` **and** add a step in `migrations.ts`. Register new models in `modelClasses`.
- Models do not use decorators (`experimentalDecorators` is off). Declare typed fields on the class and bind them with `Object.defineProperties(Model.prototype, defineColumns({...}))` from `src/data/define-columns.ts` (see `models/note.ts`).
- Read via `useDatabase()` + `collection.query(...).observe()` (see `src/screens/tab-two/useNotes.ts`); write inside `database.write(...)`.
- Read with `useQuery<Model>("table", [Q...])` from `@/hooks/useQuery` (waits for `databaseReady`, subscribes, cleans up; see `src/screens/tab-two/useNotes.ts`); write inside `database.write(...)`.
- Needs a development build (not Expo Go); the native engine is a Nitro module (`react-native-nitro-modules`, `rxjs` peer). Await `databaseReady` from `@/data` before the first query or write.
- Do not put queryable/relational data in `settings$` or MMKV.

Expand Down
3 changes: 2 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"scheme": "mytemplateproject",
"userInterfaceStyle": "automatic",
"experiments": {
"reactCompiler": true
"reactCompiler": true,
"typedRoutes": true
},
"assetBundlePatterns": ["**/*"],
"ios": {
Expand Down
7 changes: 7 additions & 0 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ export default function TabLayout() {
tabBarIcon: ({ color, size }) => <TabBarIcon color={color} name="clock" size={size} />,
}}
/>
<Tabs.Screen
name="settings"
options={{
title: t("settings.title"),
tabBarIcon: ({ color, size }) => <TabBarIcon color={color} name="settings" size={size} />,
}}
/>
</Tabs>
);
}
1 change: 1 addition & 0 deletions app/(tabs)/settings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SettingsScreen as default } from "@/screens/settings";
9 changes: 8 additions & 1 deletion app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,16 @@ function RootLayout() {
}
didInitRef.current = true;

// RevenueCat fetches customer info over the network, so it runs in the
// background; its listener updates `premium` when the answer arrives.
initializeRevenueCat().catch((error: unknown) => {
logger.error("RevenueCat initialization failed:", error);
captureException(error);
});

(async () => {
try {
const [language] = await Promise.all([initializeI18n(), initializeRevenueCat()]);
const language = await initializeI18n();
settings$.language.set(language);
} catch (error) {
logger.error("Root initialization failed:", error);
Expand Down
2 changes: 1 addition & 1 deletion assets/icons/nanoicons/ui.glyphmap.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"m":{"f":"ui-c5f20b27","u":1024,"z":1024,"s":59648,"h":"c5f20b27fe9971b2354e13971b9366bdfe82d51919eecb9a473e237bef63337b"},"i":{"chevron-left":[1024,[[59648,"currentColor"]]],"clock":[1024,[[59649,"currentColor"]]],"house":[1024,[[59650,"currentColor"]]],"x":[1024,[[59651,"currentColor"]]]}}
{"m":{"f":"ui-071fbd38","u":1024,"z":1024,"s":59648,"h":"071fbd38d91bcd3158a95c56361ea6dfe16aa0c435cd8ad2d40724aefd4e2fae"},"i":{"chevron-left":[1024,[[59648,"currentColor"]]],"clock":[1024,[[59649,"currentColor"]]],"house":[1024,[[59650,"currentColor"]]],"settings":[1024,[[59651,"currentColor"]]],"x":[1024,[[59652,"currentColor"]]]}}
Binary file modified assets/icons/nanoicons/ui.ttf
Binary file not shown.
4 changes: 4 additions & 0 deletions assets/icons/ui/settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"codegen": "bun ./scripts/codegen.mjs",
"lint": "oxlint .",
"format": "bun fmt",
"typecheck": "bun check",
"typegen": "expo customize tsconfig.json",
"typecheck": "bun run typegen && bun check",
"verify:locales": "bun ./scripts/verify-locales.mjs",
"prebuild": "bunx expo prebuild --clean",
"prebuild:dev": "APP_VARIANT=development bunx expo prebuild --clean",
Expand Down
10 changes: 5 additions & 5 deletions scripts/verify-locales.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const namespacesDir = path.join(import.meta.dirname, "../src/i18n/locales");
const languages = fs
.readdirSync(namespacesDir)
.filter((f) => fs.statSync(path.join(namespacesDir, f)).isDirectory())
.sort();
.toSorted();

if (languages.length === 0) {
process.stderr.write("❌ No language directories found\n");
Expand All @@ -62,7 +62,7 @@ const namespaces = fs
.readdirSync(referenceLangDir)
.filter((f) => f.endsWith(".json"))
.map((f) => path.basename(f, ".json"))
.sort();
.toSorted();

if (namespaces.length === 0) {
process.stderr.write(`❌ No namespace files found in ${referenceLanguage}\n`);
Expand All @@ -78,7 +78,7 @@ for (const lang of languages) {
.readdirSync(langDir)
.filter((f) => f.endsWith(".json"))
.map((f) => path.basename(f, ".json"))
.sort();
.toSorted();

const missingNamespaces = namespaces.filter((ns) => !langNamespaces.includes(ns));
const extraNamespaces = langNamespaces.filter((ns) => !namespaces.includes(ns));
Expand Down Expand Up @@ -139,7 +139,7 @@ for (const namespace of namespaces) {
hasErrors = true;
const noun = missingKeys.length === 1 ? "key" : "keys";
process.stderr.write(`❌ ${namespace}.json (${lang}): Missing ${missingKeys.length} ${noun}\n`);
missingKeys.sort();
missingKeys.toSorted();
const displayCount = isVerbose ? missingKeys.length : 5;
for (const key of missingKeys.slice(0, displayCount)) {
process.stderr.write(` ${key}\n`);
Expand All @@ -159,7 +159,7 @@ for (const namespace of namespaces) {
hasErrors = true;
const noun = extraKeys.length === 1 ? "key" : "keys";
process.stderr.write(`❌ ${namespace}.json (${lang}): Extra ${extraKeys.length} ${noun}\n`);
extraKeys.sort();
extraKeys.toSorted();
const displayCount = isVerbose ? extraKeys.length : 5;
for (const key of extraKeys.slice(0, displayCount)) {
process.stderr.write(` ${key}\n`);
Expand Down
7 changes: 4 additions & 3 deletions src/components/common/error-boundary.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { router } from "expo-router";
import { Component, type ErrorInfo, type FC, type ReactNode } from "react";
import { useTranslation } from "react-i18next";
import { Pressable, ScrollView } from "react-native";
import { ScrollView } from "react-native";
import { Text, View } from "@tamagui/tailwind";
import { getTokenValue } from "tamagui";

import { Pressable } from "@/components/common/pressable";
import { logger } from "@/utils/logger";
import { captureException } from "@/utils/sentry";

Expand Down Expand Up @@ -77,7 +78,7 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundarySt
};
}

componentDidCatch(error: Error, errorInfo: ErrorInfo) {
override componentDidCatch(error: Error, errorInfo: ErrorInfo) {
this.setState({
error,
errorInfo,
Expand Down Expand Up @@ -105,7 +106,7 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundarySt
router.replace("/(tabs)");
};

render() {
override render() {
if (this.state.hasError) {
if (this.props.fallback) {
return this.props.fallback;
Expand Down
6 changes: 3 additions & 3 deletions src/components/common/styled-native.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { styled, type TailwindComponent } from "@tamagui/tailwind";
import type { ComponentProps, ComponentType } from "react";
import type { ComponentType } from "react";

/**
* `styled()` from `@tamagui/tailwind` for a third-party React Native component.
* Its typings only accept Tamagui components, but at runtime Tamagui wraps any
* component and resolves the class string into the `style` it receives.
*/
export function styledNative<Component extends ComponentType<any>>(component: Component, className: string) {
return styled(component as unknown as TailwindComponent<unknown, ComponentProps<Component>>, className);
export function styledNative<Props extends object>(component: ComponentType<Props>, className: string) {
return styled(component as unknown as TailwindComponent<unknown, Props>, className);
}
4 changes: 2 additions & 2 deletions src/components/layouts/Bare.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { View } from "@tamagui/tailwind";
import type { FC } from "react";

import { SafeScreen } from "./safe-screen";
import { DEFAULT_SAFE_AREA_EDGES, SafeScreen } from "./safe-screen";
import type { BareLayoutProps } from "./types";

export const BareLayout: FC<BareLayoutProps> = ({ children, contentContainerStyle, safeAreaEdges = ["top"] }) => {
export const BareLayout: FC<BareLayoutProps> = ({ children, contentContainerStyle, safeAreaEdges = DEFAULT_SAFE_AREA_EDGES }) => {
return (
<SafeScreen edges={safeAreaEdges}>
<View className="flex-1 bg-background-primary px-4 py-2" style={contentContainerStyle}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/layouts/Base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useTranslation } from "react-i18next";
import { Icon } from "@/components/common/icon";
import { IconButton } from "@/components/common/icon-button";
import { useTheme } from "@/theme/hooks/useTheme";
import { SafeScreen } from "./safe-screen";
import { DEFAULT_SAFE_AREA_EDGES, SafeScreen } from "./safe-screen";
import type { BaseLayoutProps } from "./types";

export const BaseLayout: FC<BaseLayoutProps> = ({
Expand All @@ -16,7 +16,7 @@ export const BaseLayout: FC<BaseLayoutProps> = ({
onBack,
children,
contentContainerStyle,
safeAreaEdges = ["top"],
safeAreaEdges = DEFAULT_SAFE_AREA_EDGES,
callToAction,
}) => {
const router = useRouter();
Expand Down
5 changes: 5 additions & 0 deletions src/components/layouts/safe-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ import { SafeAreaView } from "react-native-safe-area-context";
import { styledNative } from "@/components/common/styled-native";

export const SafeScreen = styledNative(SafeAreaView, "flex-1 bg-background-primary");

export type SafeAreaEdge = "top" | "bottom" | "left" | "right";

/** Stable default so layouts don't pass a new array to SafeAreaView each render. */
export const DEFAULT_SAFE_AREA_EDGES: readonly SafeAreaEdge[] = ["top"];
17 changes: 11 additions & 6 deletions src/components/layouts/types.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import type { ReactNode } from "react";
import type { ViewProps } from "react-native";
import type { View } from "@tamagui/tailwind";
import type { ComponentProps, ReactNode } from "react";

import type { SafeAreaEdge } from "./safe-screen";

/** Style accepted by the `@tamagui/tailwind` `View` that hosts layout content. */
type ContentStyle = ComponentProps<typeof View>["style"];

export interface BareLayoutProps {
children?: ReactNode;
contentContainerStyle?: ViewProps["style"];
safeAreaEdges?: ("top" | "bottom" | "left" | "right")[];
contentContainerStyle?: ContentStyle;
safeAreaEdges?: readonly SafeAreaEdge[];
}

export interface BaseLayoutProps {
children: ReactNode;
title?: string;
showBack?: boolean;
safeAreaEdges?: ("top" | "bottom" | "left" | "right")[];
safeAreaEdges?: readonly SafeAreaEdge[];
onBack?: () => void;
callToAction?: ReactNode;
contentContainerStyle?: ViewProps["style"];
contentContainerStyle?: ContentStyle;
}

export interface ModalLayoutProps {
Expand Down
3 changes: 1 addition & 2 deletions src/data/define-columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ type RawValue = Parameters<Model["_setRaw"]>[1];
*/
export function defineColumns(spec: Record<string, string>): PropertyDescriptorMap {
const descriptors: PropertyDescriptorMap = {};
for (const property of Object.keys(spec)) {
const column = spec[property];
for (const [property, column] of Object.entries(spec)) {
descriptors[property] = {
configurable: true,
enumerable: true,
Expand Down
2 changes: 1 addition & 1 deletion src/data/models/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Model } from "react-native-watermelondb";
import { defineColumns } from "../define-columns";

export class Note extends Model {
static table = "notes";
static override table = "notes";

title!: string;
/** Epoch ms; WatermelonDB fills `created_at` / `updated_at` automatically. */
Expand Down
Loading