mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 03:31:13 -05:00
feat: Implement full type safety plan
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user