fix(catalog): remove suggestions that substitute different furniture
CI / check (push) Successful in 1m43s
CI / deploy (push) Successful in 1m27s
CI / e2e (push) Successful in 21s

This commit is contained in:
Simo committed 2026-09-05 15:26:46 +02:00
1 parent 33b6d1520e
commit 2d14e02a68
5 files changed
+15 -139

No files matched your search

+6 -72
View File
@@ -19,7 +19,7 @@ import type { FurniItem } from "./studio-types";
import { useSourceAssetChecks } from "./use-source-asset-checks";
export function ImportReview({
items: originalItems,
items,
sourceId,
source,
translation,
@@ -31,10 +31,8 @@ export function ImportReview({
source: string;
translation: string;
onCancel: () => void;
onConfirm: (items: FurniItem[], replaced?: boolean) => void;
onConfirm: (items: FurniItem[]) => void;
}) {
const [items, setItems] = useState(originalItems);
const [replacements, setReplacements] = useState<string[]>([]);
const inspection = useFurnitureInspection(
items.map((item) => item.classname),
);
@@ -112,22 +110,6 @@ export function ImportReview({
<strong>Selection:</strong> {items.length} furniture items
</p>
</div>
{replacements.length > 0 && (
<p className="text-sm">
Replacements selected: {replacements.join(" · ")}{" "}
<Button
variant="ghost"
onClick={() => {
setItems(originalItems);
setReplacements([]);
setStep("review");
setPage(0);
}}
>
Undo replacements
</Button>
</p>
)}
{assets.loading && !inspection.loading && (
<p role="status">
Checking source files… {assets.items.length} checked
@@ -156,58 +138,10 @@ export function ImportReview({
Source files unavailable: {check.classname}
</p>
<p className="text-xs text-[var(--admin-text-muted)]">
This item will be skipped. Choose a reachable alternative below
to replace it in this import.
The source has no downloadable files for this furniture. It
cannot be imported until its original .nitro or source files are
available.
</p>
{check.alternatives.length === 0 && (
<p className="text-sm">
No verified alternative found. Upload the original .nitro from
the import page if you have it.
</p>
)}
{check.alternatives.map((alternative) => (
<div
key={alternative.classname}
className="flex flex-wrap items-center justify-between gap-2 rounded-md bg-[var(--admin-canvas)] p-2"
>
<div className="text-sm">
<strong>{alternative.name}</strong>
<p className="font-mono text-xs">{alternative.classname}</p>
<p className="text-xs">
{alternative.type} · Revision {alternative.revision} · ID{" "}
{alternative.id}
</p>
</div>
<Button
variant="outline"
onClick={() => {
setItems((current) => [
...new Map(
current.map((item) => {
const next =
item.classname === check.classname
? {
...alternative,
alreadyImported: false,
nitroExists: false,
}
: item;
return [next.classname, next] as const;
}),
).values(),
]);
setReplacements((current) => [
...current,
`${check.classname} → ${alternative.classname}`,
]);
setStep("review");
setPage(0);
}}
>
Use this alternative
</Button>
</div>
))}
</section>
))}
{inspection.loading ? (
@@ -380,7 +314,7 @@ export function ImportReview({
if (step === "review") {
setStep("confirm");
setPage(0);
} else onConfirm(ready, replacements.length > 0);
} else onConfirm(ready);
}}
>
{step === "review"