Fix ESLint errors

This commit is contained in:
gpt-engineer-app[bot]
2025-10-29 23:27:37 +00:00
parent 017879ba21
commit 41f4e3b920
16 changed files with 80 additions and 184 deletions

View File

@@ -1,9 +1,7 @@
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import * as z from 'zod';
import { entitySchemas } from '@/lib/entityValidationSchemas';
import { getErrorMessage } from '@/lib/errorHandler';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
@@ -15,36 +13,12 @@ import { SlugField } from '@/components/ui/slug-field';
import { FerrisWheel, Save, X } from 'lucide-react';
import { useUserRole } from '@/hooks/useUserRole';
import { HeadquartersLocationInput } from './HeadquartersLocationInput';
import { EntityMultiImageUploader, ImageAssignments } from '@/components/upload/EntityMultiImageUploader';
import { FlexibleDateInput, type DatePrecision } from '@/components/ui/flexible-date-input';
import { submitOperatorCreation, submitOperatorUpdate } from '@/lib/entitySubmissionHelpers';
import { EntityMultiImageUploader } from '@/components/upload/EntityMultiImageUploader';
import { useAuth } from '@/hooks/useAuth';
import { toast } from 'sonner';
import { handleError } from '@/lib/errorHandler';
import { useNavigate } from 'react-router-dom';
import type { UploadedImage } from '@/types/company';
// Raw form input state (before Zod transformation)
interface OperatorFormInput {
name: string;
slug: string;
company_type: 'designer' | 'manufacturer' | 'operator' | 'property_owner';
description?: string;
person_type: 'company' | 'individual' | 'firm' | 'organization';
founded_year?: string;
founded_date?: string;
founded_date_precision?: 'day' | 'month' | 'year';
headquarters_location?: string;
website_url?: string;
source_url?: string;
submission_notes?: string;
images?: {
uploaded: UploadedImage[];
banner_assignment?: number | null;
card_assignment?: number | null;
};
}
// Zod output type (after transformation)
type OperatorFormData = z.infer<typeof entitySchemas.operator>;
@@ -58,10 +32,9 @@ interface OperatorFormProps {
}>;
}
export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormProps) {
export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormProps): React.JSX.Element {
const { isModerator } = useUserRole();
const { user } = useAuth();
const navigate = useNavigate();
const {
register,
@@ -109,7 +82,7 @@ export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormPr
founded_year: data.founded_year ? parseInt(String(data.founded_year)) : undefined,
};
await onSubmit(formData);
onSubmit(formData);
// Only show success toast and close if not editing through moderation queue
if (!initialData?.id) {