- Served the guest PWA at /g/{token} and introduced a mobile-friendly gallery page with lazy-loaded thumbnails, themed colors, lightbox, and download links plus new gallery data client (resources/js/guest/pages/PublicGalleryPage.tsx:1, resources/js/guest/services/galleryApi.ts:1, resources/js/guest/router.tsx:1). Added i18n strings for the public gallery experience (resources/js/guest/i18n/messages.ts:1).
- Ensured checkout step changes snap back to the progress bar on mobile via smooth scroll anchoring (resources/ js/pages/marketing/checkout/CheckoutWizard.tsx:1).
- Enabled tenant admins to export all approved event photos through a new download action that streams a ZIP archive, with translations and routing in place (app/Http/Controllers/Tenant/EventPhotoArchiveController.php:1, app/Filament/Resources/EventResource.php:1, routes/web.php:1, resources/lang/de/admin.php:1, resources/lang/en/admin.php:1).
82 lines
2.1 KiB
TypeScript
82 lines
2.1 KiB
TypeScript
import type { LocaleCode } from '../i18n/messages';
|
|
|
|
export interface GalleryBranding {
|
|
primary_color: string;
|
|
secondary_color: string;
|
|
background_color: string;
|
|
}
|
|
|
|
export interface GalleryMetaResponse {
|
|
event: {
|
|
id: number;
|
|
name: string;
|
|
slug?: string | null;
|
|
description?: string | null;
|
|
gallery_expires_at?: string | null;
|
|
};
|
|
branding: GalleryBranding;
|
|
}
|
|
|
|
export interface GalleryPhotoResource {
|
|
id: number;
|
|
thumbnail_url: string | null;
|
|
full_url: string | null;
|
|
download_url: string;
|
|
likes_count: number;
|
|
guest_name?: string | null;
|
|
created_at?: string | null;
|
|
}
|
|
|
|
export interface GalleryPhotosResponse {
|
|
data: GalleryPhotoResource[];
|
|
next_cursor: string | null;
|
|
}
|
|
|
|
async function handleResponse<T>(response: Response): Promise<T> {
|
|
if (response.status === 204) {
|
|
return {} as T;
|
|
}
|
|
|
|
const data = await response.json().catch(() => null);
|
|
|
|
if (!response.ok) {
|
|
const error = new Error((data && data.error && data.error.message) || 'Request failed');
|
|
(error as any).code = data?.error?.code ?? response.status;
|
|
throw error;
|
|
}
|
|
|
|
return data as T;
|
|
}
|
|
|
|
export async function fetchGalleryMeta(token: string, locale?: LocaleCode): Promise<GalleryMetaResponse> {
|
|
const params = new URLSearchParams();
|
|
if (locale) params.set('locale', locale);
|
|
|
|
const response = await fetch(`/api/v1/gallery/${encodeURIComponent(token)}${params.toString() ? `?${params.toString()}` : ''}`, {
|
|
headers: {
|
|
'Accept': 'application/json',
|
|
},
|
|
credentials: 'omit',
|
|
});
|
|
|
|
return handleResponse<GalleryMetaResponse>(response);
|
|
}
|
|
|
|
export async function fetchGalleryPhotos(token: string, cursor?: string | null, limit = 30): Promise<GalleryPhotosResponse> {
|
|
const params = new URLSearchParams();
|
|
params.set('limit', String(limit));
|
|
if (cursor) {
|
|
params.set('cursor', cursor);
|
|
}
|
|
|
|
const response = await fetch(`/api/v1/gallery/${encodeURIComponent(token)}/photos?${params.toString()}`, {
|
|
headers: {
|
|
'Accept': 'application/json',
|
|
},
|
|
credentials: 'omit',
|
|
});
|
|
|
|
return handleResponse<GalleryPhotosResponse>(response);
|
|
}
|
|
|