@@ -35,12 +33,15 @@
overflow: hidden;
- > div {
+ &::after {
+ content: '';
+
position: absolute;
top: $padding;
right: $padding;
bottom: $padding;
left: $padding;
+
border-radius: calc($border-radius-large - $padding);
background-color: rgba($color-background, 0.9);
}
diff --git a/front/src/components/DropDown.svelte b/front/src/components/DropDown.svelte
index bd390c1..ba0f69b 100644
--- a/front/src/components/DropDown.svelte
+++ b/front/src/components/DropDown.svelte
@@ -36,7 +36,7 @@
align-items: center;
p {
- font-size: $font-size-h5;
+ font-size: $font-size-h6;
font-weight: $font-weight-bold;
}
diff --git a/front/src/components/MenuItem.svelte b/front/src/components/MenuItem.svelte
index 12e7254..6bec1c6 100644
--- a/front/src/components/MenuItem.svelte
+++ b/front/src/components/MenuItem.svelte
@@ -4,23 +4,19 @@
import LoadingImage from '/MenuItemLoadingAlt.svg';
- export let id;
- export let name;
- export let price;
- export let image;
- export let labels = []
+ export let item = {};
diff --git a/front/src/components/MenuList.svelte b/front/src/components/MenuList.svelte
index ef96599..6d7a883 100644
--- a/front/src/components/MenuList.svelte
+++ b/front/src/components/MenuList.svelte
@@ -7,13 +7,7 @@
{#each items as item}
-
-
+
{/each}
@@ -31,4 +25,4 @@
li {
margin: 0;
}
-
\ No newline at end of file
+
diff --git a/front/src/lib/test-api.js b/front/src/lib/test-api.js
index 40e0d55..22b5973 100644
--- a/front/src/lib/test-api.js
+++ b/front/src/lib/test-api.js
@@ -1,19 +1,32 @@
import Items from '%/lib/test-data.js';
+let cache = {};
+
+
async function fakeDelay(timeout = 1000) {
await new Promise(resolve => setTimeout(resolve, timeout));
}
export async function getAnnouncements() {
+ if (cache.announcement_banner !== undefined) {
+ return cache.announcement_banner;
+ }
+
const data = {
image: "/BannerExampleImage.jpg",
};
- await fakeDelay(2000)
+ cache.announcement_banner = data;
+ await fakeDelay(5000)
return data;
}
export async function getPopularToday() {
+ if (cache.popular_today !== undefined) {
+ return cache.popular_today;
+ }
+
const data = Items;
+ cache.popular_today = data;
await fakeDelay(2000)
return data;
}
@@ -33,6 +46,24 @@ export async function getMenuItems() {
items: Items,
},
];
- await fakeDelay(2000)
+ await fakeDelay(20)
return data;
}
+
+export async function getItemByUUID(uuid) {
+ let data;
+
+ Items.forEach((item) => {
+ if (item.uuid === uuid) {
+ data = item;
+ }
+ })
+
+ await fakeDelay(1000)
+
+ if (!data) {
+ throw new Error("Resource could not be found");
+ }
+
+ return data;
+}
\ No newline at end of file
diff --git a/front/src/lib/test-data.js b/front/src/lib/test-data.js
index d39da43..8d749b5 100644
--- a/front/src/lib/test-data.js
+++ b/front/src/lib/test-data.js
@@ -7,6 +7,7 @@ const Items = [
name: "Bar of Soap",
price: 69.99,
labels: ["vegan", "spicy"],
+ detail: "Example",
},
// sock: {
{
@@ -14,6 +15,7 @@ const Items = [
name: "Sock",
price: 21,
labels: ["vegan", "fish", "nut", "spicy"],
+ detail: "Example",
},
// brick: {
{
@@ -21,6 +23,7 @@ const Items = [
name: "Brick",
price: 0,
labels: ["spicy"],
+ detail: "Example",
},
// toast: {
{
@@ -28,6 +31,7 @@ const Items = [
name: "Toast",
price: 4382749832743,
labels: ["gluten"],
+ detail: "Example",
},
// water: {
{
@@ -35,6 +39,7 @@ const Items = [
name: "water",
price: 1,
labels: ["fish"],
+ detail: "Example",
},
// mouldy_bread: {
{
@@ -42,6 +47,7 @@ const Items = [
name: "half eaten mouldy bread",
price: -99,
labels: ["nut"],
+ detail: "Example",
},
// gwagwa: {
{
@@ -58,6 +64,7 @@ const Items = [
price: "1111",
labels: ["fish"],
image: "/wathog.jpg",
+ detail: "Example",
},
// bluhog: {
{
@@ -66,6 +73,7 @@ const Items = [
price: "ARUGH",
labels: ["nut", "gluten", "spicy"],
image: "/sonichog.jpg",
+ detail: "Example",
},
];
diff --git a/front/src/pages/Page500.svelte b/front/src/pages/Page500.svelte
new file mode 100644
index 0000000..1990f3b
--- /dev/null
+++ b/front/src/pages/Page500.svelte
@@ -0,0 +1,32 @@
+
+
+
+
Server Fucking Died!
+
Error 500
+
+
+
\ No newline at end of file
diff --git a/front/src/pages/PageContact.svelte b/front/src/pages/PageContact.svelte
index f7cc9d9..ca4bd77 100644
--- a/front/src/pages/PageContact.svelte
+++ b/front/src/pages/PageContact.svelte
@@ -119,6 +119,7 @@
min-width: 250px;
max-width: calc(100vw - calc(2 * $spacing-normal));
resize: none;
+ overflow: hidden;
}
button {
diff --git a/front/src/pages/PageItem.svelte b/front/src/pages/PageItem.svelte
index 172ad78..21e32b3 100644
--- a/front/src/pages/PageItem.svelte
+++ b/front/src/pages/PageItem.svelte
@@ -1,95 +1,161 @@
-
-
-
+ {#await item}
+
+
+
+
+
-
-
-
-
{params.name}
-
+
+
+ {:then item}
+
+
+
+
+
+
+
+
+
{item.name}
+
£{item.price}
+
+
+
+ {:catch error}
+
Server fucking died...
+
{error}
+ {/await}
+
Popular
-
+
+ {#await popularToday}
+
+ {:then items}
+
+ {:catch error}
+
{error}
+ {/await}
+
\ No newline at end of file
diff --git a/front/src/routes.js b/front/src/routes.js
index e0ce799..4c06be4 100644
--- a/front/src/routes.js
+++ b/front/src/routes.js
@@ -1,6 +1,8 @@
import { wrap } from "svelte-spa-router/wrap";
+
import PageLoading from "%/pages/PageLoading.svelte";
import Page404 from "%/pages/Page404.svelte";
+import Page500 from "%/pages/Page500.svelte";
const routes = {
"/": wrap({
@@ -15,7 +17,7 @@ const routes = {
conditions: [],
userData: { showNavBar: true, fullWidth: true, },
}),
- "/item/:name": wrap({
+ "/item/:uuid": wrap({
asyncComponent: () => import("%/pages/PageItem.svelte"),
loadingComponent: PageLoading,
conditions: [],
@@ -39,11 +41,21 @@ const routes = {
conditions: [],
userData: { showNavBar: true, fullWidth: false, },
}),
- '*': wrap({
+ "/ForOhFor": wrap({
component: Page404,
conditions: [],
userData: { showNavBar: true, fullWidth: false, },
- })
+ }),
+ "/ServerError": wrap({
+ component: Page500,
+ conditions: [],
+ userData: { showNavBar: true, fullWidth: false, },
+ }),
+ "*": wrap({
+ component: Page404,
+ conditions: [],
+ userData: { showNavBar: true, fullWidth: false, },
+ }),
}
export default routes;