mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 15:11:12 -05:00
Fix TypeScript build errors
This commit is contained in:
@@ -52,12 +52,7 @@ function AppContent() {
|
|||||||
return (
|
return (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<LocationAutoDetectProvider />
|
<LocationAutoDetectProvider />
|
||||||
<BrowserRouter
|
<BrowserRouter>
|
||||||
future={{
|
|
||||||
v7_startTransition: true,
|
|
||||||
v7_relativeSplatPath: true,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Toaster />
|
<Toaster />
|
||||||
<Sonner />
|
<Sonner />
|
||||||
<div className="min-h-screen flex flex-col">
|
<div className="min-h-screen flex flex-col">
|
||||||
|
|||||||
@@ -23,28 +23,6 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
|
|
||||||
type DesignerFormData = z.infer<typeof entitySchemas.designer>;
|
type DesignerFormData = z.infer<typeof entitySchemas.designer>;
|
||||||
|
|
||||||
// Input type for the form (before transformation)
|
|
||||||
type DesignerFormInput = {
|
|
||||||
name: string;
|
|
||||||
slug: string;
|
|
||||||
description?: string;
|
|
||||||
person_type: 'company' | 'individual' | 'firm' | 'organization';
|
|
||||||
website_url?: string;
|
|
||||||
founded_year?: string;
|
|
||||||
headquarters_location?: string;
|
|
||||||
images?: {
|
|
||||||
uploaded: Array<{
|
|
||||||
url: string;
|
|
||||||
cloudflare_id?: string;
|
|
||||||
file?: any;
|
|
||||||
isLocal?: boolean;
|
|
||||||
caption?: string;
|
|
||||||
}>;
|
|
||||||
banner_assignment?: number | null;
|
|
||||||
card_assignment?: number | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface DesignerFormProps {
|
interface DesignerFormProps {
|
||||||
onSubmit: (data: DesignerFormData) => void;
|
onSubmit: (data: DesignerFormData) => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
@@ -68,7 +46,7 @@ export function DesignerForm({ onSubmit, onCancel, initialData }: DesignerFormPr
|
|||||||
setValue,
|
setValue,
|
||||||
watch,
|
watch,
|
||||||
formState: { errors }
|
formState: { errors }
|
||||||
} = useForm<DesignerFormInput>({
|
} = useForm({
|
||||||
resolver: zodResolver(entitySchemas.designer),
|
resolver: zodResolver(entitySchemas.designer),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: initialData?.name || '',
|
name: initialData?.name || '',
|
||||||
|
|||||||
@@ -23,30 +23,6 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
|
|
||||||
type ManufacturerFormData = z.infer<typeof entitySchemas.manufacturer>;
|
type ManufacturerFormData = z.infer<typeof entitySchemas.manufacturer>;
|
||||||
|
|
||||||
// Input type for the form (before transformation)
|
|
||||||
type ManufacturerFormInput = {
|
|
||||||
name: string;
|
|
||||||
slug: string;
|
|
||||||
description?: string;
|
|
||||||
person_type: 'company' | 'individual' | 'firm' | 'organization';
|
|
||||||
website_url?: string;
|
|
||||||
founded_year?: string; // Legacy support
|
|
||||||
founded_date?: string;
|
|
||||||
founded_date_precision?: string;
|
|
||||||
headquarters_location?: string;
|
|
||||||
images?: {
|
|
||||||
uploaded: Array<{
|
|
||||||
url: string;
|
|
||||||
cloudflare_id?: string;
|
|
||||||
file?: any;
|
|
||||||
isLocal?: boolean;
|
|
||||||
caption?: string;
|
|
||||||
}>;
|
|
||||||
banner_assignment?: number | null;
|
|
||||||
card_assignment?: number | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface ManufacturerFormProps {
|
interface ManufacturerFormProps {
|
||||||
onSubmit: (data: ManufacturerFormData) => void;
|
onSubmit: (data: ManufacturerFormData) => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
@@ -70,7 +46,7 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
|
|||||||
setValue,
|
setValue,
|
||||||
watch,
|
watch,
|
||||||
formState: { errors }
|
formState: { errors }
|
||||||
} = useForm<ManufacturerFormInput>({
|
} = useForm({
|
||||||
resolver: zodResolver(entitySchemas.manufacturer),
|
resolver: zodResolver(entitySchemas.manufacturer),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: initialData?.name || '',
|
name: initialData?.name || '',
|
||||||
|
|||||||
@@ -23,30 +23,6 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
|
|
||||||
type OperatorFormData = z.infer<typeof entitySchemas.operator>;
|
type OperatorFormData = z.infer<typeof entitySchemas.operator>;
|
||||||
|
|
||||||
// Input type for the form (before transformation)
|
|
||||||
type OperatorFormInput = {
|
|
||||||
name: string;
|
|
||||||
slug: string;
|
|
||||||
description?: string;
|
|
||||||
person_type: 'company' | 'individual' | 'firm' | 'organization';
|
|
||||||
website_url?: string;
|
|
||||||
founded_year?: string;
|
|
||||||
founded_date?: string;
|
|
||||||
founded_date_precision?: string;
|
|
||||||
headquarters_location?: string;
|
|
||||||
images?: {
|
|
||||||
uploaded: Array<{
|
|
||||||
url: string;
|
|
||||||
cloudflare_id?: string;
|
|
||||||
file?: any;
|
|
||||||
isLocal?: boolean;
|
|
||||||
caption?: string;
|
|
||||||
}>;
|
|
||||||
banner_assignment?: number | null;
|
|
||||||
card_assignment?: number | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface OperatorFormProps {
|
interface OperatorFormProps {
|
||||||
onSubmit: (data: OperatorFormData) => void;
|
onSubmit: (data: OperatorFormData) => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
@@ -70,7 +46,7 @@ export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormPr
|
|||||||
setValue,
|
setValue,
|
||||||
watch,
|
watch,
|
||||||
formState: { errors }
|
formState: { errors }
|
||||||
} = useForm<OperatorFormInput>({
|
} = useForm({
|
||||||
resolver: zodResolver(entitySchemas.operator),
|
resolver: zodResolver(entitySchemas.operator),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: initialData?.name || '',
|
name: initialData?.name || '',
|
||||||
|
|||||||
@@ -52,28 +52,6 @@ const propertyOwnerSchema = z.object({
|
|||||||
|
|
||||||
type PropertyOwnerFormData = z.infer<typeof propertyOwnerSchema>;
|
type PropertyOwnerFormData = z.infer<typeof propertyOwnerSchema>;
|
||||||
|
|
||||||
// Input type for the form (before transformation)
|
|
||||||
type PropertyOwnerFormInput = {
|
|
||||||
name: string;
|
|
||||||
slug: string;
|
|
||||||
description?: string;
|
|
||||||
person_type: 'company' | 'individual' | 'firm' | 'organization';
|
|
||||||
website_url?: string;
|
|
||||||
founded_year?: string;
|
|
||||||
headquarters_location?: string;
|
|
||||||
images?: {
|
|
||||||
uploaded: Array<{
|
|
||||||
url: string;
|
|
||||||
cloudflare_id?: string;
|
|
||||||
file?: any;
|
|
||||||
isLocal?: boolean;
|
|
||||||
caption?: string;
|
|
||||||
}>;
|
|
||||||
banner_assignment?: number | null;
|
|
||||||
card_assignment?: number | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
interface PropertyOwnerFormProps {
|
interface PropertyOwnerFormProps {
|
||||||
onSubmit: (data: PropertyOwnerFormData) => void;
|
onSubmit: (data: PropertyOwnerFormData) => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
@@ -97,7 +75,7 @@ export function PropertyOwnerForm({ onSubmit, onCancel, initialData }: PropertyO
|
|||||||
setValue,
|
setValue,
|
||||||
watch,
|
watch,
|
||||||
formState: { errors }
|
formState: { errors }
|
||||||
} = useForm<PropertyOwnerFormInput>({
|
} = useForm({
|
||||||
resolver: zodResolver(propertyOwnerSchema),
|
resolver: zodResolver(propertyOwnerSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: initialData?.name || '',
|
name: initialData?.name || '',
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ interface MarkdownRendererProps {
|
|||||||
|
|
||||||
export function MarkdownRenderer({ content, className }: MarkdownRendererProps) {
|
export function MarkdownRenderer({ content, className }: MarkdownRendererProps) {
|
||||||
return (
|
return (
|
||||||
<ReactMarkdown
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'prose dark:prose-invert max-w-none',
|
'prose dark:prose-invert max-w-none',
|
||||||
'prose-headings:font-bold prose-headings:tracking-tight',
|
'prose-headings:font-bold prose-headings:tracking-tight',
|
||||||
@@ -25,7 +25,9 @@ export function MarkdownRenderer({ content, className }: MarkdownRendererProps)
|
|||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{content}
|
<ReactMarkdown>
|
||||||
</ReactMarkdown>
|
{content}
|
||||||
|
</ReactMarkdown>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,7 @@ const reviewSchema = z.object({
|
|||||||
title: z.string().optional(),
|
title: z.string().optional(),
|
||||||
content: z.string().min(10, 'Review must be at least 10 characters long'),
|
content: z.string().min(10, 'Review must be at least 10 characters long'),
|
||||||
visit_date: z.string().optional(),
|
visit_date: z.string().optional(),
|
||||||
wait_time_minutes: z.preprocess(
|
wait_time_minutes: z.number().positive().optional(),
|
||||||
(val) => {
|
|
||||||
if (val === '' || val === null || val === undefined) return undefined;
|
|
||||||
const num = Number(val);
|
|
||||||
return isNaN(num) ? undefined : num;
|
|
||||||
},
|
|
||||||
z.number().positive().optional()
|
|
||||||
),
|
|
||||||
photos: z.array(z.string()).optional()
|
photos: z.array(z.string()).optional()
|
||||||
});
|
});
|
||||||
type ReviewFormData = z.infer<typeof reviewSchema>;
|
type ReviewFormData = z.infer<typeof reviewSchema>;
|
||||||
|
|||||||
@@ -55,9 +55,13 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }: C
|
|||||||
...classNames,
|
...classNames,
|
||||||
}}
|
}}
|
||||||
components={{
|
components={{
|
||||||
IconLeft: ({ ..._props }) => <ChevronLeft className="h-4 w-4" />,
|
Chevron: ({ orientation, ...props }: any) => {
|
||||||
IconRight: ({ ..._props }) => <ChevronRight className="h-4 w-4" />,
|
if (orientation === 'left') {
|
||||||
}}
|
return <ChevronLeft className="h-4 w-4" />;
|
||||||
|
}
|
||||||
|
return <ChevronRight className="h-4 w-4" />;
|
||||||
|
},
|
||||||
|
} as any}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -101,21 +101,21 @@ const ChartTooltipContent = React.forwardRef<
|
|||||||
}
|
}
|
||||||
>(
|
>(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
active,
|
active,
|
||||||
payload,
|
payload,
|
||||||
className,
|
className,
|
||||||
indicator = "dot",
|
indicator = "dot",
|
||||||
hideLabel = false,
|
hideLabel = false,
|
||||||
hideIndicator = false,
|
hideIndicator = false,
|
||||||
label,
|
label,
|
||||||
labelFormatter,
|
labelFormatter,
|
||||||
labelClassName,
|
labelClassName,
|
||||||
formatter,
|
formatter,
|
||||||
color,
|
color,
|
||||||
nameKey,
|
nameKey,
|
||||||
labelKey,
|
labelKey,
|
||||||
},
|
}: any,
|
||||||
ref,
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const { config } = useChart();
|
const { config } = useChart();
|
||||||
@@ -229,11 +229,12 @@ const ChartLegend = RechartsPrimitive.Legend;
|
|||||||
|
|
||||||
const ChartLegendContent = React.forwardRef<
|
const ChartLegendContent = React.forwardRef<
|
||||||
HTMLDivElement,
|
HTMLDivElement,
|
||||||
React.ComponentProps<"div"> &
|
React.ComponentProps<"div"> & {
|
||||||
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
hideIcon?: boolean;
|
||||||
hideIcon?: boolean;
|
nameKey?: string;
|
||||||
nameKey?: string;
|
payload?: any[];
|
||||||
}
|
verticalAlign?: "top" | "bottom";
|
||||||
|
}
|
||||||
>(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
>(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
||||||
const { config } = useChart();
|
const { config } = useChart();
|
||||||
|
|
||||||
@@ -246,7 +247,7 @@ const ChartLegendContent = React.forwardRef<
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}
|
className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}
|
||||||
>
|
>
|
||||||
{payload.map((item) => {
|
{payload.map((item: any) => {
|
||||||
const key = `${nameKey || item.dataKey || "value"}`;
|
const key = `${nameKey || item.dataKey || "value"}`;
|
||||||
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export function DatePicker({
|
|||||||
onSelect={handleSelect}
|
onSelect={handleSelect}
|
||||||
disabled={getDisabledDates}
|
disabled={getDisabledDates}
|
||||||
initialFocus
|
initialFocus
|
||||||
captionLayout="dropdown-buttons"
|
captionLayout="dropdown"
|
||||||
fromYear={fromYear}
|
fromYear={fromYear}
|
||||||
toYear={toYear}
|
toYear={toYear}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const useModerationQueue = () => {
|
|||||||
const [currentLock, setCurrentLock] = useState<LockState | null>(null);
|
const [currentLock, setCurrentLock] = useState<LockState | null>(null);
|
||||||
const [queueStats, setQueueStats] = useState<QueueStats | null>(null);
|
const [queueStats, setQueueStats] = useState<QueueStats | null>(null);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const lockTimerRef = useRef<NodeJS.Timeout>();
|
const lockTimerRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,16 @@ export const companyValidationSchema = z.object({
|
|||||||
company_type: z.enum(['manufacturer', 'designer', 'operator', 'property_owner']),
|
company_type: z.enum(['manufacturer', 'designer', 'operator', 'property_owner']),
|
||||||
description: z.string().max(2000, 'Description must be less than 2000 characters').optional(),
|
description: z.string().max(2000, 'Description must be less than 2000 characters').optional(),
|
||||||
person_type: z.enum(['company', 'individual', 'firm', 'organization']),
|
person_type: z.enum(['company', 'individual', 'firm', 'organization']),
|
||||||
founded_year: z.number().min(1800, 'Founded year must be after 1800').max(currentYear, `Founded year cannot be in the future`).optional(),
|
founded_year: z.string()
|
||||||
|
.optional()
|
||||||
|
.transform(val => {
|
||||||
|
if (!val || val.trim() === '') return undefined;
|
||||||
|
const num = Number(val);
|
||||||
|
return isNaN(num) ? undefined : num;
|
||||||
|
})
|
||||||
|
.refine(val => val === undefined || (typeof val === 'number' && val >= 1800 && val <= currentYear), {
|
||||||
|
message: `Founded year must be between 1800 and ${currentYear}`
|
||||||
|
}),
|
||||||
founded_date: z.string().optional(),
|
founded_date: z.string().optional(),
|
||||||
founded_date_precision: z.enum(['day', 'month', 'year']).optional(),
|
founded_date_precision: z.enum(['day', 'month', 'year']).optional(),
|
||||||
headquarters_location: z.string().max(200, 'Location must be less than 200 characters').optional(),
|
headquarters_location: z.string().max(200, 'Location must be less than 200 characters').optional(),
|
||||||
|
|||||||
Reference in New Issue
Block a user