Files
headroom/frontend/src/lib/stores/expertMode.ts
Santhosh Janardhanan 3324c4f156 feat(allocation): implement resource allocation feature
- Add AllocationController with CRUD + bulk endpoints
- Add AllocationValidationService for capacity/estimate validation
- Add AllocationMatrixService for optimized matrix queries
- Add AllocationPolicy for authorization
- Add AllocationResource for API responses
- Add frontend allocationService and matrix UI
- Add E2E tests for allocation matrix (20 tests)
- Add unit tests for validation service and policies
- Fix month format conversion (YYYY-MM to YYYY-MM-01)
2026-02-25 16:28:47 -05:00

33 lines
840 B
TypeScript

import { writable } from 'svelte/store';
const EXPERT_MODE_KEY = 'headroom.capacity.expertMode';
function getInitialExpertMode(): boolean {
if (typeof localStorage === 'undefined') return false;
const stored = localStorage.getItem(EXPERT_MODE_KEY);
if (stored === 'true') return true;
if (stored === 'false') return false;
return false;
}
const expertModeWritable = writable<boolean>(getInitialExpertMode());
if (typeof localStorage !== 'undefined') {
expertModeWritable.subscribe((value) => {
localStorage.setItem(EXPERT_MODE_KEY, String(value));
});
}
export const expertMode = {
subscribe: expertModeWritable.subscribe,
};
export function setExpertMode(value: boolean): void {
expertModeWritable.set(value);
}
export function toggleExpertMode(): void {
expertModeWritable.update((current) => !current);
}