added missing translations

This commit is contained in:
Codex Agent
2025-11-26 14:41:39 +01:00
parent ff168834b4
commit ecac9507a4
35 changed files with 2812 additions and 256 deletions

View File

@@ -7,7 +7,10 @@ import { Dialog, DialogContent, DialogFooter } from '@/components/ui/dialog';
import { fetchGalleryMeta, fetchGalleryPhotos, type GalleryMetaResponse, type GalleryPhotoResource } from '../services/galleryApi';
import { useTranslation } from '../i18n/useTranslation';
import { DEFAULT_LOCALE, isLocaleCode } from '../i18n/messages';
import { AlertTriangle, Download, Loader2, X } from 'lucide-react';
import { AlertTriangle, Download, Loader2, Share, X } from 'lucide-react';
import { createPhotoShareLink } from '../services/photosApi';
import { Share } from 'lucide-react';
import { createPhotoShareLink } from '../services/photosApi';
import { getContrastingTextColor } from '../lib/color';
interface GalleryState {
@@ -38,6 +41,7 @@ export default function PublicGalleryPage(): React.ReactElement | null {
const [state, setState] = useState<GalleryState>(INITIAL_STATE);
const [lightboxOpen, setLightboxOpen] = useState(false);
const [selectedPhoto, setSelectedPhoto] = useState<GalleryPhotoResource | null>(null);
const [shareLoading, setShareLoading] = useState(false);
const sentinelRef = useRef<HTMLDivElement | null>(null);
const localeStorageKey = token ? `guestGalleryLocale_${token}` : 'guestGalleryLocale';
@@ -353,14 +357,47 @@ export default function PublicGalleryPage(): React.ReactElement | null {
<div className="text-xs text-muted-foreground">
{selectedPhoto?.likes_count ? `${selectedPhoto.likes_count}` : ''}
</div>
{selectedPhoto?.download_url && (
<Button asChild className="gap-2" style={accentStyle}>
<a href={selectedPhoto.download_url} target="_blank" rel="noopener noreferrer">
<Download className="h-4 w-4" aria-hidden />
{t('galleryPublic.download')}
</a>
</Button>
)}
<div className="flex flex-wrap gap-2">
{(state.meta?.event?.guest_downloads_enabled ?? true) && selectedPhoto?.download_url ? (
<Button asChild className="gap-2" style={accentStyle}>
<a href={selectedPhoto.download_url} target="_blank" rel="noopener noreferrer">
<Download className="h-4 w-4" aria-hidden />
{t('galleryPublic.download')}
</a>
</Button>
) : null}
{(state.meta?.event?.guest_sharing_enabled ?? true) && selectedPhoto ? (
<Button
variant="outline"
className="gap-2"
disabled={shareLoading}
onClick={async () => {
if (!token || !selectedPhoto) return;
setShareLoading(true);
try {
const payload = await createPhotoShareLink(token, selectedPhoto.id);
const shareData: ShareData = {
title: selectedPhoto.guest_name ?? t('share.title', 'Geteiltes Foto'),
text: t('share.shareText', { event: state.meta?.event?.name ?? 'Fotospiel' }),
url: payload.url,
};
if (navigator.share && (!navigator.canShare || navigator.canShare(shareData))) {
await navigator.share(shareData).catch(() => undefined);
} else if (payload.url) {
await navigator.clipboard.writeText(payload.url);
}
} catch (err) {
console.error('share failed', err);
} finally {
setShareLoading(false);
}
}}
>
{shareLoading ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden /> : <Share className="h-4 w-4" aria-hidden />}
{t('share.shareCta', 'Teilen')}
</Button>
) : null}
</div>
</DialogFooter>
</DialogContent>
</Dialog>