Výběr obědu kliknutím
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
This commit is contained in:
@@ -189,6 +189,13 @@ function App() {
|
||||
}
|
||||
}, [auth?.login, easterEgg?.duration, easterEgg?.url, eggImage]);
|
||||
|
||||
const doAddClickFoodChoice = async (location: Locations, foodIndex: number) => {
|
||||
const locationKey = Object.keys(Locations).find(key => Locations[key as keyof typeof Locations] === location) as LocationKey;
|
||||
if (auth?.login) {
|
||||
await errorHandler(() => addChoice(locationKey, foodIndex, dayIndex));
|
||||
}
|
||||
}
|
||||
|
||||
const doAddChoice = async (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
const locationKey = event.target.value as LocationKey;
|
||||
if (auth?.login) {
|
||||
@@ -331,15 +338,15 @@ function App() {
|
||||
}
|
||||
}
|
||||
|
||||
const renderFoodTable = (name: string, menu: DayMenu) => {
|
||||
const renderFoodTable = (name: string, location: Locations, menu: DayMenu) => {
|
||||
let content;
|
||||
if (menu?.closed) {
|
||||
content = <h3>Zavřeno</h3>
|
||||
} else if (menu?.food?.length > 0) {
|
||||
content = <Table striped bordered hover>
|
||||
<tbody>
|
||||
<tbody style={{ cursor: 'pointer' }}>
|
||||
{menu.food.filter(f => (settings?.hideSoups ? !f.isSoup : true)).map((f: any, index: number) =>
|
||||
<tr key={index}>
|
||||
<tr key={index} onClick={() => doAddClickFoodChoice(location, index)}>
|
||||
<td>{f.amount}</td>
|
||||
<td>{f.name}</td>
|
||||
<td>{f.price}</td>
|
||||
@@ -401,8 +408,8 @@ function App() {
|
||||
<img src='snowman.png' style={{ position: "absolute", height: "110px", right: 10, top: 5 }} />
|
||||
Poslední změny:
|
||||
<ul>
|
||||
<li>Přidání restaurace Zastávka u Michala</li>
|
||||
<li>Přidání restaurace Pivovarský šenk Šeříková</li>
|
||||
<li>Přidání restaurací Zastávka u Michala a Pivovarský šenk Šeříková</li>
|
||||
<li>Možnost výběru restaurace a jídel kliknutím v tabulce</li>
|
||||
</ul>
|
||||
</Alert>
|
||||
{dayIndex != null &&
|
||||
@@ -413,11 +420,11 @@ function App() {
|
||||
</div>
|
||||
}
|
||||
<Row className='food-tables'>
|
||||
{food[Restaurants.SLADOVNICKA] && renderFoodTable('Sladovnická', food[Restaurants.SLADOVNICKA])}
|
||||
{food[Restaurants.SLADOVNICKA] && renderFoodTable('Sladovnická', Locations.SLADOVNICKA, food[Restaurants.SLADOVNICKA])}
|
||||
{/* {food[Restaurants.UMOTLIKU] && renderFoodTable('U Motlíků', food[Restaurants.UMOTLIKU])} */}
|
||||
{food[Restaurants.TECHTOWER] && renderFoodTable('TechTower', food[Restaurants.TECHTOWER])}
|
||||
{food[Restaurants.ZASTAVKAUMICHALA] && renderFoodTable('Zastávka u Michala', food[Restaurants.ZASTAVKAUMICHALA])}
|
||||
{food[Restaurants.SENKSERIKOVA] && renderFoodTable('Pivovarský šenk Šeříková', food[Restaurants.SENKSERIKOVA])}
|
||||
{food[Restaurants.TECHTOWER] && renderFoodTable('TechTower', Locations.TECHTOWER, food[Restaurants.TECHTOWER])}
|
||||
{food[Restaurants.ZASTAVKAUMICHALA] && renderFoodTable('Zastávka u Michala', Locations.ZASTAVKAUMICHALA, food[Restaurants.ZASTAVKAUMICHALA])}
|
||||
{food[Restaurants.SENKSERIKOVA] && renderFoodTable('Pivovarský šenk Šeříková', Locations.SENKSERIKOVA, food[Restaurants.SENKSERIKOVA])}
|
||||
</Row>
|
||||
<div className='content-wrapper'>
|
||||
<div className='content'>
|
||||
|
||||
Reference in New Issue
Block a user