diff --git a/client/src/components/MealGroupRow.tsx b/client/src/components/MealGroupRow.tsx
index ae788eb..eaa8f65 100644
--- a/client/src/components/MealGroupRow.tsx
+++ b/client/src/components/MealGroupRow.tsx
@@ -67,9 +67,6 @@ const MealGroupRow = ({
{group.recipe.category ?? 'recept'}
)}
- {group.recipe?.flavor === RecipeFlavor.SLADKE && (
- {RECIPE_FLAVOR_NAMES[RecipeFlavor.SLADKE].toLowerCase()}
- )}
{group.missingCaloriesCount > 0 && (
bez kalorií {describeMissing(group.missingCaloriesCount, group.count)}
diff --git a/client/src/recipePdf.ts b/client/src/recipePdf.ts
index f85af6d..b157f4d 100644
--- a/client/src/recipePdf.ts
+++ b/client/src/recipePdf.ts
@@ -10,7 +10,7 @@ import {
/** Recept s počtem fotek jídla — fotky se stahují jen tam, kde nějaké jsou. */
type RecipeItem = Pick & { recipe: MealTemplate };
-const PRIMARY_COLOR = '#15803d';
+const PRIMARY_COLOR = '#156080';
const MUTED_COLOR = '#6b7280';
const BORDER_COLOR = '#e5e7eb';
/** Šířka tisknutelné plochy A4 při okrajích 40 pt. */
@@ -63,25 +63,21 @@ const createLinks = (recipe: MealTemplate, recipeList: MealTemplate[], indexMap:
return [{ text: [{ text: `${RECIPE_LINK_NAMES[kind]}: `, bold: true }, ...nameList], style: 'recipeLinks' }];
});
-/** První fotka přes celou šířku, ostatní menší v řadách po třech. */
+const PHOTO_COLUMN_WIDTH = 220;
const createPhotos = (photoList: MealPhoto[]): Content[] => {
- const [first, ...rest] = photoList;
- if (!first) return [];
- const result: Content[] = [{ image: first.image, fit: [CONTENT_WIDTH, 240], alignment: 'center', margin: [0, 0, 0, PHOTO_GAP] }];
- const smallWidth = (CONTENT_WIDTH - PHOTO_GAP * (SMALL_PHOTOS_PER_ROW - 1)) / SMALL_PHOTOS_PER_ROW;
- for (let start = 0; start < rest.length; start += SMALL_PHOTOS_PER_ROW) {
- const rowList = rest.slice(start, start + SMALL_PHOTOS_PER_ROW);
- result.push({
- columns: [
- ...rowList.map(photo => ({ image: photo.image, fit: [smallWidth, 130] as [number, number], width: smallWidth })),
- // Nedoplněná řada si drží šířku sloupců
- ...Array.from({ length: SMALL_PHOTOS_PER_ROW - rowList.length }, () => ({ text: '', width: smallWidth })),
- ],
- columnGap: PHOTO_GAP,
- margin: [0, 0, 0, PHOTO_GAP],
- });
+ const first = photoList[0];
+
+ if (!first) {
+ return [];
}
- return result;
+
+ return [
+ {
+ image: first.image,
+ width: PHOTO_COLUMN_WIDTH,
+ alignment: 'center',
+ },
+ ];
};
const createIngredients = (recipe: MealTemplate): Content[] => {
@@ -131,26 +127,83 @@ type RecipeContext = {
const createRecipe = (
recipe: MealTemplate, photoList: MealPhoto[], { index, withToc, recipeList, indexMap }: RecipeContext,
-): Content => ({
- stack: [
- {
- text: recipe.name,
- style: 'recipeTitle',
- id: getRecipeAnchor(index),
- tocItem: withToc,
- },
- ...(recipe.source ? [{ text: recipe.source, style: 'recipeSource' }] : []),
- { text: getRecipeMeta(recipe), style: 'recipeMeta' },
- ...createLinks(recipe, recipeList, indexMap),
- ...createPhotos(photoList),
- ...createIngredients(recipe),
- ...(recipe.note?.trim()
- ? [{ text: 'Postup', style: 'sectionHeading' }, ...convertMarkdownToPdf(recipe.note)]
- : []),
- ],
- // Každý recept začíná na nové stránce, první hned za obsahem
- ...(index > 0 || withToc ? { pageBreak: 'before' as const } : {}),
-});
+): Content => {
+ const hasPhotos = photoList.length > 0;
+ return ({
+ stack: [
+ ...(hasPhotos
+ ? [{
+ columns: [
+ {
+ width: '*',
+ stack: [
+ {
+ text: recipe.name,
+ style: 'recipeTitle',
+ id: getRecipeAnchor(index),
+ tocItem: withToc,
+ },
+
+ ...(recipe.source
+ ? [{ text: recipe.source, style: 'recipeSource' }]
+ : []),
+
+ {
+ text: getRecipeMeta(recipe),
+ style: 'recipeMeta',
+ },
+
+ ...createLinks(recipe, recipeList, indexMap),
+ ...createIngredients(recipe),
+ ],
+ },
+
+ {
+ width: 220,
+ stack: createPhotos(photoList),
+ },
+ ],
+ columnGap: 20,
+ }]
+ : [
+ {
+ text: recipe.name,
+ style: 'recipeTitle',
+ id: getRecipeAnchor(index),
+ tocItem: withToc,
+ },
+
+ ...(recipe.source
+ ? [{ text: recipe.source, style: 'recipeSource' }]
+ : []),
+
+ {
+ text: getRecipeMeta(recipe),
+ style: 'recipeMeta',
+ },
+
+ ...createLinks(recipe, recipeList, indexMap),
+ ...createIngredients(recipe),
+ ]),
+
+ ...(recipe.note?.trim()
+ ? [
+ {
+ text: 'Postup',
+ style: 'sectionHeading',
+ },
+ ...convertMarkdownToPdf(recipe.note),
+ ]
+ : []),
+ ],
+
+ // Každý recept začíná na nové stránce, první hned za obsahem
+
+ ...(index > 0 || withToc
+ ? { pageBreak: 'before' as const }
+ : {}),
+ });
+}
const loadPhotos = async (item: RecipeItem): Promise => {
if (!item.photoCount) return [];