mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2025-06-13 13:43:13 +00:00
Format numbers with leading 0s
Grow map on checkout Correct some typos
This commit is contained in:
parent
60ee8e49ae
commit
e0abea8cef
5 changed files with 30 additions and 12 deletions
|
@ -46,7 +46,7 @@
|
||||||
<hr>
|
<hr>
|
||||||
<button class="button evil" on:click={yeet}><Trash /></button>
|
<button class="button evil" on:click={yeet}><Trash /></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="basket-item-price">£{item.data.price * item.amount} (£{item.data.price})</li>
|
<li class="basket-item-price">£{(item.data.price * item.amount).toFixed(2)} (£{item.data.price.toFixed(2)})</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="basket-item-labels">
|
<ul class="basket-item-labels">
|
||||||
|
|
|
@ -50,6 +50,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a class="menu-item-link" href="/item/{item.uuid}" use:link>View <ArrowUpRight /></a>
|
<a class="menu-item-link" href="/item/{item.uuid}" use:link>View <ArrowUpRight /></a>
|
||||||
<ul class="menu-item-detail"><li>£{item.price} | {item.name}</li></ul>
|
<ul class="menu-item-detail"><li>£{item.price.toFixed(2)} | {item.name}</li></ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { link } from 'svelte-spa-router';
|
import { link } from 'svelte-spa-router';
|
||||||
import {ArrowLeft, ArrowRight, Basket} from "phosphor-svelte";
|
import { ArrowRight, Basket } from "phosphor-svelte";
|
||||||
|
|
||||||
import { type CartItem } from "../lib/types";
|
import { type CartItem } from "../lib/types";
|
||||||
import { getPopularToday } from "../lib/test-api";
|
import { getPopularToday } from "../lib/test-api";
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
<h1>Cart</h1>
|
<h1>Cart</h1>
|
||||||
|
|
||||||
<a id="checkout-button" href="/cart/checkout" use:link>Checkout <ArrowRight /></a>
|
<a id="checkout-button" href="/cart/checkout" use:link>Checkout <ArrowRight /></a>
|
||||||
<h2>Order total: £{totalPrice}</h2>
|
<h2>Order total: £{totalPrice.toFixed(2)}</h2>
|
||||||
|
|
||||||
{#each items as [_, item]}
|
{#each items as [_, item]}
|
||||||
<div class="basket-item">
|
<div class="basket-item">
|
||||||
|
|
|
@ -56,7 +56,10 @@
|
||||||
}
|
}
|
||||||
$: if (!CheckoutData.delivery) {
|
$: if (!CheckoutData.delivery) {
|
||||||
// Rendering maybe off-centered since map was initialized when div was hidden
|
// Rendering maybe off-centered since map was initialized when div was hidden
|
||||||
setTimeout(() => { leafletMap.invalidateSize() }, 1);
|
setTimeout(() => {
|
||||||
|
leafletMap.invalidateSize();
|
||||||
|
leafletMap.panTo([50.82304922105467, -0.432780150496344]);
|
||||||
|
}, 305);
|
||||||
totalPrice = 1.50 + Cart.getTotalPrice();
|
totalPrice = 1.50 + Cart.getTotalPrice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +150,7 @@
|
||||||
<ul id="delivery-option">
|
<ul id="delivery-option">
|
||||||
<li class:checked={CheckoutData.delivery}>
|
<li class:checked={CheckoutData.delivery}>
|
||||||
<button on:click={() => { CheckoutData.delivery = true }} type="button">
|
<button on:click={() => { CheckoutData.delivery = true }} type="button">
|
||||||
Deliver
|
Delivery
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li class:checked={!CheckoutData.delivery}>
|
<li class:checked={!CheckoutData.delivery}>
|
||||||
|
@ -227,26 +230,26 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h2>Total: ${totalPrice}</h2>
|
<h2>Total: £{totalPrice.toFixed(2)}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="table">
|
<div class="table">
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Price (each)</th><th>Item Name</th><th>#</th></tr>
|
<tr><th>Price (each)</th><th>Item Name</th><th>#</th></tr>
|
||||||
{#each items as [_, item]}
|
{#each items as [_, item]}
|
||||||
<tr class:table-row-error={!item.data.availability}>
|
<tr class:table-row-error={!item.data.availability}>
|
||||||
<td>£{item.data.price * item.amount} (£{item.data.price})</td>
|
<td>£{(item.data.price * item.amount).toFixed(2)} (£{item.data.price.toFixed(2)})</td>
|
||||||
<td>{item.data.name}</td>
|
<td>{item.data.name}</td>
|
||||||
<td>{item.amount}</td>
|
<td>{item.amount}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
<tr class="table-row-border">
|
<tr class="table-row-border">
|
||||||
<td>£1.50</td>
|
<td>£{1.50.toFixed(2)}</td>
|
||||||
<td>Online order Fee</td>
|
<td>Online order Fee</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
{#if CheckoutData.delivery}
|
{#if CheckoutData.delivery}
|
||||||
<tr>
|
<tr>
|
||||||
<td>£3.00</td>
|
<td>£{3.00.toFixed(2)}</td>
|
||||||
<td>Delivery fee</td>
|
<td>Delivery fee</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -367,7 +370,8 @@
|
||||||
#map {
|
#map {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 550px;
|
max-width: 550px;
|
||||||
height: 400px;
|
//height: 400px;
|
||||||
|
height: 0;
|
||||||
|
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
|
@ -376,6 +380,16 @@
|
||||||
|
|
||||||
&.show-map {
|
&.show-map {
|
||||||
display: block;
|
display: block;
|
||||||
|
animation: growMap forwards 0.3s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes growMap {
|
||||||
|
0% {
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
height: 400px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,5 +514,9 @@
|
||||||
max-width: unset;
|
max-width: unset;
|
||||||
position: unset;
|
position: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#map {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
|
|
||||||
<div id="info">
|
<div id="info">
|
||||||
<h2>{item.name}</h2>
|
<h2>{item.name}</h2>
|
||||||
<p>£{item.price}</p>
|
<p>£{item.price.toFixed(2)}</p>
|
||||||
|
|
||||||
<div class="spacer" />
|
<div class="spacer" />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue