mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 07:31:14 -05:00
Fix edge function console statements
This commit is contained in:
@@ -86,14 +86,14 @@ export function CoasterStatsEditor({
|
||||
onChange(newStats.map((stat, i) => ({ ...stat, display_order: i })));
|
||||
};
|
||||
|
||||
const updateStat = (index: number, field: keyof CoasterStat, value: any) => {
|
||||
const updateStat = (index: number, field: keyof CoasterStat, value: string | number | boolean | null | undefined) => {
|
||||
const newStats = [...stats];
|
||||
|
||||
// Ensure unit is metric when updating unit field
|
||||
if (field === 'unit' && value) {
|
||||
if (field === 'unit' && value && typeof value === 'string') {
|
||||
try {
|
||||
validateMetricUnit(value, 'Unit');
|
||||
newStats[index] = { ...newStats[index], [field]: value };
|
||||
newStats[index] = { ...newStats[index], unit: value };
|
||||
// Clear error for this index
|
||||
setUnitErrors(prev => {
|
||||
const updated = { ...prev };
|
||||
|
||||
@@ -40,7 +40,7 @@ export function FormerNamesEditor({ names, onChange, currentName }: FormerNamesE
|
||||
onChange(newNames.map((name, i) => ({ ...name, order_index: i })));
|
||||
};
|
||||
|
||||
const updateName = (index: number, field: keyof FormerName, value: any) => {
|
||||
const updateName = (index: number, field: keyof FormerName, value: string | number | Date | null | undefined) => {
|
||||
const newNames = [...names];
|
||||
newNames[index] = { ...newNames[index], [field]: value };
|
||||
onChange(newNames);
|
||||
|
||||
@@ -64,14 +64,14 @@ export function TechnicalSpecsEditor({
|
||||
onChange(newSpecs.map((spec, i) => ({ ...spec, display_order: i })));
|
||||
};
|
||||
|
||||
const updateSpec = (index: number, field: keyof TechnicalSpec, value: any) => {
|
||||
const updateSpec = (index: number, field: keyof TechnicalSpec, value: string | number | boolean | null | undefined) => {
|
||||
const newSpecs = [...specs];
|
||||
|
||||
// Ensure unit is metric when updating unit field
|
||||
if (field === 'unit' && value) {
|
||||
if (field === 'unit' && value && typeof value === 'string') {
|
||||
try {
|
||||
validateMetricUnit(value, 'Unit');
|
||||
newSpecs[index] = { ...newSpecs[index], [field]: value };
|
||||
newSpecs[index] = { ...newSpecs[index], unit: value };
|
||||
// Clear error for this index
|
||||
setUnitErrors(prev => {
|
||||
const updated = { ...prev };
|
||||
|
||||
@@ -26,7 +26,7 @@ export function TurnstileCaptcha({
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [key, setKey] = useState(0);
|
||||
const turnstileRef = useRef<any>(null);
|
||||
const turnstileRef = useRef(null);
|
||||
|
||||
const handleSuccess = (token: string) => {
|
||||
setError(null);
|
||||
|
||||
@@ -11,9 +11,11 @@ interface AdminErrorBoundaryProps {
|
||||
section?: string; // e.g., "Moderation", "Users", "Settings"
|
||||
}
|
||||
|
||||
type ErrorWithId = Error & { errorId: string };
|
||||
|
||||
interface AdminErrorBoundaryState {
|
||||
hasError: boolean;
|
||||
error: Error | null;
|
||||
error: ErrorWithId | null;
|
||||
errorInfo: ErrorInfo | null;
|
||||
}
|
||||
|
||||
@@ -43,7 +45,7 @@ export class AdminErrorBoundary extends Component<AdminErrorBoundaryProps, Admin
|
||||
static getDerivedStateFromError(error: Error): Partial<AdminErrorBoundaryState> {
|
||||
return {
|
||||
hasError: true,
|
||||
error,
|
||||
error: error as ErrorWithId,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -60,7 +62,7 @@ export class AdminErrorBoundary extends Component<AdminErrorBoundaryProps, Admin
|
||||
errorId,
|
||||
});
|
||||
|
||||
this.setState({ errorInfo, error: { ...error, errorId } as any });
|
||||
this.setState({ errorInfo, error: { ...error, errorId } as ErrorWithId });
|
||||
}
|
||||
|
||||
handleRetry = () => {
|
||||
|
||||
Reference in New Issue
Block a user