This commit is contained in:
tree🌴 2024-03-06 20:04:41 +01:00
parent f1ace4a728
commit 3baf6977be
2 changed files with 37 additions and 11 deletions

View file

@ -2,7 +2,9 @@
import core from '../core.json'; import core from '../core.json';
import { dateFormat } from '../lib/events.js'; import { dateFormat } from '../lib/events.js';
import { marked, } from 'marked'; import { marked } from 'marked';
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
const topics = [ const topics = [
'identity', 'identity',
@ -24,13 +26,33 @@ const images = {
summit01: {} summit01: {}
} }
let searchParams = null
let imageSelected = Object.keys(images)[0]; let imageSelected = Object.keys(images)[0];
let eventSelected = core.events[0].id; //let eventSelected = core.events[0].id;
let speakerSelected = 'alona-shevchenko'; const eventSelected = writable(core.events[0].id)
const speakerSelected = writable('alona-shevchenko');
onMount(() => {
searchParams = new URL(document.location).searchParams;
const id = searchParams.get('id');
if (id) {
eventSelected.set(id);
}
});
eventSelected.subscribe((id, next) => {
const event = core.events.find(e => e.id === id);
if (event.speakers?.length > 0) {
speakerSelected.set(event.speakers[0]);
}
return next
})
$: image = `/gen-img/events/${imageSelected}.png`; $: image = `/gen-img/events/${imageSelected}.png`;
$: event = core.events.find(e => e.id === eventSelected); $: event = core.events.find(e => e.id === $eventSelected);
$: speaker = core.people.find(p => p.id === speakerSelected); $: speaker = core.people.find(p => p.id === $speakerSelected);
</script> </script>
@ -39,9 +61,9 @@ $: speaker = core.people.find(p => p.id === speakerSelected);
<div> <div>
<div> <div>
Event: Event:
<select bind:value={eventSelected} class="text-black"> <select bind:value={$eventSelected} class="text-black">
{#each core.events as e} {#each core.events as e}
<option value={e.id}>{e.type} {e.city}</option> <option value={e.id}>[{e.id}] {e.type} {e.city} - {dateFormat(event.date)}</option>
{/each} {/each}
</select> </select>
</div> </div>
@ -155,10 +177,12 @@ $: speaker = core.people.find(p => p.id === speakerSelected);
<div class="mb-4 text-xl text-green-500">Square (speaker) (1:1)</div> <div class="mb-4 text-xl text-green-500">Square (speaker) (1:1)</div>
<div class="my-4"> <div class="my-4">
Speaker: Speaker:
<select bind:value={speakerSelected} class="text-black"> <select bind:value={$speakerSelected} class="text-black">
{#each event.speakers as sp} {#if event.speakers}
<option value={sp}>{sp}</option> {#each event.speakers as sp}
{/each} <option value={sp}>{sp}</option>
{/each}
{/if}
</select> </select>
</div> </div>

View file

@ -2,6 +2,8 @@
import ImageGenerator from '../../components/ImageGenerator.svelte'; import ImageGenerator from '../../components/ImageGenerator.svelte';
let url = Astro.url;
--- ---
<html> <html>