Aufgabenkarten in der Gäste-pwa als swipe-barer Stapel umgesetzt. Sofortiges Freigeben von Foto-Uploads als Event-Einstellung implementiert.
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
updatePhotoVisibility,
|
||||
featurePhoto,
|
||||
unfeaturePhoto,
|
||||
updatePhotoStatus,
|
||||
TenantPhoto,
|
||||
EventAddonCatalogItem,
|
||||
createEventAddonCheckout,
|
||||
@@ -30,7 +31,7 @@ import { buildLimitWarnings } from '../lib/limitWarnings';
|
||||
import { adminPath } from '../constants';
|
||||
import { scopeDefaults, selectAddonKeyForScope } from './addons';
|
||||
|
||||
type FilterKey = 'all' | 'featured' | 'hidden';
|
||||
type FilterKey = 'all' | 'featured' | 'hidden' | 'pending';
|
||||
|
||||
export default function MobileEventPhotosPage() {
|
||||
const { slug: slugParam } = useParams<{ slug?: string }>();
|
||||
@@ -92,12 +93,18 @@ export default function MobileEventPhotosPage() {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const status =
|
||||
filter === 'hidden' || onlyHidden
|
||||
? 'hidden'
|
||||
: filter === 'pending'
|
||||
? 'pending'
|
||||
: undefined;
|
||||
const result = await getEventPhotos(slug, {
|
||||
page,
|
||||
perPage: 20,
|
||||
sort: 'desc',
|
||||
featured: filter === 'featured' || onlyFeatured,
|
||||
status: filter === 'hidden' || onlyHidden ? 'hidden' : undefined,
|
||||
status,
|
||||
search: search || undefined,
|
||||
});
|
||||
setPhotos((prev) => (page === 1 ? result.photos : [...prev, ...result.photos]));
|
||||
@@ -184,6 +191,24 @@ export default function MobileEventPhotosPage() {
|
||||
}
|
||||
}
|
||||
|
||||
async function approvePhoto(photo: TenantPhoto) {
|
||||
if (!slug) return;
|
||||
setBusyId(photo.id);
|
||||
try {
|
||||
const updated = await updatePhotoStatus(slug, photo.id, 'approved');
|
||||
setPhotos((prev) => prev.map((p) => (p.id === photo.id ? updated : p)));
|
||||
setLightbox((prev) => (prev && prev.id === photo.id ? updated : prev));
|
||||
toast.success(t('mobilePhotos.approveSuccess', 'Photo approved'));
|
||||
} catch (err) {
|
||||
if (!isAuthError(err)) {
|
||||
setError(getApiErrorMessage(err, t('mobilePhotos.approveFailed', 'Freigabe fehlgeschlagen.')));
|
||||
toast.error(t('mobilePhotos.approveFailed', 'Freigabe fehlgeschlagen.'));
|
||||
}
|
||||
} finally {
|
||||
setBusyId(null);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<MobileShell
|
||||
activeTab="uploads"
|
||||
@@ -219,8 +244,8 @@ export default function MobileEventPhotosPage() {
|
||||
style={{ ...baseInputStyle, marginBottom: 12 }}
|
||||
/>
|
||||
|
||||
<XStack space="$2">
|
||||
{(['all', 'featured', 'hidden'] as FilterKey[]).map((key) => (
|
||||
<XStack space="$2" flexWrap="wrap">
|
||||
{(['all', 'featured', 'pending', 'hidden'] as FilterKey[]).map((key) => (
|
||||
<Pressable key={key} onPress={() => setFilter(key)} style={{ flex: 1 }}>
|
||||
<MobileCard
|
||||
backgroundColor={filter === key ? infoBg : surface}
|
||||
@@ -232,7 +257,9 @@ export default function MobileEventPhotosPage() {
|
||||
? t('common.all', 'All')
|
||||
: key === 'featured'
|
||||
? t('photos.filters.featured', 'Featured')
|
||||
: t('photos.filters.hidden', 'Hidden')}
|
||||
: key === 'pending'
|
||||
? t('photos.filters.pending', 'Pending')
|
||||
: t('photos.filters.hidden', 'Hidden')}
|
||||
</Text>
|
||||
</MobileCard>
|
||||
</Pressable>
|
||||
@@ -283,6 +310,9 @@ export default function MobileEventPhotosPage() {
|
||||
/>
|
||||
<XStack position="absolute" top={6} left={6} space="$1">
|
||||
{photo.is_featured ? <PillBadge tone="warning">{t('photos.filters.featured', 'Featured')}</PillBadge> : null}
|
||||
{photo.status === 'pending' ? (
|
||||
<PillBadge tone="warning">{t('photos.filters.pending', 'Pending')}</PillBadge>
|
||||
) : null}
|
||||
{photo.status === 'hidden' ? <PillBadge tone="muted">{t('photos.filters.hidden', 'Hidden')}</PillBadge> : null}
|
||||
</XStack>
|
||||
</YStack>
|
||||
@@ -317,8 +347,25 @@ export default function MobileEventPhotosPage() {
|
||||
<XStack space="$2" alignItems="center">
|
||||
<PillBadge tone="muted">{lightbox.uploader_name || t('events.members.roles.guest', 'Guest')}</PillBadge>
|
||||
<PillBadge tone="muted">❤️ {lightbox.likes_count ?? 0}</PillBadge>
|
||||
{lightbox.status === 'pending' ? (
|
||||
<PillBadge tone="warning">{t('photos.filters.pending', 'Pending')}</PillBadge>
|
||||
) : null}
|
||||
{lightbox.status === 'hidden' ? (
|
||||
<PillBadge tone="muted">{t('photos.filters.hidden', 'Hidden')}</PillBadge>
|
||||
) : null}
|
||||
</XStack>
|
||||
<XStack space="$2" flexWrap="wrap">
|
||||
{lightbox.status === 'pending' ? (
|
||||
<CTAButton
|
||||
label={
|
||||
busyId === lightbox.id
|
||||
? t('common.processing', '...')
|
||||
: t('photos.actions.approve', 'Approve')
|
||||
}
|
||||
onPress={() => approvePhoto(lightbox)}
|
||||
style={{ flex: 1, minWidth: 140 }}
|
||||
/>
|
||||
) : null}
|
||||
<CTAButton
|
||||
label={
|
||||
busyId === lightbox.id
|
||||
|
||||
Reference in New Issue
Block a user