feat: export + detail receptů

feat: losování jídel
This commit is contained in:
Ondřej Anděl committed 2026-10-16 12:55:32 +02:00
1 parent 35cbc5a9ca
commit caffb6d8b4
23 files changed
+2674 -43

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { useState } from "react";
import { toast } from "react-toastify";
import { exportRecipesPdf } from "./recipePdf";
/** Export receptů do PDF s příznakem probíhajícího exportu a hláškou při chybě. */
export const useRecipeExport = () => {
const [exporting, setExporting] = useState(false);
const exportRecipes = async (itemList: Parameters<typeof exportRecipesPdf>[0]) => {
if (exporting || !itemList.length) return;
setExporting(true);
try {
await exportRecipesPdf(itemList);
} catch (error) {
console.error('Export receptů do PDF selhal', error);
toast.error('PDF se nepodařilo vytvořit.');
} finally {
setExporting(false);
}
};
return { exporting, exportRecipes };
};