Chore: Completed Splash-Screen & Iniital Tauri Wire-Up

This commit is contained in:
Youwes09
2026-06-02 08:27:37 -05:00
parent c5243ba30c
commit 18027baee1
45 changed files with 2981 additions and 2013 deletions
+8 -37
View File
@@ -1,46 +1,17 @@
export interface HistoryEntry {
mangaId: number;
mangaTitle: string;
thumbnailUrl: string;
chapterId: number;
chapterName: string;
chapterNumber: number;
pageNumber: number;
readAt: number;
}
export interface ReadingStats {
currentStreakDays: number;
totalChaptersRead: number;
totalMinutesRead: number;
totalMangaRead: number;
longestStreakDays: number;
}
import { historyState } from '$lib/state/history.svelte'
export const homeState = $state({
history: [] as HistoryEntry[],
dailyReadCounts: {} as Record<string, number>,
stats: {
currentStreakDays: 0,
totalChaptersRead: 0,
totalMinutesRead: 0,
totalMangaRead: 0,
longestStreakDays: 0,
} as ReadingStats,
heroSlots: [null, null, null, null] as [number | null, number | null, number | null, number | null],
});
})
export function getHistoryStats() { return historyState.stats }
export function getHistorySessions() { return historyState.sessions }
export function getHistoryDailyCounts() { return historyState.dailyReadCounts }
export function setHeroSlot(i: 1 | 2 | 3, mangaId: number | null) {
homeState.heroSlots[i] = mangaId;
}
export function recordRead(entry: HistoryEntry) {
homeState.history = [entry, ...homeState.history.filter(e => e.chapterId !== entry.chapterId)];
const dateStr = new Date(entry.readAt).toISOString().slice(0, 10);
homeState.dailyReadCounts[dateStr] = (homeState.dailyReadCounts[dateStr] ?? 0) + 1;
homeState.stats.totalChaptersRead++;
homeState.heroSlots[i] = mangaId
}
export function clearHistory() {
homeState.history = [];
historyState.clearHistory()
}