created a demo mode for the guest pwa

This commit is contained in:
Codex Agent
2025-11-17 12:24:14 +01:00
parent 167734f87a
commit 2978b0ef15
11 changed files with 671 additions and 17 deletions

View File

@@ -370,7 +370,7 @@ class EventController extends Controller
];
$taskSummary['pending'] = max(0, $taskSummary['total'] - $taskSummary['completed']);
$translate = static function ($value, string $fallback = '') {
$translate = static function ($value, ?string $fallback = '') {
if (is_array($value)) {
$locale = app()->getLocale();
$candidates = array_filter([

View File

@@ -16,6 +16,8 @@ class PhotoResource extends JsonResource
{
$tenantId = $request->attributes->get('tenant_id');
$showSensitive = $this->event->tenant_id === $tenantId;
$fullUrl = $this->getFullUrl();
$thumbnailUrl = $this->getThumbnailUrl();
return [
'id' => $this->id,
@@ -23,8 +25,8 @@ class PhotoResource extends JsonResource
'original_name' => $this->original_name,
'mime_type' => $this->mime_type,
'size' => (int) ($this->size ?? 0),
'url' => $showSensitive ? $this->getFullUrl() : $this->getThumbnailUrl(),
'thumbnail_url' => $this->getThumbnailUrl(),
'url' => $showSensitive ? ($fullUrl ?? $thumbnailUrl) : ($thumbnailUrl ?? $fullUrl),
'thumbnail_url' => $thumbnailUrl ?? $fullUrl,
'width' => $this->width,
'height' => $this->height,
'is_featured' => (bool) ($this->is_featured ?? false),
@@ -46,16 +48,24 @@ class PhotoResource extends JsonResource
/**
* Get full image URL
*/
private function getFullUrl(): string
private function getFullUrl(): ?string
{
if (empty($this->filename)) {
return null;
}
return url("storage/events/{$this->event->slug}/photos/{$this->filename}");
}
/**
* Get thumbnail URL
*/
private function getThumbnailUrl(): string
private function getThumbnailUrl(): ?string
{
if (empty($this->filename)) {
return null;
}
return url("storage/events/{$this->event->slug}/thumbnails/{$this->filename}");
}
}