diff --git a/front/src/App.svelte b/front/src/App.svelte index dd7a050..63e85df 100644 --- a/front/src/App.svelte +++ b/front/src/App.svelte @@ -48,38 +48,20 @@ diff --git a/front/src/lib/api.js b/front/src/lib/api.js index f507e62..3f170d8 100644 --- a/front/src/lib/api.js +++ b/front/src/lib/api.js @@ -1,4 +1,4 @@ -import Items from '%/lib/testData.js'; +import Items from '%/lib/test-data.js'; export async function getPopularToday() { const res = await fetch("/api/items") diff --git a/front/src/lib/test-api.js b/front/src/lib/test-api.js new file mode 100644 index 0000000..91f43fa --- /dev/null +++ b/front/src/lib/test-api.js @@ -0,0 +1,30 @@ +import Items from '%/lib/test-data.js'; + +async function fakeDelay(timeout = 1000) { + await new Promise(resolve => setTimeout(resolve, timeout)); +} + +export async function getPopularToday() { + const data = Items; + await fakeDelay(2000) + return data; +} + +export async function getMenuItems() { + const data = [ + { + name: "Main Menu", + items: Items, + }, + { + name: "Breakfast", + items: [], + }, + { + name: "Seasonal", + items: Items, + }, + ]; + await fakeDelay(2000) + return data; +} diff --git a/front/src/lib/testData.js b/front/src/lib/test-data.js similarity index 70% rename from front/src/lib/testData.js rename to front/src/lib/test-data.js index 225d03d..d39da43 100644 --- a/front/src/lib/testData.js +++ b/front/src/lib/test-data.js @@ -1,53 +1,72 @@ // "vegan", "fish", "nut", "spicy", "gluten" -let Items; -export default Items = [ +const Items = [ + // soap: { { + uuid: "soap", name: "Bar of Soap", price: 69.99, labels: ["vegan", "spicy"], }, + // sock: { { + uuid: "sock", name: "Sock", price: 21, labels: ["vegan", "fish", "nut", "spicy"], }, + // brick: { { + uuid: "brick", name: "Brick", price: 0, labels: ["spicy"], }, + // toast: { { + uuid: "toast", name: "Toast", price: 4382749832743, labels: ["gluten"], }, + // water: { { + uuid: "water", name: "water", price: 1, labels: ["fish"], }, + // mouldy_bread: { { + uuid: "mouldy_bread", name: "half eaten mouldy bread", price: -99, labels: ["nut"], }, + // gwagwa: { { + uuid: "gwagwa", name: "GwaGwa", price: "Priceless", labels: ["nut"], image: "/dab.jpg", }, + // hogmelon: { { + uuid: "hogmelon", name: "Hogermellon", price: "1111", labels: ["fish"], image: "/wathog.jpg", }, + // bluhog: { { + uuid: "bluhog", name: "Blue HOGGGGG", price: "ARUGH", labels: ["nut", "gluten", "spicy"], image: "/sonichog.jpg", }, ]; + +export default Items; diff --git a/front/src/pages/PageIndex.svelte b/front/src/pages/PageIndex.svelte index b0e2353..64b26f1 100644 --- a/front/src/pages/PageIndex.svelte +++ b/front/src/pages/PageIndex.svelte @@ -5,7 +5,7 @@ import { ArrowUpRight } from "phosphor-svelte"; import MenuList from "%/components/MenuList.svelte"; - import { getPopularToday } from "%/lib/api.js"; + import { getPopularToday } from "%/lib/test-api.js"; import BannerImage from '/BannerExampleImage.jpg'; let items = getPopularToday(); @@ -35,8 +35,8 @@
Example text
+Please make sure to checkout our full calendar, as we have different times during public holiday
Day | Opening | Closing |
---|