feat: use module store

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-02-17 19:11:12 -05:00
parent 6a7b28b86d
commit b663efbb3e
10 changed files with 883 additions and 612 deletions

30
src/types/spans.ts Normal file
View File

@@ -0,0 +1,30 @@
export const DAYS_VIEW_SPANS = ['1d', '3d', '5d', '7d', '9d', '11d', '14d'] as const
export type DaysViewSpan = typeof DAYS_VIEW_SPANS[number]
export const AGENDA_VIEW_SPANS = ['1d', '3d', '1w', '2w', '3w', '1m'] as const
export type AgendaViewSpan = typeof AGENDA_VIEW_SPANS[number]
export const SPAN_TO_DAYS = {
'1d': 1,
'3d': 3,
'5d': 5,
'7d': 7,
'9d': 9,
'11d': 11,
'14d': 14,
'1w': 7,
'2w': 14,
'3w': 21,
'1m': 30,
} as const
export type TimeSpanLabel = keyof typeof SPAN_TO_DAYS
export function spanToDays(span: TimeSpanLabel): number {
return SPAN_TO_DAYS[span]
}
export function dayCountToDaysViewSpan(days: number): DaysViewSpan | null {
const label = `${days}d`
return DAYS_VIEW_SPANS.includes(label as DaysViewSpan) ? (label as DaysViewSpan) : null
}