mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-02 13:12:44 +00:00
docs: add toggle UI components, submission chart, and update stats schema
This commit is contained in:
1 parent
5d2d1dff3c
commit
d194cedf7a
6 files changed
+449
-65
No files matched your search
+14
-11
@@ -29,27 +29,30 @@ export interface Stats {
|
||||
topics: { issue: number; name: string; total: number; done: number; taught: boolean }[];
|
||||
/** The ten most recently solved, newest first, dated by first pass (ET). */
|
||||
recent: { lc: number; title: string; difficulty: Difficulty; date: string }[];
|
||||
/** The 365 days ending today (ET), zeros included, plus LeetCode's three figures. */
|
||||
year: {
|
||||
days: { date: string; attempts: number; passes: number }[];
|
||||
attempts: number;
|
||||
active_days: number;
|
||||
max_streak: number;
|
||||
};
|
||||
/**
|
||||
* The 365 days ending today (ET), zeros included — always the current
|
||||
* calendar year to date. Per difficulty: every logged attempt, and every
|
||||
* first solve (the first-pass date `recent` uses).
|
||||
*/
|
||||
year: Day[];
|
||||
}
|
||||
|
||||
export interface Day {
|
||||
date: string;
|
||||
passes: number;
|
||||
attempts: Record<Difficulty, number>;
|
||||
solved: Record<Difficulty, number>;
|
||||
}
|
||||
|
||||
function isStats(value: unknown): value is Stats {
|
||||
if (typeof value !== "object" || value === null) return false;
|
||||
const v = value as Record<string, unknown>;
|
||||
const year = v.year as Record<string, unknown> | null | undefined;
|
||||
return (
|
||||
Array.isArray(v.difficulty) &&
|
||||
typeof v.attempting === "number" &&
|
||||
Array.isArray(v.topics) &&
|
||||
Array.isArray(v.recent) &&
|
||||
typeof year === "object" &&
|
||||
year !== null &&
|
||||
Array.isArray(year.days)
|
||||
Array.isArray(v.year)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user