From 009b19e404a9ba2dd30e086f563db953a741ac47 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Mon, 10 Nov 2025 14:24:20 +0100 Subject: [PATCH] feat: move top screen components to own folder, and implement calendar --- app/app.vue | 53 ++++--------- app/components/Screen.vue | 4 + app/components/Stats.vue | 4 +- app/components/{ => TopScreen}/Background.vue | 2 +- app/components/TopScreen/Calendar.vue | 75 +++++++++++++++++++ app/components/TopScreen/TopScreen.vue | 8 ++ 6 files changed, 105 insertions(+), 41 deletions(-) rename app/components/{ => TopScreen}/Background.vue (91%) create mode 100644 app/components/TopScreen/Calendar.vue create mode 100644 app/components/TopScreen/TopScreen.vue diff --git a/app/app.vue b/app/app.vue index 74df694..0693ac1 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,45 +1,24 @@ - - diff --git a/app/components/Screen.vue b/app/components/Screen.vue index 06bf8b8..202d722 100644 --- a/app/components/Screen.vue +++ b/app/components/Screen.vue @@ -36,7 +36,11 @@ const renderFrame = (timestamp: number) => { ctx.clearRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); for (const callback of renderCallbacks) { + ctx.save(); + callback(ctx); + + ctx.restore(); } lastRealFrameTime = Date.now() - start; diff --git a/app/components/Stats.vue b/app/components/Stats.vue index def8f9b..e2bd688 100644 --- a/app/components/Stats.vue +++ b/app/components/Stats.vue @@ -31,7 +31,7 @@ useRender((ctx) => { const LINE_HEIGHT = 12; ctx.fillStyle = "red"; - ctx.fillRect(props.x - 2, props.y, 140, LINE_COUNT * LINE_HEIGHT + 3); + ctx.fillRect(props.x - 2, props.y, 120, LINE_COUNT * LINE_HEIGHT + 3); let textY = props.y; @@ -59,5 +59,3 @@ useRender((ctx) => { ); }); - - diff --git a/app/components/Background.vue b/app/components/TopScreen/Background.vue similarity index 91% rename from app/components/Background.vue rename to app/components/TopScreen/Background.vue index dceff7a..4be4828 100644 --- a/app/components/Background.vue +++ b/app/components/TopScreen/Background.vue @@ -1,4 +1,4 @@ - + + diff --git a/app/components/TopScreen/TopScreen.vue b/app/components/TopScreen/TopScreen.vue new file mode 100644 index 0000000..c1415bf --- /dev/null +++ b/app/components/TopScreen/TopScreen.vue @@ -0,0 +1,8 @@ +