From fc0603377cbca6e1aa8fada0e4af17c1c8643dfd Mon Sep 17 00:00:00 2001 From: Johannes Date: Thu, 26 Nov 2026 07:57:17 +0100 Subject: [PATCH] Update --- src/components/AnchorNav.astro | 2 +- src/layouts/BaseLayout.astro | 6 ++--- src/pages/flyer.ts | 14 ++++++++++++ src/pages/index.astro | 33 ++++++++++++++++++++++++--- src/sanity/queries.ts | 11 ++++++++- src/sanity/schemas/theaterHomepage.ts | 7 ++++++ src/styles/global.css | 23 +++++++++++++++++++ 7 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 src/pages/flyer.ts diff --git a/src/components/AnchorNav.astro b/src/components/AnchorNav.astro index d49d3f2..9a67ce0 100644 --- a/src/components/AnchorNav.astro +++ b/src/components/AnchorNav.astro @@ -3,7 +3,7 @@ const navItems = [ { id: 'projekt', label: 'Das Projekt' }, { id: 'team', label: 'Wer steckt dahinter' }, { id: 'stueck', label: 'Das Stück' }, - { id: 'mitwirkung', label: 'Mitwirkung' }, + { id: 'mitwirkung', label: 'Mitwirken' }, { id: 'termine', label: 'Termine' }, { id: 'presse', label: 'Presse' }, { id: 'gallery', label: 'Galerie' }, diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index a6c622a..097a057 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -6,7 +6,7 @@ interface Props { description?: string; } -const { title, description = "Theater Ziefen - Coming 2029" } = Astro.props; +const { title, description = "Freilichttheater Ziefen 2028 – Wyti Wäg mit Breitestei. Uraufführung im Juni 2028 rund um Jonas Breitenstein (1828–1877)." } = Astro.props; --- @@ -29,8 +29,8 @@ const { title, description = "Theater Ziefen - Coming 2029" } = Astro.props; diff --git a/src/pages/flyer.ts b/src/pages/flyer.ts new file mode 100644 index 0000000..8fcca9c --- /dev/null +++ b/src/pages/flyer.ts @@ -0,0 +1,14 @@ +import type { APIRoute } from 'astro'; +import { fetchWithCache } from '../sanity/client'; +import { flyerUrlQuery } from '../sanity/queries'; + +export const prerender = false; + +// Short, shareable link (theater-jb.ch/flyer) to the current recruitment flyer. +// Redirects to the PDF stored in Sanity, so swapping the flyer in the Studio +// keeps this URL working. +export const GET: APIRoute = async ({ redirect }) => { + const url = await fetchWithCache(flyerUrlQuery); + if (!url) return new Response('Flyer nicht gefunden', { status: 404 }); + return redirect(url, 302); +}; diff --git a/src/pages/index.astro b/src/pages/index.astro index 18f6095..b6708b5 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -7,7 +7,7 @@ import { fetchWithCache } from '../sanity/client'; import { renderPortableText } from '../sanity/portableText'; import { urlFor } from '../sanity/imageUrl'; import { theaterHomepageQuery } from '../sanity/queries'; -import { MapPin } from '@lucide/astro'; +import { MapPin, Download, FileText } from '@lucide/astro'; export const prerender = false @@ -122,14 +122,41 @@ const content: any = await fetchWithCache(theaterHomepageQuery) ?? {};
- +
+ {content.mitwirkung?.flyerUrl && ( + + )} + {content.mitwirkung?.director_name && (

Kontakt Regisseur:

diff --git a/src/sanity/queries.ts b/src/sanity/queries.ts index d88fef6..3989ace 100644 --- a/src/sanity/queries.ts +++ b/src/sanity/queries.ts @@ -1 +1,10 @@ -export const theaterHomepageQuery = `*[_type == "theaterHomepage" && _id == "theaterHomepage"][0]` +export const theaterHomepageQuery = `*[_type == "theaterHomepage" && _id == "theaterHomepage"][0]{ + ..., + mitwirkung{ + ..., + "flyerUrl": flyer.asset->url, + "flyerSize": flyer.asset->size + } +}` + +export const flyerUrlQuery = `*[_type == "theaterHomepage" && _id == "theaterHomepage"][0].mitwirkung.flyer.asset->url` diff --git a/src/sanity/schemas/theaterHomepage.ts b/src/sanity/schemas/theaterHomepage.ts index 3d07998..0f286e9 100644 --- a/src/sanity/schemas/theaterHomepage.ts +++ b/src/sanity/schemas/theaterHomepage.ts @@ -104,6 +104,13 @@ export const theaterHomepageSchema = defineType({ fields: [ defineField({ name: 'title', title: 'Title', type: 'string', validation: (r) => r.required() }), defineField({ name: 'content', title: 'Content', type: 'array', of: [{ type: 'block' }, defineArrayMember({ type: 'image', options: { hotspot: true } })] }), + defineField({ + name: 'flyer', + title: 'Flyer (PDF)', + description: 'Wird als Download-Button angezeigt und ist unter /flyer erreichbar.', + type: 'file', + options: { accept: 'application/pdf' }, + }), defineField({ name: 'director_name', title: 'Director Name', type: 'string' }), defineField({ name: 'director_email', title: 'Director Email', type: 'string' }), defineField({ name: 'director_phone', title: 'Director Phone', type: 'string' }), diff --git a/src/styles/global.css b/src/styles/global.css index 1bd6ab9..c61964b 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -51,6 +51,29 @@ margin: 1.5rem 0 1rem; } + .section-content h4 { + font-family: var(--font-body); + font-weight: 700; + font-size: 1.15rem; + margin: 1.5rem 0 0.5rem; + } + + .section-content ul { + list-style: disc; + padding-left: 1.5rem; + margin-bottom: 1rem; + } + + .section-content ol { + list-style: decimal; + padding-left: 1.5rem; + margin-bottom: 1rem; + } + + .section-content a { + text-decoration: underline; + } + /* Keep flowing prose to a comfortable reading measure so lines don't stretch across the full section width. */ .prose-measure {