Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7af9b5bbc4 | ||
|
|
abc380bb84 | ||
|
|
26922af997 | ||
|
|
18a66aba58 | ||
|
|
4dd8d743a7 |
@@ -8,17 +8,17 @@ jobs:
|
|||||||
check:
|
check:
|
||||||
# Fast fail: lockfile sync, types, lint — catches in ~2 min what would
|
# Fast fail: lockfile sync, types, lint — catches in ~2 min what would
|
||||||
# otherwise kill the APK build twenty minutes in.
|
# otherwise kill the APK build twenty minutes in.
|
||||||
runs-on: desktop
|
runs-on: macbook
|
||||||
container:
|
|
||||||
image: node:22
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
git init -q .
|
git init -q .
|
||||||
git fetch -q --depth 1 "https://git.rehbock.xyz/${{ github.repository }}.git" "${{ github.sha }}"
|
git fetch -q --depth 1 "https://git.rehbock.xyz/${{ github.repository }}.git" "${{ github.sha }}"
|
||||||
git checkout -q FETCH_HEAD
|
git checkout -q -f FETCH_HEAD
|
||||||
|
git clean -qfd
|
||||||
- name: Lockfile + typecheck + lint
|
- name: Lockfile + typecheck + lint
|
||||||
run: |
|
run: |
|
||||||
|
export PATH="$HOME/.hermes/node/bin:$PATH"
|
||||||
cd app
|
cd app
|
||||||
npm ci --no-audit --no-fund
|
npm ci --no-audit --no-fund
|
||||||
npx tsc --noEmit
|
npx tsc --noEmit
|
||||||
@@ -35,59 +35,51 @@ jobs:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
needs: check
|
needs: check
|
||||||
# RN/NDK builds starve the 4-core VPS — run on the desktop runner
|
# Runs natively on the MacBook Air (gitea-runner in host mode, label
|
||||||
# (marcusDesktop). Jobs queue while the desktop is off and start when it
|
# "macbook"): Java 21 from Homebrew, the Android SDK from Android Studio,
|
||||||
# comes online; switch back to ubuntu-latest to build on the VPS.
|
# node 22 from ~/.hermes. No container, no SDK download.
|
||||||
runs-on: desktop
|
runs-on: macbook
|
||||||
container:
|
env:
|
||||||
image: eclipse-temurin:21-jdk
|
ANDROID_HOME: /Users/marcus/Library/Android/sdk
|
||||||
|
JAVA_HOME: /opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home
|
||||||
steps:
|
steps:
|
||||||
# actions/checkout needs node, which this container lacks — clone directly
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
apt-get update -qq && apt-get install -y -qq git unzip curl >/dev/null
|
|
||||||
git init -q .
|
git init -q .
|
||||||
git fetch -q --depth 1 "https://git.rehbock.xyz/${{ github.repository }}.git" "${{ github.sha }}"
|
git fetch -q --depth 1 "https://git.rehbock.xyz/${{ github.repository }}.git" "${{ github.sha }}"
|
||||||
git checkout -q FETCH_HEAD
|
git checkout -q -f FETCH_HEAD
|
||||||
|
git clean -qfd
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Toolchain
|
||||||
run: |
|
run: |
|
||||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - >/dev/null 2>&1
|
export PATH="$HOME/.hermes/node/bin:$PATH"
|
||||||
apt-get install -y -qq nodejs >/dev/null
|
|
||||||
node --version
|
node --version
|
||||||
|
"$JAVA_HOME/bin/java" -version
|
||||||
- name: Install Android SDK
|
test -d "$ANDROID_HOME/platforms/android-36"
|
||||||
# $HOME/android-sdk is a persistent runner volume — skip when warm.
|
test -d "$ANDROID_HOME/build-tools/36.0.0"
|
||||||
run: |
|
|
||||||
if [ ! -d "$HOME/android-sdk/platforms/android-36" ]; then
|
|
||||||
mkdir -p "$HOME/android-sdk/cmdline-tools"
|
|
||||||
curl -sLo /tmp/ct.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
|
||||||
unzip -q /tmp/ct.zip -d /tmp
|
|
||||||
mv /tmp/cmdline-tools "$HOME/android-sdk/cmdline-tools/latest"
|
|
||||||
yes | "$HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$HOME/android-sdk" --licenses >/dev/null 2>&1 || true
|
|
||||||
"$HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$HOME/android-sdk" \
|
|
||||||
"platform-tools" "platforms;android-36" "build-tools;36.0.0" >/dev/null
|
|
||||||
else
|
|
||||||
echo "SDK cache warm — skipping install"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Install app dependencies
|
- name: Install app dependencies
|
||||||
run: cd app && npm ci --no-audit --no-fund
|
run: |
|
||||||
|
export PATH="$HOME/.hermes/node/bin:$PATH"
|
||||||
|
cd app && npm ci --no-audit --no-fund
|
||||||
|
|
||||||
- name: Decode signing keystore
|
- name: Decode signing keystore
|
||||||
env:
|
env:
|
||||||
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
|
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
|
||||||
run: echo "$KEYSTORE_B64" | base64 -d > /tmp/release.jks
|
run: echo "$KEYSTORE_B64" | base64 --decode > /tmp/release.jks
|
||||||
|
|
||||||
- name: Build signed release APK
|
- name: Build signed release APK
|
||||||
env:
|
env:
|
||||||
KEYSTORE_FILE: /tmp/release.jks
|
KEYSTORE_FILE: /tmp/release.jks
|
||||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||||
KEY_ALIAS: gtd
|
# EAS-managed keystore (since v1.16) — alias is EAS-generated, and the
|
||||||
|
# key password can differ from the store password.
|
||||||
|
KEY_ALIAS: a5ff13aa8571055bcaecbaca29a548ae
|
||||||
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||||
VERSION_CODE: ${{ github.run_number }}
|
VERSION_CODE: ${{ github.run_number }}
|
||||||
VERSION_NAME: 1.${{ github.run_number }}
|
VERSION_NAME: 1.${{ github.run_number }}
|
||||||
run: |
|
run: |
|
||||||
export ANDROID_HOME="$HOME/android-sdk"
|
export PATH="$HOME/.hermes/node/bin:$PATH"
|
||||||
cd app/android
|
cd app/android
|
||||||
echo "sdk.dir=$ANDROID_HOME" > local.properties
|
echo "sdk.dir=$ANDROID_HOME" > local.properties
|
||||||
./gradlew assembleRelease --no-daemon --console=plain
|
./gradlew assembleRelease --no-daemon --console=plain
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,3 +5,5 @@ server/.env
|
|||||||
server/.env.token.local
|
server/.env.token.local
|
||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
credentials.json
|
||||||
|
*.jks
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ Minimal Getting Things Done app. One Expo/React Native codebase for iPhone, Andr
|
|||||||
|
|
||||||
## Layout
|
## Layout
|
||||||
|
|
||||||
- `app/` — Expo app (expo-router, TypeScript). Home shows the top 3 next actions plus a launcher menu: Today / Next / Waiting / Someday / Projects / Review. There is no inbox — every task is born fully scoped (title, priority, due date). Tap a task to clarify (list, project, context, waiting-for, due/defer dates, repeat).
|
- `app/` — Expo app (expo-router, TypeScript). Home shows the top 3 next actions plus a launcher menu: Today / Next / Waiting / Someday / Projects / Review.
|
||||||
|
- **Personal / Work**: the toggle in the home header is a global lens — every list, Today, Projects and Review show only the active area, and new tasks/projects are born into it. Tasks and projects carry an `area` column (`personal` default); the task form's Area chip re-files a task across areas. The choice persists locally (`area_v1`). There is no inbox — every task is born fully scoped (title, priority, due date). Tap a task to clarify (list, project, context, waiting-for, due/defer dates, repeat).
|
||||||
- **Quick add**: the title field parses tokens live — `Pay rent tmr p1 @home #Sydney ~30m monthly` — and mirrors them into the form.
|
- **Quick add**: the title field parses tokens live — `Pay rent tmr p1 @home #Sydney ~30m monthly` — and mirrors them into the form.
|
||||||
- **Repeat**: daily / weekdays / weekly / monthly / yearly; completing spawns the next occurrence (lapsed tasks catch up to today).
|
- **Repeat**: daily / weekdays / weekly / monthly / yearly; completing spawns the next occurrence (lapsed tasks catch up to today).
|
||||||
- **Defer**: deferred tasks are hidden from action lists until their date; a footer link reveals them.
|
- **Defer**: deferred tasks are hidden from action lists until their date; a footer link reveals them.
|
||||||
|
|||||||
1
app/.gitignore
vendored
1
app/.gitignore
vendored
@@ -40,3 +40,4 @@ example
|
|||||||
|
|
||||||
# generated native folders (android/ is committed — CI builds it)
|
# generated native folders (android/ is committed — CI builds it)
|
||||||
/ios
|
/ios
|
||||||
|
*.apk
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
"buildType": "apk"
|
"buildType": "apk"
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"VERSION_CODE": "18",
|
"VERSION_CODE": "23",
|
||||||
"VERSION_NAME": "1.18"
|
"VERSION_NAME": "1.23"
|
||||||
},
|
},
|
||||||
"node": "22.20.0"
|
"node": "22.20.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useEffect } from "react";
|
|||||||
import { AppState, Pressable } from "react-native";
|
import { AppState, Pressable } from "react-native";
|
||||||
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
||||||
import { getState, hydrate, subscribe, sync } from "../lib/store";
|
import { getState, hydrate, subscribe, sync } from "../lib/store";
|
||||||
|
import AreaToggle from "../components/AreaToggle";
|
||||||
import Icon from "../components/Icon";
|
import Icon from "../components/Icon";
|
||||||
import { ToastHost } from "../components/Toast";
|
import { ToastHost } from "../components/Toast";
|
||||||
import { C, space } from "../lib/theme";
|
import { C, space } from "../lib/theme";
|
||||||
@@ -54,6 +55,11 @@ export default function RootLayout() {
|
|||||||
name="index"
|
name="index"
|
||||||
options={{
|
options={{
|
||||||
title: "GTD",
|
title: "GTD",
|
||||||
|
// The personal/work switch sits where the title would be: it is
|
||||||
|
// the screen's identity, and it must be reachable from the top of
|
||||||
|
// every visit without scrolling.
|
||||||
|
headerTitle: () => <AreaToggle />,
|
||||||
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<Link href="/settings" asChild>
|
<Link href="/settings" asChild>
|
||||||
<Pressable
|
<Pressable
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function ProjectDetail() {
|
|||||||
if (!title) return;
|
if (!title) return;
|
||||||
setDraft("");
|
setDraft("");
|
||||||
haptic.success();
|
haptic.success();
|
||||||
createTask({ title, status: "next", project_id: id });
|
createTask({ title, status: "next", project_id: id, area: project.area ?? "personal" });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const toDraft = (t: Task): TaskDraft => ({
|
|||||||
estimate_min: t.estimate_min,
|
estimate_min: t.estimate_min,
|
||||||
repeat: t.repeat,
|
repeat: t.repeat,
|
||||||
priority: t.priority,
|
priority: t.priority,
|
||||||
|
area: t.area ?? "personal",
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function TaskDetail() {
|
export default function TaskDetail() {
|
||||||
|
|||||||
64
app/src/components/AreaToggle.tsx
Normal file
64
app/src/components/AreaToggle.tsx
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
// The personal / work switch that lives in the home header.
|
||||||
|
//
|
||||||
|
// A two-segment pill rather than a menu or a settings row: the whole point is
|
||||||
|
// that flipping halves of your life is one tap and its state is always
|
||||||
|
// visible. Work gets its own tone so a glance at the header tells you which
|
||||||
|
// lens is on even before you read the label.
|
||||||
|
import { Pressable, StyleSheet, Text, View } from "react-native";
|
||||||
|
import { haptic } from "../lib/haptics";
|
||||||
|
import { setArea } from "../lib/store";
|
||||||
|
import { C, radius, type } from "../lib/theme";
|
||||||
|
import { useStore } from "../lib/useStore";
|
||||||
|
import { AREA_LABEL, AREAS, type Area } from "../lib/types";
|
||||||
|
|
||||||
|
export const AREA_TONE: Record<Area, string> = { personal: C.accent, work: C.work };
|
||||||
|
|
||||||
|
export default function AreaToggle() {
|
||||||
|
const { area } = useStore();
|
||||||
|
return (
|
||||||
|
<View style={s.track} accessibilityRole="tablist">
|
||||||
|
{AREAS.map((a) => {
|
||||||
|
const active = a === area;
|
||||||
|
return (
|
||||||
|
<Pressable
|
||||||
|
key={a}
|
||||||
|
accessibilityRole="tab"
|
||||||
|
accessibilityState={{ selected: active }}
|
||||||
|
hitSlop={6}
|
||||||
|
onPress={() => {
|
||||||
|
if (active) return;
|
||||||
|
haptic.select();
|
||||||
|
setArea(a);
|
||||||
|
}}
|
||||||
|
style={({ pressed }) => [
|
||||||
|
s.segment,
|
||||||
|
active && { backgroundColor: AREA_TONE[a] },
|
||||||
|
pressed && !active && s.segmentPressed,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text style={[s.label, active && s.labelActive]}>{AREA_LABEL[a]}</Text>
|
||||||
|
</Pressable>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const s = StyleSheet.create({
|
||||||
|
track: {
|
||||||
|
flexDirection: "row",
|
||||||
|
padding: 3,
|
||||||
|
borderRadius: radius.pill,
|
||||||
|
backgroundColor: C.surface2,
|
||||||
|
borderWidth: StyleSheet.hairlineWidth,
|
||||||
|
borderColor: C.border,
|
||||||
|
},
|
||||||
|
segment: {
|
||||||
|
paddingVertical: 5,
|
||||||
|
paddingHorizontal: 16,
|
||||||
|
borderRadius: radius.pill,
|
||||||
|
},
|
||||||
|
segmentPressed: { backgroundColor: C.border },
|
||||||
|
label: { ...type.chip, color: C.textSecondary },
|
||||||
|
labelActive: { color: C.onAccent, fontWeight: "600" },
|
||||||
|
});
|
||||||
@@ -18,6 +18,7 @@ export type IconName =
|
|||||||
| "flag"
|
| "flag"
|
||||||
| "repeat"
|
| "repeat"
|
||||||
| "tag"
|
| "tag"
|
||||||
|
| "area"
|
||||||
| "plus"
|
| "plus"
|
||||||
| "close"
|
| "close"
|
||||||
| "chevron";
|
| "chevron";
|
||||||
@@ -281,6 +282,38 @@ export default function Icon({ name, size = 22, color = C.textSecondary, bg = C.
|
|||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
case "area":
|
||||||
|
// Briefcase: a body with a short handle on top.
|
||||||
|
return (
|
||||||
|
<View style={[box, s.center]}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
top: size * 0.12,
|
||||||
|
width: size * 0.36,
|
||||||
|
height: size * 0.26,
|
||||||
|
borderWidth: w,
|
||||||
|
borderBottomWidth: 0,
|
||||||
|
borderColor: color,
|
||||||
|
borderTopLeftRadius: 3,
|
||||||
|
borderTopRightRadius: 3,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
top: size * 0.32,
|
||||||
|
width: size * 0.84,
|
||||||
|
height: size * 0.56,
|
||||||
|
borderWidth: w,
|
||||||
|
borderColor: color,
|
||||||
|
borderRadius: 4,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<View style={{ position: "absolute", top: size * 0.32 + size * 0.2, width: size * 0.84, height: w, backgroundColor: color }} />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
|
||||||
case "close":
|
case "close":
|
||||||
return (
|
return (
|
||||||
<View style={[box, s.center]}>
|
<View style={[box, s.center]}>
|
||||||
|
|||||||
@@ -15,15 +15,16 @@ import { friendlyDate } from "../lib/dates";
|
|||||||
import { haptic } from "../lib/haptics";
|
import { haptic } from "../lib/haptics";
|
||||||
import { formatEstimate, PRIORITY_COLOR, PRIORITY_LABEL } from "../lib/priority";
|
import { formatEstimate, PRIORITY_COLOR, PRIORITY_LABEL } from "../lib/priority";
|
||||||
import { REPEAT_LABEL, REPEATS } from "../lib/repeat";
|
import { REPEAT_LABEL, REPEATS } from "../lib/repeat";
|
||||||
import { activeProjects, knownContexts } from "../lib/store";
|
import { getState, knownContexts } from "../lib/store";
|
||||||
import { C, radius, space, type } from "../lib/theme";
|
import { C, radius, space, type } from "../lib/theme";
|
||||||
import { useStore } from "../lib/useStore";
|
import { useStore } from "../lib/useStore";
|
||||||
import type { Task, TaskStatus } from "../lib/types";
|
import { AREA_LABEL, AREAS, type Task, type TaskStatus } from "../lib/types";
|
||||||
|
import { AREA_TONE } from "./AreaToggle";
|
||||||
|
|
||||||
/** Everything a task screen edits. Priority is nullable while undecided. */
|
/** Everything a task screen edits. Priority is nullable while undecided. */
|
||||||
export type TaskDraft = Pick<
|
export type TaskDraft = Pick<
|
||||||
Task,
|
Task,
|
||||||
"title" | "notes" | "status" | "project_id" | "context" | "waiting_for" | "due_date" | "defer_date" | "estimate_min" | "repeat"
|
"title" | "notes" | "status" | "project_id" | "context" | "waiting_for" | "due_date" | "defer_date" | "estimate_min" | "repeat" | "area"
|
||||||
> & { priority: Task["priority"] | null };
|
> & { priority: Task["priority"] | null };
|
||||||
|
|
||||||
export const BOX_LABEL: Record<string, string> = {
|
export const BOX_LABEL: Record<string, string> = {
|
||||||
@@ -48,6 +49,8 @@ export const emptyDraft = (): TaskDraft => ({
|
|||||||
estimate_min: null,
|
estimate_min: null,
|
||||||
repeat: null,
|
repeat: null,
|
||||||
priority: null,
|
priority: null,
|
||||||
|
// Born into whichever lens is on — that's what "add" means in work mode.
|
||||||
|
area: getState().area,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function TaskForm({
|
export default function TaskForm({
|
||||||
@@ -71,7 +74,12 @@ export default function TaskForm({
|
|||||||
const store = useStore();
|
const store = useStore();
|
||||||
// Keep a project that has since been archived visible, or editing an old task
|
// Keep a project that has since been archived visible, or editing an old task
|
||||||
// would silently drop it.
|
// would silently drop it.
|
||||||
const projects = activeProjects(store).filter((p) => p.status === "active" || p.id === d.project_id);
|
// Projects follow the draft's area, not the global lens, so re-filing a task
|
||||||
|
// to Work offers Work projects. An archived project stays visible while the
|
||||||
|
// task still points at it.
|
||||||
|
const projects = store.projects
|
||||||
|
.filter((p) => (p.status === "active" && (p.area ?? "personal") === d.area) || p.id === d.project_id)
|
||||||
|
.sort((a, b) => a.sort_order - b.sort_order || b.created_at.localeCompare(a.created_at));
|
||||||
const contexts = knownContexts(store);
|
const contexts = knownContexts(store);
|
||||||
const projectName = projects.find((p) => p.id === d.project_id)?.name ?? null;
|
const projectName = projects.find((p) => p.id === d.project_id)?.name ?? null;
|
||||||
|
|
||||||
@@ -185,6 +193,32 @@ export default function TaskForm({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Area reads as a placeholder while it matches the lens you're in — only a
|
||||||
|
// deliberate cross-filing (a work task captured from personal) earns colour.
|
||||||
|
attrs.push({
|
||||||
|
key: "area",
|
||||||
|
icon: "area",
|
||||||
|
placeholder: AREA_LABEL[store.area],
|
||||||
|
value: d.area === store.area ? null : AREA_LABEL[d.area],
|
||||||
|
tone: AREA_TONE[d.area],
|
||||||
|
panel: (
|
||||||
|
<View>
|
||||||
|
<Chips
|
||||||
|
options={AREAS}
|
||||||
|
labels={AREA_LABEL}
|
||||||
|
value={d.area}
|
||||||
|
onChange={(area) => {
|
||||||
|
if (area === d.area) return;
|
||||||
|
haptic.select();
|
||||||
|
// A project belongs to one area; drop it when the task moves.
|
||||||
|
onChange({ area, project_id: null });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Text style={s.panelEmpty}>Only shows up when that lens is on.</Text>
|
||||||
|
</View>
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
if (showDefer) {
|
if (showDefer) {
|
||||||
attrs.push({
|
attrs.push({
|
||||||
key: "defer",
|
key: "defer",
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const store = await import("./store");
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
storage.clear();
|
storage.clear();
|
||||||
await store.hydrate();
|
await store.hydrate();
|
||||||
|
store.setArea("personal");
|
||||||
});
|
});
|
||||||
|
|
||||||
const find = (id: string) => store.getState().tasks.find((t) => t.id === id)!;
|
const find = (id: string) => store.getState().tasks.find((t) => t.id === id)!;
|
||||||
@@ -61,3 +62,66 @@ describe("completeTask", () => {
|
|||||||
expect(store.completeTask("nope")).toBeNull();
|
expect(store.completeTask("nope")).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("area lens", () => {
|
||||||
|
test("new rows are born into the active area and selectors filter by it", () => {
|
||||||
|
const home = store.createTask({ title: "home" });
|
||||||
|
store.setArea("work");
|
||||||
|
const office = store.createTask({ title: "office" });
|
||||||
|
const proj = store.createProject({ name: "Q4" });
|
||||||
|
expect(home.area).toBe("personal");
|
||||||
|
expect(office.area).toBe("work");
|
||||||
|
expect(proj.area).toBe("work");
|
||||||
|
|
||||||
|
// The store is module state shared across tests, so assert on membership
|
||||||
|
// and on every visible row's area rather than on exact lists.
|
||||||
|
const ids = (s: ReturnType<typeof store.getState>) => store.tasksByStatus(s, "next").map((t) => t.id);
|
||||||
|
let s = store.getState();
|
||||||
|
expect(ids(s)).toContain(office.id);
|
||||||
|
expect(ids(s)).not.toContain(home.id);
|
||||||
|
expect(store.tasksByStatus(s, "next").every((t) => t.area === "work")).toBe(true);
|
||||||
|
expect(store.activeProjects(s).map((p) => p.id)).toEqual([proj.id]);
|
||||||
|
|
||||||
|
store.setArea("personal");
|
||||||
|
s = store.getState();
|
||||||
|
expect(ids(s)).toContain(home.id);
|
||||||
|
expect(ids(s)).not.toContain(office.id);
|
||||||
|
expect(store.activeProjects(s).some((p) => p.id === proj.id)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("area persists across hydrate", async () => {
|
||||||
|
store.setArea("work");
|
||||||
|
expect(storage.get("area_v1")).toBe("work");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("rows cached without an area count as personal", () => {
|
||||||
|
// Simulate a pre-migration cache row.
|
||||||
|
const legacy = store.createTask({ title: "old" });
|
||||||
|
delete (legacy as { area?: string }).area;
|
||||||
|
store.setArea("work");
|
||||||
|
expect(store.todayTasks(store.getState()).overdue).toEqual([]);
|
||||||
|
store.setArea("personal");
|
||||||
|
expect(store.tasksByStatus(store.getState(), "next").some((t) => t.id === legacy.id)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("today, review and contexts respect the lens", () => {
|
||||||
|
store.createTask({ title: "p", due_date: "2000-01-01", context: "@home" });
|
||||||
|
store.setArea("work");
|
||||||
|
store.createTask({ title: "w", due_date: "2000-01-01", context: "@office" });
|
||||||
|
const s = store.getState();
|
||||||
|
expect(store.todayTasks(s).overdue.every((t) => t.area === "work")).toBe(true);
|
||||||
|
expect(store.todayTasks(s).overdue.map((t) => t.title)).toContain("w");
|
||||||
|
expect(store.reviewBuckets(s).overdue.map((t) => t.title)).toContain("w");
|
||||||
|
expect(store.reviewBuckets(s).overdue.map((t) => t.title)).not.toContain("p");
|
||||||
|
expect(store.knownContexts(s)).toEqual(["@office"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("completing a repeating work task spawns into work", () => {
|
||||||
|
store.setArea("work");
|
||||||
|
const t = store.createTask({ title: "standup", repeat: "daily", due_date: "2000-01-01" });
|
||||||
|
store.setArea("personal");
|
||||||
|
store.completeTask(t.id);
|
||||||
|
const spawned = store.getState().tasks.find((x) => x.title === "standup" && x.status === "next")!;
|
||||||
|
expect(spawned.area).toBe("work");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -12,11 +12,17 @@ import { api } from "./api";
|
|||||||
import { getConfig } from "./config";
|
import { getConfig } from "./config";
|
||||||
import { daysFromToday, isDeferred, todayIso } from "./dates";
|
import { daysFromToday, isDeferred, todayIso } from "./dates";
|
||||||
import { nextOccurrence, shiftDays } from "./repeat";
|
import { nextOccurrence, shiftDays } from "./repeat";
|
||||||
import type { Project, Task } from "./types";
|
import type { Area, Project, Task } from "./types";
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
tasks: Task[];
|
tasks: Task[];
|
||||||
projects: Project[];
|
projects: Project[];
|
||||||
|
/**
|
||||||
|
* Which half of life is on screen. Every selector filters by it, so the
|
||||||
|
* toggle acts as a global lens: work mode shows no personal rows and vice
|
||||||
|
* versa. New tasks and projects are born into the active area.
|
||||||
|
*/
|
||||||
|
area: Area;
|
||||||
hydrated: boolean;
|
hydrated: boolean;
|
||||||
syncing: boolean;
|
syncing: boolean;
|
||||||
pending: number;
|
pending: number;
|
||||||
@@ -31,10 +37,12 @@ type Op =
|
|||||||
|
|
||||||
const DATA_KEY = "store_v1";
|
const DATA_KEY = "store_v1";
|
||||||
const QUEUE_KEY = "queue_v1";
|
const QUEUE_KEY = "queue_v1";
|
||||||
|
const AREA_KEY = "area_v1";
|
||||||
|
|
||||||
let state: State = {
|
let state: State = {
|
||||||
tasks: [],
|
tasks: [],
|
||||||
projects: [],
|
projects: [],
|
||||||
|
area: "personal",
|
||||||
hydrated: false,
|
hydrated: false,
|
||||||
syncing: false,
|
syncing: false,
|
||||||
pending: 0,
|
pending: 0,
|
||||||
@@ -68,13 +76,39 @@ function persistQueue() {
|
|||||||
|
|
||||||
export async function hydrate() {
|
export async function hydrate() {
|
||||||
if (state.hydrated) return;
|
if (state.hydrated) return;
|
||||||
const [data, q] = await Promise.all([AsyncStorage.getItem(DATA_KEY), AsyncStorage.getItem(QUEUE_KEY)]);
|
const [data, q, area] = await Promise.all([
|
||||||
|
AsyncStorage.getItem(DATA_KEY),
|
||||||
|
AsyncStorage.getItem(QUEUE_KEY),
|
||||||
|
AsyncStorage.getItem(AREA_KEY),
|
||||||
|
]);
|
||||||
if (q) queue = JSON.parse(q);
|
if (q) queue = JSON.parse(q);
|
||||||
const parsed = data ? JSON.parse(data) : { tasks: [], projects: [] };
|
const parsed = data ? JSON.parse(data) : { tasks: [], projects: [] };
|
||||||
setState({ tasks: parsed.tasks, projects: parsed.projects, hydrated: true });
|
setState({
|
||||||
|
tasks: parsed.tasks,
|
||||||
|
projects: parsed.projects,
|
||||||
|
area: area === "work" ? "work" : "personal",
|
||||||
|
hydrated: true,
|
||||||
|
});
|
||||||
void sync();
|
void sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Flip the personal/work lens. Persists so the app reopens where you left it. */
|
||||||
|
export function setArea(area: Area) {
|
||||||
|
if (area === state.area) return;
|
||||||
|
setState({ area });
|
||||||
|
void AsyncStorage.setItem(AREA_KEY, area);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rows cached before the area column existed have no `area`; they are
|
||||||
|
// personal, matching the server's column default.
|
||||||
|
function areaOf(row: { area?: Area }): Area {
|
||||||
|
return row.area ?? "personal";
|
||||||
|
}
|
||||||
|
|
||||||
|
function inArea<T extends { area?: Area }>(s: State, rows: T[]): T[] {
|
||||||
|
return rows.filter((r) => areaOf(r) === s.area);
|
||||||
|
}
|
||||||
|
|
||||||
// ---- mutations (instant; network happens later) ----
|
// ---- mutations (instant; network happens later) ----
|
||||||
|
|
||||||
function now() {
|
function now() {
|
||||||
@@ -83,8 +117,8 @@ function now() {
|
|||||||
|
|
||||||
// Fields the API accepts — everything else (timestamps, completed_at) is local
|
// Fields the API accepts — everything else (timestamps, completed_at) is local
|
||||||
// bookkeeping until the server's authoritative row arrives via pull().
|
// bookkeeping until the server's authoritative row arrives via pull().
|
||||||
const TASK_FIELDS = ["title", "notes", "status", "project_id", "context", "waiting_for", "due_date", "defer_date", "priority", "estimate_min", "repeat", "sort_order"] as const;
|
const TASK_FIELDS = ["title", "notes", "status", "project_id", "context", "waiting_for", "due_date", "defer_date", "priority", "estimate_min", "repeat", "sort_order", "area"] as const;
|
||||||
const PROJECT_FIELDS = ["name", "status", "notes", "sort_order"] as const;
|
const PROJECT_FIELDS = ["name", "status", "notes", "sort_order", "area"] as const;
|
||||||
|
|
||||||
function pickFields<T>(data: Partial<T>, fields: readonly (keyof T & string)[]): Partial<T> {
|
function pickFields<T>(data: Partial<T>, fields: readonly (keyof T & string)[]): Partial<T> {
|
||||||
const out: Partial<T> = {};
|
const out: Partial<T> = {};
|
||||||
@@ -122,6 +156,7 @@ export function createTask(data: Partial<Task> & { title: string }): Task {
|
|||||||
estimate_min: data.estimate_min ?? null,
|
estimate_min: data.estimate_min ?? null,
|
||||||
repeat: data.repeat ?? null,
|
repeat: data.repeat ?? null,
|
||||||
completed_at: null,
|
completed_at: null,
|
||||||
|
area: data.area ?? state.area,
|
||||||
// New tasks land at the top of their list.
|
// New tasks land at the top of their list.
|
||||||
sort_order:
|
sort_order:
|
||||||
data.sort_order ??
|
data.sort_order ??
|
||||||
@@ -202,6 +237,7 @@ function spawnNextOccurrence(t: Task): Task {
|
|||||||
priority: t.priority,
|
priority: t.priority,
|
||||||
estimate_min: t.estimate_min,
|
estimate_min: t.estimate_min,
|
||||||
repeat: t.repeat,
|
repeat: t.repeat,
|
||||||
|
area: areaOf(t),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +252,7 @@ export function createProject(data: Partial<Project> & { name: string }): Projec
|
|||||||
status: data.status ?? "active",
|
status: data.status ?? "active",
|
||||||
notes: data.notes ?? "",
|
notes: data.notes ?? "",
|
||||||
sort_order: data.sort_order ?? 0,
|
sort_order: data.sort_order ?? 0,
|
||||||
|
area: data.area ?? state.area,
|
||||||
created_at: now(),
|
created_at: now(),
|
||||||
updated_at: now(),
|
updated_at: now(),
|
||||||
};
|
};
|
||||||
@@ -333,7 +370,7 @@ function byManualOrder(a: Task, b: Task): number {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function tasksByStatus(s: State, status: Task["status"]): Task[] {
|
export function tasksByStatus(s: State, status: Task["status"]): Task[] {
|
||||||
return s.tasks.filter((t) => t.status === status).sort(byManualOrder);
|
return inArea(s, s.tasks).filter((t) => t.status === status).sort(byManualOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -362,7 +399,7 @@ export function reorderTask(id: string, status: Task["status"], index: number) {
|
|||||||
export function todayTasks(s: State): { overdue: Task[]; today: Task[] } {
|
export function todayTasks(s: State): { overdue: Task[]; today: Task[] } {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const todayIso = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
|
const todayIso = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
|
||||||
const open = s.tasks.filter((t) => t.status !== "done" && t.status !== "trashed");
|
const open = inArea(s, s.tasks).filter((t) => t.status !== "done" && t.status !== "trashed");
|
||||||
return {
|
return {
|
||||||
overdue: open.filter((t) => t.due_date && t.due_date < todayIso).sort(byPriorityDue),
|
overdue: open.filter((t) => t.due_date && t.due_date < todayIso).sort(byPriorityDue),
|
||||||
today: open
|
today: open
|
||||||
@@ -372,7 +409,7 @@ export function todayTasks(s: State): { overdue: Task[]; today: Task[] } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function activeProjects(s: State): Project[] {
|
export function activeProjects(s: State): Project[] {
|
||||||
return s.projects
|
return inArea(s, s.projects)
|
||||||
.filter((p) => p.status !== "dropped")
|
.filter((p) => p.status !== "dropped")
|
||||||
.sort((a, b) => a.sort_order - b.sort_order || b.created_at.localeCompare(a.created_at));
|
.sort((a, b) => a.sort_order - b.sort_order || b.created_at.localeCompare(a.created_at));
|
||||||
}
|
}
|
||||||
@@ -384,7 +421,7 @@ export function openTaskCount(s: State, projectId: string): number {
|
|||||||
/** Distinct contexts on open tasks — suggestion chips beat retyping "@homr". */
|
/** Distinct contexts on open tasks — suggestion chips beat retyping "@homr". */
|
||||||
export function knownContexts(s: State): string[] {
|
export function knownContexts(s: State): string[] {
|
||||||
const set = new Set<string>();
|
const set = new Set<string>();
|
||||||
for (const t of s.tasks) {
|
for (const t of inArea(s, s.tasks)) {
|
||||||
if (t.context && t.status !== "done" && t.status !== "trashed") set.add(t.context);
|
if (t.context && t.status !== "done" && t.status !== "trashed") set.add(t.context);
|
||||||
}
|
}
|
||||||
return [...set].sort();
|
return [...set].sort();
|
||||||
@@ -410,7 +447,7 @@ export interface ReviewBuckets {
|
|||||||
|
|
||||||
export function reviewBuckets(s: State): ReviewBuckets {
|
export function reviewBuckets(s: State): ReviewBuckets {
|
||||||
const today = todayIso();
|
const today = todayIso();
|
||||||
const open = s.tasks.filter((t) => t.status !== "done" && t.status !== "trashed");
|
const open = inArea(s, s.tasks).filter((t) => t.status !== "done" && t.status !== "trashed");
|
||||||
const overdue = open.filter((t) => t.due_date && t.due_date < today).sort(byPriorityDue);
|
const overdue = open.filter((t) => t.due_date && t.due_date < today).sort(byPriorityDue);
|
||||||
const overdueIds = new Set(overdue.map((t) => t.id));
|
const overdueIds = new Set(overdue.map((t) => t.id));
|
||||||
const actionable = new Set(["next", "waiting"]);
|
const actionable = new Set(["next", "waiting"]);
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ const light = {
|
|||||||
accent: "#2F6FED",
|
accent: "#2F6FED",
|
||||||
/** Tinted accent wash for selected chips and active states. */
|
/** Tinted accent wash for selected chips and active states. */
|
||||||
accentSoft: "#E8F0FE",
|
accentSoft: "#E8F0FE",
|
||||||
|
/** Accent for the work lens — the one place the app changes colour. */
|
||||||
|
work: "#0F766E",
|
||||||
done: "#2FA36B",
|
done: "#2FA36B",
|
||||||
danger: "#E5484D",
|
danger: "#E5484D",
|
||||||
warn: "#D98324",
|
warn: "#D98324",
|
||||||
@@ -45,6 +47,7 @@ const dark = {
|
|||||||
muted: "#7A7A85",
|
muted: "#7A7A85",
|
||||||
accent: "#4C86F0",
|
accent: "#4C86F0",
|
||||||
accentSoft: "#1B2740",
|
accentSoft: "#1B2740",
|
||||||
|
work: "#2DD4BF",
|
||||||
done: "#3FBF84",
|
done: "#3FBF84",
|
||||||
danger: "#F0605F",
|
danger: "#F0605F",
|
||||||
warn: "#E0A93E",
|
warn: "#E0A93E",
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
export type TaskStatus = "inbox" | "next" | "waiting" | "scheduled" | "someday" | "done" | "trashed";
|
export type TaskStatus = "inbox" | "next" | "waiting" | "scheduled" | "someday" | "done" | "trashed";
|
||||||
export type ProjectStatus = "active" | "someday" | "completed" | "dropped";
|
export type ProjectStatus = "active" | "someday" | "completed" | "dropped";
|
||||||
export type Repeat = "daily" | "weekdays" | "weekly" | "monthly" | "yearly";
|
export type Repeat = "daily" | "weekdays" | "weekly" | "monthly" | "yearly";
|
||||||
|
/** Personal vs work — the app-wide toggle shows one area at a time. */
|
||||||
|
export type Area = "personal" | "work";
|
||||||
|
|
||||||
|
export const AREAS: Area[] = ["personal", "work"];
|
||||||
|
export const AREA_LABEL: Record<Area, string> = { personal: "Personal", work: "Work" };
|
||||||
|
|
||||||
export interface Task {
|
export interface Task {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -17,6 +22,7 @@ export interface Task {
|
|||||||
repeat: Repeat | null;
|
repeat: Repeat | null;
|
||||||
completed_at: string | null;
|
completed_at: string | null;
|
||||||
sort_order: number;
|
sort_order: number;
|
||||||
|
area: Area;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
}
|
}
|
||||||
@@ -27,6 +33,7 @@ export interface Project {
|
|||||||
status: ProjectStatus;
|
status: ProjectStatus;
|
||||||
notes: string;
|
notes: string;
|
||||||
sort_order: number;
|
sort_order: number;
|
||||||
|
area: Area;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
open_tasks?: number;
|
open_tasks?: number;
|
||||||
|
|||||||
22
desktop/scripts/dev-web.sh
Executable file
22
desktop/scripts/dev-web.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Start the Expo web dev server for `tauri dev`.
|
||||||
|
#
|
||||||
|
# Runs from src-tauri/ as Tauri's beforeDevCommand, or from desktop/ by hand.
|
||||||
|
# Serves the GTD web UI on :8081 (devUrl in tauri.conf.json) with hot reload;
|
||||||
|
# the Tauri window loads it and talks to https://gtd.rehbock.xyz/api.
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ -x "$HOME/.hermes/node/bin/node" ]; then
|
||||||
|
export PATH="$HOME/.hermes/node/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
case "$HERE" in
|
||||||
|
*/desktop/src-tauri/scripts) REPO="$(cd "$HERE/../../.." && pwd)" ;;
|
||||||
|
*/desktop/scripts) REPO="$(cd "$HERE/../.." && pwd)" ;;
|
||||||
|
*) REPO="$(cd "$HERE/../.." && pwd)" ;;
|
||||||
|
esac
|
||||||
|
APP_DIR="$REPO/app"
|
||||||
|
|
||||||
|
cd "$APP_DIR"
|
||||||
|
exec npx expo start --web --port 8081
|
||||||
37
desktop/scripts/export-web.sh
Executable file
37
desktop/scripts/export-web.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Re-export the Expo web frontend for the Tauri desktop shell.
|
||||||
|
#
|
||||||
|
# Runs from src-tauri/ as Tauri's beforeBuildCommand, or from desktop/ by hand.
|
||||||
|
# `frontendDist` points at ../app/dist in the repo root, so a plain release
|
||||||
|
# build of an unchanged tree simply re-bundles the last committed export —
|
||||||
|
# exactly like the web deploy copies app/dist to the VPS.
|
||||||
|
#
|
||||||
|
# Node 22 only (matches app/.nvmrc and CI): newer npm writes lockfiles that
|
||||||
|
# CI's npm 10 refuses, so force the hermes node 22 toolchain if present.
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
case "$HERE" in
|
||||||
|
*/desktop/src-tauri/scripts)
|
||||||
|
# invoked as src-tauri/scripts/export-web.sh (Tauri hook cwd): repo is two up
|
||||||
|
ROOT="$(cd "$HERE/../../.." && pwd)" ;;
|
||||||
|
*/desktop/scripts)
|
||||||
|
# invoked as desktop/scripts/export-web.sh: repo is two up
|
||||||
|
ROOT="$(cd "$HERE/../.." && pwd)" ;;
|
||||||
|
*)
|
||||||
|
ROOT="$(cd "$HERE/../.." && pwd)" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$HOME/.hermes/node/bin/node" ]; then
|
||||||
|
export PATH="$HOME/.hermes/node/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')"
|
||||||
|
if [ "$NODE_MAJOR" != "22" ]; then
|
||||||
|
echo "export-web.sh: need node 22 (have $(node -v)); refusing to run" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$ROOT/app"
|
||||||
|
npx expo export --platform web
|
||||||
|
echo "export-web.sh: exported to $ROOT/app/dist"
|
||||||
2
desktop/src-tauri/.gitignore
vendored
Normal file
2
desktop/src-tauri/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/target/
|
||||||
|
/gen/schemas
|
||||||
4512
desktop/src-tauri/Cargo.lock
generated
Normal file
4512
desktop/src-tauri/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
desktop/src-tauri/Cargo.toml
Normal file
14
desktop/src-tauri/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[package]
|
||||||
|
name = "gtd"
|
||||||
|
version = "1.0.0"
|
||||||
|
description = "GTD desktop app — Tauri shell around the Expo web export"
|
||||||
|
edition = "2021"
|
||||||
|
authors = ["Marcus"]
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
tauri-build = { version = "2", features = [] }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tauri = { version = "2", features = [] }
|
||||||
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
serde_json = "1"
|
||||||
3
desktop/src-tauri/build.rs
Normal file
3
desktop/src-tauri/build.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
tauri_build::build()
|
||||||
|
}
|
||||||
7
desktop/src-tauri/capabilities/main.json
Normal file
7
desktop/src-tauri/capabilities/main.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
|
"identifier": "main-capability",
|
||||||
|
"description": "Capabilities for the GTD main window. The Expo web frontend needs no Tauri plugin APIs — it only talks to the remote API over fetch — so this grants the read-only core defaults (window/event/app metadata) and nothing privileged.",
|
||||||
|
"windows": ["main"],
|
||||||
|
"permissions": ["core:default"]
|
||||||
|
}
|
||||||
BIN
desktop/src-tauri/icons/128x128.png
Normal file
BIN
desktop/src-tauri/icons/128x128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
desktop/src-tauri/icons/128x128@2x.png
Normal file
BIN
desktop/src-tauri/icons/128x128@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
BIN
desktop/src-tauri/icons/32x32.png
Normal file
BIN
desktop/src-tauri/icons/32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
desktop/src-tauri/icons/64x64.png
Normal file
BIN
desktop/src-tauri/icons/64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
BIN
desktop/src-tauri/icons/icon.icns
Normal file
BIN
desktop/src-tauri/icons/icon.icns
Normal file
Binary file not shown.
BIN
desktop/src-tauri/icons/icon.ico
Normal file
BIN
desktop/src-tauri/icons/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
BIN
desktop/src-tauri/icons/icon.png
Normal file
BIN
desktop/src-tauri/icons/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 182 KiB |
22
desktop/src-tauri/scripts/dev-web.sh
Executable file
22
desktop/src-tauri/scripts/dev-web.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Start the Expo web dev server for `tauri dev`.
|
||||||
|
#
|
||||||
|
# Runs from src-tauri/ as Tauri's beforeDevCommand, or from desktop/ by hand.
|
||||||
|
# Serves the GTD web UI on :8081 (devUrl in tauri.conf.json) with hot reload;
|
||||||
|
# the Tauri window loads it and talks to https://gtd.rehbock.xyz/api.
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ -x "$HOME/.hermes/node/bin/node" ]; then
|
||||||
|
export PATH="$HOME/.hermes/node/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
case "$HERE" in
|
||||||
|
*/desktop/src-tauri/scripts) REPO="$(cd "$HERE/../../.." && pwd)" ;;
|
||||||
|
*/desktop/scripts) REPO="$(cd "$HERE/../.." && pwd)" ;;
|
||||||
|
*) REPO="$(cd "$HERE/../.." && pwd)" ;;
|
||||||
|
esac
|
||||||
|
APP_DIR="$REPO/app"
|
||||||
|
|
||||||
|
cd "$APP_DIR"
|
||||||
|
exec npx expo start --web --port 8081
|
||||||
37
desktop/src-tauri/scripts/export-web.sh
Executable file
37
desktop/src-tauri/scripts/export-web.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Re-export the Expo web frontend for the Tauri desktop shell.
|
||||||
|
#
|
||||||
|
# Runs from src-tauri/ as Tauri's beforeBuildCommand, or from desktop/ by hand.
|
||||||
|
# `frontendDist` points at ../app/dist in the repo root, so a plain release
|
||||||
|
# build of an unchanged tree simply re-bundles the last committed export —
|
||||||
|
# exactly like the web deploy copies app/dist to the VPS.
|
||||||
|
#
|
||||||
|
# Node 22 only (matches app/.nvmrc and CI): newer npm writes lockfiles that
|
||||||
|
# CI's npm 10 refuses, so force the hermes node 22 toolchain if present.
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
case "$HERE" in
|
||||||
|
*/desktop/src-tauri/scripts)
|
||||||
|
# invoked as src-tauri/scripts/export-web.sh (Tauri hook cwd): repo is two up
|
||||||
|
ROOT="$(cd "$HERE/../../.." && pwd)" ;;
|
||||||
|
*/desktop/scripts)
|
||||||
|
# invoked as desktop/scripts/export-web.sh: repo is two up
|
||||||
|
ROOT="$(cd "$HERE/../.." && pwd)" ;;
|
||||||
|
*)
|
||||||
|
ROOT="$(cd "$HERE/../.." && pwd)" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$HOME/.hermes/node/bin/node" ]; then
|
||||||
|
export PATH="$HOME/.hermes/node/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')"
|
||||||
|
if [ "$NODE_MAJOR" != "22" ]; then
|
||||||
|
echo "export-web.sh: need node 22 (have $(node -v)); refusing to run" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$ROOT/app"
|
||||||
|
npx expo export --platform web
|
||||||
|
echo "export-web.sh: exported to $ROOT/app/dist"
|
||||||
22
desktop/src-tauri/src/main.rs
Normal file
22
desktop/src-tauri/src/main.rs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// GTD desktop shell — Tauri 2 backend.
|
||||||
|
//
|
||||||
|
// The UI is the Expo web export (rebuilt from `app/` by
|
||||||
|
// `scripts/export-web.sh` into `app/dist`, which this crate bundles via
|
||||||
|
// `frontendDist`). All app logic, offline queueing, and API sync live in
|
||||||
|
// that frontend; Rust only hosts the window. Native hooks (global
|
||||||
|
// quick-add, menu-bar toggle) can attach to the builder below later
|
||||||
|
// without touching the web code.
|
||||||
|
//
|
||||||
|
// CSP note (tauri.conf.json > app.security): `dangerousDisableAssetCspModification`
|
||||||
|
// lists "style-src" because Tauri otherwise injects nonces into that directive,
|
||||||
|
// which makes WebKit ignore 'unsafe-inline' and block every react-native-web
|
||||||
|
// inline `style=""` attribute plus Reanimated's runtime <style> tags. The
|
||||||
|
// result is a collapsed, unstyled page — a black screen in dark mode.
|
||||||
|
// script-src still receives Tauri's hashes/nonces.
|
||||||
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
tauri::Builder::default()
|
||||||
|
.run(tauri::generate_context!())
|
||||||
|
.expect("failed to run GTD");
|
||||||
|
}
|
||||||
48
desktop/src-tauri/tauri.conf.json
Normal file
48
desktop/src-tauri/tauri.conf.json
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
|
"productName": "GTD",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"identifier": "xyz.rehbock.gtd",
|
||||||
|
"build": {
|
||||||
|
"devUrl": "http://localhost:8081",
|
||||||
|
"beforeDevCommand": "scripts/dev-web.sh",
|
||||||
|
"beforeBuildCommand": "scripts/export-web.sh",
|
||||||
|
"frontendDist": "../../app/dist"
|
||||||
|
},
|
||||||
|
"app": {
|
||||||
|
"windows": [
|
||||||
|
{
|
||||||
|
"label": "main",
|
||||||
|
"title": "GTD",
|
||||||
|
"url": "index.html",
|
||||||
|
"width": 1100,
|
||||||
|
"height": 750,
|
||||||
|
"minWidth": 800,
|
||||||
|
"minHeight": 600,
|
||||||
|
"center": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"security": {
|
||||||
|
"dangerousDisableAssetCspModification": ["style-src"],
|
||||||
|
"csp": {
|
||||||
|
"default-src": "'self' tauri: asset: http://asset.localhost",
|
||||||
|
"script-src": "'self' 'unsafe-inline' 'unsafe-eval' tauri: asset: http://asset.localhost blob: data:",
|
||||||
|
"style-src": "'self' 'unsafe-inline' tauri: asset: http://asset.localhost blob: data:",
|
||||||
|
"img-src": "'self' tauri: asset: http://asset.localhost blob: data:",
|
||||||
|
"font-src": "'self' tauri: asset: http://asset.localhost blob: data:",
|
||||||
|
"connect-src": "'self' ipc: http://ipc.localhost tauri: asset: http://asset.localhost https://gtd.rehbock.xyz",
|
||||||
|
"media-src": "'self' tauri: asset: http://asset.localhost blob: data:"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bundle": {
|
||||||
|
"active": true,
|
||||||
|
"targets": ["app", "dmg"],
|
||||||
|
"icon": ["icons/icon.icns", "icons/icon.ico", "icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png"],
|
||||||
|
"category": "Productivity",
|
||||||
|
"macOS": {
|
||||||
|
"minimumSystemVersion": "11.0",
|
||||||
|
"hardenedRuntime": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,12 +11,13 @@ await sql.unsafe(await Bun.file(new URL("schema.sql", import.meta.url)).text());
|
|||||||
|
|
||||||
const TASK_COLS = `id, title, notes, status, project_id, context, waiting_for,
|
const TASK_COLS = `id, title, notes, status, project_id, context, waiting_for,
|
||||||
due_date::text as due_date, defer_date::text as defer_date,
|
due_date::text as due_date, defer_date::text as defer_date,
|
||||||
priority, estimate_min, repeat, completed_at, sort_order, created_at, updated_at`;
|
priority, estimate_min, repeat, completed_at, sort_order, area, created_at, updated_at`;
|
||||||
const PROJECT_COLS = `id, name, status, notes, sort_order, created_at, updated_at`;
|
const PROJECT_COLS = `id, name, status, notes, sort_order, area, created_at, updated_at`;
|
||||||
|
|
||||||
const TASK_STATUSES = ["inbox", "next", "waiting", "scheduled", "someday", "done", "trashed"];
|
const TASK_STATUSES = ["inbox", "next", "waiting", "scheduled", "someday", "done", "trashed"];
|
||||||
const REPEATS = ["daily", "weekdays", "weekly", "monthly", "yearly"];
|
const REPEATS = ["daily", "weekdays", "weekly", "monthly", "yearly"];
|
||||||
const PROJECT_STATUSES = ["active", "someday", "completed", "dropped"];
|
const PROJECT_STATUSES = ["active", "someday", "completed", "dropped"];
|
||||||
|
const AREAS = ["personal", "work"];
|
||||||
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||||
|
|
||||||
const CORS = {
|
const CORS = {
|
||||||
@@ -33,8 +34,8 @@ function err(message: string, status: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fields a client may set. completed_at is derived from status server-side.
|
// Fields a client may set. completed_at is derived from status server-side.
|
||||||
const TASK_FIELDS = ["title", "notes", "status", "project_id", "context", "waiting_for", "due_date", "defer_date", "priority", "estimate_min", "repeat", "sort_order"];
|
const TASK_FIELDS = ["title", "notes", "status", "project_id", "context", "waiting_for", "due_date", "defer_date", "priority", "estimate_min", "repeat", "sort_order", "area"];
|
||||||
const PROJECT_FIELDS = ["name", "status", "notes", "sort_order"];
|
const PROJECT_FIELDS = ["name", "status", "notes", "sort_order", "area"];
|
||||||
|
|
||||||
// Only these may be cleared to NULL; notes/title are NOT NULL and keep "".
|
// Only these may be cleared to NULL; notes/title are NOT NULL and keep "".
|
||||||
const NULLABLE = new Set(["project_id", "context", "waiting_for", "due_date", "defer_date", "estimate_min", "repeat"]);
|
const NULLABLE = new Set(["project_id", "context", "waiting_for", "due_date", "defer_date", "estimate_min", "repeat"]);
|
||||||
@@ -62,12 +63,15 @@ async function handle(req: Request): Promise<Response> {
|
|||||||
if (path === "/v1/tasks" && method === "GET") {
|
if (path === "/v1/tasks" && method === "GET") {
|
||||||
const status = url.searchParams.get("status");
|
const status = url.searchParams.get("status");
|
||||||
const projectId = url.searchParams.get("project_id");
|
const projectId = url.searchParams.get("project_id");
|
||||||
|
const area = url.searchParams.get("area");
|
||||||
if (status && !TASK_STATUSES.includes(status)) return err("bad status", 400);
|
if (status && !TASK_STATUSES.includes(status)) return err("bad status", 400);
|
||||||
|
if (area && !AREAS.includes(area)) return err("bad area", 400);
|
||||||
const where: string[] = [];
|
const where: string[] = [];
|
||||||
const params: unknown[] = [];
|
const params: unknown[] = [];
|
||||||
if (status) { params.push(status); where.push(`status = $${params.length}`); }
|
if (status) { params.push(status); where.push(`status = $${params.length}`); }
|
||||||
else where.push(`status != 'trashed'`);
|
else where.push(`status != 'trashed'`);
|
||||||
if (projectId) { params.push(projectId); where.push(`project_id = $${params.length}`); }
|
if (projectId) { params.push(projectId); where.push(`project_id = $${params.length}`); }
|
||||||
|
if (area) { params.push(area); where.push(`area = $${params.length}`); }
|
||||||
const rows = await sql.unsafe(
|
const rows = await sql.unsafe(
|
||||||
`select ${TASK_COLS} from tasks where ${where.join(" and ")}
|
`select ${TASK_COLS} from tasks where ${where.join(" and ")}
|
||||||
order by sort_order, created_at desc`, params);
|
order by sort_order, created_at desc`, params);
|
||||||
@@ -79,16 +83,17 @@ async function handle(req: Request): Promise<Response> {
|
|||||||
if (typeof t.title !== "string" || !t.title.trim()) return err("title required", 400);
|
if (typeof t.title !== "string" || !t.title.trim()) return err("title required", 400);
|
||||||
if (t.status && !TASK_STATUSES.includes(t.status as string)) return err("bad status", 400);
|
if (t.status && !TASK_STATUSES.includes(t.status as string)) return err("bad status", 400);
|
||||||
if (t.repeat && !REPEATS.includes(t.repeat as string)) return err("bad repeat", 400);
|
if (t.repeat && !REPEATS.includes(t.repeat as string)) return err("bad repeat", 400);
|
||||||
|
if (t.area && !AREAS.includes(t.area as string)) return err("bad area", 400);
|
||||||
const id = typeof body.id === "string" && UUID_RE.test(body.id) ? body.id : null;
|
const id = typeof body.id === "string" && UUID_RE.test(body.id) ? body.id : null;
|
||||||
// Client-supplied id + on-conflict no-op make offline-queue retries idempotent.
|
// Client-supplied id + on-conflict no-op make offline-queue retries idempotent.
|
||||||
const rows = await sql.unsafe(
|
const rows = await sql.unsafe(
|
||||||
`insert into tasks (id, title, notes, status, project_id, context, waiting_for, due_date, defer_date, priority, estimate_min, repeat, sort_order)
|
`insert into tasks (id, title, notes, status, project_id, context, waiting_for, due_date, defer_date, priority, estimate_min, repeat, sort_order, area)
|
||||||
values (coalesce($1::uuid, gen_random_uuid()), $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
|
values (coalesce($1::uuid, gen_random_uuid()), $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)
|
||||||
on conflict (id) do nothing
|
on conflict (id) do nothing
|
||||||
returning ${TASK_COLS}`,
|
returning ${TASK_COLS}`,
|
||||||
[id, t.title, t.notes ?? "", t.status ?? "next", t.project_id ?? null, t.context ?? null,
|
[id, t.title, t.notes ?? "", t.status ?? "next", t.project_id ?? null, t.context ?? null,
|
||||||
t.waiting_for ?? null, t.due_date ?? null, t.defer_date ?? null, t.priority ?? 4,
|
t.waiting_for ?? null, t.due_date ?? null, t.defer_date ?? null, t.priority ?? 4,
|
||||||
t.estimate_min ?? null, t.repeat ?? null, t.sort_order ?? 0]);
|
t.estimate_min ?? null, t.repeat ?? null, t.sort_order ?? 0, t.area ?? "personal"]);
|
||||||
if (rows.length) return json(rows[0], 201);
|
if (rows.length) return json(rows[0], 201);
|
||||||
const existing = await sql.unsafe(`select ${TASK_COLS} from tasks where id = $1`, [id]);
|
const existing = await sql.unsafe(`select ${TASK_COLS} from tasks where id = $1`, [id]);
|
||||||
return json(existing[0], 200);
|
return json(existing[0], 200);
|
||||||
@@ -104,6 +109,7 @@ async function handle(req: Request): Promise<Response> {
|
|||||||
const patch = method === "DELETE" ? { status: "trashed" } : pick(body, TASK_FIELDS);
|
const patch = method === "DELETE" ? { status: "trashed" } : pick(body, TASK_FIELDS);
|
||||||
if (patch.status && !TASK_STATUSES.includes(patch.status as string)) return err("bad status", 400);
|
if (patch.status && !TASK_STATUSES.includes(patch.status as string)) return err("bad status", 400);
|
||||||
if (patch.repeat && !REPEATS.includes(patch.repeat as string)) return err("bad repeat", 400);
|
if (patch.repeat && !REPEATS.includes(patch.repeat as string)) return err("bad repeat", 400);
|
||||||
|
if (patch.area && !AREAS.includes(patch.area as string)) return err("bad area", 400);
|
||||||
const existing = await sql.unsafe(`select ${TASK_COLS} from tasks where id = $1`, [id]);
|
const existing = await sql.unsafe(`select ${TASK_COLS} from tasks where id = $1`, [id]);
|
||||||
if (!existing.length) return err("not found", 404);
|
if (!existing.length) return err("not found", 404);
|
||||||
const cur = { ...existing[0], ...patch };
|
const cur = { ...existing[0], ...patch };
|
||||||
@@ -111,10 +117,10 @@ async function handle(req: Request): Promise<Response> {
|
|||||||
const rows = await sql.unsafe(
|
const rows = await sql.unsafe(
|
||||||
`update tasks set title=$2, notes=$3, status=$4, project_id=$5, context=$6, waiting_for=$7,
|
`update tasks set title=$2, notes=$3, status=$4, project_id=$5, context=$6, waiting_for=$7,
|
||||||
due_date=$8, defer_date=$9, priority=$10, estimate_min=$11, repeat=$12, completed_at=$13,
|
due_date=$8, defer_date=$9, priority=$10, estimate_min=$11, repeat=$12, completed_at=$13,
|
||||||
sort_order=$14, updated_at=now()
|
sort_order=$14, area=$15, updated_at=now()
|
||||||
where id=$1 returning ${TASK_COLS}`,
|
where id=$1 returning ${TASK_COLS}`,
|
||||||
[id, cur.title, cur.notes, cur.status, cur.project_id, cur.context, cur.waiting_for,
|
[id, cur.title, cur.notes, cur.status, cur.project_id, cur.context, cur.waiting_for,
|
||||||
cur.due_date, cur.defer_date, cur.priority, cur.estimate_min, cur.repeat, completedAt, cur.sort_order]);
|
cur.due_date, cur.defer_date, cur.priority, cur.estimate_min, cur.repeat, completedAt, cur.sort_order, cur.area]);
|
||||||
return json(rows[0]);
|
return json(rows[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,13 +139,14 @@ async function handle(req: Request): Promise<Response> {
|
|||||||
const p = pick(body, PROJECT_FIELDS);
|
const p = pick(body, PROJECT_FIELDS);
|
||||||
if (typeof p.name !== "string" || !p.name.trim()) return err("name required", 400);
|
if (typeof p.name !== "string" || !p.name.trim()) return err("name required", 400);
|
||||||
if (p.status && !PROJECT_STATUSES.includes(p.status as string)) return err("bad status", 400);
|
if (p.status && !PROJECT_STATUSES.includes(p.status as string)) return err("bad status", 400);
|
||||||
|
if (p.area && !AREAS.includes(p.area as string)) return err("bad area", 400);
|
||||||
const id = typeof body.id === "string" && UUID_RE.test(body.id) ? body.id : null;
|
const id = typeof body.id === "string" && UUID_RE.test(body.id) ? body.id : null;
|
||||||
const rows = await sql.unsafe(
|
const rows = await sql.unsafe(
|
||||||
`insert into projects (id, name, status, notes, sort_order)
|
`insert into projects (id, name, status, notes, sort_order, area)
|
||||||
values (coalesce($1::uuid, gen_random_uuid()), $2, $3, $4, $5)
|
values (coalesce($1::uuid, gen_random_uuid()), $2, $3, $4, $5, $6)
|
||||||
on conflict (id) do nothing
|
on conflict (id) do nothing
|
||||||
returning ${PROJECT_COLS}`,
|
returning ${PROJECT_COLS}`,
|
||||||
[id, p.name, p.status ?? "active", p.notes ?? "", p.sort_order ?? 0]);
|
[id, p.name, p.status ?? "active", p.notes ?? "", p.sort_order ?? 0, p.area ?? "personal"]);
|
||||||
if (rows.length) return json(rows[0], 201);
|
if (rows.length) return json(rows[0], 201);
|
||||||
const existing = await sql.unsafe(`select ${PROJECT_COLS} from projects where id = $1`, [id]);
|
const existing = await sql.unsafe(`select ${PROJECT_COLS} from projects where id = $1`, [id]);
|
||||||
return json(existing[0], 200);
|
return json(existing[0], 200);
|
||||||
@@ -150,13 +157,14 @@ async function handle(req: Request): Promise<Response> {
|
|||||||
const id = m[1];
|
const id = m[1];
|
||||||
const patch = method === "DELETE" ? { status: "dropped" } : pick(body, PROJECT_FIELDS);
|
const patch = method === "DELETE" ? { status: "dropped" } : pick(body, PROJECT_FIELDS);
|
||||||
if (patch.status && !PROJECT_STATUSES.includes(patch.status as string)) return err("bad status", 400);
|
if (patch.status && !PROJECT_STATUSES.includes(patch.status as string)) return err("bad status", 400);
|
||||||
|
if (patch.area && !AREAS.includes(patch.area as string)) return err("bad area", 400);
|
||||||
const existing = await sql.unsafe(`select ${PROJECT_COLS} from projects where id = $1`, [id]);
|
const existing = await sql.unsafe(`select ${PROJECT_COLS} from projects where id = $1`, [id]);
|
||||||
if (!existing.length) return err("not found", 404);
|
if (!existing.length) return err("not found", 404);
|
||||||
const cur = { ...existing[0], ...patch };
|
const cur = { ...existing[0], ...patch };
|
||||||
const rows = await sql.unsafe(
|
const rows = await sql.unsafe(
|
||||||
`update projects set name=$2, status=$3, notes=$4, sort_order=$5, updated_at=now()
|
`update projects set name=$2, status=$3, notes=$4, sort_order=$5, area=$6, updated_at=now()
|
||||||
where id=$1 returning ${PROJECT_COLS}`,
|
where id=$1 returning ${PROJECT_COLS}`,
|
||||||
[id, cur.name, cur.status, cur.notes, cur.sort_order]);
|
[id, cur.name, cur.status, cur.notes, cur.sort_order, cur.area]);
|
||||||
return json(rows[0]);
|
return json(rows[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,3 +38,10 @@ create index if not exists tasks_project_idx on tasks (project_id);
|
|||||||
-- Columns added after the initial deploy (create-if-not-exists won't alter).
|
-- Columns added after the initial deploy (create-if-not-exists won't alter).
|
||||||
alter table tasks add column if not exists repeat text
|
alter table tasks add column if not exists repeat text
|
||||||
check (repeat in ('daily', 'weekdays', 'weekly', 'monthly', 'yearly'));
|
check (repeat in ('daily', 'weekdays', 'weekly', 'monthly', 'yearly'));
|
||||||
|
|
||||||
|
-- Personal vs work: the app's top-level toggle filters every list by area.
|
||||||
|
alter table tasks add column if not exists area text not null default 'personal'
|
||||||
|
check (area in ('personal', 'work'));
|
||||||
|
alter table projects add column if not exists area text not null default 'personal'
|
||||||
|
check (area in ('personal', 'work'));
|
||||||
|
create index if not exists tasks_area_idx on tasks (area);
|
||||||
|
|||||||
Reference in New Issue
Block a user