diff --git a/src/routes/[entry]/[type]/[slug]/+page.svelte b/src/routes/[entry]/[type]/[slug]/+page.svelte
index f61185f9..13d8dda3 100644
--- a/src/routes/[entry]/[type]/[slug]/+page.svelte
+++ b/src/routes/[entry]/[type]/[slug]/+page.svelte
@@ -37,15 +37,54 @@
return dates;
}
+ function enrichItem (it) {
+ if (!it) return null
+ console.log(it)
+ // segments
+ let segments = it.segments
+ for (let i = 0; i < segments.length; i++) {
+ const sg = segments[i]
+ if (sg.remote) {
+ const event = data.bundle.events.find(e => e.id === sg.remote)
+ const remoteSegments = event.segments.map(rs => Object.assign(rs, {
+ event,
+ remote: true
+ }))
+ segments.splice(i, remoteSegments.length, ...remoteSegments)
+ }
+ }
+ it.segments = segments
+ return it
+ }
+
$: entry = $page.params.entry;
$: col = $page.params.type;
$: colPlural = colsDef[col];
- $: item = data.bundle[colPlural].find((e) => e.id === $page.params.slug);
+ $: item = enrichItem(data.bundle[colPlural].find((e) => e.id === $page.params.slug));
$: defs = data.schema ? data.schema.definitions[col] : {};
+
+ function venuesMap (arr, rich = false) {
+ return arr.map((vId) => {
+ const place = data.bundle.places.find((p) => p.id === vId);
+ return rich ? `${place.name}` : place.name;
+ })
+ .join(', ')
+ }
+
+ $: itemDescription = `${formatItemDate(item, { full: true })} @ ${item.venues ? venuesMap(item.venues) : item.venueName }. ${item.tags ? item.tags.join(', ') : ''}`