feat: Implement full type safety plan

This commit is contained in:
gpt-engineer-app[bot]
2025-10-20 00:40:47 +00:00
parent d9a912f443
commit db60759b9b
11 changed files with 271 additions and 23 deletions

View File

@@ -36,7 +36,7 @@ export function ItemEditDialog({ item, open, onOpenChange, onComplete }: ItemEdi
if (!item) return null;
const handleSubmit = async (data: any) => {
const handleSubmit = async (data: Record<string, unknown>) => {
if (!user?.id) {
toast({
title: 'Authentication Required',
@@ -59,7 +59,7 @@ export function ItemEditDialog({ item, open, onOpenChange, onComplete }: ItemEdi
onComplete();
onOpenChange(false);
} catch (error) {
} catch (error: unknown) {
const errorMsg = getErrorMessage(error);
toast({
title: 'Error',
@@ -74,11 +74,13 @@ export function ItemEditDialog({ item, open, onOpenChange, onComplete }: ItemEdi
const handlePhotoSubmit = async (caption: string, credit: string) => {
const photoData = {
...item.item_data,
photos: item.item_data.photos?.map((photo: any) => ({
...photo,
caption,
credit,
})),
photos: Array.isArray(item.item_data.photos)
? item.item_data.photos.map((photo: unknown) => ({
...(typeof photo === 'object' && photo !== null ? photo : {}),
caption,
credit,
}))
: [],
};
await handleSubmit(photoData);
};
@@ -211,13 +213,19 @@ export function ItemEditDialog({ item, open, onOpenChange, onComplete }: ItemEdi
}
// Simple photo editing form for caption and credit
interface PhotoItem {
url: string;
caption?: string;
credit?: string;
}
function PhotoEditForm({
photos,
onSubmit,
onCancel,
submitting
}: {
photos: any[];
photos: PhotoItem[];
onSubmit: (caption: string, credit: string) => void;
onCancel: () => void;
submitting: boolean;