Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions src/client/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@ export default function App() {
sendMessage({ type: 'session-rename', sessionId, newName })
}

const handleDuplicateSession = useCallback((sessionId: string) => {
const session = sessions.find((s) => s.id === sessionId)
if (session) {
sendMessage({ type: 'session-create', projectPath: session.projectPath, command: session.command })
}
}, [sessions, sendMessage])

// Apply theme to document
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme)
Expand Down Expand Up @@ -369,6 +376,7 @@ export default function App() {
onRename={handleRenameSession}
onResume={handleResumeSession}
onKill={handleKillSession}
onDuplicate={handleDuplicateSession}
onOpenSettings={handleOpenSettings}
loading={!hasLoaded}
error={connectionError || serverError}
Expand Down
23 changes: 23 additions & 0 deletions src/client/components/SessionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from '@dnd-kit/sortable'
import { CSS } from '@dnd-kit/utilities'
import { HandIcon, XCloseIcon } from '@untitledui-icons/react/line'
import Copy01Icon from '@untitledui-icons/react/line/esm/Copy01Icon'
import ChevronDownIcon from '@untitledui-icons/react/line/esm/ChevronDownIcon'
import ChevronRightIcon from '@untitledui-icons/react/line/esm/ChevronRightIcon'
import Edit05Icon from '@untitledui-icons/react/line/esm/Edit05Icon'
Expand Down Expand Up @@ -45,6 +46,7 @@ interface SessionListProps {
onRename: (sessionId: string, newName: string) => void
onResume?: (sessionId: string) => void
onKill?: (sessionId: string) => void
onDuplicate?: (sessionId: string) => void
onOpenSettings?: () => void
}

Expand Down Expand Up @@ -74,6 +76,7 @@ export default function SessionList({
onRename,
onResume,
onKill,
onDuplicate,
onOpenSettings,
}: SessionListProps) {
useTimestampRefresh()
Expand Down Expand Up @@ -605,6 +608,7 @@ export default function SessionList({
onCancelEdit={() => setEditingSessionId(null)}
onRename={(newName) => handleRename(session.id, newName)}
onKill={onKill ? () => onKill(session.id) : undefined}
onDuplicate={onDuplicate ? () => onDuplicate(session.id) : undefined}
onOpenSettings={onOpenSettings}
/>
)
Expand Down Expand Up @@ -732,6 +736,7 @@ interface SortableSessionItemProps {
onCancelEdit: () => void
onRename: (newName: string) => void
onKill?: () => void
onDuplicate?: () => void
onOpenSettings?: () => void
}

Expand All @@ -754,6 +759,7 @@ const SortableSessionItem = forwardRef<HTMLDivElement, SortableSessionItemProps>
onCancelEdit,
onRename,
onKill,
onDuplicate,
onOpenSettings,
}, ref) {
const {
Expand Down Expand Up @@ -841,6 +847,7 @@ const SortableSessionItem = forwardRef<HTMLDivElement, SortableSessionItemProps>
onCancelEdit={onCancelEdit}
onRename={onRename}
onKill={onKill}
onDuplicate={onDuplicate}
onOpenSettings={onOpenSettings}
/>
{dropIndicator === 'below' && (
Expand All @@ -865,6 +872,7 @@ interface SessionRowProps {
onCancelEdit: () => void
onRename: (newName: string) => void
onKill?: () => void
onDuplicate?: () => void
onOpenSettings?: () => void
}

Expand All @@ -881,6 +889,7 @@ function SessionRow({
onCancelEdit,
onRename,
onKill,
onDuplicate,
onOpenSettings,
}: SessionRowProps) {
const lastActivity = formatRelativeTime(session.lastActivity)
Expand Down Expand Up @@ -1113,6 +1122,20 @@ function SessionRow({
Settings
</button>
)}
{onDuplicate && (
<button
onClick={(e) => {
e.stopPropagation()
setContextMenu(null)
onDuplicate()
}}
className="w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2"
role="menuitem"
>
<Copy01Icon width={14} height={14} />
Duplicate
</button>
)}
{onKill && (
<>
<div className="my-1 border-t border-border" />
Expand Down