fix: preserve model selection when toggling series
This commit is contained in:
@@ -171,10 +171,7 @@ export default function VehicleTree({ selection, onSelect }: Props) {
|
|||||||
<div
|
<div
|
||||||
className={`flex items-center gap-1 px-1 py-1 rounded cursor-pointer group text-xs
|
className={`flex items-center gap-1 px-1 py-1 rounded cursor-pointer group text-xs
|
||||||
${isSeriesSelected ? 'bg-primary/20 text-primary' : 'hover:bg-secondary/60'}`}
|
${isSeriesSelected ? 'bg-primary/20 text-primary' : 'hover:bg-secondary/60'}`}
|
||||||
onClick={() => {
|
onClick={() => toggleSeries(series.id)}
|
||||||
toggleSeries(series.id);
|
|
||||||
onSelect({ seriesId: series.id, modelId: null, taskId: null });
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{expanded ? <ChevronDown className="w-3 h-3 flex-shrink-0 text-muted-foreground" /> : <ChevronRight className="w-3 h-3 flex-shrink-0 text-muted-foreground" />}
|
{expanded ? <ChevronDown className="w-3 h-3 flex-shrink-0 text-muted-foreground" /> : <ChevronRight className="w-3 h-3 flex-shrink-0 text-muted-foreground" />}
|
||||||
<Train className="w-3 h-3 flex-shrink-0 text-muted-foreground" />
|
<Train className="w-3 h-3 flex-shrink-0 text-muted-foreground" />
|
||||||
|
|||||||
@@ -278,14 +278,11 @@ export default function Home() {
|
|||||||
|
|
||||||
// ── 左侧面板渲染 ───────────────────────────────────────────────────────────
|
// ── 左侧面板渲染 ───────────────────────────────────────────────────────────
|
||||||
const renderLeftPanel = () => {
|
const renderLeftPanel = () => {
|
||||||
if (selection.modelId == null) {
|
|
||||||
return (
|
|
||||||
<VehicleTree selection={selection} onSelect={setSelection} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-0 flex-1 flex-col">
|
<div className="flex min-h-0 flex-1 flex-col">
|
||||||
<VehicleTree selection={selection} onSelect={setSelection} />
|
<VehicleTree selection={selection} onSelect={setSelection} />
|
||||||
|
{selection.modelId != null && (
|
||||||
|
<>
|
||||||
<div className="h-px bg-border my-1" />
|
<div className="h-px bg-border my-1" />
|
||||||
<TaskManager
|
<TaskManager
|
||||||
modelId={selection.modelId}
|
modelId={selection.modelId}
|
||||||
@@ -296,6 +293,8 @@ export default function Home() {
|
|||||||
onCadFilesSelectionChange={setSelectedTaskCadFileIds}
|
onCadFilesSelectionChange={setSelectedTaskCadFileIds}
|
||||||
onSelectTaskCad={handleSelectCad}
|
onSelectTaskCad={handleSelectCad}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user