Implementace #30, #31 a #39 #46

Merged
mates merged 4 commits from feat/issues-30-31-39 into master 2026-02-05 09:57:21 +01:00
2 changed files with 12 additions and 4 deletions
Showing only changes of commit fdd42dc46a - Show all commits

View File

@@ -461,7 +461,12 @@ function App() {
{easterEgg && eggImage && <img ref={eggRef} alt='' src={URL.createObjectURL(eggImage)} style={{ position: 'absolute', ...EASTER_EGG_STYLE, ...style, animationDuration: `${duration ?? EASTER_EGG_DEFAULT_DURATION}s` }} />} {easterEgg && eggImage && <img ref={eggRef} alt='' src={URL.createObjectURL(eggImage)} style={{ position: 'absolute', ...EASTER_EGG_STYLE, ...style, animationDuration: `${duration ?? EASTER_EGG_DEFAULT_DURATION}s` }} />}
<Header /> <Header />
<div className='wrapper'> <div className='wrapper'>
{data.isWeekend ? <h4>Užívejte víkend :)</h4> : <> {data.todayDayIndex != null && data.todayDayIndex > 4 &&
<Alert variant="info" className="mb-3">
Zobrazujete uplynulý týden
</Alert>
}
<>
{dayIndex != null && {dayIndex != null &&
<div className='day-navigator'> <div className='day-navigator'>
<span title='Předchozí den'> <span title='Předchozí den'>
@@ -724,7 +729,7 @@ function App() {
</div> </div>
} }
</div> </div>
</> || "Jejda, něco se nám nepovedlo :("} </>
</div> </div>
{/* <FallingLeaves {/* <FallingLeaves
numLeaves={LEAF_PRESETS.NORMAL} numLeaves={LEAF_PRESETS.NORMAL}

View File

@@ -1,12 +1,12 @@
import express from "express"; import express from "express";
import bodyParser from "body-parser"; import bodyParser from "body-parser";
import cors from 'cors'; import cors from 'cors';
import { getData, getDateForWeekIndex } from "./service"; import { getData, getDateForWeekIndex, getToday } from "./service";
import dotenv from 'dotenv'; import dotenv from 'dotenv';
import path from 'path'; import path from 'path';
import { getQr } from "./qr"; import { getQr } from "./qr";
import { generateToken, verify } from "./auth"; import { generateToken, verify } from "./auth";
import { InsufficientPermissions } from "./utils"; import { getIsWeekend, InsufficientPermissions } from "./utils";
import { initWebsocket } from "./websocket"; import { initWebsocket } from "./websocket";
import pizzaDayRoutes from "./routes/pizzaDayRoutes"; import pizzaDayRoutes from "./routes/pizzaDayRoutes";
import foodRoutes, { refreshMetoda } from "./routes/foodRoutes"; import foodRoutes, { refreshMetoda } from "./routes/foodRoutes";
@@ -133,6 +133,9 @@ app.get("/api/data", async (req, res) => {
if (!isNaN(index)) { if (!isNaN(index)) {
date = getDateForWeekIndex(parseInt(req.query.dayIndex)); date = getDateForWeekIndex(parseInt(req.query.dayIndex));
} }
} else if (getIsWeekend(getToday())) {
// Na víkendu zobrazíme pátek místo hlášky "Užívejte víkend"
date = getDateForWeekIndex(4);
} }
res.status(200).json(await getData(date)); res.status(200).json(await getData(date));
}); });