perf: logbook memoization and pagination, debounced realtime, lazy exceljs

- Precompute per-entry spend/caffeine/sugar map; paginate ledger at 50 rows
- Debounce realtime refetches (500ms trailing) and suppress during bulk import
- Show import progress (Importing X of N)
- Dynamic-import exceljs: entry chunk 1640 -> 700 kB
- Skeleton placeholders for initial load on Overview/Trends/Logbook
This commit is contained in:
nh9961
2026-07-19 21:00:51 +00:00
parent bb5750e928
commit 9e8f3c55d6
12 changed files with 247 additions and 61 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
import ExcelJS from "exceljs";
import type ExcelJS from "exceljs";
import { flavourMeta } from "../data/flavours";
import type { EntryDraft, ImportPreview, ImportPreviewRow, RedBullEntry } from "../types";
import {
@@ -39,6 +39,7 @@ const ENTRY_COLUMNS = [
] as const;
export async function createExcelExport(entries: RedBullEntry[]) {
const { default: ExcelJS } = await import("exceljs");
const workbook = new ExcelJS.Workbook();
workbook.creator = "Red Bull Intake Tracker";
workbook.created = new Date();
@@ -53,6 +54,7 @@ export async function createExcelExport(entries: RedBullEntry[]) {
}
export async function parseExcelImport(file: File, existingEntries: RedBullEntry[]): Promise<ImportPreview> {
const { default: ExcelJS } = await import("exceljs");
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.load(await file.arrayBuffer());