mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-09 03:11:58 +02:00
fix(import): name the new workspace in the preview's destination row
The row read "New workspace" no matter what the import was about to create, which matters more now that the name can come back numbered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
fd5cb448bb
commit
83f2606624
@@ -11,7 +11,7 @@ import { platform } from "@yaakapp-internal/platform";
|
||||
import classNames from "classnames";
|
||||
import { formatDistanceToNowStrict } from "date-fns";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { pluralize } from "../lib/pluralize";
|
||||
import { pluralize, pluralizeCount } from "../lib/pluralize";
|
||||
import { CommercialUseBanner } from "./CommercialUseBanner";
|
||||
import { Button } from "./core/Button";
|
||||
import { Checkbox } from "./core/Checkbox";
|
||||
@@ -309,7 +309,11 @@ function LoadedImportDataDialog({
|
||||
}).length;
|
||||
|
||||
const destinationLabel = (() => {
|
||||
if (plan.destination.type === "new_workspace") return "New workspace";
|
||||
if (plan.destination.type === "new_workspace") {
|
||||
const names = plan.resources.workspaces.map((w) => w.name).filter((n) => n !== "");
|
||||
if (names.length > 1) return pluralizeCount("new workspace", names.length);
|
||||
return names[0] == null ? "New workspace" : `${names[0]} (new workspace)`;
|
||||
}
|
||||
const { workspaceId, folderId } = plan.destination;
|
||||
const name = workspaces.find((w) => w.id === workspaceId)?.name ?? "Unknown workspace";
|
||||
return folderId != null && folderId === selectedFolder?.id
|
||||
|
||||
Reference in New Issue
Block a user