chore: initial commit of HouseholdBudgetBook (backend, frontend, desktop)
This commit is contained in:
commit
4a5db3f1f9
167 files changed
+21732
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import { createContext, type Dispatch } from 'react'
|
||||
|
||||
export interface AppState {
|
||||
selectedYear: string
|
||||
selectedMonth: string
|
||||
}
|
||||
|
||||
export type AppAction =
|
||||
| { type: 'SET_YEAR'; year: string }
|
||||
| { type: 'SET_MONTH'; month: string }
|
||||
|
||||
export const initialState: AppState = (() => {
|
||||
const now = new Date()
|
||||
return {
|
||||
selectedYear: now.getFullYear().toString(),
|
||||
selectedMonth: (now.getMonth() + 1).toString().padStart(2, '0'),
|
||||
}
|
||||
})()
|
||||
|
||||
export const AppCtx = createContext<{
|
||||
state: AppState
|
||||
dispatch: Dispatch<AppAction>
|
||||
}>({ state: initialState, dispatch: () => {} })
|
||||
Reference in new issue
Block a user