refactor: enhance routing and state management in CoopBuilder, add migration checks on startup, and update Tailwind configuration for improved component styling

This commit is contained in:
Jennie Robinson Faber 2025-08-23 18:24:31 +01:00
parent 848386e3dd
commit 4cea1f71fe
55 changed files with 4053 additions and 1486 deletions

View file

@ -33,10 +33,13 @@ export function useFixtureIO() {
payrollOncostPct: policies.payrollOncostPct,
savingsTargetMonths: policies.savingsTargetMonths,
minCashCushionAmount: policies.minCashCushionAmount,
operatingMode: policies.operatingMode,
payPolicy: policies.payPolicy,
deferredCapHoursPerQtr: policies.deferredCapHoursPerQtr,
deferredSunsetMonths: policies.deferredSunsetMonths,
surplusOrder: policies.surplusOrder,
paymentPriority: policies.paymentPriority
paymentPriority: policies.paymentPriority,
volunteerScope: policies.volunteerScope
},
streams: streams.streams,
budget: {
@ -66,9 +69,65 @@ export function useFixtureIO() {
}
const importAll = (snapshot: AppSnapshot) => {
// TODO: Implement import functionality for all stores
// This will patch each store with the snapshot data
console.log('Import functionality to be implemented', snapshot)
const members = useMembersStore()
const policies = usePoliciesStore()
const streams = useStreamsStore()
const budget = useBudgetStore()
const scenarios = useScenariosStore()
const cash = useCashStore()
const session = useSessionStore()
try {
// Import members
if (snapshot.members && Array.isArray(snapshot.members)) {
members.$patch({ members: snapshot.members })
}
// Import policies
if (snapshot.policies) {
policies.$patch(snapshot.policies)
}
// Import streams
if (snapshot.streams && Array.isArray(snapshot.streams)) {
streams.$patch({ streams: snapshot.streams })
}
// Import budget
if (snapshot.budget) {
budget.$patch(snapshot.budget)
}
// Import scenarios
if (snapshot.scenarios) {
scenarios.$patch(snapshot.scenarios)
}
// Import cash
if (snapshot.cash) {
cash.updateCurrentBalances(
snapshot.cash.currentCash || 0,
snapshot.cash.currentSavings || 0
)
// Handle cash events and payment queue if present
if (snapshot.cash.cashEvents) {
cash.$patch({ cashEvents: snapshot.cash.cashEvents })
}
if (snapshot.cash.paymentQueue) {
cash.$patch({ paymentQueue: snapshot.cash.paymentQueue })
}
}
// Import session
if (snapshot.session) {
session.$patch(snapshot.session)
}
console.log('Successfully imported data snapshot')
} catch (error) {
console.error('Failed to import snapshot:', error)
throw error
}
}
return { exportAll, importAll }