From af424313b9864ebbdd598b9a3d3516b774003cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20And=C4=9Bl?= Date: Fri, 13 Nov 2026 09:13:26 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20export=20=C4=8D=C3=A1ste=C4=8Dn=C3=BDch?= =?UTF-8?q?=20recept=C5=AF=20omezen=20jen=20na=20chyb=C4=9Bj=C3=ADc=C3=AD?= =?UTF-8?q?=20fix:=20zm=C4=9Bna=20fontu=20pro=20=C4=8Deskou=20=C4=8D=C3=A1?= =?UTF-8?q?st=20hell=20girl=20feat:=20export=20recept=C5=AF=20grupov=C3=A1?= =?UTF-8?q?n=20dle=20typu=20feat:=20p=C5=99id=C3=A1ny=20filtery=20j=C3=ADd?= =?UTF-8?q?el?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CLAUDE.md | 12 ++- client/index.html | 2 +- client/src/App.scss | 15 ++++ client/src/components/RecipeExportButton.tsx | 13 +-- client/src/components/WheelConfetti.scss | 6 +- client/src/enums.ts | 27 ++++++ client/src/pages/IntakeStatsPanel.tsx | 4 +- client/src/pages/MealGroupsPage.scss | 8 +- client/src/pages/MealGroupsPage.tsx | 90 ++++++++++++++++---- client/src/recipePdf.ts | 63 ++++++++++++-- client/src/themes/hellgirl.scss | 4 +- 11 files changed, 201 insertions(+), 43 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a64dcdc..f7e7583 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -75,7 +75,8 @@ cd client && yarn build # tsc --noEmit + vite build → client/dist ### Client (client/src/) - **Entry:** `index.tsx` → `AppRoutes.tsx`; `Login.tsx` je přihlašovací obrazovka - **Pages:** `pages/` — `DayPage` (přehled dne se záložkami Příjem/Výdej), - `MealGroupsPage` (`/jidla` — seznam jídel podle názvu a zdroje s filtrem zdroje, + `MealGroupsPage` (`/jidla` — seznam jídel podle názvu a zdroje s filtry zdroje, + receptu, typu receptu a chybějících údajů (`MissingFilter`), hromadným doplněním údajů a přejmenováním), `WorkoutsPage` (`/treninky` — plány a šablony tréninků), `ProfilePage` (Profil — ukazatele, vývoj hmotnosti, tělesné údaje, cíle a klidový výdej), @@ -420,12 +421,15 @@ Markdownu v jedné cestě, je potřeba upravit i druhou.** exportu) jde u jednoho receptu (ikona na kartě receptu) i hromadně tlačítkem na stránce Jídla (`RecipeExportButton`) — exportují se recepty, které seznam po filtrech ukazuje, bez filtru všechny. Hlavní tlačítko bere jen úplné recepty, -nabídka u něj i neúplné. Víc receptů dostane titulní stranu s klikacím obsahem, každý -recept začíná na nové stránce. PDF nese suroviny, hodnoty porce, postup a fotky +nabídka u něj jen recepty bez surovin (k doplnění). Víc receptů dostane titulní +stranu s klikacím obsahem a seskupí se podle typu (`createSections` — typy podle +abecedy, bez typu na konec, uvnitř oddílu podle názvu); každý oddíl má úvodní +stránku s názvem a počtem receptů, každý recept začíná na nové stránce. PDF nese suroviny, hodnoty porce, postup a fotky jídla (první přes šířku, ostatní menší); pdfmake umí jen JPEG a PNG, jiné formáty se vynechají. Server se exportu neúčastní. -**PDF k doplnění** (volba v nabídce exportu, neúplný recept ho dostane vždy): +**PDF k doplnění** (volba v nabídce exportu jen pro recepty bez surovin; pole +dostane i neúplný recept v jakémkoli jiném exportu): každý recept má vyplnitelná pole pro čas přípravy, počet porcí a hmotnost hotového jídla, předvyplněná tím, co recept už má, aby šla i opravit. Suroviny a postup jsou pole (jedno volné textové) jen tam, kde chybí; chybu v hotových diff --git a/client/index.html b/client/index.html index ed985c6..aa7f706 100644 --- a/client/index.html +++ b/client/index.html @@ -8,7 +8,7 @@ Food Tracer - + diff --git a/client/src/App.scss b/client/src/App.scss index f34a4a2..0323ad7 100644 --- a/client/src/App.scss +++ b/client/src/App.scss @@ -387,6 +387,21 @@ body { } } +// Bez vlastního stylu by zůstala bootstrapová modrá, která nesedí k žádnému vzhledu +.btn-outline-primary { + --bs-btn-color: var(--ft-primary); + --bs-btn-border-color: var(--ft-primary); + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: var(--ft-primary); + --bs-btn-hover-border-color: var(--ft-primary); + --bs-btn-active-color: #fff; + --bs-btn-active-bg: var(--ft-primary-hover); + --bs-btn-active-border-color: var(--ft-primary-hover); + --bs-btn-disabled-color: var(--ft-primary); + --bs-btn-disabled-border-color: var(--ft-primary); + --bs-btn-focus-shadow-rgb: 128, 128, 128; +} + .btn-outline-secondary { color: var(--ft-text-secondary); border-color: var(--ft-border); diff --git a/client/src/components/RecipeExportButton.tsx b/client/src/components/RecipeExportButton.tsx index dad2168..7d30b12 100644 --- a/client/src/components/RecipeExportButton.tsx +++ b/client/src/components/RecipeExportButton.tsx @@ -16,12 +16,13 @@ type Props = { /** * Hromadný export receptů do PDF. Hlavní tlačítko stáhne jen úplné recepty - * (se surovinami i postupem); v nabídce je export všech včetně neúplných - * s poli k doplnění a opravě — PDF se pošle někomu, kdo recepty zná. + * (se surovinami i postupem); v nabídce je export receptů bez surovin s poli + * k doplnění — PDF se pošle někomu, kdo recepty zná. */ const RecipeExportButton = ({ itemList, filtered, loading }: Readonly) => { const { exporting, exportRecipes } = useRecipeExport(); const completeList = itemList.filter(item => isRecipeComplete(item.recipe)); + const emptyList = itemList.filter(item => !item.recipe.ingredients.length); const scope = filtered ? 'zobrazené' : 'všechny'; return ( @@ -35,11 +36,11 @@ const RecipeExportButton = ({ itemList, filtered, loading }: Readonly) => {exporting ? : } {' '}Recepty do PDF{!loading && ` (${completeList.length})`} - + - exportRecipes(itemList, true)}> - K doplnění, včetně neúplných ({itemList.length}) -
čas, porce, hmotnost, chybějící suroviny a postup i poznámky jde dopsat přímo v PDF
+ exportRecipes(emptyList, true)}> + K doplnění, recepty bez surovin ({emptyList.length}) +
suroviny, postup, čas, porce, hmotnost i poznámky jde dopsat přímo v PDF
diff --git a/client/src/components/WheelConfetti.scss b/client/src/components/WheelConfetti.scss index daf95ae..e6d234f 100644 --- a/client/src/components/WheelConfetti.scss +++ b/client/src/components/WheelConfetti.scss @@ -48,7 +48,7 @@ outline: 1px solid rgb(200 16 46 / 0.4); outline-offset: 2px; color: #fff4ee; - font-family: 'Shippori Mincho', 'Noto Serif JP', serif; + font-family: 'Noto Serif', 'Shippori Mincho', 'Noto Serif JP', serif; font-weight: 800; font-size: 1.1rem; letter-spacing: 1px; @@ -63,7 +63,7 @@ left: 50%; transform: translate(-50%, -50%); padding: 14px 48px; - font-family: 'Shippori Mincho', 'Noto Serif JP', serif; + font-family: 'Noto Serif', 'Shippori Mincho', 'Noto Serif JP', serif; font-weight: 800; font-size: clamp(2rem, 7vw, 4rem); letter-spacing: 0.3em; @@ -118,7 +118,7 @@ border: 1px solid var(--speaker, #c8102e); border-radius: 3px; box-shadow: 0 0 16px rgb(0 0 0 / 0.6), 0 0 10px rgb(200 16 46 / 0.3); - font-family: 'Shippori Mincho', 'Noto Serif JP', serif; + font-family: 'Noto Serif', 'Shippori Mincho', 'Noto Serif JP', serif; p { margin: 0; diff --git a/client/src/enums.ts b/client/src/enums.ts index 900ec27..f3e9f08 100644 --- a/client/src/enums.ts +++ b/client/src/enums.ts @@ -214,6 +214,33 @@ export const RECIPE_FILTER_NAMES: Record = { BEZ_RECEPTU: 'Bez receptu', }; +/** + * Filtr seznamu jídel podle chybějících údajů. Živiny chybí skoro všude (recept + * je nemá nikdy), proto jde hledat i jen chybějící gramáž nebo kalorie. + */ +export enum MissingFilter { + VSE = 'VSE', + COKOLI = 'COKOLI', + GRAMAZ_NEBO_KALORIE = 'GRAMAZ_NEBO_KALORIE', + GRAMAZ = 'GRAMAZ', + KALORIE = 'KALORIE', + ZIVINY = 'ZIVINY', +} + +export const MISSING_FILTER_NAMES: Record = { + VSE: 'Doplněná i nedoplněná', + COKOLI: 'Chybí cokoli', + GRAMAZ_NEBO_KALORIE: 'Chybí gramáž nebo kalorie', + GRAMAZ: 'Chybí gramáž', + KALORIE: 'Chybí kalorie', + ZIVINY: 'Chybí živiny', +}; + +/** Zvláštní volba filtru typu receptu; jinak se filtruje konkrétním typem. */ +export enum RecipeCategoryFilter { + VSE = 'VSE', +} + /** Popisky chuti receptu. */ export const RECIPE_FLAVOR_NAMES: Record = { SLANE: 'Slané', diff --git a/client/src/pages/IntakeStatsPanel.tsx b/client/src/pages/IntakeStatsPanel.tsx index bc9058f..a31b933 100644 --- a/client/src/pages/IntakeStatsPanel.tsx +++ b/client/src/pages/IntakeStatsPanel.tsx @@ -9,7 +9,7 @@ import { Bar, CartesianGrid, Cell, ComposedChart, Legend, Line, Pie, PieChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts"; import { IntakeStats, MealType, getIntakeStats } from "../../../types"; -import { MEAL_TYPE_NAMES, NUTRIENT_NAMES, NUTRIENTS_IN_ORDER, StatsRange } from "../enums"; +import { MEAL_TYPE_NAMES, MissingFilter, NUTRIENT_NAMES, NUTRIENTS_IN_ORDER, StatsRange } from "../enums"; import { formatBalance, formatCalories, formatNutrient } from "../Utils"; import { JIDLA_URL } from "../routes"; import { StatsBounds, TOOLTIP_STYLE, buildSourceSlices } from "./statsShared"; @@ -130,7 +130,7 @@ const IntakeStatsPanel = ({ range, mode, reloadKey }: Readonly) => { {stats.missingCaloriesCount} z {stats.entryCount} jídel nemá kalorie, do součtů nevstupují a příjem tak vychází nižší, než byl. - diff --git a/client/src/pages/MealGroupsPage.scss b/client/src/pages/MealGroupsPage.scss index 0bd4a12..ddb1707 100644 --- a/client/src/pages/MealGroupsPage.scss +++ b/client/src/pages/MealGroupsPage.scss @@ -15,9 +15,11 @@ flex: 0 1 200px; } - .form-check { - margin: 0; - white-space: nowrap; + // Popisky volby jsou delší, pole bere šířku podle nejdelší z nich + .meal-groups-category, + .meal-groups-missing { + flex: 0 0 auto; + width: auto; } .meal-groups-count { diff --git a/client/src/pages/MealGroupsPage.tsx b/client/src/pages/MealGroupsPage.tsx index 6517ff8..c69ef4a 100644 --- a/client/src/pages/MealGroupsPage.tsx +++ b/client/src/pages/MealGroupsPage.tsx @@ -4,7 +4,9 @@ import { useLocation } from "react-router"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faBookOpen, faCircleCheck } from "@fortawesome/free-solid-svg-icons"; import { MealGroup, MealTemplate, getMealGroups } from "../../../types"; -import { MealGroupAction, RECIPE_FILTER_NAMES, RecipeFilter, SourceFilter } from "../enums"; +import { + MISSING_FILTER_NAMES, MealGroupAction, MissingFilter, RECIPE_FILTER_NAMES, RecipeCategoryFilter, RecipeFilter, SourceFilter, +} from "../enums"; import { getMealKey, normalizeSearch } from "../Utils"; import MealGroupRow from "../components/MealGroupRow"; import MealTemplateForm from "../components/MealTemplateForm"; @@ -12,8 +14,22 @@ import RecipeExportButton from "../components/RecipeExportButton"; import "./templates.scss"; import "./MealGroupsPage.scss"; -const isIncomplete = (group: MealGroup): boolean => - group.missingCaloriesCount + group.missingWeightCount + group.missingNutrientsCount > 0; +const matchesMissing = (group: MealGroup, missingFilter: MissingFilter): boolean => { + switch (missingFilter) { + case MissingFilter.VSE: + return true; + case MissingFilter.COKOLI: + return group.missingCaloriesCount + group.missingWeightCount + group.missingNutrientsCount > 0; + case MissingFilter.GRAMAZ_NEBO_KALORIE: + return group.missingCaloriesCount + group.missingWeightCount > 0; + case MissingFilter.GRAMAZ: + return group.missingWeightCount > 0; + case MissingFilter.KALORIE: + return group.missingCaloriesCount > 0; + case MissingFilter.ZIVINY: + return group.missingNutrientsCount > 0; + } +}; /** Hodnota výběru pro konkrétní zdroj; předpona ji odliší od zvláštních voleb filtru. */ const toSourceOption = (source: string): string => `zdroj:${normalizeSearch(source)}`; @@ -35,6 +51,27 @@ const listSources = (groupList: MealGroup[]): { value: string, label: string }[] .map(([value, item]) => ({ value, label: item.label })); }; +/** Hodnota výběru pro konkrétní typ receptu; předpona ji odliší od zvláštní volby filtru. */ +const toCategoryOption = (category: string): string => `typ:${normalizeSearch(category)}`; + +/** Typy receptů pro filtr, každý jednou, podle abecedy. */ +const listCategories = (recipeList: MealTemplate[]): { value: string, label: string }[] => { + const labelMap = new Map(); + for (const recipe of recipeList) { + const category = recipe.category?.trim(); + if (category && !labelMap.has(toCategoryOption(category))) labelMap.set(toCategoryOption(category), category); + } + return [...labelMap.entries()] + .map(([value, label]) => ({ value, label })) + .sort((a, b) => a.label.localeCompare(b.label, 'cs')); +}; + +const matchesCategory = (group: MealGroup, categoryFilter: string): boolean => { + if (categoryFilter === RecipeCategoryFilter.VSE) return true; + const category = group.recipe?.category?.trim(); + return !!category && toCategoryOption(category) === categoryFilter; +}; + const matchesRecipe = (group: MealGroup, recipeFilter: RecipeFilter): boolean => { if (recipeFilter === RecipeFilter.S_RECEPTEM) return !!group.recipe; if (recipeFilter === RecipeFilter.BEZ_RECEPTU) return !group.recipe; @@ -47,7 +84,7 @@ const matchesSearch = (group: MealGroup, search: string): boolean => || (!!group.recipe?.category && normalizeSearch(group.recipe.category).includes(search)); /** Stav, se kterým stránku může otevřít odkaz odjinud (statistiky, výběr z historie). */ -type LocationState = { onlyIncomplete?: boolean, recipeFilter?: RecipeFilter } | null; +type LocationState = { missingFilter?: MissingFilter, recipeFilter?: RecipeFilter } | null; const matchesSource = (group: MealGroup, sourceFilter: string): boolean => { if (sourceFilter === SourceFilter.VSE) return true; @@ -69,7 +106,9 @@ const MealGroupsPage = () => { const [loading, setLoading] = useState(true); const [query, setQuery] = useState(''); const [sourceFilter, setSourceFilter] = useState(SourceFilter.VSE); - const [onlyIncomplete, setOnlyIncomplete] = useState(() => !!(location.state as LocationState)?.onlyIncomplete); + const [missingFilter, setMissingFilter] = useState(() => + (location.state as LocationState)?.missingFilter ?? MissingFilter.VSE); + const [categoryFilter, setCategoryFilter] = useState(RecipeCategoryFilter.VSE); const [recipeFilter, setRecipeFilter] = useState(() => (location.state as LocationState)?.recipeFilter ?? RecipeFilter.VSE); const [opened, setOpened] = useState<{ key: string, action: MealGroupAction } | undefined>(); @@ -89,15 +128,17 @@ const MealGroupsPage = () => { () => groupList.flatMap(group => group.recipe ? [group.recipe] : []), [groupList], ); + const categoryList = useMemo(() => listCategories(recipeList), [recipeList]); const visibleList = useMemo(() => { const search = normalizeSearch(query); return groupList.filter(group => - (!onlyIncomplete || isIncomplete(group)) + matchesMissing(group, missingFilter) && matchesSource(group, sourceFilter) && matchesRecipe(group, recipeFilter) + && matchesCategory(group, categoryFilter) && (!search.length || matchesSearch(group, search))); - }, [groupList, query, sourceFilter, recipeFilter, onlyIncomplete]); + }, [groupList, query, sourceFilter, recipeFilter, categoryFilter, missingFilter]); // Exportují se recepty, které seznam právě ukazuje — bez filtru tedy všechny const visibleRecipeList = useMemo(() => visibleList @@ -119,13 +160,18 @@ const MealGroupsPage = () => { setQuery(''); setSourceFilter(SourceFilter.VSE); setRecipeFilter(RecipeFilter.VSE); - setOnlyIncomplete(false); + setCategoryFilter(RecipeCategoryFilter.VSE); + setMissingFilter(MissingFilter.VSE); } setOpened({ key, action: MealGroupAction.RECEPT }); setScrollKey(key); }; - const filtered = !!query.trim().length || sourceFilter !== SourceFilter.VSE || recipeFilter !== RecipeFilter.VSE; + const otherFiltered = !!query.trim().length + || sourceFilter !== SourceFilter.VSE + || recipeFilter !== RecipeFilter.VSE + || categoryFilter !== RecipeCategoryFilter.VSE; + const filtered = otherFiltered || missingFilter !== MissingFilter.VSE; return ( <> @@ -175,13 +221,23 @@ const MealGroupsPage = () => { ))} - setOnlyIncomplete(event.target.checked)} - /> + setCategoryFilter(event.target.value)} + > + + {categoryList.map(category => )} + + setMissingFilter(event.target.value as MissingFilter)} + > + {Object.values(MissingFilter).map(value => ( + + ))} + {!loading && ( Zobrazeno {visibleList.length === groupList.length @@ -201,7 +257,7 @@ const MealGroupsPage = () => {
- {onlyIncomplete && !filtered ? 'Všechna jídla mají údaje vyplněné' : 'Nic nenalezeno'} + {missingFilter !== MissingFilter.VSE && !otherFiltered ? 'Všechna jídla mají údaje vyplněné' : 'Nic nenalezeno'}
)} diff --git a/client/src/recipePdf.ts b/client/src/recipePdf.ts index ce669b1..4741181 100644 --- a/client/src/recipePdf.ts +++ b/client/src/recipePdf.ts @@ -11,6 +11,9 @@ import { /** Recept s počtem fotek jídla — fotky se stahují jen tam, kde nějaké jsou. */ type RecipeItem = Pick & { recipe: MealTemplate }; +/** Recepty jednoho typu (polévky, omáčky…) v pořadí, v jakém jdou do PDF. */ +type RecipeSection = { title: string, itemList: RecipeItem[] }; + const PRIMARY_COLOR = '#156080'; const MUTED_COLOR = '#6b7280'; const BORDER_COLOR = '#e5e7eb'; @@ -29,6 +32,11 @@ const INGREDIENTS_FIELD_HEIGHT = 150; const NOTE_FIELD_HEIGHT = 230; const REMARKS_FIELD_HEIGHT = 90; +/** Název oddílu pro recepty bez typu. */ +const NO_CATEGORY_TITLE = 'Bez typu'; +/** Odsazení názvu oddílu od horního okraje, aby stál zhruba ve třetině stránky. */ +const SECTION_TOP_MARGIN = 220; + /** Předpony `id` uzlů, podle kterých se v rozvržení pdfmake najdou pole a jejich popisky. */ const FIELD_ID_PREFIX = 'pole:'; const LABEL_ID_PREFIX = 'popisek:'; @@ -56,6 +64,42 @@ const getRecipeMeta = (recipe: MealTemplate, editable: boolean): string => { ].filter(item => !!item).join(' · '); }; +/** + * Rozdělí recepty do oddílů podle typu — typy podle abecedy, recepty bez typu + * na konec, uvnitř oddílu podle názvu. Typ je volný text, „Polévka" a „polévka" + * jsou tentýž oddíl pojmenovaný podle prvního výskytu. + */ +const createSections = (itemList: RecipeItem[]): RecipeSection[] => { + const sectionMap = new Map(); + for (const item of itemList) { + const category = item.recipe.category?.trim(); + const key = category?.toLocaleLowerCase('cs') ?? ''; + const section = sectionMap.get(key) ?? { title: category || NO_CATEGORY_TITLE, itemList: [] }; + section.itemList.push(item); + sectionMap.set(key, section); + } + return [...sectionMap.entries()] + .sort(([a], [b]) => { + if (!a) return 1; + if (!b) return -1; + return a.localeCompare(b, 'cs'); + }) + .map(([, section]) => ({ + title: section.title, + itemList: [...section.itemList].sort((a, b) => a.recipe.name.localeCompare(b.recipe.name, 'cs')), + })); +}; + +/** Úvodní stránka oddílu s jeho názvem a počtem receptů; v obsahu je tučně nad recepty oddílu. */ +const createSectionPage = (section: RecipeSection): Content => ({ + stack: [ + { text: section.title, style: 'coverTitle', tocItem: true, tocStyle: { bold: true }, tocMargin: [0, 6, 0, 2] }, + { text: formatCount(section.itemList.length, 'recept', 'recepty', 'receptů'), style: 'recipeMeta' }, + ], + margin: [0, SECTION_TOP_MARGIN, 0, 0], + pageBreak: 'before', +}); + /** Kotva receptu v dokumentu — cíl odkazů z obsahu a z vazeb mezi recepty. */ const getRecipeAnchor = (index: number): string => `recept-${index}`; @@ -200,7 +244,7 @@ const createRecipe = ( ): Content => { const fields = editable || !isRecipeComplete(recipe) ? createEditableFields(recipe, index, fieldList) : undefined; const header: Content[] = [ - { text: recipe.name, style: 'recipeTitle', id: getRecipeAnchor(index), tocItem: withToc }, + { text: recipe.name, style: 'recipeTitle', id: getRecipeAnchor(index), tocItem: withToc, tocMargin: [12, 2, 0, 2] }, ...(recipe.source ? [{ text: recipe.source, style: 'recipeSource' }] : []), { text: getRecipeMeta(recipe, !!fields), style: 'recipeMeta' }, ...(fields @@ -271,15 +315,17 @@ const loadPdfMake = async () => { /** * Stáhne recepty jako PDF — suroviny, hodnoty porce, postup a fotky jídla. - * Víc receptů dostane titulní stránku s klikacím obsahem a každý recept - * začíná na nové stránce. + * Víc receptů dostane titulní stránku s klikacím obsahem, recepty jsou + * seskupené podle typu (`createSections`), každý oddíl má úvodní stránku + * a každý recept začíná na nové stránce. * * S `editable` dostane každý recept vyplnitelná pole PDF k doplnění a opravě * (`createEditableFields`); neúplný recept (bez surovin nebo postupu) je * dostane vždy. */ export const exportRecipesPdf = async (itemList: RecipeItem[], editable = false): Promise => { - const sortedList = [...itemList].sort((a, b) => a.recipe.name.localeCompare(b.recipe.name, 'cs')); + const sectionList = createSections(itemList); + const sortedList = sectionList.flatMap(section => section.itemList); const [{ pdfMake, vfs }, photoLists, recipeResponse] = await Promise.all([ loadPdfMake(), Promise.all(sortedList.map(loadPhotos)), @@ -306,8 +352,13 @@ export const exportRecipesPdf = async (itemList: RecipeItem[], editable = false) ] : []; // Sestavením obsahu se naplní i fieldList, proto musí proběhnout před definicí - const recipeContent = sortedList.map((item, index) => - createRecipe(item.recipe, photoLists[index], { index, withToc, recipeList, indexMap, fieldList, editable })); + const recipeContent = sortedList.flatMap((item, index) => { + const section = withToc ? sectionList.find(candidate => candidate.itemList[0] === item) : undefined; + return [ + ...(section ? [createSectionPage(section)] : []), + createRecipe(item.recipe, photoLists[index], { index, withToc, recipeList, indexMap, fieldList, editable }), + ]; + }); const definition: TDocumentDefinitions = { info: { title }, diff --git a/client/src/themes/hellgirl.scss b/client/src/themes/hellgirl.scss index 0821dc5..270c78b 100644 --- a/client/src/themes/hellgirl.scss +++ b/client/src/themes/hellgirl.scss @@ -14,7 +14,9 @@ $hg-twilight: linear-gradient(90deg, #1e0a1c, #4a0f2a 35%, #8e0f24 70%, #c8452a) $hg-thread: linear-gradient(90deg, transparent, #c8102e 12%, #e8344f 50%, #c8102e 88%, transparent); #{$hg} { - --hg-font: 'Shippori Mincho', 'Noto Serif JP', 'Georgia', serif; + // Latinku i s českou diakritikou kreslí Noto Serif, Shippori Mincho jen japonské + // znaky — v jeho latince ř, ž, č, ě… chybí a prohlížeč by je bral z jiného písma + --hg-font: 'Noto Serif', 'Shippori Mincho', 'Noto Serif JP', 'Georgia', serif; --hg-crimson: #a3122a; --hg-crimson-deep: #7a0c1f; --hg-crimson-shadow: #4a0612;