Skip to content

Commit faa848c

Browse files
authored
Fix for #7229 Fix/project sidebar folder name (#7232)
1 parent 80772e5 commit faa848c

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

packages/app/src/components/dialog-edit-project.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ import { createMemo, createSignal, For, Show } from "solid-js"
77
import { createStore } from "solid-js/store"
88
import { useGlobalSDK } from "@/context/global-sdk"
99
import { type LocalProject, getAvatarColors } from "@/context/layout"
10+
import { getFilename } from "@opencode-ai/util/path"
1011
import { Avatar } from "@opencode-ai/ui/avatar"
1112

1213
const AVATAR_COLOR_KEYS = ["pink", "mint", "orange", "purple", "cyan", "lime"] as const
1314

14-
function getFilename(input: string) {
15-
const parts = input.split("/")
16-
return parts[parts.length - 1] || input
17-
}
18-
1915
export function DialogEditProject(props: { project: LocalProject }) {
2016
const dialog = useDialog()
2117
const globalSDK = useGlobalSDK()

packages/app/src/pages/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ export default function Layout(props: ParentProps) {
875875
</Collapsible>
876876
</Match>
877877
<Match when={true}>
878-
<Tooltip placement="right" value={props.project.worktree}>
878+
<Tooltip placement="right" value={getFilename(props.project.worktree)}>
879879
<ProjectVisual project={props.project} />
880880
</Tooltip>
881881
</Match>

packages/util/src/path.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export function getFilename(path: string | undefined) {
22
if (!path) return ""
3-
const trimmed = path.replace(/[\/]+$/, "")
4-
const parts = trimmed.split("/")
3+
const trimmed = path.replace(/[\/\\]+$/, "")
4+
const parts = trimmed.split(/[\/\\]/)
55
return parts[parts.length - 1] ?? ""
66
}
77

0 commit comments

Comments
 (0)