Skip to content

Commit ca9ccc9

Browse files
committed
update
1 parent 5361c2f commit ca9ccc9

File tree

14 files changed

+159
-21
lines changed

14 files changed

+159
-21
lines changed

astro.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { defineConfig } from 'astro/config';
22
import tailwind from "@astrojs/tailwind";
33
import svelte from "@astrojs/svelte";
4-
54
import image from "@astrojs/image";
65

76
// https://astro.build/config

src/components/EventCard.svelte

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script>
2+
import CountryIco from "../components/CountryIco.svelte";
3+
import { formatPeriod, normalizedName } from "../lib/helpers.js";
4+
export let item;
5+
export let data;
6+
</script>
7+
8+
<div class="px-3 py-2 border border-1 hover:bg-gray-50 hover:cursor-pointer" onclick="location.href='/{item.id}';">
9+
<div class="text-lg font-semibold"><a class="link" href="/{item.id}">{normalizedName(item)}</a></div>
10+
<div class="mt-1 flex flex-wrap gap-3">
11+
<div class="">{formatPeriod(item.date, item.days)}</div>
12+
<div class=""><CountryIco country={item.country} /> {item.place}, {item.country.toUpperCase()}</div>
13+
<div class="">👥 {@html item.attendees_real ? `${item.attendees_real} <span class="text-sm">(≈${item.attendees})</span>` : (item.attendees ? ''+item.attendees : '?')}</div>
14+
</div>
15+
</div>

src/components/EventDetail.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
const contributorsTypes = [
1111
{ name: 'Speakers', role: 'speaker' },
1212
{ name: 'Mentors', role: 'mentor' },
13-
{ name: 'Judge', role: 'judge' },
14-
{ name: 'Team', role: 'team' },
13+
{ name: 'Judge', role: 'judge' },
14+
{ name: 'Team', role: 'team' },
1515
]
1616
const serie = item.series ? data.series.find(s => s.id === item.series) : null
1717
</script>
1818

1919
<div class="event-detail">
20-
<div class="text-4xl">{normalizedName(item)}</div>
20+
<div class="detail-header">{normalizedName(item)}</div>
2121
<div class="flex flex-wrap mt-2 gap-4 items-center">
2222
<div class="flex gap-2">
2323
{#each item.types as type}
@@ -79,7 +79,7 @@
7979
<iframe width="560" height="315" src={item.aftermovie.replace("/watch?v=", '/embed/')} title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
8080
{/if}
8181

82-
<pre class="mt-64 p-4 bg-gray-200 mt-4"><code class="whitespace-pre-wrap">{JSON.stringify(item, null, 2)}</code></pre>
82+
<!--pre class="mt-64 p-4 bg-gray-200 mt-4"><code class="whitespace-pre-wrap">{JSON.stringify(item, null, 2)}</code></pre-->
8383
</div>
8484

8585
<style>

src/components/EventList.svelte

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
<script>
2+
import EventCard from "./EventCard.svelte";
23
import { formatPeriod, normalizedName } from "../lib/helpers.js";
34
export let data;
5+
export let items;
46
</script>
57

6-
{#each data.events as event}
7-
<div><a class="link" href="/{event.id}">{normalizedName(event)}</a></div>
8-
{/each}
8+
<div class="grid grid-cols-1 gap-2">
9+
{#each items as event}
10+
<div>
11+
<EventCard item={event} {data} />
12+
</div>
13+
{/each}
14+
</div>
15+
16+
<style>
17+
table a { @apply underline; }
18+
table a:hover { @apply no-underline; }
19+
</style>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<script>
2+
import EventList from '../components/EventList.svelte';
3+
import { isFuture } from 'date-fns';
4+
5+
export let data;
6+
let q = '';
7+
8+
const upcoming = data.events.filter(e => isFuture(new Date(e.date))).sort((x, y) => (new Date(x.date) > new Date(y.date) ? 1 : -1))
9+
const past = data.events.filter(e => !isFuture(new Date(e.date))).sort((x, y) => (new Date(x.date) < new Date(y.date) ? 1 : -1))
10+
11+
$: results = q ? data.events.filter(e => e.name.match(new RegExp(q, 'i'))) : null
12+
</script>
13+
14+
<div class="text-lg">
15+
<div>
16+
Search: <input type="text" class="border rounded py-0.5 px-1 w-80" bind:value={q} />
17+
</div>
18+
</div>
19+
20+
{#if q}
21+
<h1 class="header1">Events results for "{q}":</h1>
22+
{#if results && results.length > 0}
23+
<EventList items={results} data={data} />
24+
{:else}
25+
<div>Nothing found.</div>
26+
{/if}
27+
28+
{:else}
29+
30+
<h1 class="header1">Upcoming ({upcoming.length})</h1>
31+
<EventList items={upcoming} data={data} />
32+
33+
<h1 class="header1">Past ({past.length})</h1>
34+
<EventList items={past} data={data} />
35+
{/if}

src/components/Header.astro

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import { config } from '../lib/config.js';
33
---
44

55
<div class="h-16 flex gap-8 items-center">
6-
<h1 class="text-xl"><a href="/"><span class="font-bold">⟠ eth</span>events.xyz</a></h1>
7-
<div class="menu flex gap-4 h-full items-center">
6+
<h1 class="text-xl whitespace-nowrap"><a href="/"><span class="font-bold">⟠ eth</span>events.xyz</a></h1>
7+
<div class="grow menu flex gap-4 h-full items-center">
88
<div><a href="/">Events</a></div>
99
<div><a href="/series">Series</a></div>
1010
<div><a href="/contributors">Contributors</a></div>
1111
<div><a href="/map">Map</a></div>
1212
</div>
13+
<div class="flex gap-4">
14+
<div><a class="external" target="_blank" href="https://github.com/ethereumeg/chronicle">Source</a></div>
15+
<div><a class="external" target="_blank" href="https://ethevents.club">Forum</a></div>
16+
</div>
1317
</div>
1418

1519
<style>

src/components/SeriesDetail.astro

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
import EventList from '../components/EventList.svelte';
3+
const { item, data } = Astro.props;
4+
const events = data.events.filter(e => e.series === item.id)
5+
6+
---
7+
<div>
8+
<h1 class="detail-header">{item.name} (series)</h1>
9+
</div>
10+
<div>
11+
<h2 class="header2">Events ({events.length})</h2>
12+
<div>
13+
<EventList items={events} data={data} />
14+
</div>
15+
</div>

src/layouts/Layout.astro

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
---
2-
export interface Props {
3-
title: string;
4-
}
52
import Header from '../components/Header.astro';
63
import { config } from '../lib/config.js';
74
import '../styles/utils.css';
@@ -23,7 +20,7 @@ const { title } = Astro.props;
2320
<Header />
2421
</div>
2522
</div>
26-
<div class="mt-6 px-4 md:px-0">
23+
<div class="mt-8 mb-20 px-4 md:px-0">
2724
<div class="md:w-4/5 mx-auto">
2825
<slot />
2926
</div>

src/pages/contributors.astro

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
import Layout from '../layouts/Layout.astro';
3+
---
4+
5+
<Layout>
6+
<h1 class="header1">Contributors</h1>
7+
<div>TODO</div>
8+
</Layout>

src/pages/index.astro

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
---
22
import Layout from '../layouts/Layout.astro';
33
import Card from '../components/Card.astro';
4-
import EventList from '../components/EventList.svelte';
4+
import EventOverview from '../components/EventOverview.svelte';
55
import { config } from '../lib/config.js';
66
import data from '../data.json';
77
88
---
99

1010
<Layout>
11-
<h1 class="header1">Events</h1>
12-
<EventList data={data} client:load />
13-
</Layout>
14-
15-
<style>
16-
</style>
11+
<EventOverview data={data} client:load />
12+
</Layout>

0 commit comments

Comments
 (0)