Skip to content

Commit

Permalink
adds menu birre
Browse files Browse the repository at this point in the history
  • Loading branch information
motocarota committed Jun 28, 2024
1 parent 56c69c0 commit b7a1779
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions src/lib/Menus.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,36 @@
import { onMount } from "svelte";
import { Card } from "flowbite-svelte";
const links = [
{ id: 'menu', label: 'La Carta', link: 'files/menu.pdf' },
{ id: 'pizza', label: 'La Pizzeria', link: 'files/pizza.pdf' },
{ id: 'bar', label: 'Bar Menú & Cocktail', link: 'files/bar.pdf' },
{ id: 'wine', label: 'Carta del Vino', link: 'menu-vini' },
{ id: 'special', label: 'Special del giorno - Lo Chef consiglia', link: 'menu-special' },
]
{ id: "menu", label: "La Carta", link: "files/menu.pdf" },
{ id: "pizza", label: "La Pizzeria", link: "files/pizza.pdf" },
{ id: "bar", label: "Bar Menú & Cocktail", link: "files/bar.pdf" },
{ id: "wine", label: "Carta del Vino", link: "menu-vini" },
{ id: "birre", label: "Carta delle Birre", link: "files/birre.pdf" },
{
id: "special",
label: "Special del giorno - Lo Chef consiglia",
link: "menu-special",
},
];
// fetch menu config
const endpoint = "https://docs.google.com/spreadsheets/d/e/2PACX-1vRsqIM7bI1QSk4J7bJlAzgvUks8ZtzXrOSNezIQ5kYo7Cu69pcq9o4sFwX5_cnwbotWwOaSYFoVlVMA/pub?gid=174690761&single=true&output=tsv";
const endpoint =
"https://docs.google.com/spreadsheets/d/e/2PACX-1vRsqIM7bI1QSk4J7bJlAzgvUks8ZtzXrOSNezIQ5kYo7Cu69pcq9o4sFwX5_cnwbotWwOaSYFoVlVMA/pub?gid=174690761&single=true&output=tsv";
let config = {};
onMount(async function () {
const response = await fetch(endpoint);
const data = await response.text();
config = (data.split('\r\n')).map(row => row.split('\t')).reduce(
(acc, [k,v]) => ({
...acc,
[k]: v === "TRUE",
}),
{}
);
config = data
.split("\r\n")
.map((row) => row.split("\t"))
.reduce(
(acc, [k, v]) => ({
...acc,
[k]: v === "TRUE",
}),
{},
);
});
</script>

Expand All @@ -31,7 +40,9 @@
<div class="flex justify-center gap-4 flex-wrap">
{#each links as link}
{#if config[link.id]}
<Card img={`img/${link.id}.webp`} href={link.link} target="_blank">{link.label}</Card>
<Card img={`img/${link.id}.webp`} href={link.link} target="_blank"
>{link.label}</Card
>
{/if}
{/each}
</div>
Expand Down
Binary file added static/files/birre.pdf
Binary file not shown.
Binary file added static/img/birre.webp
Binary file not shown.
Binary file modified static/img/special.webp
Binary file not shown.

0 comments on commit b7a1779

Please sign in to comment.