From 55dfa9c3535e2441937f49220a5ebf38c18ccad5 Mon Sep 17 00:00:00 2001 From: lashman Date: Sat, 20 Dec 2025 01:59:16 +0200 Subject: [PATCH] daily presets --- frontend/src/presets.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 frontend/src/presets.ts diff --git a/frontend/src/presets.ts b/frontend/src/presets.ts new file mode 100644 index 0000000..ca6bbe4 --- /dev/null +++ b/frontend/src/presets.ts @@ -0,0 +1,23 @@ +import { IconFeatherFilled, IconDiamondFilled, IconCompassFilled, IconFlameFilled, IconMeteorFilled } from '@tabler/icons-react' + +export const PRESETS = [ + { id: 'glyph', name: 'Glyph', desc: '5x5', tag: 'very easy', speedrunSecs: 45, icon: IconFeatherFilled }, + { id: 'rune', name: 'Rune', desc: '5x5', tag: 'easy', speedrunSecs: 60, icon: IconDiamondFilled }, + { id: 'scroll', name: 'Scroll', desc: '9x9', tag: 'medium', speedrunSecs: 300, icon: IconCompassFilled }, + { id: 'codex', name: 'Codex', desc: '15x15', tag: 'hard', speedrunSecs: 1200, icon: IconFlameFilled }, + { id: 'grimoire', name: 'Grimoire', desc: '21x21', tag: 'expert', speedrunSecs: 2700, icon: IconMeteorFilled }, +] as const + +export const SPEEDRUN_LIMITS: Record = Object.fromEntries( + PRESETS.map(p => [p.id, p.speedrunSecs]) +) + +export function formatSpeedrunTime(secs: number): string { + if (secs < 60) return `${secs}s` + return `${Math.floor(secs / 60)} min` +} + +export function speedrunDescription(): string { + return 'Countdown timer, no hints, no pausing. Beat the clock or lose. Time limits: ' + + PRESETS.map(p => `${p.name} ${formatSpeedrunTime(p.speedrunSecs)}`).join(', ') + '.' +}