({
sidebarOpen,
onShowSidebar
}: {
sidebarOpen: boolean
onShowSidebar: () => void
})
| 44 | * edited notes plus the open tasks for today. Keyboard: ↑/↓ (and j/k in vim |
| 45 | * mode) move between rows, Enter opens. */ |
| 46 | export function HomeView({ |
| 47 | sidebarOpen, |
| 48 | onShowSidebar |
| 49 | }: { |
| 50 | sidebarOpen: boolean |
| 51 | onShowSidebar: () => void |
| 52 | }): JSX.Element { |
| 53 | const notes = useStore((s) => s.notes) |
| 54 | const vaultTasks = useStore((s) => s.vaultTasks) |
| 55 | const tasksLoading = useStore((s) => s.tasksLoading) |
| 56 | const vimMode = useStore((s) => s.vimMode) |
| 57 | const selectNote = useStore((s) => s.selectNote) |
| 58 | const openTaskAt = useStore((s) => s.openTaskAt) |
| 59 | const toggleTaskFromList = useStore((s) => s.toggleTaskFromList) |
| 60 | const refreshTasks = useStore((s) => s.refreshTasks) |
| 61 | const openTasksView = useStore((s) => s.openTasksView) |
| 62 | const vaultSettings = useStore((s) => s.vaultSettings) |
| 63 | const createAndOpen = useStore((s) => s.createAndOpen) |
| 64 | const createDatabase = useStore((s) => s.createDatabase) |
| 65 | const createDrawingAndOpen = useStore((s) => s.createDrawingAndOpen) |
| 66 | const openTodayDailyNote = useStore((s) => s.openTodayDailyNote) |
| 67 | const openWeeklyNoteForDate = useStore((s) => s.openWeeklyNoteForDate) |
| 68 | |
| 69 | const containerRef = useRef<HTMLDivElement>(null) |
| 70 | |
| 71 | // Quick-create actions. Daily/weekly only appear when enabled in settings |
| 72 | // (they default off), matching the command palette's gating. |
| 73 | const actions = useMemo<Array<{ label: string; icon: JSX.Element; run: () => void }>>(() => { |
| 74 | const list: Array<{ label: string; icon: JSX.Element; run: () => void }> = [ |
| 75 | { |
| 76 | label: 'New note', |
| 77 | icon: <NotePlusIcon width={15} height={15} />, |
| 78 | run: () => void createAndOpen('inbox', '') |
| 79 | }, |
| 80 | { |
| 81 | label: 'Database', |
| 82 | icon: <DatabaseIcon width={15} height={15} />, |
| 83 | run: () => void createDatabase('inbox', '') |
| 84 | }, |
| 85 | { |
| 86 | label: 'Drawing', |
| 87 | icon: <ExcalidrawIcon width={15} height={15} />, |
| 88 | run: () => void createDrawingAndOpen('inbox', '') |
| 89 | } |
| 90 | ] |
| 91 | if (vaultSettings?.dailyNotes?.enabled) { |
| 92 | list.push({ |
| 93 | label: 'Daily note', |
| 94 | icon: <CalendarIcon width={15} height={15} />, |
| 95 | run: () => void openTodayDailyNote() |
| 96 | }) |
| 97 | } |
| 98 | if (vaultSettings?.weeklyNotes?.enabled) { |
| 99 | list.push({ |
| 100 | label: 'Weekly note', |
| 101 | icon: <CalendarIcon width={15} height={15} />, |
| 102 | run: () => void openWeeklyNoteForDate(new Date()) |
| 103 | }) |
nothing calls this directly
no test coverage detected