Skip to content

Commit f2db0ef

Browse files
committed
aMaZing CSS!!!!! thanks copilot
1 parent 81db194 commit f2db0ef

File tree

6 files changed

+84
-33
lines changed

6 files changed

+84
-33
lines changed

src/App.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
body {
3434
display: flex;
3535
justify-content: center;
36-
background-color: #fef0ff;
36+
background-color: #f5f5f5;
3737
height: 100vh;
3838
overflow: hidden;
3939
}

src/lib/Details.svelte

+7-20
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<script lang="ts">
22
import { type Concert } from "src/lib/bindings/Concert";
3-
import { formatDate } from "src/utils";
3+
import Tags from "src/lib/Tags.svelte";
4+
import { formatDate, getPriceString } from "src/utils";
45
56
export let selectedConcert: Concert | null;
67
</script>
78

89
<div class="details">
910
{#if selectedConcert !== null}
1011
<div id="selected">
12+
<Tags concert={selectedConcert} />
1113
<h2>
1214
{selectedConcert.title}
1315
{#if selectedConcert.subtitle}
@@ -16,24 +18,9 @@
1618
</h2>
1719
<p>
1820
{formatDate(new Date(selectedConcert.datetime))}
19-
20-
{selectedConcert.venue}
21-
22-
{#if selectedConcert.min_price !== null && selectedConcert.max_price !== null}
23-
{#if selectedConcert.min_price === selectedConcert.max_price}
24-
{#if selectedConcert.min_price === 0}
25-
Free entry
26-
{:else}
27-
£{selectedConcert.min_price / 100}
28-
{/if}
29-
{:else}
30-
£{selectedConcert.min_price /
31-
100}–£{selectedConcert.max_price / 100}
32-
{/if}
33-
{/if}
34-
</p>
35-
36-
<p>
21+
|
22+
{getPriceString(selectedConcert)}
23+
<br />
3724
<a href={selectedConcert.url}>Link to concert</a>
3825
{#if selectedConcert.programme_pdf_url}
3926
| <a href={selectedConcert.programme_pdf_url}
@@ -99,7 +86,7 @@
9986
overflow-y: auto;
10087
10188
padding: 10px;
102-
border: 2px solid #000;
89+
border: 2px solid #666;
10390
border-radius: 10px;
10491
}
10592

src/lib/Filters.svelte

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
background-color: #f0f0f0;
3232
padding: 10px;
3333
border-radius: 0.5rem;
34+
border: 2px solid #666;
3435
3536
display: flex;
3637
flex-direction: column;

src/lib/Overview.svelte

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script lang="ts">
22
import { type Concert } from "src/lib/bindings/Concert";
3+
import Tags from "src/lib/Tags.svelte";
34
import { type FiltersType } from "src/lib/filters";
4-
import { formatDate } from "src/utils";
5+
import { formatDate, getPriceString } from "src/utils";
56
67
export let selectedConcert: Concert | null;
78
export let filters: FiltersType;
@@ -42,15 +43,19 @@
4243
class:active={selectedConcert === concert}
4344
class:wigmoreU35={concert.is_wigmore_u35}
4445
on:click={() => {
45-
selectedConcert = concert;
46+
selectedConcert = selectedConcert === concert ? null : concert;
4647
}}
4748
>
49+
<Tags {concert} />
4850
<h3>{concert.title}</h3>
4951
{#if concert.subtitle !== null}
5052
<h4>{concert.subtitle}</h4>
5153
{/if}
52-
<p>{formatDate(new Date(concert.datetime))}</p>
53-
<p>{concert.venue}</p>
54+
<p>
55+
{formatDate(new Date(concert.datetime))}
56+
|
57+
{getPriceString(concert)}
58+
</p>
5459
</button>
5560
{/each}
5661
</div>
@@ -63,29 +68,31 @@
6368
width: 100%;
6469
height: 100%;
6570
overflow-y: auto;
71+
padding: 0 15px 0 0;
6672
}
6773
6874
.concert {
69-
border: 2px solid #000;
75+
border: 2px solid #666;
7076
padding: 10px;
7177
border-radius: 5px;
7278
width: 100%;
7379
7480
font-family: inherit;
7581
text-align: left;
7682
cursor: pointer;
83+
84+
transition: border-color 0.3s;
7785
transition: background-color 0.3s;
86+
transition: margin-left 0.3s;
7887
}
7988
8089
.active {
81-
background-color: #ff99bb;
82-
}
83-
84-
.wigmoreU35 {
85-
border: 2px dashed #c13ad6;
90+
border-color: #a6628f;
91+
background-color: #f5e9f1;
92+
margin-left: 15px;
8693
}
8794
8895
.concert > * {
89-
margin: 0;
96+
margin: 2px 0;
9097
}
9198
</style>

src/lib/Tags.svelte

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<script lang="ts">
2+
import { type Concert } from "src/lib/bindings/Concert";
3+
export let concert: Concert;
4+
</script>
5+
6+
<div id="tags">
7+
{#if concert.venue === "Wigmore Hall"}
8+
<span class="tag wigmore">Wigmore Hall</span>
9+
{/if}
10+
{#if concert.is_wigmore_u35}
11+
<span class="tag wigmore-u35">£5 for U35</span>
12+
{/if}
13+
</div>
14+
15+
<style>
16+
div#tags {
17+
display: flex;
18+
justify-content: flex-start;
19+
gap: 5px;
20+
margin-bottom: 5px;
21+
}
22+
23+
span.tag {
24+
padding: 2px 5px;
25+
border-radius: 5px;
26+
margin: 0;
27+
}
28+
29+
span.wigmore {
30+
background-color: #17a8ad;
31+
color: white;
32+
}
33+
34+
span.wigmore-u35 {
35+
background-color: #3694cf;
36+
color: white;
37+
}
38+
</style>

src/utils.ts

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1+
import { type Concert } from 'src/lib/bindings/Concert';
2+
13
export function formatDate(date: Date): string {
24
let day_of_week = date.toLocaleString(undefined, { weekday: 'long' });
3-
let date_long = date.toLocaleString(undefined, { day: '2-digit', month: 'long', year: 'numeric' });
5+
let date_long = date.toLocaleString(undefined, { day: 'numeric', month: 'long', year: 'numeric' });
46
let time = date.toLocaleString(undefined, { hour: 'numeric', minute: '2-digit', hour12: true });
57
return `${date_long} (${day_of_week}), ${time}`;
68
}
9+
10+
export function getPriceString(concert: Concert): string {
11+
if (concert.min_price !== null && concert.max_price !== null) {
12+
if (concert.min_price === concert.max_price) {
13+
if (concert.min_price === 0) {
14+
return "Free entry";
15+
}
16+
else {
17+
return ${concert.min_price / 100}`;
18+
}
19+
} else {
20+
return ${concert.min_price / 100}–£${concert.max_price / 100}`;
21+
}
22+
}
23+
return "Price not available";
24+
}

0 commit comments

Comments
 (0)