refactor: decompose frontend state and medication dialog flows
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user