Minimal home: top-3 next actions only, bottom icon menu, FAB-only capture, inbox abolished (priority+due required at creation)
All checks were successful
Build & Release APK / build (push) Successful in 1m52s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-07 20:27:36 -07:00
parent 0487bc7e4e
commit d6bd8500e3
6 changed files with 116 additions and 325 deletions

View File

@@ -2,7 +2,7 @@ import { useRouter } from "expo-router";
import { useState } from "react";
import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
import PriorityChips from "../components/PriorityChips";
import { Button, Chips, Field } from "../components/ui";
import { Chips, Field } from "../components/ui";
import { haptic } from "../lib/haptics";
import { activeProjects, createTask } from "../lib/store";
import { C } from "../lib/theme";
@@ -10,7 +10,6 @@ import { useStore } from "../lib/useStore";
import type { Task, TaskStatus } from "../lib/types";
const BOXES: { key: TaskStatus; label: string }[] = [
{ key: "inbox", label: "Inbox" },
{ key: "next", label: "Next up" },
{ key: "waiting", label: "Waiting" },
{ key: "someday", label: "Someday" },
@@ -29,25 +28,29 @@ export default function AddTask() {
const store = useStore();
const [title, setTitle] = useState("");
const [notes, setNotes] = useState("");
const [priority, setPriority] = useState<Task["priority"]>(4);
const [priority, setPriority] = useState<Task["priority"] | null>(null);
const [estimate, setEstimate] = useState<number | null>(null);
const [due, setDue] = useState("");
const [box, setBox] = useState<TaskStatus>("inbox");
const [box, setBox] = useState<TaskStatus>("next");
const [projectId, setProjectId] = useState<string | null>(null);
const projects = activeProjects(store).filter((p) => p.status === "active");
const projectOptions = ["none", ...projects.map((p) => p.id)];
const projectLabels = Object.fromEntries([["none", "None"], ...projects.map((p) => [p.id, p.name])]);
// Every task must be born fully scoped: title + priority + due date.
const dueValid = /^\d{4}-\d{2}-\d{2}$/.test(due.trim());
const ready = title.trim().length > 0 && priority !== null && dueValid;
const save = () => {
if (!title.trim()) return;
if (!ready || priority === null) return;
createTask({
title: title.trim(),
notes,
status: box,
priority,
estimate_min: estimate,
due_date: due.trim() || null,
due_date: due.trim(),
project_id: projectId,
});
haptic.success();
@@ -66,6 +69,28 @@ export default function AddTask() {
style={{ minHeight: 64, textAlignVertical: "top" }}
/>
<PriorityChips value={priority} onChange={setPriority} />
<View style={{ marginBottom: 2 }}>
<Text style={s.label}>Due date</Text>
<View style={s.rowWrap}>
{[
{ label: "Today", v: isoToday() },
{ label: "Tomorrow", v: isoToday(1) },
{ label: "Next week", v: isoToday(7) },
].map(({ label, v }) => (
<Pressable
key={label}
style={[s.chip, due === v && s.chipActive]}
onPress={() => {
haptic.select();
setDue(due === v ? "" : v);
}}
>
<Text style={[s.chipText, due === v && { color: C.text }]}>{label}</Text>
</Pressable>
))}
</View>
</View>
<Field label="" value={due} onChangeText={setDue} placeholder="YYYY-MM-DD" autoCapitalize="none" />
<View style={{ marginBottom: 14 }}>
<Text style={s.label}>Estimated time</Text>
<View style={s.rowWrap}>
@@ -88,26 +113,6 @@ export default function AddTask() {
})}
</View>
</View>
<View style={{ marginBottom: 2 }}>
<View style={s.rowWrap}>
{[
{ label: "Due today", v: isoToday() },
{ label: "Tomorrow", v: isoToday(1) },
].map(({ label, v }) => (
<Pressable
key={label}
style={[s.chip, due === v && s.chipActive]}
onPress={() => {
haptic.select();
setDue(due === v ? "" : v);
}}
>
<Text style={[s.chipText, due === v && { color: C.text }]}>{label}</Text>
</Pressable>
))}
</View>
</View>
<Field label="Due date" value={due} onChangeText={setDue} placeholder="YYYY-MM-DD" autoCapitalize="none" />
<Chips
label="Box"
options={BOXES.map((b) => b.key)}
@@ -125,7 +130,11 @@ export default function AddTask() {
value={projectId ?? "none"}
onChange={(v) => setProjectId(v === "none" ? null : v)}
/>
<Button title="Add task" onPress={save} />
<Pressable style={[s.save, !ready && s.saveDisabled]} onPress={save} disabled={!ready}>
<Text style={[s.saveText, !ready && { color: C.muted }]}>
{ready ? "Add task" : "Needs a title, priority & due date"}
</Text>
</Pressable>
</ScrollView>
);
}
@@ -143,4 +152,14 @@ const s = StyleSheet.create({
},
chipActive: { backgroundColor: C.surface2, borderColor: C.accent },
chipText: { color: C.muted, fontSize: 14 },
save: {
backgroundColor: C.accent,
borderRadius: 10,
padding: 14,
alignItems: "center",
marginTop: 8,
marginBottom: 24,
},
saveDisabled: { backgroundColor: C.surface },
saveText: { color: C.text, fontSize: 16, fontWeight: "600" },
});

View File

@@ -1,226 +1,60 @@
import { useRouter } from "expo-router";
import { useRef, useState } from "react";
import { Pressable, StyleSheet, Text, TextInput, View } from "react-native";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
import Animated, {
runOnJS,
useAnimatedStyle,
useSharedValue,
withSpring,
withTiming,
} from "react-native-reanimated";
import { Pressable, StyleSheet, Text, View } from "react-native";
import TaskRow from "../components/TaskRow";
import { haptic } from "../lib/haptics";
import { PRIORITY_COLOR } from "../lib/priority";
import { parseQuickAdd } from "../lib/quickadd";
import { activeProjects, createTask, tasksByStatus, todayTasks, updateTask } from "../lib/store";
import { tasksByStatus, todayTasks } from "../lib/store";
import { C } from "../lib/theme";
import { useStore } from "../lib/useStore";
import type { Task, TaskStatus } from "../lib/types";
const Q = {
next: { title: "Next up", color: "#3DBF77", bg: "#15301F", border: "#1E4D33" },
waiting: { title: "Waiting for", color: "#E0A93E", bg: "#33270F", border: "#544019" },
someday: { title: "Someday", color: "#9D8FE8", bg: "#221E38", border: "#38315C" },
projects: { title: "Projects", color: "#5B9DE8", bg: "#152538", border: "#1F3D5C" },
};
type DropZone = Extract<TaskStatus, "inbox" | "next" | "waiting" | "someday">;
type Rect = { x: number; y: number; w: number; h: number };
type ZoneRects = Partial<Record<DropZone, Rect>>;
const SPRING = { damping: 18, stiffness: 260, mass: 0.6 };
/** Long-press-drag wrapper: spring transforms, haptics, window-coord drop. */
function Draggable({
task,
findZone,
children,
}: {
task: Task;
findZone: (x: number, y: number) => DropZone | null;
children: React.ReactNode;
}) {
const tx = useSharedValue(0);
const ty = useSharedValue(0);
const active = useSharedValue(false);
const drop = (x: number, y: number) => {
const zone = findZone(x, y);
if (zone && zone !== task.status) {
haptic.success();
updateTask(task.id, { status: zone });
}
};
const pan = Gesture.Pan()
.activateAfterLongPress(180)
.onStart(() => {
active.value = true;
runOnJS(haptic.pickup)();
})
.onUpdate((e) => {
tx.value = e.translationX;
ty.value = e.translationY;
})
.onEnd((e) => {
runOnJS(drop)(e.absoluteX, e.absoluteY);
})
.onFinalize(() => {
active.value = false;
tx.value = withSpring(0, SPRING);
ty.value = withSpring(0, SPRING);
});
const style = useAnimatedStyle(() => ({
transform: [
{ translateX: tx.value },
{ translateY: ty.value },
{ scale: withTiming(active.value ? 1.06 : 1, { duration: 120 }) },
],
zIndex: active.value ? 100 : 0,
elevation: active.value ? 8 : 0,
opacity: withTiming(active.value ? 0.92 : 1, { duration: 120 }),
}));
return (
<GestureDetector gesture={pan}>
<Animated.View style={style}>{children}</Animated.View>
</GestureDetector>
);
}
function DragRow({ task, findZone }: { task: Task; findZone: (x: number, y: number) => DropZone | null }) {
const router = useRouter();
return (
<Draggable task={task} findZone={findZone}>
<Pressable style={s.dragRow} onPress={() => router.push(`/task/${task.id}`)}>
<View style={[s.priorityDot, { backgroundColor: PRIORITY_COLOR[task.priority] }]} />
<Text style={s.dragRowText} numberOfLines={1}>
{task.title}
</Text>
</Pressable>
</Draggable>
);
}
const MENU = [
{ icon: "📅", label: "Today", href: "/today" },
{ icon: "▶️", label: "Next", href: "/list/next" },
{ icon: "⏳", label: "Waiting", href: "/list/waiting" },
{ icon: "💭", label: "Someday", href: "/list/someday" },
{ icon: "📁", label: "Projects", href: "/projects" },
] as const;
export default function Home() {
const router = useRouter();
const store = useStore();
const [draft, setDraft] = useState("");
const zones = useRef<ZoneRects>({});
const zoneRefs = useRef<Partial<Record<DropZone, View | null>>>({});
const measureZone = (zone: DropZone) => () => {
zoneRefs.current[zone]?.measureInWindow((x, y, w, h) => {
zones.current[zone] = { x, y, w, h };
});
};
const findZone = (x: number, y: number): DropZone | null => {
for (const [zone, r] of Object.entries(zones.current) as [DropZone, Rect][]) {
if (x >= r.x && x <= r.x + r.w && y >= r.y && y <= r.y + r.h) return zone;
}
return null;
};
const capture = () => {
if (!draft.trim()) return;
const parsed = parseQuickAdd(draft, store.projects);
if (!parsed.title) return;
setDraft("");
haptic.tap();
createTask({ ...parsed, status: "inbox" });
};
const inbox = tasksByStatus(store, "inbox");
const next = tasksByStatus(store, "next");
const waiting = tasksByStatus(store, "waiting");
const someday = tasksByStatus(store, "someday");
const projects = activeProjects(store).filter((p) => p.status === "active");
const { overdue, today } = todayTasks(store);
const quadrant = (zone: Exclude<DropZone, "inbox">, tasks: Task[], onOpen: () => void) => {
const q = Q[zone];
return (
<View
ref={(r) => {
zoneRefs.current[zone] = r;
}}
onLayout={measureZone(zone)}
style={[s.quad, { backgroundColor: q.bg, borderColor: q.border }]}
>
<Pressable style={s.quadHead} onPress={onOpen}>
<Text style={[s.quadTitle, { color: q.color }]}>{q.title}</Text>
<Text style={[s.quadCount, { color: q.color }]}>{tasks.length}</Text>
</Pressable>
{tasks.slice(0, 3).map((t) => (
<DragRow key={t.id} task={t} findZone={findZone} />
))}
</View>
);
};
const { overdue } = todayTasks(store);
return (
<View style={s.screen}>
<TextInput
style={s.capture}
placeholder="Capture… (tomorrow p1 @home #project ~30m)"
placeholderTextColor={C.muted}
value={draft}
onChangeText={setDraft}
onSubmitEditing={capture}
submitBehavior="submit"
returnKeyType="done"
/>
<View style={s.pillRow}>
<View
ref={(r) => {
zoneRefs.current.inbox = r;
}}
onLayout={measureZone("inbox")}
style={s.pill}
>
<Pressable style={s.pillPress} onPress={() => router.push("/list/inbox")}>
<Text style={s.pillText}>📥 Inbox</Text>
<Text style={[s.pillText, { color: inbox.length ? C.text : C.muted }]}>{inbox.length}</Text>
<View style={{ flex: 1 }}>
<Text style={s.sectionTitle}>Next up</Text>
{next.slice(0, 3).map((t) => (
<TaskRow key={t.id} task={t} />
))}
{next.length === 0 && <Text style={s.empty}>Nothing next. Tap to add.</Text>}
{next.length > 3 && (
<Pressable onPress={() => router.push("/list/next")}>
<Text style={s.viewAll}>all next actions ({next.length}) </Text>
</Pressable>
</View>
<View style={s.pill}>
<Pressable style={s.pillPress} onPress={() => router.push("/today")}>
<Text style={s.pillText}>📅 Today</Text>
<Text style={[s.pillText, { color: overdue.length ? C.danger : today.length ? C.text : C.muted }]}>
{overdue.length ? `${overdue.length}!` : today.length}
</Text>
)}
{overdue.length > 0 && (
<Pressable onPress={() => router.push("/today")}>
<Text style={s.overdue}>{overdue.length} overdue </Text>
</Pressable>
</View>
)}
{store.syncError && <Text style={s.error}>{store.syncError}</Text>}
</View>
{inbox.slice(0, 3).map((t) => (
<DragRow key={t.id} task={t} findZone={findZone} />
))}
{store.syncError && <Text style={s.error}>{store.syncError}</Text>}
<View style={s.grid}>
<View style={s.gridRow}>
{quadrant("next", next, () => router.push("/list/next"))}
{quadrant("waiting", waiting, () => router.push("/list/waiting"))}
</View>
<View style={s.gridRow}>
{quadrant("someday", someday, () => router.push("/list/someday"))}
<View style={[s.quad, { backgroundColor: Q.projects.bg, borderColor: Q.projects.border }]}>
<Pressable style={{ flex: 1 }} onPress={() => router.push("/projects")}>
<View style={s.quadHead}>
<Text style={[s.quadTitle, { color: Q.projects.color }]}>{Q.projects.title}</Text>
<Text style={[s.quadCount, { color: Q.projects.color }]}>{projects.length}</Text>
</View>
{projects.slice(0, 3).map((p) => (
<Text key={p.id} style={s.quadItem} numberOfLines={1}>
{p.name}
</Text>
))}
</Pressable>
</View>
</View>
<View style={s.menu}>
{MENU.map((m) => (
<Pressable key={m.label} style={s.menuItem} onPress={() => router.push(m.href)}>
<Text style={s.menuIcon}>{m.icon}</Text>
<Text style={s.menuLabel}>{m.label}</Text>
</Pressable>
))}
</View>
<Pressable style={s.fab} onPress={() => { haptic.tap(); router.push("/add"); }}>
<Pressable
style={s.fab}
onPress={() => {
haptic.tap();
router.push("/add");
}}
>
<Text style={s.fabText}></Text>
</Pressable>
</View>
@@ -228,58 +62,35 @@ export default function Home() {
}
const s = StyleSheet.create({
screen: { flex: 1, backgroundColor: C.bg, padding: 12 },
capture: {
padding: 14,
borderRadius: 12,
backgroundColor: C.surface,
color: C.text,
fontSize: 16,
borderWidth: 1,
borderColor: C.border,
screen: { flex: 1, backgroundColor: C.bg },
sectionTitle: {
color: C.muted,
fontSize: 13,
textTransform: "uppercase",
letterSpacing: 1,
paddingHorizontal: 16,
paddingTop: 18,
paddingBottom: 6,
},
pillRow: { flexDirection: "row", gap: 10, marginTop: 10 },
pill: {
flex: 1,
borderRadius: 12,
backgroundColor: C.surface,
borderWidth: 1,
borderColor: C.border,
},
pillPress: {
empty: { color: C.muted, textAlign: "center", marginTop: 48, fontSize: 15 },
viewAll: { color: C.muted, fontSize: 14, padding: 16 },
overdue: { color: C.danger, fontSize: 14, paddingHorizontal: 16, paddingBottom: 8 },
error: { color: C.danger, paddingHorizontal: 16, paddingTop: 8 },
menu: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
paddingVertical: 12,
paddingHorizontal: 14,
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: C.border,
paddingTop: 10,
paddingBottom: 18,
backgroundColor: C.bg,
},
pillText: { color: C.text, fontSize: 15, fontWeight: "600" },
dragRow: {
flexDirection: "row",
alignItems: "center",
gap: 8,
marginTop: 6,
paddingVertical: 9,
paddingHorizontal: 12,
borderRadius: 10,
backgroundColor: C.surface2,
borderWidth: 1,
borderColor: C.border,
},
dragRowText: { color: C.text, fontSize: 14, flex: 1 },
priorityDot: { width: 8, height: 8, borderRadius: 4 },
grid: { flex: 1, marginTop: 10, gap: 10 },
gridRow: { flex: 1, flexDirection: "row", gap: 10 },
quad: { flex: 1, borderRadius: 16, borderWidth: 1, padding: 12, overflow: "visible" },
quadHead: { flexDirection: "row", justifyContent: "space-between", marginBottom: 4 },
quadTitle: { fontSize: 16, fontWeight: "700" },
quadCount: { fontSize: 16, fontWeight: "700" },
quadItem: { color: C.muted, fontSize: 13, marginBottom: 4 },
error: { color: C.danger, marginTop: 8 },
menuItem: { flex: 1, alignItems: "center", gap: 3 },
menuIcon: { fontSize: 20 },
menuLabel: { color: C.muted, fontSize: 11 },
fab: {
position: "absolute",
right: 20,
bottom: 24,
bottom: 92,
width: 58,
height: 58,
borderRadius: 29,

View File

@@ -3,7 +3,6 @@ import TaskListScreen from "../../components/TaskListScreen";
import type { TaskStatus } from "../../lib/types";
const TITLES: Record<string, string> = {
inbox: "Inbox",
next: "Next up",
waiting: "Waiting for",
scheduled: "Scheduled",
@@ -12,8 +11,7 @@ const TITLES: Record<string, string> = {
};
const HINTS: Record<string, string> = {
inbox: "Inbox zero. Capture from the home screen.",
next: "No next actions. Clarify your inbox.",
next: "Nothing next. Tap on the home screen.",
waiting: "Not waiting on anyone.",
scheduled: "Nothing scheduled.",
someday: "No someday/maybe items.",
@@ -22,11 +20,11 @@ const HINTS: Record<string, string> = {
export default function ListByStatus() {
const { status } = useLocalSearchParams<{ status: string }>();
const st = (status in TITLES ? status : "inbox") as TaskStatus;
const st = (status in TITLES ? status : "next") as TaskStatus;
return (
<>
<Stack.Screen options={{ title: TITLES[st] }} />
<TaskListScreen status={st} capture={st === "inbox" || st === "next"} emptyHint={HINTS[st]} />
<TaskListScreen status={st} emptyHint={HINTS[st]} />
</>
);
}

View File

@@ -8,7 +8,7 @@ import { C } from "../../lib/theme";
import { useStore } from "../../lib/useStore";
import type { Task, TaskStatus } from "../../lib/types";
const STATUSES: TaskStatus[] = ["inbox", "next", "waiting", "scheduled", "someday", "done"];
const STATUSES: TaskStatus[] = ["next", "waiting", "someday", "done"];
export default function TaskDetail() {
const { id } = useLocalSearchParams<{ id: string }>();

View File

@@ -8,7 +8,7 @@ export default function PriorityChips({
value,
onChange,
}: {
value: Task["priority"];
value: Task["priority"] | null;
onChange: (p: Task["priority"]) => void;
}) {
return (

View File

@@ -1,8 +1,6 @@
import { useState } from "react";
import { FlatList, RefreshControl, StyleSheet, Text, TextInput, View } from "react-native";
import { haptic } from "../lib/haptics";
import { parseQuickAdd } from "../lib/quickadd";
import { createTask, sync, tasksByStatus } from "../lib/store";
import { FlatList, RefreshControl, StyleSheet, Text, View } from "react-native";
import { sync, tasksByStatus } from "../lib/store";
import { C } from "../lib/theme";
import { useStore } from "../lib/useStore";
import type { TaskStatus } from "../lib/types";
@@ -10,41 +8,17 @@ import TaskRow from "./TaskRow";
export default function TaskListScreen({
status,
capture,
emptyHint,
}: {
status: TaskStatus;
capture?: boolean;
emptyHint: string;
}) {
const store = useStore();
const [refreshing, setRefreshing] = useState(false);
const [draft, setDraft] = useState("");
const tasks = tasksByStatus(store, status);
const add = () => {
if (!draft.trim()) return;
const parsed = parseQuickAdd(draft, store.projects);
if (!parsed.title) return;
setDraft("");
haptic.tap();
createTask({ ...parsed, status });
};
return (
<View style={s.screen}>
{capture && (
<TextInput
style={s.capture}
placeholder="Capture anything…"
placeholderTextColor={C.muted}
value={draft}
onChangeText={setDraft}
onSubmitEditing={add}
submitBehavior="submit"
returnKeyType="done"
/>
)}
<FlatList
data={tasks}
keyExtractor={(t) => t.id}
@@ -69,16 +43,5 @@ export default function TaskListScreen({
const s = StyleSheet.create({
screen: { flex: 1, backgroundColor: C.bg },
capture: {
margin: 12,
marginBottom: 4,
padding: 14,
borderRadius: 12,
backgroundColor: C.surface,
color: C.text,
fontSize: 16,
borderWidth: 1,
borderColor: C.border,
},
empty: { color: C.muted, textAlign: "center", marginTop: 48, fontSize: 15 },
});