getting there

This commit is contained in:
Andras Schmelczer 2026-05-30 15:40:53 +01:00
parent f87480e79d
commit 5ac6633d40
20 changed files with 898 additions and 112 deletions

View file

@ -60,6 +60,7 @@ interface ExampleBlockSeed {
tag: string;
desc: string;
done: boolean;
difficulty?: number;
ageHrs: number;
}
@ -318,12 +319,14 @@ export class StoreService implements OnDestroy {
tag: string,
description: string,
is_done = false,
difficulty = 1,
): void {
const block: Block = {
id: uuidV4(),
tag,
description,
is_done,
difficulty,
created_at: Math.floor(Date.now() / 1000),
};
this._pages.update((pages) =>
@ -578,7 +581,7 @@ export class StoreService implements OnDestroy {
// ── Example data ──────────────────────────────────────────────────────────
loadExample(): void {
loadExample(): string {
const now = Math.floor(Date.now() / 1000);
const page: Page = {
@ -593,7 +596,13 @@ export class StoreService implements OnDestroy {
// oldest → newest (left → right), matching the slider's old → new
// labels; pending tasks stay on top for the accordion.
this.makeExampleTower('Reading', { h: 0.05, s: 0.7, l: 0.55 }, now, [
{ tag: 'novel', desc: 'Finish The Brothers Karamazov', done: false, ageHrs: 0 },
{
tag: 'novel',
desc: 'Finish The Brothers Karamazov',
done: false,
difficulty: 4,
ageHrs: 0,
},
...this.makeExampleDoneBlocks(
[
{ tag: 'novel', desc: (n) => `Read chapter ${n}` },
@ -606,8 +615,20 @@ export class StoreService implements OnDestroy {
),
]),
this.makeExampleTower('Side projects', { h: 0.58, s: 0.65, l: 0.5 }, now, [
{ tag: 'angular', desc: 'Modernise the towers app', done: false, ageHrs: 0 },
{ tag: 'rust', desc: 'Port the sync layer to Tauri', done: false, ageHrs: 1 },
{
tag: 'angular',
desc: 'Modernise the towers app',
done: false,
difficulty: 3,
ageHrs: 0,
},
{
tag: 'rust',
desc: 'Port the sync layer to Tauri',
done: false,
difficulty: 5,
ageHrs: 1,
},
...this.makeExampleDoneBlocks(
[
{ tag: 'angular', desc: (n) => `Refined UI pass ${n}` },
@ -620,8 +641,8 @@ export class StoreService implements OnDestroy {
),
]),
this.makeExampleTower('Exercise', { h: 0.36, s: 0.6, l: 0.5 }, now, [
{ tag: 'run', desc: '10k Sunday', done: false, ageHrs: 0 },
{ tag: 'climb', desc: 'Lead 6a outdoors', done: false, ageHrs: 4 },
{ tag: 'run', desc: '10k Sunday', done: false, difficulty: 2, ageHrs: 0 },
{ tag: 'climb', desc: 'Lead 6a outdoors', done: false, difficulty: 4, ageHrs: 4 },
...this.makeExampleDoneBlocks(
[
{ tag: 'run', desc: (n) => `Easy run ${n}` },
@ -640,6 +661,7 @@ export class StoreService implements OnDestroy {
this.analytics.trackStart();
this.analytics.trackExampleLoaded();
this.scheduleSave();
return page.id;
}
private makeExampleTower(
@ -657,6 +679,7 @@ export class StoreService implements OnDestroy {
tag: b.tag,
description: b.desc,
is_done: b.done,
difficulty: b.difficulty ?? 1,
created_at: nowSec - Math.floor(b.ageHrs * 3600),
})),
};
@ -674,6 +697,7 @@ export class StoreService implements OnDestroy {
tag: pattern.tag,
desc: pattern.desc(sequence),
done: true,
difficulty: 1 + ((i + (i % patterns.length) * 2) % 5),
ageHrs: newestAgeHrs + (EXAMPLE_DONE_BLOCKS_PER_TOWER - 1 - i) * spacingHrs,
};
});