This commit is contained in:
tree🌴 2024-03-06 20:23:02 +01:00
parent 69fcfaf468
commit 2a28319fe4

View file

@ -33,7 +33,7 @@ const events = {
let searchParams = null 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;
const eventSelected = writable(Object.keys(events)[0]); const eventSelected = writable('');
const speakerSelected = writable('alona-shevchenko'); const speakerSelected = writable('alona-shevchenko');
onMount(() => { onMount(() => {
@ -48,6 +48,9 @@ onMount(() => {
eventSelected.subscribe((id, next) => { eventSelected.subscribe((id, next) => {
const event = core.events.find(e => e.id === id); const event = core.events.find(e => e.id === id);
if (!event) {
return;
}
if (event.speakers?.length > 0) { if (event.speakers?.length > 0) {
speakerSelected.set(event.speakers[0]); speakerSelected.set(event.speakers[0]);
} }
@ -66,8 +69,9 @@ $: speaker = core.people.find(p => p.id === $speakerSelected);
<div> <div>
Event: Event:
<select bind:value={$eventSelected} class="text-black"> <select bind:value={$eventSelected} class="text-black">
<option value="">---</option>
{#each Object.keys(events).map(eId => core.events.find(e => e.id === eId)) as e} {#each Object.keys(events).map(eId => core.events.find(e => e.id === eId)) as e}
<option value={e.id}>[{e.id}] {e.type} {e.city} - {dateFormat(event.date)}</option> <option value={e.id}>[{e.id}] {e.type} {e.city} - {dateFormat(e.date)}</option>
{/each} {/each}
</select> </select>
</div> </div>
@ -81,6 +85,12 @@ $: speaker = core.people.find(p => p.id === $speakerSelected);
</div--> </div-->
</div> </div>
</div> </div>
{#if !$eventSelected}
<div class="w-full flex flex-wrap gap-10 p-10">
Please select event.
</div>
{:else}
<div class="w-full flex flex-wrap gap-10 p-10"> <div class="w-full flex flex-wrap gap-10 p-10">
<div> <div>
@ -294,3 +304,4 @@ $: speaker = core.people.find(p => p.id === $speakerSelected);
</div> </div>
</div> </div>
</div> </div>
{/if}