@@ -260,6 +260,26 @@ const filteredMenuItems = computed(() => {
260260 return items;
261261});
262262
263+ // Get a seeded random number based on the current date (consistent for the whole day)
264+ const getSeededRandom = (seed ) => {
265+ const x = Math .sin (seed) * 10000 ;
266+ return x - Math .floor (x);
267+ };
268+
269+ // Daily recommendation - pick a random menu item (consistent for the day)
270+ const dailyRecommendation = computed (() => {
271+ // Exclude foodtrucks as they aren't consistently there
272+ const items = filteredMenuItems .value .filter (item => item .restaurant !== ' Foodtrucks' );
273+ if (items .length === 0 ) return null ;
274+
275+ // Use date as seed so recommendation stays consistent throughout the day
276+ const today = new Date ();
277+ const seed = today .getFullYear () * 10000 + (today .getMonth () + 1 ) * 100 + today .getDate ();
278+ const randomIndex = Math .floor (getSeededRandom (seed) * items .length );
279+
280+ return items[randomIndex];
281+ });
282+
263283// Group menu items by restaurant for display
264284const groupedMenuItems = computed (() => {
265285 const items = filteredMenuItems .value ;
@@ -357,12 +377,30 @@ onUnmounted(() => {
357377 </div >
358378 <!-- menu items list grouped by restaurant -->
359379 <div v-else-if =" hasMenuForSelectedDay" class =" space-y-6" >
360- <div v-for =" (group, groupIndex) in groupedMenuItems" :key =" group.restaurant" >
380+ <!-- Daily recommendation -->
381+ <div v-if =" dailyRecommendation" class =" mb-6" >
361382 <div class =" flex items-center justify-between mb-3 max-w-md mx-auto" >
362- <h2 class =" text-lg font-semibold text-gray-700" >{{ group.restaurant }} </h2 >
363- <ViewToggle v-if = " groupIndex === 0 " v- model:compactView =" compactView" />
383+ <h2 class =" text-lg font-semibold text-gray-700" >Tagesempfehlung </h2 >
384+ <ViewToggle v-model:compactView =" compactView" />
364385 </div >
365- <div :class =" compactView ? 'max-w-md mx-auto rounded-lg shadow-md overflow-hidden bg-white p-6' : 'space-y-4'" >
386+ <div :class =" compactView ? 'max-w-md mx-auto rounded-lg shadow-md overflow-hidden bg-white p-4' : ''" >
387+ <MenuItem
388+ :name =" dailyRecommendation.name"
389+ :description =" dailyRecommendation.description"
390+ :type =" dailyRecommendation.type"
391+ :link =" dailyRecommendation.link || ''"
392+ :icon =" dailyRecommendation.icon || ''"
393+ :restaurant =" dailyRecommendation.restaurant || ''"
394+ :foodtruck =" dailyRecommendation.foodtruck || ''"
395+ :compact =" compactView"
396+ :always-show-restaurant =" true"
397+ />
398+ </div >
399+ </div >
400+
401+ <div v-for =" group in groupedMenuItems" :key =" group.restaurant" >
402+ <h2 class =" text-lg font-semibold text-gray-700 mb-3 max-w-md mx-auto" >{{ group.restaurant }}</h2 >
403+ <div :class =" compactView ? 'max-w-md mx-auto rounded-lg shadow-md overflow-hidden bg-white p-4' : 'space-y-4'" >
366404 <MenuItem
367405 v-for =" (item, index) in group.items"
368406 :key =" index"
0 commit comments