Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/tui/src/component/dialog-status.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TextAttributes } from "@opentui/core"
import { fileURLToPath } from "bun"
import path from "node:path"
import { useTheme } from "../context/theme"
import { useDialog } from "../ui/dialog"
import { useSync } from "../context/sync"
Expand All @@ -19,15 +20,13 @@ export function DialogStatus() {
const result = list.map((item) => {
const value = typeof item === "string" ? item : item[0]
if (value.startsWith("file://")) {
const path = fileURLToPath(value)
const parts = path.split("/")
const filename = parts.pop() || path
const filePath = fileURLToPath(value)
const filename = path.basename(filePath)
if (!filename.includes(".")) return { name: filename }
const basename = filename.split(".")[0]
if (basename === "index") {
const dirname = parts.pop()
const name = dirname || basename
return { name }
const dirname = path.basename(path.dirname(filePath))
return { name: dirname || basename }
}
return { name: basename }
}
Expand Down
Loading