Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ed1e09180 | ||
|
|
54d4cf6604 | ||
|
|
359e89971f | ||
|
|
7f833747b0 | ||
|
|
ab3f228d85 |
@@ -11,20 +11,11 @@ interface InstanceTabProps {
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
function formatFolderName(path: string, instances: Instance[], currentInstance: Instance): string {
|
||||
const name = path.split("/").pop() || path
|
||||
|
||||
const duplicates = instances.filter((i) => {
|
||||
const iName = i.folder.split("/").pop() || i.folder
|
||||
return iName === name
|
||||
})
|
||||
|
||||
if (duplicates.length > 1) {
|
||||
const index = duplicates.findIndex((i) => i.id === currentInstance.id)
|
||||
return `~/${name} (${index + 1})`
|
||||
}
|
||||
|
||||
return `~/${name}`
|
||||
function getPathBasename(path: string): string {
|
||||
// Instance folders can be POSIX-like (/Users/...) on macOS/Linux or Windows-like (C:\Users\...).
|
||||
// Normalize by trimming trailing separators and then splitting on both '/' and '\\'.
|
||||
const normalized = path.replace(/[\\/]+$/, "")
|
||||
return normalized.split(/[\\/]/).pop() || path
|
||||
}
|
||||
|
||||
const InstanceTab: Component<InstanceTabProps> = (props) => {
|
||||
@@ -58,7 +49,7 @@ const InstanceTab: Component<InstanceTabProps> = (props) => {
|
||||
>
|
||||
<FolderOpen class="w-4 h-4 flex-shrink-0" />
|
||||
<span class="tab-label">
|
||||
{props.instance.folder.split("/").pop() || props.instance.folder}
|
||||
{getPathBasename(props.instance.folder)}
|
||||
</span>
|
||||
<span
|
||||
class={`status-indicator session-status ml-auto ${statusClassName()}`}
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Session } from "../../../types/session"
|
||||
import type { KeyboardShortcut } from "../../../lib/keyboard-registry"
|
||||
import type { DrawerViewState } from "./types"
|
||||
|
||||
import { Search } from "lucide-solid"
|
||||
import { PlusSquare, Search } from "lucide-solid"
|
||||
import IconButton from "@suid/material/IconButton"
|
||||
import MenuOpenIcon from "@suid/icons-material/MenuOpen"
|
||||
import PushPinIcon from "@suid/icons-material/PushPin"
|
||||
@@ -56,6 +56,20 @@ const SessionSidebar: Component<SessionSidebarProps> = (props) => (
|
||||
{props.t("instanceShell.leftPanel.sessionsTitle")}
|
||||
</span>
|
||||
<div class="flex items-center gap-2 text-primary">
|
||||
<IconButton
|
||||
size="small"
|
||||
color="inherit"
|
||||
aria-label={props.t("sessionList.actions.newSession.ariaLabel")}
|
||||
title={props.t("sessionList.actions.newSession.title")}
|
||||
onClick={() => {
|
||||
const result = props.onNewSession()
|
||||
if (result instanceof Promise) {
|
||||
void result.catch((error) => log.error("Failed to create session:", error))
|
||||
}
|
||||
}}
|
||||
>
|
||||
<PlusSquare class="w-5 h-5" />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
size="small"
|
||||
color="inherit"
|
||||
@@ -71,7 +85,7 @@ const SessionSidebar: Component<SessionSidebarProps> = (props) => (
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Search class={props.showSearch() ? "w-4 h-4" : "w-4 h-4 opacity-70"} />
|
||||
<Search class="w-5 h-5" />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
size="small"
|
||||
|
||||
@@ -21,6 +21,8 @@ export const sessionMessages = {
|
||||
"sessionList.expand.expandAriaLabel": "Expand session",
|
||||
"sessionList.expand.collapseTitle": "Collapse",
|
||||
"sessionList.expand.expandTitle": "Expand",
|
||||
"sessionList.actions.newSession.ariaLabel": "New session",
|
||||
"sessionList.actions.newSession.title": "New session",
|
||||
"sessionList.actions.copyId.ariaLabel": "Copy session ID",
|
||||
"sessionList.actions.copyId.title": "Copy session ID",
|
||||
"sessionList.actions.rename.ariaLabel": "Rename session",
|
||||
|
||||
@@ -21,6 +21,8 @@ export const sessionMessages = {
|
||||
"sessionList.expand.expandAriaLabel": "Expandir sesión",
|
||||
"sessionList.expand.collapseTitle": "Colapsar",
|
||||
"sessionList.expand.expandTitle": "Expandir",
|
||||
"sessionList.actions.newSession.ariaLabel": "Nueva sesión",
|
||||
"sessionList.actions.newSession.title": "Nueva sesión",
|
||||
"sessionList.actions.copyId.ariaLabel": "Copiar ID de sesión",
|
||||
"sessionList.actions.copyId.title": "Copiar ID de sesión",
|
||||
"sessionList.actions.rename.ariaLabel": "Renombrar sesión",
|
||||
|
||||
@@ -21,6 +21,8 @@ export const sessionMessages = {
|
||||
"sessionList.expand.expandAriaLabel": "Développer la session",
|
||||
"sessionList.expand.collapseTitle": "Réduire",
|
||||
"sessionList.expand.expandTitle": "Développer",
|
||||
"sessionList.actions.newSession.ariaLabel": "Nouvelle session",
|
||||
"sessionList.actions.newSession.title": "Nouvelle session",
|
||||
"sessionList.actions.copyId.ariaLabel": "Copier l'ID de session",
|
||||
"sessionList.actions.copyId.title": "Copier l'ID de session",
|
||||
"sessionList.actions.rename.ariaLabel": "Renommer la session",
|
||||
|
||||
@@ -21,6 +21,8 @@ export const sessionMessages = {
|
||||
"sessionList.expand.expandAriaLabel": "セッションを展開",
|
||||
"sessionList.expand.collapseTitle": "折りたたむ",
|
||||
"sessionList.expand.expandTitle": "展開",
|
||||
"sessionList.actions.newSession.ariaLabel": "新しいセッション",
|
||||
"sessionList.actions.newSession.title": "新しいセッション",
|
||||
"sessionList.actions.copyId.ariaLabel": "セッション ID をコピー",
|
||||
"sessionList.actions.copyId.title": "セッション ID をコピー",
|
||||
"sessionList.actions.rename.ariaLabel": "セッション名を変更",
|
||||
|
||||
@@ -21,6 +21,8 @@ export const sessionMessages = {
|
||||
"sessionList.expand.expandAriaLabel": "Развернуть сессию",
|
||||
"sessionList.expand.collapseTitle": "Свернуть",
|
||||
"sessionList.expand.expandTitle": "Развернуть",
|
||||
"sessionList.actions.newSession.ariaLabel": "Новая сессия",
|
||||
"sessionList.actions.newSession.title": "Новая сессия",
|
||||
"sessionList.actions.copyId.ariaLabel": "Скопировать ID сессии",
|
||||
"sessionList.actions.copyId.title": "Скопировать ID сессии",
|
||||
"sessionList.actions.rename.ariaLabel": "Переименовать сессию",
|
||||
|
||||
@@ -21,6 +21,8 @@ export const sessionMessages = {
|
||||
"sessionList.expand.expandAriaLabel": "展开会话",
|
||||
"sessionList.expand.collapseTitle": "折叠",
|
||||
"sessionList.expand.expandTitle": "展开",
|
||||
"sessionList.actions.newSession.ariaLabel": "新建会话",
|
||||
"sessionList.actions.newSession.title": "新建会话",
|
||||
"sessionList.actions.copyId.ariaLabel": "复制会话 ID",
|
||||
"sessionList.actions.copyId.title": "复制会话 ID",
|
||||
"sessionList.actions.rename.ariaLabel": "重命名会话",
|
||||
|
||||
Reference in New Issue
Block a user