Skip to content
Open
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
10 changes: 10 additions & 0 deletions src/components/tabs/tab-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Reorder } from "motion/react"
import { useAppWorkspace } from "@/contexts/app-workspace-context"
import { useTabContext } from "@/contexts/tab-context"
import type { TabItem as TabItemData } from "@/contexts/tab-context"
import { useAcpActions } from "@/contexts/acp-connections-context"
import { useWorkspaceContext } from "@/contexts/workspace-context"
import { useIsCoarsePointer } from "@/hooks/use-is-coarse-pointer"
import { useShortcutSettings } from "@/hooks/use-shortcut-settings"
Expand All @@ -27,6 +28,7 @@ export function TabBar() {
} = useTabContext()
const { allFolders, branches } = useAppWorkspace()
const { mode, activePane, filesMaximized } = useWorkspaceContext()
const { reapplyConfig } = useAcpActions()

const folderIndex = useMemo(() => {
const map = new Map<number, { name: string }>()
Expand Down Expand Up @@ -112,6 +114,13 @@ export function TabBar() {
[]
)

const handleReconnect = useCallback(
async (tabId: string) => {
await reapplyConfig(tabId)
},
[reapplyConfig]
)

if (tabs.length === 0) return null

return (
Expand Down Expand Up @@ -154,6 +163,7 @@ export function TabBar() {
onCloseOthers={closeOtherTabs}
onCloseAll={closeAllTabs}
onPin={pinTab}
onReconnect={handleReconnect}
onToggleTile={toggleTileMode}
isCoarsePointer={isCoarsePointer}
isTouchSorting={touchSortingTabId === tab.id}
Expand Down
13 changes: 12 additions & 1 deletion src/components/tabs/tab-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { memo, useCallback, useMemo, useRef } from "react"
import { Reorder } from "motion/react"
import { X } from "lucide-react"
import { RefreshCw, X } from "lucide-react"
import { useTranslations } from "next-intl"
import { cn, handleMiddleClickClose } from "@/lib/utils"
import type { ConversationStatus } from "@/lib/types"
Expand All @@ -28,6 +28,7 @@ interface TabItemProps {
onCloseOthers: (tabId: string) => void
onCloseAll: () => void
onPin: (tabId: string) => void
onReconnect: (tabId: string) => void
onToggleTile: () => void
isCoarsePointer: boolean
isTouchSorting: boolean
Expand All @@ -46,6 +47,7 @@ export const TabItem = memo(function TabItem({
onCloseOthers,
onCloseAll,
onPin,
onReconnect,
onToggleTile,
isCoarsePointer,
isTouchSorting,
Expand Down Expand Up @@ -99,6 +101,10 @@ export const TabItem = memo(function TabItem({
onCloseOthers(tab.id)
}, [onCloseOthers, tab.id])

const handleReconnect = useCallback(() => {
onReconnect(tab.id)
}, [onReconnect, tab.id])

const whileDrag = useMemo(() => ({ scale: 1.03 }), [])

return (
Expand Down Expand Up @@ -167,6 +173,11 @@ export const TabItem = memo(function TabItem({
</div>
</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem onSelect={handleReconnect}>
<RefreshCw className="h-4 w-4" />
{t("reconnect")}
</ContextMenuItem>
<ContextMenuSeparator />
<ContextMenuItem onSelect={handleClose}>{t("close")}</ContextMenuItem>
<ContextMenuItem onSelect={handleCloseOthers}>
{t("closeOthers")}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "إغلاق تبويب المحادثة",
"reconnect": "إعادة الاتصال",
"close": "إغلاق",
"closeOthers": "إغلاق البقية",
"closeAll": "إغلاق الكل",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "Konversationstab schließen",
"reconnect": "Neu verbinden",
"close": "Schließen",
"closeOthers": "Andere schließen",
"closeAll": "Alle schließen",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "Close conversation tab",
"reconnect": "Reconnect",
"close": "Close",
"closeOthers": "Close Others",
"closeAll": "Close All",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "Cerrar pestaña de conversación",
"reconnect": "Reconectar",
"close": "Cerrar",
"closeOthers": "Cerrar otros",
"closeAll": "Cerrar todo",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "Fermer l’onglet de conversation",
"reconnect": "Reconnecter",
"close": "Fermer",
"closeOthers": "Fermer les autres",
"closeAll": "Tout fermer",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "会話タブを閉じる",
"reconnect": "再接続",
"close": "閉じる",
"closeOthers": "他を閉じる",
"closeAll": "すべて閉じる",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "대화 탭 닫기",
"reconnect": "다시 연결",
"close": "닫기",
"closeOthers": "다른 항목 닫기",
"closeAll": "모두 닫기",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "Fechar aba de conversa",
"reconnect": "Reconectar",
"close": "Fechar",
"closeOthers": "Fechar outros",
"closeAll": "Fechar tudo",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "关闭会话标签",
"reconnect": "重新连接",
"close": "关闭",
"closeOthers": "关闭其它",
"closeAll": "关闭所有",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/messages/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,7 @@
},
"tabs": {
"closeConversationTab": "關閉會話分頁",
"reconnect": "重新連接",
"close": "關閉",
"closeOthers": "關閉其它",
"closeAll": "關閉所有",
Expand Down
Loading