Neorientovat se dle datumu klienta
This commit is contained in:
@@ -172,12 +172,6 @@ function App() {
|
||||
}
|
||||
}, [handleKeyDown]);
|
||||
|
||||
// Index v týdnu dnešního dne (0-6)
|
||||
// TODO tohle má posílat server, klient je nespolehlivý
|
||||
const currentDayIndex = useMemo(() => {
|
||||
return (((new Date().getDay() - 1) % 7) + 7) % 7;
|
||||
}, [])
|
||||
|
||||
const doAddChoice = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
const index = Object.keys(Locations).indexOf(event.target.value as unknown as Locations);
|
||||
if (auth?.login) {
|
||||
@@ -381,7 +375,7 @@ function App() {
|
||||
{dayIndex != null &&
|
||||
<div className='day-navigator'>
|
||||
{dayIndex > 0 && <FontAwesomeIcon title="Předchozí den" icon={faChevronLeft} style={{ cursor: "pointer" }} onClick={() => handleDayChange(dayIndex - 1)} />}
|
||||
<h1 className='title'>{`${dayIndex === currentDayIndex ? "(Dnes) " : ""}${data.date}`}</h1>
|
||||
<h1 className='title'>{`${dayIndex === data.todayWeekIndex ? "(Dnes) " : ""}${data.date}`}</h1>
|
||||
{dayIndex < 4 && <FontAwesomeIcon title="Následující den" icon={faChevronRight} style={{ cursor: "pointer" }} onClick={() => handleDayChange(dayIndex + 1)} />}
|
||||
</div>
|
||||
}
|
||||
@@ -392,8 +386,8 @@ function App() {
|
||||
</Row>
|
||||
<div className='content-wrapper'>
|
||||
<div className='content'>
|
||||
{dayIndex == null || dayIndex >= currentDayIndex && <>
|
||||
<p>{`Jak to ${dayIndex == null || dayIndex === currentDayIndex ? 'dnes' : 'tento den'} vidíš s obědem?`}</p>
|
||||
{dayIndex == null || dayIndex >= data.todayWeekIndex && <>
|
||||
<p>{`Jak to ${dayIndex == null || dayIndex === data.todayWeekIndex ? 'dnes' : 'tento den'} vidíš s obědem?`}</p>
|
||||
<Form.Select ref={choiceRef} onChange={doAddChoice}>
|
||||
<option></option>
|
||||
{Object.entries(Locations)
|
||||
@@ -482,7 +476,7 @@ function App() {
|
||||
: <div className='mt-5'><i>Zatím nikdo nehlasoval...</i></div>
|
||||
}
|
||||
</div>
|
||||
{dayIndex === currentDayIndex &&
|
||||
{dayIndex === data.todayWeekIndex &&
|
||||
<div className='mt-5'>
|
||||
{!data.pizzaDay &&
|
||||
<div style={{ textAlign: 'center' }}>
|
||||
|
||||
Reference in New Issue
Block a user