feat: add shared overview and harden frontend session state (#407)

This commit is contained in:
Daniel Volz
2026-03-10 06:26:03 +01:00
committed by GitHub
parent 733fe2f38a
commit 105eb7bc0d
37 changed files with 3281 additions and 1138 deletions
+18
View File
@@ -36,6 +36,7 @@ export interface UseRefillReturn {
editStockMedication: Medication | null;
// Actions
clearRefillState: () => void;
loadRefillHistory: (medId: number) => Promise<void>;
submitRefill: (
medId: number,
@@ -69,6 +70,22 @@ export function useRefill(): UseRefillReturn {
const [editStockSaving, setEditStockSaving] = useState(false);
const [editStockMedication, setEditStockMedication] = useState<Medication | null>(null);
const clearRefillState = useCallback(() => {
setShowRefillModal(false);
setRefillPacks(1);
setRefillLoose(0);
setUsePrescriptionRefill(false);
setRefillSaving(false);
setRefillHistory([]);
setRefillHistoryExpanded(false);
setShowEditStockModal(false);
setEditStockFullBlisters(0);
setEditStockPartialBlisterPills(0);
setEditStockLoosePills(0);
setEditStockSaving(false);
setEditStockMedication(null);
}, []);
// Load refill history for a medication
const loadRefillHistory = useCallback(async (medId: number) => {
try {
@@ -327,6 +344,7 @@ export function useRefill(): UseRefillReturn {
}, [showEditStockModal]);
return {
clearRefillState,
showRefillModal,
setShowRefillModal,
refillPacks,