refactor: decompose frontend state and medication dialog flows

This commit is contained in:
Daniel Volz
2026-03-27 06:50:19 +01:00
committed by GitHub
parent b58c4fe5bb
commit f46043970f
28 changed files with 2450 additions and 1613 deletions
@@ -0,0 +1,41 @@
import { useAppContext } from "../context";
export function useScheduleController() {
const ctx = useAppContext();
return {
meds: ctx.meds,
loading: ctx.loading,
settings: ctx.settings,
settingsLoading: ctx.settingsLoading,
coverage: ctx.coverage,
coverageByMed: ctx.coverageByMed,
depletionByMed: ctx.depletionByMed,
stockThresholds: ctx.stockThresholds,
scheduleDays: ctx.scheduleDays,
setScheduleDays: ctx.setScheduleDays,
showPastDays: ctx.showPastDays,
setShowPastDays: ctx.setShowPastDays,
showFutureDays: ctx.showFutureDays,
setShowFutureDays: ctx.setShowFutureDays,
pastDays: ctx.pastDays,
todayDay: ctx.todayDay,
futureDays: ctx.futureDays,
takenDoses: ctx.takenDoses,
dismissedDoses: ctx.dismissedDoses,
markDoseTaken: ctx.markDoseTaken,
undoDoseTaken: ctx.undoDoseTaken,
manuallyCollapsedDays: ctx.manuallyCollapsedDays,
manuallyExpandedDays: ctx.manuallyExpandedDays,
toggleDayCollapse: ctx.toggleDayCollapse,
missedPastDoseIds: ctx.missedPastDoseIds,
getDayStockStatus: ctx.getDayStockStatus,
getDoseId: ctx.getDoseId,
isDoseTakenAutomatically: ctx.isDoseTakenAutomatically,
openMedDetail: ctx.openMedDetail,
openUserFilter: ctx.openUserFilter,
openScheduleLightbox: ctx.openScheduleLightbox,
loadMeds: ctx.loadMeds,
loadSettings: ctx.loadSettings,
};
}