From 9e8e8719b4fc325973ae365476a52b9cf7da5aee Mon Sep 17 00:00:00 2001
From: "gpt-engineer-app[bot]"
<159125892+gpt-engineer-app[bot]@users.noreply.github.com>
Date: Mon, 3 Nov 2025 02:28:57 +0000
Subject: [PATCH] Fix: Resolve TypeScript errors
---
src/components/settings/EmailChangeDialog.tsx | 2 +-
src/components/ui/sidebar.tsx | 2 +-
.../upload/EntityMultiImageUploader.tsx | 4 ++--
src/components/upload/EntityPhotoGallery.tsx | 4 ++--
src/components/upload/PhotoManagementDialog.tsx | 6 +++++-
.../upload/UppyPhotoSubmissionUpload.tsx | 3 +++
src/hooks/moderation/useEntityCache.ts | 2 +-
src/hooks/moderation/useModerationActions.ts | 10 ++++++----
src/hooks/moderation/useProfileCache.ts | 15 ++++++++++++---
src/hooks/useAutocompleteData.ts | 8 ++++----
src/hooks/useProfile.tsx | 2 +-
src/hooks/useSearch.tsx | 10 +++++-----
src/hooks/useVersionComparison.ts | 4 ++--
src/lib/entitySubmissionHelpers.ts | 6 +++---
14 files changed, 48 insertions(+), 30 deletions(-)
diff --git a/src/components/settings/EmailChangeDialog.tsx b/src/components/settings/EmailChangeDialog.tsx
index 9283629f..d36b01ef 100644
--- a/src/components/settings/EmailChangeDialog.tsx
+++ b/src/components/settings/EmailChangeDialog.tsx
@@ -253,7 +253,7 @@ export function EmailChangeDialog({ open, onOpenChange, currentEmail, userId }:
metadata: {
currentEmail,
newEmail: data.newEmail,
- errorType: error.constructor.name
+ errorType: error instanceof Error ? error.constructor.name : 'Unknown'
}
}
);
diff --git a/src/components/ui/sidebar.tsx b/src/components/ui/sidebar.tsx
index 37ea9ff6..dd067989 100644
--- a/src/components/ui/sidebar.tsx
+++ b/src/components/ui/sidebar.tsx
@@ -78,7 +78,7 @@ const SidebarProvider = React.forwardRef<
state,
open,
setOpen,
- isMobile,
+ isMobile: isMobile ?? false,
openMobile,
setOpenMobile,
toggleSidebar,
diff --git a/src/components/upload/EntityMultiImageUploader.tsx b/src/components/upload/EntityMultiImageUploader.tsx
index ceee256e..497fd939 100644
--- a/src/components/upload/EntityMultiImageUploader.tsx
+++ b/src/components/upload/EntityMultiImageUploader.tsx
@@ -86,7 +86,7 @@ export function EntityMultiImageUploader({
.from('photos')
.select('id, cloudflare_image_url, cloudflare_image_id, caption, title')
.eq('entity_type', entityType)
- .eq('entity_id', entityId)
+ .eq('entity_id', entityId || '')
.order('created_at', { ascending: false });
if (error) throw error;
@@ -314,7 +314,7 @@ export function EntityMultiImageUploader({
const existingCount = value.uploaded.filter(img => !img.isLocal).length;
const newCount = value.uploaded.filter(img => img.isLocal).length;
- const parts = [];
+ const parts: string[] = [];
if (mode === 'edit' && existingCount > 0) {
parts.push(`${existingCount} existing photo${existingCount !== 1 ? 's' : ''}`);
diff --git a/src/components/upload/EntityPhotoGallery.tsx b/src/components/upload/EntityPhotoGallery.tsx
index ac775991..c6ff02e3 100644
--- a/src/components/upload/EntityPhotoGallery.tsx
+++ b/src/components/upload/EntityPhotoGallery.tsx
@@ -68,7 +68,7 @@ export function EntityPhotoGallery({
url: photo.cloudflare_image_url,
caption: photo.caption || undefined,
title: photo.title || undefined,
- user_id: photo.submitted_by,
+ user_id: photo.submitted_by || '',
created_at: photo.created_at,
})) || [];
@@ -148,7 +148,7 @@ export function EntityPhotoGallery({
- {isModerator && photos.length > 0 && (
+ {isModerator() && photos.length > 0 && (