fix: show rename indicator on folder, not AGENTS.md file
Move the rename indicator (→ newName) in the file tree to only display on the parent directory node, not on the individual file. The preview header still shows the rename when viewing the file. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
bf9b057670
commit
43fa4fc487
1 changed files with 7 additions and 5 deletions
|
|
@ -133,7 +133,8 @@ function FrontmatterCard({ data }: { data: FrontmatterData }) {
|
||||||
// ── Import file tree customization ───────────────────────────────────
|
// ── Import file tree customization ───────────────────────────────────
|
||||||
|
|
||||||
function renderImportFileExtra(node: FileTreeNode, checked: boolean, renameMap: Map<string, string>) {
|
function renderImportFileExtra(node: FileTreeNode, checked: boolean, renameMap: Map<string, string>) {
|
||||||
const renamedTo = renameMap.get(node.path);
|
// Show rename indicator only on directories (folders), not individual files
|
||||||
|
const renamedTo = node.kind === "dir" ? renameMap.get(node.path) : undefined;
|
||||||
const actionBadge = node.action ? (
|
const actionBadge = node.action ? (
|
||||||
<span className={cn(
|
<span className={cn(
|
||||||
"shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-wide",
|
"shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-wide",
|
||||||
|
|
@ -673,7 +674,8 @@ export function CompanyImport() {
|
||||||
[importPreview],
|
[importPreview],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Map file paths (and their parent dir) → planned rename name for display in tree + preview
|
// Map directory paths → planned rename name for display in the file tree
|
||||||
|
// Also maps file paths for use in the preview header
|
||||||
const renameMap = useMemo(() => {
|
const renameMap = useMemo(() => {
|
||||||
const map = new Map<string, string>();
|
const map = new Map<string, string>();
|
||||||
if (!importPreview) return map;
|
if (!importPreview) return map;
|
||||||
|
|
@ -683,11 +685,11 @@ export function CompanyImport() {
|
||||||
if (isSkipped) continue;
|
if (isSkipped) continue;
|
||||||
const renamedTo = nameOverrides[c.slug] ?? c.plannedName;
|
const renamedTo = nameOverrides[c.slug] ?? c.plannedName;
|
||||||
if (renamedTo === c.originalName) continue;
|
if (renamedTo === c.originalName) continue;
|
||||||
// Map the file itself
|
// Map the parent directory (e.g. agents/ceo → gstack-ceo) for the file tree
|
||||||
map.set(c.filePath, renamedTo);
|
|
||||||
// Map the parent directory (e.g. agents/ceo → gstack-ceo)
|
|
||||||
const parentDir = c.filePath.split("/").slice(0, -1).join("/");
|
const parentDir = c.filePath.split("/").slice(0, -1).join("/");
|
||||||
if (parentDir) map.set(parentDir, renamedTo);
|
if (parentDir) map.set(parentDir, renamedTo);
|
||||||
|
// Map the file path too — used by the preview header, not shown in tree
|
||||||
|
map.set(c.filePath, renamedTo);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}, [importPreview, conflicts, nameOverrides, skippedSlugs]);
|
}, [importPreview, conflicts, nameOverrides, skippedSlugs]);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue