Files
Momento/memento-note/lib/quota-utils.ts
Antigravity bd495be965
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 12s
feat: design system overhaul — sidebar, AI chats, settings, brainstorm, color cleanup
- Sidebar: dynamic brand-accent colors, brainstorm section restyled
- AI chat general: popup panel with expand/collapse, hides when contextual AI open
- AI chat contextual: tabs reordered (Actions first), X close button, height fix
- Settings: all tabs restyled, 6 new color presets (sage, terracotta, iron, etc.)
- Global color cleanup: emerald/orange hardcoded → brand-accent dynamic
- Brainstorm page: orange → brand-accent throughout
- PageEntry animation component added to key pages
- Floating AI button: bg-brand-accent instead of hardcoded black
- i18n: all 15 locales updated with new AI/billing keys
- Billing: freemium quota tracking, BYOK, stripe subscription scaffolding
- Admin: integrated into new design
- AGENTS.md + CLAUDE.md project rules added
2026-05-16 12:59:30 +00:00

32 lines
848 B
TypeScript

export const VALID_FEATURES = [
'semantic_search',
'auto_tag',
'auto_title',
'reformulate',
'chat',
'brainstorm_create',
'brainstorm_expand',
'brainstorm_enrich',
] as const;
export type FeatureName = (typeof VALID_FEATURES)[number];
export function getCurrentPeriodKey(): string {
return new Date().toISOString().slice(0, 7);
}
export function getRedisKey(userId: string, feature: string): string {
const period = getCurrentPeriodKey();
return `usage:${userId}:${feature}:${period}`;
}
export function parseRedisInt(value: string | number | null | undefined): number {
if (value == null) return 0;
const n = Number(value);
return Number.isFinite(n) ? Math.round(n) : 1;
}
export function isValidFeature(feature: string): feature is FeatureName {
return (VALID_FEATURES as readonly string[]).includes(feature);
}