typescript-typenfehler behoben.. npm run lint läuft nun fehlerfrei durch.

This commit is contained in:
Codex Agent
2025-11-22 11:49:47 +01:00
parent 6c78d7e281
commit eb41cb6194
74 changed files with 469 additions and 396 deletions

View File

@@ -38,8 +38,6 @@ export default function PhotoLightbox({ photos, currentIndex, onClose, onIndexCh
const toast = useToast();
const [standalonePhoto, setStandalonePhoto] = useState<Photo | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [task, setTask] = useState<Task | null>(null);
const [taskLoading, setTaskLoading] = useState(false);
const [likes, setLikes] = useState<number>(0);
@@ -59,8 +57,6 @@ export default function PhotoLightbox({ photos, currentIndex, onClose, onIndexCh
useEffect(() => {
if (isStandalone && photoId && !standalonePhoto && eventToken) {
const fetchPhoto = async () => {
setLoading(true);
setError(null);
try {
const res = await fetch(`/api/v1/photos/${photoId}?locale=${encodeURIComponent(locale)}`, {
headers: {
@@ -76,20 +72,17 @@ export default function PhotoLightbox({ photos, currentIndex, onClose, onIndexCh
setStandalonePhoto(location.state.photo);
}
} else {
setError(t('lightbox.errors.notFound'));
toast.push({ text: t('lightbox.errors.notFound'), type: 'error' });
}
} catch (err) {
setError(t('lightbox.errors.loadFailed'));
} finally {
setLoading(false);
console.warn('Standalone photo load failed', err);
toast.push({ text: t('lightbox.errors.loadFailed'), type: 'error' });
}
};
fetchPhoto();
} else if (!isStandalone) {
setLoading(false);
}
}, [isStandalone, photoId, eventToken, standalonePhoto, location.state, t, locale]);
}, [isStandalone, photoId, eventToken, standalonePhoto, location.state, t, locale, toast]);
// Update likes when photo changes
React.useEffect(() => {
@@ -163,8 +156,8 @@ export default function PhotoLightbox({ photos, currentIndex, onClose, onIndexCh
}
);
if (res.ok) {
const tasks = await res.json();
const foundTask = tasks.find((t: any) => t.id === taskId);
const tasks = (await res.json()) as Task[];
const foundTask = tasks.find((t) => t.id === taskId);
if (foundTask) {
setTask({
id: foundTask.id,
@@ -207,7 +200,9 @@ export default function PhotoLightbox({ photos, currentIndex, onClose, onIndexCh
if (!arr.includes(photo.id)) {
localStorage.setItem('liked-photo-ids', JSON.stringify([...arr, photo.id]));
}
} catch {}
} catch (storageError) {
console.warn('Failed to persist liked photo IDs', storageError);
}
} catch (error) {
console.error('Like failed:', error);
setLiked(false);