Files
fotospiel-app/resources/views/layouts/join-token/svg.blade.php
2025-10-28 18:28:22 +01:00

171 lines
7.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@php
$width = $layout['svg']['width'] ?? 1080;
$height = $layout['svg']['height'] ?? 1520;
$background = $layout['background'] ?? '#FFFFFF';
$gradient = $layout['background_gradient'] ?? null;
$gradientId = $gradient ? 'bg-gradient-'.uniqid() : null;
$accent = $layout['accent'] ?? '#000000';
$secondary = $layout['secondary'] ?? '#E5E7EB';
$textColor = $layout['text'] ?? '#111827';
$badgeColor = $layout['badge'] ?? $accent;
$instructions = $layout['instructions'] ?? [];
$description = $layout['description'] ?? '';
$subtitle = $layout['subtitle'] ?? '';
$headline = $layout['headline'] ?? $eventName;
$badgeLabel = $layout['badge_label'] ?? 'Digitale Gästebox';
$instructionsHeading = $layout['instructions_heading'] ?? "So funktioniert's";
$linkHeading = $layout['link_heading'] ?? 'Alternative zum Einscannen';
$ctaLabel = $layout['cta_label'] ?? 'Scan mich & starte direkt';
$linkLabel = $layout['link_label'] ?? $tokenUrl;
$logoUrl = $layout['logo_url'] ?? null;
$titleLines = explode("\n", wordwrap($headline, 18, "\n", true));
$subtitleLines = $subtitle !== '' ? explode("\n", wordwrap($subtitle, 36, "\n", true)) : [];
$descriptionLines = $description !== '' ? explode("\n", wordwrap($description, 40, "\n", true)) : [];
$instructionStartY = 870;
$instructionSpacing = 56;
if ($gradient) {
$angle = (float) ($gradient['angle'] ?? 180);
$angleRad = deg2rad($angle);
$x1 = 0.5 - cos($angleRad) / 2;
$y1 = 0.5 - sin($angleRad) / 2;
$x2 = 0.5 + cos($angleRad) / 2;
$y2 = 0.5 + sin($angleRad) / 2;
$x1Attr = number_format($x1, 4, '.', '');
$y1Attr = number_format($y1, 4, '.', '');
$x2Attr = number_format($x2, 4, '.', '');
$y2Attr = number_format($y2, 4, '.', '');
}
@endphp
<svg width="{{ $width }}" height="{{ $height }}" viewBox="0 0 {{ $width }} {{ $height }}" xmlns="http://www.w3.org/2000/svg">
<defs>
@if($gradientId)
<linearGradient id="{{ $gradientId }}" x1="{{ $x1Attr }}" y1="{{ $y1Attr }}" x2="{{ $x2Attr }}" y2="{{ $y2Attr }}">
@php
$stops = $gradient['stops'] ?? [];
$stopCount = max(count($stops) - 1, 1);
@endphp
@foreach($stops as $index => $stopColor)
@php
$offset = $stopCount > 0 ? ($index / $stopCount) * 100 : 0;
@endphp
<stop offset="{{ number_format($offset, 2, '.', '') }}%" stop-color="{{ $stopColor }}"/>
@endforeach
</linearGradient>
@endif
</defs>
<style>
.title-line {
font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
font-size: 82px;
font-weight: 700;
letter-spacing: -1px;
}
.subtitle-line {
font-family: 'Lora', 'Georgia', serif;
font-size: 32px;
font-weight: 500;
}
.description-line {
font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
font-size: 30px;
font-weight: 400;
line-height: 1.4;
}
.badge-text {
font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
font-size: 28px;
font-weight: 600;
letter-spacing: 4px;
text-transform: uppercase;
}
.instruction-bullet {
font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
font-size: 30px;
font-weight: 600;
}
.instruction-text {
font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
font-size: 30px;
font-weight: 400;
}
.small-label {
font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
font-size: 28px;
font-weight: 600;
letter-spacing: 3px;
text-transform: uppercase;
}
.link-text {
font-family: 'Courier New', monospace;
font-size: 30px;
}
.footer-text {
font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
font-size: 26px;
font-weight: 400;
}
.footer-strong {
font-weight: 700;
}
</style>
<rect x="0" y="0" width="{{ $width }}" height="{{ $height }}" fill="{{ $gradientId ? 'url(#'.$gradientId.')' : $background }}" />
<rect x="70" y="380" width="500" height="600" rx="46" fill="rgba(255,255,255,0.78)" />
<rect x="600" y="420" width="380" height="380" rx="36" fill="rgba(255,255,255,0.88)" />
<rect x="640" y="780" width="300" height="6" rx="3" fill="{{ $accent }}" opacity="0.6" />
<rect x="80" y="120" width="250" height="70" rx="35" fill="{{ $badgeColor }}" />
<text x="205" y="165" text-anchor="middle" fill="#FFFFFF" class="badge-text">{{ e($badgeLabel) }}</text>
@if($logoUrl)
<image href="{{ $logoUrl }}" x="840" y="90" width="180" height="120" preserveAspectRatio="xMidYMid meet" />
@endif
@foreach($titleLines as $index => $line)
<text x="80" y="{{ 260 + $index * 88 }}" fill="{{ $textColor }}" class="title-line">{{ e($line) }}</text>
@endforeach
@php
$subtitleOffset = 260 + count($titleLines) * 88 + 40;
@endphp
@foreach($subtitleLines as $index => $line)
<text x="80" y="{{ $subtitleOffset + $index * 44 }}" fill="{{ $secondary }}" class="subtitle-line">{{ e($line) }}</text>
@endforeach
@php
$descriptionOffset = $subtitleOffset + (count($subtitleLines) ? count($subtitleLines) * 44 + 60 : 40);
@endphp
@foreach($descriptionLines as $index => $line)
<text x="110" y="{{ $descriptionOffset + $index * 48 }}" fill="{{ $textColor }}" class="description-line">{{ e($line) }}</text>
@endforeach
<text x="120" y="760" fill="{{ $accent }}" class="small-label">{{ e(mb_strtoupper($instructionsHeading)) }}</text>
@foreach($instructions as $index => $step)
@php
$lineY = $instructionStartY + $index * $instructionSpacing;
@endphp
<circle cx="120" cy="{{ $lineY - 18 }}" r="10" fill="{{ $accent }}" />
<text x="150" y="{{ $lineY }}" fill="{{ $textColor }}" class="instruction-text">{{ e($step) }}</text>
@endforeach
<text x="640" y="760" fill="{{ $accent }}" class="small-label">{{ e(mb_strtoupper($linkHeading)) }}</text>
<rect x="630" y="790" width="320" height="120" rx="22" fill="rgba(0,0,0,0.08)" />
<text x="650" y="850" fill="{{ $textColor }}" class="link-text">{{ e($linkLabel) }}</text>
<image href="{{ $qrPngDataUri }}" x="620" y="440" width="{{ $layout['qr']['size_px'] ?? 340 }}" height="{{ $layout['qr']['size_px'] ?? 340 }}" />
<text x="820" y="820" text-anchor="middle" fill="{{ $accent }}" class="small-label">{{ e(mb_strtoupper($ctaLabel)) }}</text>
<text x="120" y="{{ $height - 160 }}" fill="rgba(17,24,39,0.6)" class="footer-text">
<tspan class="footer-strong" fill="{{ $accent }}">{{ e(config('app.name', 'Fotospiel')) }}</tspan>
&nbsp; Gästebox & Fotochallenges
</text>
<text x="{{ $width - 120 }}" y="{{ $height - 160 }}" text-anchor="end" fill="rgba(17,24,39,0.6)" class="footer-text">
Einladung gültig: {{ $joinToken->expires_at ? $joinToken->expires_at->isoFormat('LLL') : 'bis Widerruf' }}
</text>
</svg>