Data Model
Cấu trúc dữ liệu trong Steadii
Habit (Thói quen)
interface Habit {
id: string; // "read", "create", "custom_xyz"
name: string; // Tên hiển thị
icon: string; // Material Symbol icon
target: number; // Mục tiêu (GIÂY, 1800 = 30 phút)
color: string; // Hex color ("#E8A838")
enabled: boolean; // Đang bật hay tắt
}DayRecord (Dữ liệu ngày)
// Key = YYYY-MM-DD, Value = { habitId → giây đã tập }
Record<string, { [habitId: string]: number }>
// Ví dụ:
{ "2026-03-29": { "read": 1845, "create": 3600, "move": 0 } }JournalEntry (Nhật ký phiên)
interface JournalEntry {
date: string; // "2026-03-29"
habitName: string; // "Đọc / Học"
mood: string; // "great" | "good" | "okay"
note: string; // Max 280 ký tự
seconds: number; // Thời gian phiên (giây)
timestamp: number; // Unix timestamp (ms)
}AppState (Zustand Store)
| Field | Type | Persist? | Sync? |
|---|---|---|---|
onboardingCompleted | boolean | ✅ | ✅ |
habits | Habit[] | ✅ | ✅ |
days | Record | ✅ | ✅ |
reminders | Reminders | ✅ | ✅ |
customQuotes | string[] | ✅ | ✅ |
theme | string | ✅ | ❌ |
locale | string | ✅ | ❌ |
focusSettings | FocusSettings | ✅ | ❌ |
journals | JournalEntry[] | ✅ | ❌ |
subscription | Subscription | ✅ | ❌ (API fetch) |
jwt | string | ❌ (memory) | — |
syncStatus | string | ❌ (memory) | — |
Persisted to localStorage key: du-deu-storage-v4