Refactor code structure and remove redundant changes

This commit is contained in:
pacnpal
2025-11-09 16:31:34 -05:00
parent 2884bc23ce
commit eb68cf40c6
1080 changed files with 27361 additions and 56687 deletions

View File

@@ -0,0 +1,61 @@
/**
* UI components for Park and Designer creation within RideForm
* Extracted for clarity - import these into RideForm.tsx
*/
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Plus, Building2, X } from 'lucide-react';
import type { TempParkData, TempCompanyData } from '@/types/company';
interface ParkSelectorProps {
tempNewPark: TempParkData | null;
onCreateNew: () => void;
onEdit: () => void;
onRemove: () => void;
parkId?: string;
onParkChange: (id: string) => void;
}
interface DesignerSelectorProps {
tempNewDesigner: TempCompanyData | null;
onCreateNew: () => void;
onEdit: () => void;
onRemove: () => void;
designerId?: string;
onDesignerChange: (id: string) => void;
}
export function RideParkSelector({ tempNewPark, onCreateNew, onEdit, onRemove }: ParkSelectorProps) {
return tempNewPark ? (
<div className="space-y-2">
<Badge variant="secondary" className="gap-2">
<Building2 className="h-3 w-3" />
New: {tempNewPark.name}
<button type="button" onClick={onRemove} className="ml-1 hover:text-destructive">×</button>
</Badge>
<Button type="button" variant="outline" size="sm" onClick={onEdit}>Edit New Park</Button>
</div>
) : (
<Button type="button" variant="outline" size="sm" onClick={onCreateNew}>
<Plus className="h-4 w-4 mr-2" />Create New Park
</Button>
);
}
export function RideDesignerSelector({ tempNewDesigner, onCreateNew, onEdit, onRemove }: DesignerSelectorProps) {
return tempNewDesigner ? (
<div className="space-y-2">
<Badge variant="secondary" className="gap-2">
<Building2 className="h-3 w-3" />
New: {tempNewDesigner.name}
<button type="button" onClick={onRemove} className="ml-1 hover:text-destructive">×</button>
</Badge>
<Button type="button" variant="outline" size="sm" onClick={onEdit}>Edit New Designer</Button>
</div>
) : (
<Button type="button" variant="outline" size="sm" onClick={onCreateNew}>
<Plus className="h-4 w-4 mr-2" />Create New Designer
</Button>
);
}