diff --git a/.gitignore b/.gitignore index 47ffcf73..302d14da 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ betterseqtaplus-safari/ .million/ .vscode/ +.cursor/ **/.DS_Store .parcel-cache .env diff --git a/lib/fixCrxWorkerLiveReload.ts b/lib/fixCrxWorkerLiveReload.ts new file mode 100644 index 00000000..2dc607a9 --- /dev/null +++ b/lib/fixCrxWorkerLiveReload.ts @@ -0,0 +1,19 @@ +import type { Plugin } from "vite"; + +/** + * crxjs 2.6.x only replaces the first `__LIVE_RELOAD__` in `@crx/client-worker`, + * which crashes the service worker when the dev server reconnects. + */ +export default function fixCrxWorkerLiveReload(): Plugin { + return { + name: "fix-crx-worker-live-reload", + apply: "serve", + enforce: "post", + transform(code, id) { + if (!id.includes("@crx/client-worker") || !code.includes("__LIVE_RELOAD__")) { + return; + } + return code.replaceAll("__LIVE_RELOAD__", "true"); + }, + }; +} diff --git a/src/plugins/built-in/gradeAnalytics/AnalyticsAreaChart.svelte b/src/plugins/built-in/gradeAnalytics/AnalyticsAreaChart.svelte index fafe4be7..3c1ba0b9 100644 --- a/src/plugins/built-in/gradeAnalytics/AnalyticsAreaChart.svelte +++ b/src/plugins/built-in/gradeAnalytics/AnalyticsAreaChart.svelte @@ -2,7 +2,7 @@ import * as Chart from "./chart/index"; import { scaleLinear } from "d3-scale"; import { Area, AreaChart, ChartClipPath, Spline } from "layerchart"; - import { curveNatural } from "d3-shape"; + import { curveMonotoneX } from "d3-shape"; import { cubicInOut } from "svelte/easing"; import type { Assessment } from "./types"; import { @@ -46,7 +46,7 @@ return computeGradeForecast(points, predictionMonths); }); - /** Bridge point + future months — separate from historical so the main line stays intact. */ + /** Bridge point + future months — separate series rendered via Spline. */ const forecastLineData = $derived.by(() => { if (!showPrediction || !forecast) return []; @@ -60,19 +60,21 @@ ]; }); - /** Ghost future dates (null grades) extend the x domain without touching the historical line. */ - const chartData = $derived.by(() => { - if (!showPrediction || forecastLineData.length <= 1) { - return historicalData; + const xDomain = $derived.by((): [Date, Date] | undefined => { + const times = historicalData.map((p) => p.date.getTime()); + + if (showPrediction && forecastLineData.length > 1) { + for (const point of forecastLineData.slice(1)) { + times.push(point.date.getTime()); + } } - const futurePadding = forecastLineData.slice(1).map((p) => ({ - date: p.date, - average: null, - count: 0, - })); + if (!times.length) return undefined; - return [...historicalData, ...futurePadding]; + return [ + new Date(Math.min(...times)), + new Date(Math.max(...times)), + ]; }); const chartConfig = $derived.by(() => { @@ -161,8 +163,19 @@
-
-

Grade trends

+
+
+

Grade trends

+ +

{#if showSubjectTrends} Overall and per-subject averages · {getTimeRangeLabel(timeRange)} @@ -172,21 +185,14 @@

-
- - -
- Months ahead - + {#if showPrediction} +
+
-
+ {/if}
@@ -195,13 +201,14 @@ {/if} diff --git a/src/plugins/built-in/gradeAnalytics/GradeAnalyticsPage.svelte b/src/plugins/built-in/gradeAnalytics/GradeAnalyticsPage.svelte index 9d5590ee..5860fa21 100644 --- a/src/plugins/built-in/gradeAnalytics/GradeAnalyticsPage.svelte +++ b/src/plugins/built-in/gradeAnalytics/GradeAnalyticsPage.svelte @@ -209,7 +209,6 @@ {/if} -

Track your academic performance and progress over time

{#if lastUpdated && analyticsData && analyticsData.length > 0}

Last updated: {formattedTimestamp()}

{/if} @@ -244,32 +243,22 @@
{:else if analyticsData && analyticsData.length > 0} -
-
-
Average grade
-
- {statsAverage !== null ? `${statsAverage}%` : "—"} +
+
-
-
Graded shown
-
{gradedFiltered().length}
-
-
-
Subjects
-
{statsSubjectCount}
-
-
-
-
-
+
Time period
-
+
Subjects
{/each}
@@ -369,7 +355,7 @@
-