feat: enhance rosary with interactive Bible citations and improved mystery selection
- Add clickable Bible reference buttons that open modal with full verses - Create BibleModal component with backdrop blur and styled close button - Implement build-time data fetching for Bible texts while maintaining reactivity - Redesign mystery selector with responsive grid (3-in-row/4-in-row/2×2) - Add "Heutige" badge to indicate today's auto-selected mystery - Reposition luminous mysteries toggle below mystery selector - Integrate Bible reference and counter buttons side-by-side - Restructure Bible API under /api/glaube/bibel/ for better organization
This commit is contained in:
278
src/lib/components/BibleModal.svelte
Normal file
278
src/lib/components/BibleModal.svelte
Normal file
@@ -0,0 +1,278 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
export let reference: string = '';
|
||||
export let title: string = '';
|
||||
export let onClose: () => void;
|
||||
|
||||
let book: string = '';
|
||||
let chapter: number = 0;
|
||||
let verses: Array<{ verse: number; text: string }> = [];
|
||||
let loading = true;
|
||||
let error = '';
|
||||
|
||||
onMount(async () => {
|
||||
if (!reference) return;
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/glaube/bibel/${encodeURIComponent(reference)}`);
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch verses');
|
||||
}
|
||||
const data = await response.json();
|
||||
book = data.book;
|
||||
chapter = data.chapter;
|
||||
verses = data.verses;
|
||||
} catch (err) {
|
||||
console.error('Error fetching Bible verses:', err);
|
||||
error = 'Fehler beim Laden der Bibelstelle';
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
});
|
||||
|
||||
function handleBackdropClick(event: MouseEvent) {
|
||||
if (event.target === event.currentTarget) {
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'Escape') {
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
|
||||
<div class="modal-backdrop" on:click={handleBackdropClick} role="presentation">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<div class="header-content">
|
||||
{#if title}
|
||||
<h3 class="modal-title">
|
||||
{#if title.includes(':')}
|
||||
{title.split(':')[0]}:<br>{title.split(':')[1]}
|
||||
{:else}
|
||||
{title}
|
||||
{/if}
|
||||
</h3>
|
||||
{/if}
|
||||
<p class="modal-reference">{reference}</p>
|
||||
</div>
|
||||
<button class="close-button" on:click={onClose} aria-label="Schließen">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<line x1="18" y1="6" x2="6" y2="18"></line>
|
||||
<line x1="6" y1="6" x2="18" y2="18"></line>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
{#if loading}
|
||||
<p class="loading">Lädt...</p>
|
||||
{:else if error}
|
||||
<p class="error">{error}</p>
|
||||
{:else if verses.length > 0}
|
||||
<div class="verses">
|
||||
{#each verses as verse}
|
||||
<p class="verse">
|
||||
<span class="verse-number">{verse.verse}</span>
|
||||
<span class="verse-text">{verse.text}</span>
|
||||
</p>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="error">Keine Verse gefunden</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.modal-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
backdrop-filter: blur(10px);
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
padding: 1rem;
|
||||
animation: show-backdrop 200ms ease forwards;
|
||||
}
|
||||
|
||||
@keyframes show-backdrop {
|
||||
from {
|
||||
backdrop-filter: blur(0px);
|
||||
background: rgba(0, 0, 0, 0);
|
||||
}
|
||||
to {
|
||||
backdrop-filter: blur(10px);
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
@media(prefers-color-scheme: light) {
|
||||
.modal-backdrop {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
@keyframes show-backdrop {
|
||||
from {
|
||||
backdrop-filter: blur(0px);
|
||||
background: rgba(255, 255, 255, 0);
|
||||
}
|
||||
to {
|
||||
backdrop-filter: blur(10px);
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background: var(--nord0);
|
||||
border-radius: 12px;
|
||||
max-width: 600px;
|
||||
width: 100%;
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@media(prefers-color-scheme: light) {
|
||||
.modal-content {
|
||||
background: var(--nord6);
|
||||
}
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
padding: 1.5rem;
|
||||
border-bottom: 1px solid var(--nord3);
|
||||
}
|
||||
|
||||
@media(prefers-color-scheme: light) {
|
||||
.modal-header {
|
||||
border-bottom: 1px solid var(--nord4);
|
||||
}
|
||||
}
|
||||
|
||||
.header-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
margin: 0;
|
||||
color: var(--nord10);
|
||||
font-size: 1.3rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.modal-reference {
|
||||
margin: 0;
|
||||
color: var(--nord8);
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
position: absolute;
|
||||
top: -1rem;
|
||||
right: -1rem;
|
||||
background-color: var(--nord11);
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 1rem;
|
||||
border-radius: 1000px;
|
||||
color: white;
|
||||
transition: 200ms;
|
||||
box-shadow: 0 0 1em 0.2em rgba(0, 0, 0, 0.3);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
.close-button svg {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
}
|
||||
|
||||
.close-button:hover {
|
||||
background-color: var(--nord0);
|
||||
transform: scale(1.2, 1.2);
|
||||
box-shadow: 0 0 1em 0.4em rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.close-button:active {
|
||||
transition: 50ms;
|
||||
scale: 0.8 0.8;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.loading,
|
||||
.error {
|
||||
text-align: center;
|
||||
color: var(--nord4);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@media(prefers-color-scheme: light) {
|
||||
.loading,
|
||||
.error {
|
||||
color: var(--nord2);
|
||||
}
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--nord11);
|
||||
}
|
||||
|
||||
.verses {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.verse {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
line-height: 1.6;
|
||||
color: var(--nord4);
|
||||
}
|
||||
|
||||
@media(prefers-color-scheme: light) {
|
||||
.verse {
|
||||
color: var(--nord0);
|
||||
}
|
||||
}
|
||||
|
||||
.verse-number {
|
||||
color: var(--nord10);
|
||||
font-weight: 700;
|
||||
min-width: 2rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.verse-text {
|
||||
flex: 1;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
</style>
|
||||
@@ -10,9 +10,6 @@ export let onClick;
|
||||
|
||||
<style>
|
||||
.counter-button {
|
||||
position: absolute;
|
||||
bottom: 0.5rem;
|
||||
right: 0.5rem;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
border-radius: 50%;
|
||||
|
||||
100
src/lib/data/mysteryDescriptions.ts
Normal file
100
src/lib/data/mysteryDescriptions.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
export interface MysteryReference {
|
||||
title: string;
|
||||
reference: string;
|
||||
}
|
||||
|
||||
export interface MysteryDescription extends MysteryReference {
|
||||
text: string;
|
||||
}
|
||||
|
||||
// Only store references - texts will be fetched at build time
|
||||
export const mysteryReferences = {
|
||||
lichtreichen: [
|
||||
{
|
||||
title: "Das erste lichtreiche Geheimnis: Die Taufe im Jordan.",
|
||||
reference: "Mt 3, 16-17"
|
||||
},
|
||||
{
|
||||
title: "Das zweite lichtreiche Geheimnis: Die Hochzeit von Kana.",
|
||||
reference: "Joh 2, 1-5"
|
||||
},
|
||||
{
|
||||
title: "Das dritte lichtreiche Geheimnis: Die Verkündigung des Reiches Gottes.",
|
||||
reference: "Mk 1, 15"
|
||||
},
|
||||
{
|
||||
title: "Das vierte lichtreiche Geheimnis: Die Verklärung.",
|
||||
reference: "Mt 17, 1-2"
|
||||
},
|
||||
{
|
||||
title: "Das fünfte lichtreiche Geheimnis: Die heiligste Eucharistie (Das Altarssakrament).",
|
||||
reference: "Mt 26, 26"
|
||||
}
|
||||
],
|
||||
freudenreich: [
|
||||
{
|
||||
title: "Das erste freudenreiche Geheimnis: Die Verkündigung des Erzengles Gabriel an die Jungfrau Maria.",
|
||||
reference: "Lk 1, 26-27"
|
||||
},
|
||||
{
|
||||
title: "Das zweite freudenreiche Geheimnis: Der Besuch Marias bei Elisabeth.",
|
||||
reference: "Lk 1, 39-42"
|
||||
},
|
||||
{
|
||||
title: "Das dritte freudenreiche Geheimnis: Die Geburt Jesu im Stall von Bethlehem.",
|
||||
reference: "Lk 2, 1-7"
|
||||
},
|
||||
{
|
||||
title: "Das vierte freudenreiche Geheimnis: Jesus wird von Maria und Josef im Tempel dargebracht.",
|
||||
reference: "Lk 2, 21-24"
|
||||
},
|
||||
{
|
||||
title: "Das fünfte freudenreiche Geheimnis: Jesus wird im Tempel wiedergefunden.",
|
||||
reference: "Lk 2, 41-47"
|
||||
}
|
||||
],
|
||||
schmerzhaften: [
|
||||
{
|
||||
title: "Das erste schmerzhafte Geheimnis: Die Todesangst Jesu.",
|
||||
reference: "Mt 26, 36-39"
|
||||
},
|
||||
{
|
||||
title: "Das zweite schmerzhafte Geheimnis: Die Geißelung Jesu.",
|
||||
reference: "Mt 27, 26"
|
||||
},
|
||||
{
|
||||
title: "Das dritte schmerzhafte Geheimnis: Die Dornenkrönung.",
|
||||
reference: "Mt 27, 27-29"
|
||||
},
|
||||
{
|
||||
title: "Das vierte schmerzhafte Geheimnis: Jesus trägt das schwere Kreuz.",
|
||||
reference: "Mk 15, 21-22"
|
||||
},
|
||||
{
|
||||
title: "Das fünfte schmerzhafte Geheimnis: Die Kreuzigung Jesu.",
|
||||
reference: "Lk 23, 33-46"
|
||||
}
|
||||
],
|
||||
glorreichen: [
|
||||
{
|
||||
title: "Das erste glorreiche Geheimnis: Die Auferstehung Jesu.",
|
||||
reference: "Lk 24, 1-6"
|
||||
},
|
||||
{
|
||||
title: "Das zweite glorreiche Geheimnis: Die Himmerfahrt Jesu.",
|
||||
reference: "Mk 16, 19"
|
||||
},
|
||||
{
|
||||
title: "Das dritte glorreiche Geheimnis: Die Herabkunft des Heiligen Geistes im Abendmahlssaal.",
|
||||
reference: "Apg 2, 1-4"
|
||||
},
|
||||
{
|
||||
title: "Das vierte glorreiche Geheimnis: Die Aufnahme Marias in den Himmel.",
|
||||
reference: "Lk 1, 48-49"
|
||||
},
|
||||
{
|
||||
title: "Das fünfte glorreiche Geheimnis: Die Krönung Marias zur Königin des Himmels und der Erde.",
|
||||
reference: "Offb 12, 1"
|
||||
}
|
||||
]
|
||||
} as const;
|
||||
Reference in New Issue
Block a user