From b9b9487375bae8605f5c9a2bf6fe73140b732e1f Mon Sep 17 00:00:00 2001 From: Martin Berka Date: Fri, 10 Nov 2023 20:48:34 +0100 Subject: [PATCH] =?UTF-8?q?Neumo=C5=BEnit=20zm=C4=9Bnu=20volby=20do=20minu?= =?UTF-8?q?losti?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/App.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index ba23c97..4e36d3c 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -350,6 +350,7 @@ function App() { } const noOrders = data?.pizzaDay?.orders?.length === 0; + const canChangeChoice = dayIndex == null || data.todayWeekIndex == null || dayIndex >= data.todayWeekIndex; return ( <> @@ -376,7 +377,7 @@ function App() {
- {(dayIndex == null || data.todayWeekIndex == null || dayIndex >= data.todayWeekIndex) && <> + {canChangeChoice && <>

{`Jak to ${dayIndex == null || dayIndex === data.todayWeekIndex ? 'dnes' : 'tento den'} vidíš s obědem?`}

@@ -432,7 +433,7 @@ function App() { } {login} {userPayload.departureTime && ({userPayload.departureTime})} - {login === auth.login && { + {login === auth.login && canChangeChoice && { doRemoveChoices(locationKey); }} title={`Odstranit volbu ${locationName}, včetně případných zvolených jídel`} className='action-icon' icon={faTrashCan} />} @@ -445,7 +446,7 @@ function App() { const foodName = food[restaurant]?.food[foodIndex].name; return
  • {foodName} - {login === auth.login && { + {login === auth.login && canChangeChoice && { doRemoveFoodChoice(locationKey, foodIndex); }} title={`Odstranit ${foodName}`} className='action-icon' icon={faTrashCan} />}