Compare commits

..

No commits in common. "main" and "v17" have entirely different histories.
main ... v17

6 changed files with 30 additions and 131 deletions

View file

@ -381,23 +381,6 @@ const gym = [
},
];
const fast = [
{ name: "1:1", planned_at: "2025-04-30", completed: false },
{ name: "1:2", planned_at: "2025-05-02", completed: false },
{ name: "2:1", planned_at: "2025-05-05", completed: false },
{ name: "2:2", planned_at: "2025-05-07", completed: false },
{ name: "2:3", planned_at: "2025-05-09", completed: false },
{ name: "3:1", planned_at: "2025-05-12", completed: false },
{ name: "3:2", planned_at: "2025-05-14", completed: false },
{ name: "3:3", planned_at: "2025-05-16", completed: false },
{ name: "4:1", planned_at: "2025-05-19", completed: false },
{ name: "4:2", planned_at: "2025-05-21", completed: false },
{ name: "4:3", planned_at: "2025-05-23", completed: false },
{ name: "5:1", planned_at: "2025-05-26", completed: false },
{ name: "5:2", planned_at: "2025-05-28", completed: false },
{ name: "5:3", planned_at: "2025-05-30", completed: false },
];
const diet = [
{ date: "2025-02-10", completed: false },
{ date: "2025-02-11", completed: false },
@ -515,5 +498,4 @@ export default {
cardio,
gym,
diet,
fast,
};

View file

@ -6,29 +6,25 @@
import GymProgress from "./lib/GymProgress.svelte";
import CardioProgress from "./lib/CardioProgress.svelte";
import DietProgress from "./lib/DietProgress.svelte";
import FastProgress from "./lib/FastProgress.svelte";
import Info from "./lib/Info.svelte";
import Info from "./lib/Info.svelte"
</script>
<div class="chrome">
{#if $currentView === 0}
<Summary />
{/if}
{#if $currentView === 1}
<GymProgress />
{/if}
{#if $currentView === 2}
<CardioProgress />
{/if}
{#if $currentView === 3}
<DietProgress />
{/if}
{#if $currentView === 4}
<Info />
{/if}
{#if $currentView === 5}
<FastProgress />
{/if}
{#if $currentView === 0}
<Summary />
{/if}
{#if $currentView === 1}
<GymProgress />
{/if}
{#if $currentView === 2}
<CardioProgress />
{/if}
{#if $currentView === 3}
<DietProgress />
{/if}
{#if $currentView === 4}
<Info />
{/if}
</div>
<style>

View file

@ -1,7 +1,7 @@
<script lang="ts">
import DietProgress from "./DietProgress.svelte";
import P from "./svg-path";
import { gym, cardio, diet, fast } from "./store";
import { gym, cardio, diet } from "./store";
export const DEG_TO_RAD = Math.PI / 180;
export const RAD_TO_DEG = 180 / Math.PI;
@ -17,12 +17,7 @@
const x = 0;
const y = 0;
const points = (
radius: number,
radLength: number,
thickness: number,
offset?: number,
) => {
const points = (radius: number, radLength: number, thickness: number) => {
const borderRadius = thickness / 2;
const outerRadius = radius;
const innerRadius = outerRadius - thickness;
@ -31,20 +26,19 @@
(borderRadius / (outerRadius * FULL_CIRCLE_IN_RADIANS)) *
FULL_CIRCLE_IN_RADIANS;
const isLongTrack = radLength - 2 * borderRadiusAngle > Math.PI;
const start = startAngle + (offset ?? 0);
return P()
.moveTo(
-Math.sin(start) * (outerRadius - borderRadius),
Math.cos(start) * (outerRadius - borderRadius),
-Math.sin(startAngle) * (outerRadius - borderRadius),
Math.cos(startAngle) * (outerRadius - borderRadius),
)
.arcTo(
borderRadius,
borderRadius,
false,
true,
-Math.sin(start - borderRadiusAngle) * outerRadius,
Math.cos(start - borderRadiusAngle) * outerRadius,
-Math.sin(startAngle - borderRadiusAngle) * outerRadius,
Math.cos(startAngle - borderRadiusAngle) * outerRadius,
)
.arcTo(
outerRadius,
@ -79,16 +73,16 @@
innerRadius,
isLongTrack,
false,
-Math.sin(start - borderRadiusAngle) * innerRadius,
Math.cos(start - borderRadiusAngle) * innerRadius,
-Math.sin(startAngle - borderRadiusAngle) * innerRadius,
Math.cos(startAngle - borderRadiusAngle) * innerRadius,
)
.arcTo(
borderRadius,
borderRadius,
false,
true,
-Math.sin(start) * (innerRadius + borderRadius),
Math.cos(start) * (innerRadius + borderRadius),
-Math.sin(startAngle) * (innerRadius + borderRadius),
Math.cos(startAngle) * (innerRadius + borderRadius),
)
.close()
.stringify();
@ -102,21 +96,16 @@
},
{
c: "cardio",
progress: $cardio.filter((c) => c.completed).length / $cardio.length,
progress: $diet.filter((c) => !c.excluded).length / $cardio.length,
level: 1,
},
{
c: "diet",
progress:
$diet.filter((c) => c.completed).length /
$cardio.filter((c) => c.completed).length /
$diet.filter((c) => !c.excluded).length,
level: 2,
},
{
c: "fast",
progress: $fast.filter((c) => c.completed).length / $fast.length,
level: 3,
},
];
</script>
@ -143,15 +132,6 @@
segmentHeight,
)}
/>
<path
fill="#fff"
opacity="0.4"
d={points(
size / 2 - level * (segmentHeight + 4) - 4,
progress * span * 0.98,
4,
)}
/>
{/each}
</g>
</g>
@ -185,8 +165,4 @@
.diet {
color: #35d450;
}
.fast {
color: #ff00ff;
}
</style>

View file

@ -1,39 +0,0 @@
<script lang="ts">
import { fast } from "./store";
import { dm, back } from "./common";
const remaining = $fast.length;
const days = ["ons", "fre", "mån"];
let done = $derived($fast.filter((c) => c.completed).length);
</script>
<header>
<button class="clickable back" onclick={() => back()}>←</button>
<h1>
Fasta: {done} av {remaining}
</h1>
</header>
<main>
<progress hidden max={remaining} value={done}></progress>
<div class="calendar">
{#each $fast as col, i}
<article class="clickable">
<label>
<input type="checkbox" bind:checked={col.completed} />
<strong>{col.name}</strong>
<small>{days[i % 3]} {dm(col.planned_at)}</small>
</label>
</article>
{/each}
</div>
</main>
<style>
main {
background-color: #5dc5f8;
border-top: 4px solid rgba(0, 0, 0, 0.2);
}
article:nth-child(1) {
grid-column: 2;
}
</style>

View file

@ -1,13 +1,12 @@
<script lang="ts">
import { gym, fast, cardio, diet, currentView } from "./store";
import { gym, cardio, diet, currentView } from "./store";
import Arc from "./Arc.svelte";
let gymProgress = $derived($gym.filter((c) => c.completed).length);
let cardioProgress = $derived($cardio.filter((c) => c.completed).length);
let fastProgress = $derived($fast.filter((c) => c.completed).length);
let dietProgress = $derived($diet.filter((c) => c.completed).length);
let dietTotal = $derived($diet.filter((c) => !c.excluded).length);
const navigate = (v: 0 | 1 | 2 | 3 | 4 | 5) => {
const navigate = (v: 0 | 1 | 2 | 3 | 4) => {
currentView.update((_) => v);
};
</script>
@ -35,12 +34,6 @@
<i>{dietProgress} / {dietTotal}</i>
<button class="clickable diet" onclick={() => navigate(3)}>+</button>
</div>
<h2>Fasta, 3d/v under maj</h2>
<div class="progress-row">
<progress class="fast" value={fastProgress} max={$fast.length}></progress>
<i>{fastProgress} / {$fast.length}</i>
<button class="clickable fast" onclick={() => navigate(5)}>+</button>
</div>
</div>
<div class="top-button">
<button class="clickable info" onclick={() => navigate(4)}> Va? </button>
@ -71,10 +64,6 @@
&.gym {
--pcolor: #f62b5a;
}
&.fast {
--pcolor: #ff00ff;
}
}
progress,
@ -196,10 +185,6 @@
&.gym {
--btn-bg: #f62b5a;
}
&.fast {
--btn-bg: #ff00ff;
}
}
}
</style>

View file

@ -7,7 +7,6 @@ export const currentView = writable(0);
export const cardio = persisted("cardio", defaultState.cardio);
export const gym = persisted("gym", defaultState.gym);
export const diet = persisted("diet", defaultState.diet);
export const fast = persisted("fast", defaultState.fast);
export type Exercise = {
completed: boolean;