支持folder主界面多语言
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||||
import { Plus, RefreshCw, X } from "lucide-react"
|
import { Plus, RefreshCw, X } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { useFolderContext } from "@/contexts/folder-context"
|
import { useFolderContext } from "@/contexts/folder-context"
|
||||||
import { useTabContext } from "@/contexts/tab-context"
|
import { useTabContext } from "@/contexts/tab-context"
|
||||||
@@ -41,6 +42,7 @@ const ExistingConversationView = memo(function ExistingConversationView({
|
|||||||
isActive,
|
isActive,
|
||||||
reloadSignal,
|
reloadSignal,
|
||||||
}: ExistingConversationViewProps) {
|
}: ExistingConversationViewProps) {
|
||||||
|
const t = useTranslations("Folder.conversation")
|
||||||
const { refreshConversations, folder } = useFolderContext()
|
const { refreshConversations, folder } = useFolderContext()
|
||||||
const contextKey = `conv-${agentType}-${conversationId}`
|
const contextKey = `conv-${agentType}-${conversationId}`
|
||||||
|
|
||||||
@@ -193,12 +195,12 @@ const ExistingConversationView = memo(function ExistingConversationView({
|
|||||||
pendingReloadState.current = null
|
pendingReloadState.current = null
|
||||||
|
|
||||||
if (detailError) {
|
if (detailError) {
|
||||||
toast.error(`会话重新加载失败:${detailError}`)
|
toast.error(t("reloadFailed", { message: detailError }))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.success("当前会话已重新加载")
|
toast.success(t("reloaded"))
|
||||||
}, [detailLoading, detailError])
|
}, [detailLoading, detailError, t])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConversationShell
|
<ConversationShell
|
||||||
@@ -237,6 +239,7 @@ const ExistingConversationView = memo(function ExistingConversationView({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export function ConversationDetailPanel() {
|
export function ConversationDetailPanel() {
|
||||||
|
const t = useTranslations("Folder.conversation")
|
||||||
const { folder, newConversation } = useFolderContext()
|
const { folder, newConversation } = useFolderContext()
|
||||||
const { tabs, activeTabId, openNewConversationTab, closeTab } =
|
const { tabs, activeTabId, openNewConversationTab, closeTab } =
|
||||||
useTabContext()
|
useTabContext()
|
||||||
@@ -364,14 +367,14 @@ export function ConversationDetailPanel() {
|
|||||||
onSelect={handleReloadActiveConversation}
|
onSelect={handleReloadActiveConversation}
|
||||||
>
|
>
|
||||||
<RefreshCw className="h-4 w-4" />
|
<RefreshCw className="h-4 w-4" />
|
||||||
重新加载
|
{t("reload")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
disabled={!folder?.path}
|
disabled={!folder?.path}
|
||||||
onSelect={handleNewConversation}
|
onSelect={handleNewConversation}
|
||||||
>
|
>
|
||||||
<Plus className="h-4 w-4" />
|
<Plus className="h-4 w-4" />
|
||||||
新建会话
|
{t("newConversation")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
@@ -379,7 +382,7 @@ export function ConversationDetailPanel() {
|
|||||||
onSelect={handleCloseActiveTab}
|
onSelect={handleCloseActiveTab}
|
||||||
>
|
>
|
||||||
<X className="h-4 w-4" />
|
<X className="h-4 w-4" />
|
||||||
关闭会话
|
{t("closeConversation")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
import { useState, useEffect, useRef, useCallback } from "react"
|
import { useState, useEffect, useRef, useCallback } from "react"
|
||||||
import { formatDistanceToNow } from "date-fns"
|
import { formatDistanceToNow } from "date-fns"
|
||||||
|
import { enUS, zhCN, zhTW } from "date-fns/locale"
|
||||||
|
import { useLocale, useTranslations } from "next-intl"
|
||||||
import { useFolderContext } from "@/contexts/folder-context"
|
import { useFolderContext } from "@/contexts/folder-context"
|
||||||
import { useTabContext } from "@/contexts/tab-context"
|
import { useTabContext } from "@/contexts/tab-context"
|
||||||
import { listFolderConversations } from "@/lib/tauri"
|
import { listFolderConversations } from "@/lib/tauri"
|
||||||
@@ -31,6 +33,10 @@ export function SearchCommandDialog({
|
|||||||
open,
|
open,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
}: SearchCommandDialogProps) {
|
}: SearchCommandDialogProps) {
|
||||||
|
const t = useTranslations("Folder.search")
|
||||||
|
const locale = useLocale()
|
||||||
|
const dateFnsLocale =
|
||||||
|
locale === "zh-CN" ? zhCN : locale === "zh-TW" ? zhTW : enUS
|
||||||
const { folderId, conversations } = useFolderContext()
|
const { folderId, conversations } = useFolderContext()
|
||||||
const { openTab } = useTabContext()
|
const { openTab } = useTabContext()
|
||||||
|
|
||||||
@@ -96,12 +102,12 @@ export function SearchCommandDialog({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<CommandDialog
|
<CommandDialog
|
||||||
title="Search conversations"
|
title={t("dialogTitle")}
|
||||||
open={open}
|
open={open}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
>
|
>
|
||||||
<CommandInput
|
<CommandInput
|
||||||
placeholder="Search conversations..."
|
placeholder={t("placeholder")}
|
||||||
value={query}
|
value={query}
|
||||||
onValueChange={setQuery}
|
onValueChange={setQuery}
|
||||||
/>
|
/>
|
||||||
@@ -116,7 +122,7 @@ export function SearchCommandDialog({
|
|||||||
: "text-muted-foreground hover:text-foreground"
|
: "text-muted-foreground hover:text-foreground"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
All
|
{t("allAgents")}
|
||||||
</button>
|
</button>
|
||||||
{availableAgents.map((at) => (
|
{availableAgents.map((at) => (
|
||||||
<button
|
<button
|
||||||
@@ -138,10 +144,10 @@ export function SearchCommandDialog({
|
|||||||
<CommandList className="min-h-96">
|
<CommandList className="min-h-96">
|
||||||
<CommandEmpty>
|
<CommandEmpty>
|
||||||
{searching
|
{searching
|
||||||
? "Searching..."
|
? t("searching")
|
||||||
: !query.trim() && !agentFilter
|
: !query.trim() && !agentFilter
|
||||||
? "键入搜索以查询会话"
|
? t("typeToSearch")
|
||||||
: "No results found."}
|
: t("noResults")}
|
||||||
</CommandEmpty>
|
</CommandEmpty>
|
||||||
{results.length > 0 && (
|
{results.length > 0 && (
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
@@ -159,7 +165,7 @@ export function SearchCommandDialog({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<span className="flex-1 truncate">
|
<span className="flex-1 truncate">
|
||||||
{conv.title || "Untitled conversation"}
|
{conv.title || t("untitledConversation")}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-xs text-muted-foreground shrink-0">
|
<span className="text-xs text-muted-foreground shrink-0">
|
||||||
{AGENT_LABELS[conv.agent_type]}
|
{AGENT_LABELS[conv.agent_type]}
|
||||||
@@ -167,6 +173,7 @@ export function SearchCommandDialog({
|
|||||||
<span className="text-xs text-muted-foreground shrink-0">
|
<span className="text-xs text-muted-foreground shrink-0">
|
||||||
{formatDistanceToNow(new Date(conv.created_at), {
|
{formatDistanceToNow(new Date(conv.created_at), {
|
||||||
addSuffix: true,
|
addSuffix: true,
|
||||||
|
locale: dateFnsLocale,
|
||||||
})}
|
})}
|
||||||
</span>
|
</span>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
import { memo, useState, useCallback } from "react"
|
import { memo, useState, useCallback } from "react"
|
||||||
import { formatDistanceToNow } from "date-fns"
|
import { formatDistanceToNow } from "date-fns"
|
||||||
|
import { enUS, zhCN, zhTW } from "date-fns/locale"
|
||||||
import { GitBranch, Pencil, Trash2, Circle, Download, Plus } from "lucide-react"
|
import { GitBranch, Pencil, Trash2, Circle, Download, Plus } from "lucide-react"
|
||||||
|
import { useLocale, useTranslations } from "next-intl"
|
||||||
import type { DbConversationSummary, ConversationStatus } from "@/lib/types"
|
import type { DbConversationSummary, ConversationStatus } from "@/lib/types"
|
||||||
import { STATUS_COLORS, STATUS_LABELS } from "@/lib/types"
|
import { STATUS_COLORS } from "@/lib/types"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
import { AgentIcon } from "@/components/agent-icon"
|
import { AgentIcon } from "@/components/agent-icon"
|
||||||
import {
|
import {
|
||||||
@@ -69,12 +71,18 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({
|
|||||||
onImport,
|
onImport,
|
||||||
importing,
|
importing,
|
||||||
}: SidebarConversationCardProps) {
|
}: SidebarConversationCardProps) {
|
||||||
|
const t = useTranslations("Folder.conversationCard")
|
||||||
|
const tStatus = useTranslations("Folder.statusLabels")
|
||||||
|
const locale = useLocale()
|
||||||
|
const dateFnsLocale =
|
||||||
|
locale === "zh-CN" ? zhCN : locale === "zh-TW" ? zhTW : enUS
|
||||||
const [renameOpen, setRenameOpen] = useState(false)
|
const [renameOpen, setRenameOpen] = useState(false)
|
||||||
const [deleteOpen, setDeleteOpen] = useState(false)
|
const [deleteOpen, setDeleteOpen] = useState(false)
|
||||||
const [renameValue, setRenameValue] = useState("")
|
const [renameValue, setRenameValue] = useState("")
|
||||||
|
|
||||||
const timeAgo = formatDistanceToNow(new Date(conversation.updated_at), {
|
const timeAgo = formatDistanceToNow(new Date(conversation.updated_at), {
|
||||||
addSuffix: true,
|
addSuffix: true,
|
||||||
|
locale: dateFnsLocale,
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => {
|
||||||
@@ -123,7 +131,7 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({
|
|||||||
className="size-4 shrink-0"
|
className="size-4 shrink-0"
|
||||||
/>
|
/>
|
||||||
<span className="text-sm font-medium truncate">
|
<span className="text-sm font-medium truncate">
|
||||||
{conversation.title || "Untitled conversation"}
|
{conversation.title || t("untitledConversation")}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-3 mt-1 text-xs text-muted-foreground">
|
<div className="flex items-center gap-3 mt-1 text-xs text-muted-foreground">
|
||||||
@@ -142,20 +150,20 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({
|
|||||||
<>
|
<>
|
||||||
<ContextMenuItem onSelect={onNewConversation}>
|
<ContextMenuItem onSelect={onNewConversation}>
|
||||||
<Plus className="h-4 w-4" />
|
<Plus className="h-4 w-4" />
|
||||||
New Conversation
|
{t("newConversation")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<ContextMenuItem onSelect={handleRenameOpen}>
|
<ContextMenuItem onSelect={handleRenameOpen}>
|
||||||
<Pencil className="h-4 w-4" />
|
<Pencil className="h-4 w-4" />
|
||||||
Rename
|
{t("rename")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
<ContextMenuSub>
|
<ContextMenuSub>
|
||||||
<ContextMenuSubTrigger>
|
<ContextMenuSubTrigger>
|
||||||
<Circle className="h-4 w-4" />
|
<Circle className="h-4 w-4" />
|
||||||
Status
|
{t("status")}
|
||||||
</ContextMenuSubTrigger>
|
</ContextMenuSubTrigger>
|
||||||
<ContextMenuSubContent>
|
<ContextMenuSubContent>
|
||||||
{ALL_STATUSES.filter((s) => s !== conversation.status).map(
|
{ALL_STATUSES.filter((s) => s !== conversation.status).map(
|
||||||
@@ -170,7 +178,7 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({
|
|||||||
STATUS_COLORS[s]
|
STATUS_COLORS[s]
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{STATUS_LABELS[s]}
|
{tStatus(s)}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
@@ -182,14 +190,14 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({
|
|||||||
onSelect={() => setDeleteOpen(true)}
|
onSelect={() => setDeleteOpen(true)}
|
||||||
>
|
>
|
||||||
<Trash2 className="h-4 w-4" />
|
<Trash2 className="h-4 w-4" />
|
||||||
Delete
|
{t("delete")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
{onImport && (
|
{onImport && (
|
||||||
<>
|
<>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
<ContextMenuItem disabled={importing} onSelect={onImport}>
|
<ContextMenuItem disabled={importing} onSelect={onImport}>
|
||||||
<Download className="h-4 w-4" />
|
<Download className="h-4 w-4" />
|
||||||
{importing ? "Importing..." : "Import local sessions"}
|
{importing ? t("importing") : t("importLocalSessions")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -199,7 +207,7 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({
|
|||||||
<Dialog open={renameOpen} onOpenChange={setRenameOpen}>
|
<Dialog open={renameOpen} onOpenChange={setRenameOpen}>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Rename conversation</DialogTitle>
|
<DialogTitle>{t("renameConversation")}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<Input
|
<Input
|
||||||
value={renameValue}
|
value={renameValue}
|
||||||
@@ -212,9 +220,9 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({
|
|||||||
/>
|
/>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button variant="outline" onClick={() => setRenameOpen(false)}>
|
<Button variant="outline" onClick={() => setRenameOpen(false)}>
|
||||||
Cancel
|
{t("cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleRenameConfirm}>Save</Button>
|
<Button onClick={handleRenameConfirm}>{t("save")}</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -222,17 +230,17 @@ export const SidebarConversationCard = memo(function SidebarConversationCard({
|
|||||||
<AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}>
|
<AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>Delete conversation?</AlertDialogTitle>
|
<AlertDialogTitle>{t("deleteConversationTitle")}</AlertDialogTitle>
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
This will delete “
|
{t("deleteConversationDescription", {
|
||||||
{conversation.title || "Untitled conversation"}”. This
|
title: conversation.title || t("untitledConversation"),
|
||||||
action cannot be undone.
|
})}
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
<AlertDialogCancel>{t("cancel")}</AlertDialogCancel>
|
||||||
<AlertDialogAction onClick={handleDeleteConfirm}>
|
<AlertDialogAction onClick={handleDeleteConfirm}>
|
||||||
Delete
|
{t("delete")}
|
||||||
</AlertDialogAction>
|
</AlertDialogAction>
|
||||||
</AlertDialogFooter>
|
</AlertDialogFooter>
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
type Ref,
|
type Ref,
|
||||||
} from "react"
|
} from "react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { CheckCheck, ChevronRight, Download, Loader2, Plus } from "lucide-react"
|
import { CheckCheck, ChevronRight, Download, Loader2, Plus } from "lucide-react"
|
||||||
import { useFolderContext } from "@/contexts/folder-context"
|
import { useFolderContext } from "@/contexts/folder-context"
|
||||||
@@ -20,7 +21,7 @@ import {
|
|||||||
deleteConversation,
|
deleteConversation,
|
||||||
} from "@/lib/tauri"
|
} from "@/lib/tauri"
|
||||||
import type { ConversationStatus, DbConversationSummary } from "@/lib/types"
|
import type { ConversationStatus, DbConversationSummary } from "@/lib/types"
|
||||||
import { STATUS_ORDER, STATUS_LABELS, STATUS_COLORS } from "@/lib/types"
|
import { STATUS_ORDER, STATUS_COLORS } from "@/lib/types"
|
||||||
import { SidebarConversationCard } from "./sidebar-conversation-card"
|
import { SidebarConversationCard } from "./sidebar-conversation-card"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Skeleton } from "@/components/ui/skeleton"
|
import { Skeleton } from "@/components/ui/skeleton"
|
||||||
@@ -79,6 +80,9 @@ export function SidebarConversationList({
|
|||||||
}: {
|
}: {
|
||||||
ref?: Ref<SidebarConversationListHandle>
|
ref?: Ref<SidebarConversationListHandle>
|
||||||
}) {
|
}) {
|
||||||
|
const t = useTranslations("Folder.sidebar")
|
||||||
|
const tStatus = useTranslations("Folder.statusLabels")
|
||||||
|
const tCommon = useTranslations("Folder.common")
|
||||||
const {
|
const {
|
||||||
folder,
|
folder,
|
||||||
conversations,
|
conversations,
|
||||||
@@ -225,7 +229,7 @@ export function SidebarConversationList({
|
|||||||
if (importing) return
|
if (importing) return
|
||||||
setImporting(true)
|
setImporting(true)
|
||||||
const taskId = `import-${folderId}-${Date.now()}`
|
const taskId = `import-${folderId}-${Date.now()}`
|
||||||
addTask(taskId, "Importing local sessions")
|
addTask(taskId, t("importLocalSessions"))
|
||||||
updateTask(taskId, { status: "running" })
|
updateTask(taskId, { status: "running" })
|
||||||
try {
|
try {
|
||||||
const result = await importLocalConversations(folderId)
|
const result = await importLocalConversations(folderId)
|
||||||
@@ -233,19 +237,22 @@ export function SidebarConversationList({
|
|||||||
refreshConversations()
|
refreshConversations()
|
||||||
if (result.imported > 0) {
|
if (result.imported > 0) {
|
||||||
toast.success(
|
toast.success(
|
||||||
`Imported ${result.imported} session(s), skipped ${result.skipped}`
|
t("toasts.importedSessions", {
|
||||||
|
imported: result.imported,
|
||||||
|
skipped: result.skipped,
|
||||||
|
})
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
toast.info(`No new sessions found (skipped ${result.skipped})`)
|
toast.info(t("toasts.noNewSessionsFound", { skipped: result.skipped }))
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = e instanceof Error ? e.message : String(e)
|
const msg = e instanceof Error ? e.message : String(e)
|
||||||
updateTask(taskId, { status: "failed", error: msg })
|
updateTask(taskId, { status: "failed", error: msg })
|
||||||
toast.error(`Import failed: ${msg}`)
|
toast.error(t("toasts.importFailed", { message: msg }))
|
||||||
} finally {
|
} finally {
|
||||||
setImporting(false)
|
setImporting(false)
|
||||||
}
|
}
|
||||||
}, [importing, folderId, addTask, updateTask, refreshConversations])
|
}, [importing, folderId, addTask, updateTask, refreshConversations, t])
|
||||||
|
|
||||||
const handleCompleteAllReview = useCallback(async () => {
|
const handleCompleteAllReview = useCallback(async () => {
|
||||||
if (completingReview || reviewConversationCount === 0) return
|
if (completingReview || reviewConversationCount === 0) return
|
||||||
@@ -258,12 +265,12 @@ export function SidebarConversationList({
|
|||||||
)
|
)
|
||||||
refreshConversations()
|
refreshConversations()
|
||||||
toast.success(
|
toast.success(
|
||||||
`Marked ${reviewConversationCount} review session(s) as completed`
|
t("toasts.reviewCompleted", { count: reviewConversationCount })
|
||||||
)
|
)
|
||||||
setCompleteReviewOpen(false)
|
setCompleteReviewOpen(false)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = e instanceof Error ? e.message : String(e)
|
const msg = e instanceof Error ? e.message : String(e)
|
||||||
toast.error(`Failed to complete review sessions: ${msg}`)
|
toast.error(t("toasts.completeReviewFailed", { message: msg }))
|
||||||
} finally {
|
} finally {
|
||||||
setCompletingReview(false)
|
setCompletingReview(false)
|
||||||
}
|
}
|
||||||
@@ -272,6 +279,7 @@ export function SidebarConversationList({
|
|||||||
reviewConversationCount,
|
reviewConversationCount,
|
||||||
reviewConversations,
|
reviewConversations,
|
||||||
refreshConversations,
|
refreshConversations,
|
||||||
|
t,
|
||||||
])
|
])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -290,14 +298,16 @@ export function SidebarConversationList({
|
|||||||
</div>
|
</div>
|
||||||
) : error ? (
|
) : error ? (
|
||||||
<div className="flex-1 flex items-center justify-center px-3">
|
<div className="flex-1 flex items-center justify-center px-3">
|
||||||
<p className="text-destructive text-xs">Error: {error}</p>
|
<p className="text-destructive text-xs">
|
||||||
|
{t("error", { message: error })}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
) : conversations.length === 0 ? (
|
) : conversations.length === 0 ? (
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<ContextMenuTrigger asChild>
|
<ContextMenuTrigger asChild>
|
||||||
<div className="flex-1 flex flex-col items-center justify-center px-3 gap-3">
|
<div className="flex-1 flex flex-col items-center justify-center px-3 gap-3">
|
||||||
<p className="text-muted-foreground text-xs text-center">
|
<p className="text-muted-foreground text-xs text-center">
|
||||||
No conversations found.
|
{t("noConversationsFound")}
|
||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -310,19 +320,19 @@ export function SidebarConversationList({
|
|||||||
) : (
|
) : (
|
||||||
<Download className="h-3.5 w-3.5 mr-1.5" />
|
<Download className="h-3.5 w-3.5 mr-1.5" />
|
||||||
)}
|
)}
|
||||||
{importing ? "Importing..." : "Import local sessions"}
|
{importing ? t("importing") : t("importLocalSessions")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</ContextMenuTrigger>
|
</ContextMenuTrigger>
|
||||||
<ContextMenuContent>
|
<ContextMenuContent>
|
||||||
<ContextMenuItem onSelect={handleNewConversation}>
|
<ContextMenuItem onSelect={handleNewConversation}>
|
||||||
<Plus className="h-4 w-4" />
|
<Plus className="h-4 w-4" />
|
||||||
New Conversation
|
{t("newConversation")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
<ContextMenuItem disabled={importing} onSelect={handleImport}>
|
<ContextMenuItem disabled={importing} onSelect={handleImport}>
|
||||||
<Download className="h-4 w-4" />
|
<Download className="h-4 w-4" />
|
||||||
{importing ? "Importing..." : "Import local sessions"}
|
{importing ? t("importing") : t("importLocalSessions")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@@ -356,7 +366,7 @@ export function SidebarConversationList({
|
|||||||
STATUS_COLORS[status]
|
STATUS_COLORS[status]
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<span>{STATUS_LABELS[status]}</span>
|
<span>{tStatus(status)}</span>
|
||||||
<span className="ml-auto text-muted-foreground/60 tabular-nums">
|
<span className="ml-auto text-muted-foreground/60 tabular-nums">
|
||||||
{items.length}
|
{items.length}
|
||||||
</span>
|
</span>
|
||||||
@@ -381,7 +391,7 @@ export function SidebarConversationList({
|
|||||||
onSelect={() => setCompleteReviewOpen(true)}
|
onSelect={() => setCompleteReviewOpen(true)}
|
||||||
>
|
>
|
||||||
<CheckCheck className="h-4 w-4" />
|
<CheckCheck className="h-4 w-4" />
|
||||||
Complete all sessions
|
{t("completeAllSessions")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@@ -421,12 +431,12 @@ export function SidebarConversationList({
|
|||||||
<ContextMenuContent>
|
<ContextMenuContent>
|
||||||
<ContextMenuItem onSelect={handleNewConversation}>
|
<ContextMenuItem onSelect={handleNewConversation}>
|
||||||
<Plus className="h-4 w-4" />
|
<Plus className="h-4 w-4" />
|
||||||
New Conversation
|
{t("newConversation")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
<ContextMenuItem disabled={importing} onSelect={handleImport}>
|
<ContextMenuItem disabled={importing} onSelect={handleImport}>
|
||||||
<Download className="h-4 w-4" />
|
<Download className="h-4 w-4" />
|
||||||
{importing ? "Importing..." : "Import local sessions"}
|
{importing ? t("importing") : t("importLocalSessions")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@@ -439,21 +449,22 @@ export function SidebarConversationList({
|
|||||||
>
|
>
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>Complete all review sessions?</AlertDialogTitle>
|
<AlertDialogTitle>{t("completeAllReviewTitle")}</AlertDialogTitle>
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
This will mark all {reviewConversationCount} session(s) in Review
|
{t("completeAllReviewDescription", {
|
||||||
as completed.
|
count: reviewConversationCount,
|
||||||
|
})}
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
<AlertDialogCancel disabled={completingReview}>
|
<AlertDialogCancel disabled={completingReview}>
|
||||||
Cancel
|
{tCommon("cancel")}
|
||||||
</AlertDialogCancel>
|
</AlertDialogCancel>
|
||||||
<AlertDialogAction
|
<AlertDialogAction
|
||||||
disabled={completingReview || reviewConversationCount === 0}
|
disabled={completingReview || reviewConversationCount === 0}
|
||||||
onClick={handleCompleteAllReview}
|
onClick={handleCompleteAllReview}
|
||||||
>
|
>
|
||||||
{completingReview ? "Completing..." : "Confirm"}
|
{completingReview ? t("completing") : tCommon("confirm")}
|
||||||
</AlertDialogAction>
|
</AlertDialogAction>
|
||||||
</AlertDialogFooter>
|
</AlertDialogFooter>
|
||||||
</AlertDialogContent>
|
</AlertDialogContent>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
|||||||
import dynamic from "next/dynamic"
|
import dynamic from "next/dynamic"
|
||||||
import { ChevronDown, ChevronRight, FileCode2, FileIcon } from "lucide-react"
|
import { ChevronDown, ChevronRight, FileCode2, FileIcon } from "lucide-react"
|
||||||
import type { editor as MonacoEditorNs } from "monaco-editor"
|
import type { editor as MonacoEditorNs } from "monaco-editor"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useWorkspaceContext } from "@/contexts/workspace-context"
|
import { useWorkspaceContext } from "@/contexts/workspace-context"
|
||||||
import { DiffViewer } from "@/components/diff/diff-viewer"
|
import { DiffViewer } from "@/components/diff/diff-viewer"
|
||||||
import { UnifiedDiffPreview } from "@/components/diff/unified-diff-preview"
|
import { UnifiedDiffPreview } from "@/components/diff/unified-diff-preview"
|
||||||
@@ -490,6 +491,7 @@ function DiffFileList({
|
|||||||
onOpenDiff: (path: string) => Promise<void>
|
onOpenDiff: (path: string) => Promise<void>
|
||||||
openFilePreview: (path: string) => Promise<void>
|
openFilePreview: (path: string) => Promise<void>
|
||||||
}) {
|
}) {
|
||||||
|
const t = useTranslations("Folder.fileWorkspacePanel")
|
||||||
return (
|
return (
|
||||||
<div className="h-full flex flex-col min-h-0">
|
<div className="h-full flex flex-col min-h-0">
|
||||||
<div className="border-b border-border bg-muted/25 px-3 py-2 space-y-1">
|
<div className="border-b border-border bg-muted/25 px-3 py-2 space-y-1">
|
||||||
@@ -499,10 +501,7 @@ function DiffFileList({
|
|||||||
{badge}
|
{badge}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<span>
|
<span>{t("fileCount", { count: diffOutline.files.length })}</span>
|
||||||
{diffOutline.files.length}{" "}
|
|
||||||
{diffOutline.files.length === 1 ? "file" : "files"}
|
|
||||||
</span>
|
|
||||||
<span className="font-mono text-green-600 dark:text-green-400">
|
<span className="font-mono text-green-600 dark:text-green-400">
|
||||||
+{diffOutline.totalAdditions}
|
+{diffOutline.totalAdditions}
|
||||||
</span>
|
</span>
|
||||||
@@ -553,14 +552,14 @@ function DiffFileList({
|
|||||||
void onOpenDiff(file.path)
|
void onOpenDiff(file.path)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
查看差异
|
{t("viewDiff")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
void openFilePreview(file.path)
|
void openFilePreview(file.path)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
打开文件
|
{t("openFile")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@@ -572,6 +571,7 @@ function DiffFileList({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function FileWorkspacePanel() {
|
export function FileWorkspacePanel() {
|
||||||
|
const t = useTranslations("Folder.fileWorkspacePanel")
|
||||||
const {
|
const {
|
||||||
activeFileTab,
|
activeFileTab,
|
||||||
openBranchDiff,
|
openBranchDiff,
|
||||||
@@ -999,9 +999,7 @@ export function FileWorkspacePanel() {
|
|||||||
return (
|
return (
|
||||||
<div className="h-full flex flex-col items-center justify-center text-center px-6">
|
<div className="h-full flex flex-col items-center justify-center text-center px-6">
|
||||||
<FileCode2 className="h-8 w-8 text-muted-foreground/60 mb-3" />
|
<FileCode2 className="h-8 w-8 text-muted-foreground/60 mb-3" />
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">{t("openFileOrDiff")}</p>
|
||||||
Open a file or diff from the right panel
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1017,19 +1015,19 @@ export function FileWorkspacePanel() {
|
|||||||
const origLabel = isCommitDiff
|
const origLabel = isCommitDiff
|
||||||
? `${commitHash}~1`
|
? `${commitHash}~1`
|
||||||
: isExternalConflictDiff
|
: isExternalConflictDiff
|
||||||
? "Disk"
|
? t("disk")
|
||||||
: "HEAD"
|
: t("head")
|
||||||
const modLabel = isCommitDiff
|
const modLabel = isCommitDiff
|
||||||
? commitHash
|
? commitHash
|
||||||
: isExternalConflictDiff
|
: isExternalConflictDiff
|
||||||
? "Unsaved"
|
? t("unsaved")
|
||||||
: "Working Tree"
|
: t("workingTree")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full relative">
|
<div className="h-full relative">
|
||||||
{activeFileTab.loading && (
|
{activeFileTab.loading && (
|
||||||
<div className="absolute top-2 right-3 z-10 rounded-md bg-background/70 px-2 py-1 text-[11px] text-muted-foreground backdrop-blur-sm">
|
<div className="absolute top-2 right-3 z-10 rounded-md bg-background/70 px-2 py-1 text-[11px] text-muted-foreground backdrop-blur-sm">
|
||||||
Loading...
|
{t("loading")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!activeFileTab.loading && (
|
{!activeFileTab.loading && (
|
||||||
@@ -1055,7 +1053,7 @@ export function FileWorkspacePanel() {
|
|||||||
<div className="h-full relative">
|
<div className="h-full relative">
|
||||||
{activeFileTab.loading && (
|
{activeFileTab.loading && (
|
||||||
<div className="absolute top-2 right-3 z-10 rounded-md bg-background/70 px-2 py-1 text-[11px] text-muted-foreground backdrop-blur-sm">
|
<div className="absolute top-2 right-3 z-10 rounded-md bg-background/70 px-2 py-1 text-[11px] text-muted-foreground backdrop-blur-sm">
|
||||||
Loading...
|
{t("loading")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<UnifiedDiffPreview
|
<UnifiedDiffPreview
|
||||||
@@ -1074,13 +1072,16 @@ export function FileWorkspacePanel() {
|
|||||||
? diffListContext.commitHash.slice(0, 7)
|
? diffListContext.commitHash.slice(0, 7)
|
||||||
: diffListContext.kind === "branch"
|
: diffListContext.kind === "branch"
|
||||||
? diffListContext.branch
|
? diffListContext.branch
|
||||||
: "Working Tree"
|
: t("workingTree")
|
||||||
|
|
||||||
const description =
|
const description =
|
||||||
diffListContext.kind === "commit"
|
diffListContext.kind === "commit"
|
||||||
? diffListContext.commitMessage
|
? diffListContext.commitMessage
|
||||||
: diffListContext.kind === "branch"
|
: diffListContext.kind === "branch"
|
||||||
? `${diffListContext.path} · compare with ${diffListContext.branch}`
|
? t("compareWithBranch", {
|
||||||
|
path: diffListContext.path,
|
||||||
|
branch: diffListContext.branch,
|
||||||
|
})
|
||||||
: diffListContext.path
|
: diffListContext.path
|
||||||
|
|
||||||
const handleOpenDiff = async (path: string) => {
|
const handleOpenDiff = async (path: string) => {
|
||||||
@@ -1101,7 +1102,7 @@ export function FileWorkspacePanel() {
|
|||||||
<div className="h-full relative">
|
<div className="h-full relative">
|
||||||
{activeFileTab.loading && (
|
{activeFileTab.loading && (
|
||||||
<div className="absolute top-2 right-3 z-10 rounded-md bg-background/70 px-2 py-1 text-[11px] text-muted-foreground backdrop-blur-sm">
|
<div className="absolute top-2 right-3 z-10 rounded-md bg-background/70 px-2 py-1 text-[11px] text-muted-foreground backdrop-blur-sm">
|
||||||
Loading...
|
{t("loading")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!activeFileTab.loading && (
|
{!activeFileTab.loading && (
|
||||||
@@ -1121,17 +1122,14 @@ export function FileWorkspacePanel() {
|
|||||||
<div className="h-full relative">
|
<div className="h-full relative">
|
||||||
{activeFileTab.loading && (
|
{activeFileTab.loading && (
|
||||||
<div className="absolute top-2 right-3 z-10 rounded-md bg-background/70 px-2 py-1 text-[11px] text-muted-foreground backdrop-blur-sm">
|
<div className="absolute top-2 right-3 z-10 rounded-md bg-background/70 px-2 py-1 text-[11px] text-muted-foreground backdrop-blur-sm">
|
||||||
Loading...
|
{t("loading")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="h-full flex flex-col min-h-0">
|
<div className="h-full flex flex-col min-h-0">
|
||||||
{diffOutline && (
|
{diffOutline && (
|
||||||
<div className="border-b border-border bg-muted/25">
|
<div className="border-b border-border bg-muted/25">
|
||||||
<div className="px-3 py-1.5 text-[11px] text-muted-foreground flex items-center gap-3">
|
<div className="px-3 py-1.5 text-[11px] text-muted-foreground flex items-center gap-3">
|
||||||
<span>
|
<span>{t("fileCount", { count: diffOutline.files.length })}</span>
|
||||||
{diffOutline.files.length}{" "}
|
|
||||||
{diffOutline.files.length === 1 ? "file" : "files"}
|
|
||||||
</span>
|
|
||||||
<span className="font-mono text-green-600 dark:text-green-400">
|
<span className="font-mono text-green-600 dark:text-green-400">
|
||||||
+{diffOutline.totalAdditions}
|
+{diffOutline.totalAdditions}
|
||||||
</span>
|
</span>
|
||||||
@@ -1139,7 +1137,7 @@ export function FileWorkspacePanel() {
|
|||||||
-{diffOutline.totalDeletions}
|
-{diffOutline.totalDeletions}
|
||||||
</span>
|
</span>
|
||||||
{diffOutline.totalHunks > 0 && (
|
{diffOutline.totalHunks > 0 && (
|
||||||
<span>{diffOutline.totalHunks} hunks</span>
|
<span>{t("hunkCount", { count: diffOutline.totalHunks })}</span>
|
||||||
)}
|
)}
|
||||||
{allHunks.length > 0 && (
|
{allHunks.length > 0 && (
|
||||||
<div className="ml-auto flex items-center gap-1">
|
<div className="ml-auto flex items-center gap-1">
|
||||||
@@ -1150,7 +1148,7 @@ export function FileWorkspacePanel() {
|
|||||||
className="rounded border border-border bg-background px-2 py-0.5 text-[10px] disabled:opacity-40 hover:bg-muted transition-colors inline-flex items-center gap-1"
|
className="rounded border border-border bg-background px-2 py-0.5 text-[10px] disabled:opacity-40 hover:bg-muted transition-colors inline-flex items-center gap-1"
|
||||||
>
|
>
|
||||||
<ChevronRight className="h-3 w-3 rotate-180" />
|
<ChevronRight className="h-3 w-3 rotate-180" />
|
||||||
Prev
|
{t("prev")}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -1161,7 +1159,7 @@ export function FileWorkspacePanel() {
|
|||||||
}
|
}
|
||||||
className="rounded border border-border bg-background px-2 py-0.5 text-[10px] disabled:opacity-40 hover:bg-muted transition-colors inline-flex items-center gap-1"
|
className="rounded border border-border bg-background px-2 py-0.5 text-[10px] disabled:opacity-40 hover:bg-muted transition-colors inline-flex items-center gap-1"
|
||||||
>
|
>
|
||||||
Next
|
{t("next")}
|
||||||
<ChevronRight className="h-3 w-3" />
|
<ChevronRight className="h-3 w-3" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -1245,7 +1243,9 @@ export function FileWorkspacePanel() {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => jumpToLine(hunk.startLine)}
|
onClick={() => jumpToLine(hunk.startLine)}
|
||||||
className="shrink-0 rounded border border-border bg-background px-1.5 py-0.5 hover:bg-muted transition-colors"
|
className="shrink-0 rounded border border-border bg-background px-1.5 py-0.5 hover:bg-muted transition-colors"
|
||||||
title={`Jump to line ${hunk.startLine}`}
|
title={t("jumpToLine", {
|
||||||
|
line: hunk.startLine,
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
L{hunk.startLine}
|
L{hunk.startLine}
|
||||||
</button>
|
</button>
|
||||||
@@ -1259,7 +1259,7 @@ export function FileWorkspacePanel() {
|
|||||||
})}
|
})}
|
||||||
{diffOutline.files.length === 0 && (
|
{diffOutline.files.length === 0 && (
|
||||||
<div className="text-[11px] text-muted-foreground px-1 py-0.5">
|
<div className="text-[11px] text-muted-foreground px-1 py-0.5">
|
||||||
No parsed diff sections
|
{t("noParsedDiffSections")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -1279,7 +1279,7 @@ export function FileWorkspacePanel() {
|
|||||||
theme={editorTheme}
|
theme={editorTheme}
|
||||||
loading={
|
loading={
|
||||||
<div className="h-full flex items-center justify-center text-xs text-muted-foreground">
|
<div className="h-full flex items-center justify-center text-xs text-muted-foreground">
|
||||||
Loading editor...
|
{t("loadingEditor")}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
options={{
|
options={{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from "react"
|
import { useCallback, useEffect, useRef, useState } from "react"
|
||||||
import { Reorder } from "motion/react"
|
import { Reorder } from "motion/react"
|
||||||
import { FileText, GitCompare, X } from "lucide-react"
|
import { FileText, GitCompare, X } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useWorkspaceContext } from "@/contexts/workspace-context"
|
import { useWorkspaceContext } from "@/contexts/workspace-context"
|
||||||
import { useShortcutSettings } from "@/hooks/use-shortcut-settings"
|
import { useShortcutSettings } from "@/hooks/use-shortcut-settings"
|
||||||
import { matchShortcutEvent } from "@/lib/keyboard-shortcuts"
|
import { matchShortcutEvent } from "@/lib/keyboard-shortcuts"
|
||||||
@@ -16,6 +17,7 @@ import {
|
|||||||
} from "@/components/ui/context-menu"
|
} from "@/components/ui/context-menu"
|
||||||
|
|
||||||
export function FileWorkspaceTabBar() {
|
export function FileWorkspaceTabBar() {
|
||||||
|
const t = useTranslations("Folder.fileWorkspace")
|
||||||
const {
|
const {
|
||||||
mode,
|
mode,
|
||||||
activePane,
|
activePane,
|
||||||
@@ -80,7 +82,7 @@ export function FileWorkspaceTabBar() {
|
|||||||
if (fileTabs.length === 0) {
|
if (fileTabs.length === 0) {
|
||||||
return (
|
return (
|
||||||
<div className="h-10 px-3 flex items-center border-b border-border text-xs text-muted-foreground">
|
<div className="h-10 px-3 flex items-center border-b border-border text-xs text-muted-foreground">
|
||||||
Files
|
{t("files")}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -159,7 +161,7 @@ export function FileWorkspaceTabBar() {
|
|||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
closeFileTab(tab.id)
|
closeFileTab(tab.id)
|
||||||
}}
|
}}
|
||||||
aria-label="Close file tab"
|
aria-label={t("closeFileTab")}
|
||||||
>
|
>
|
||||||
<X className="h-3 w-3" />
|
<X className="h-3 w-3" />
|
||||||
</button>
|
</button>
|
||||||
@@ -167,14 +169,14 @@ export function FileWorkspaceTabBar() {
|
|||||||
</ContextMenuTrigger>
|
</ContextMenuTrigger>
|
||||||
<ContextMenuContent>
|
<ContextMenuContent>
|
||||||
<ContextMenuItem onSelect={() => closeFileTab(tab.id)}>
|
<ContextMenuItem onSelect={() => closeFileTab(tab.id)}>
|
||||||
关闭
|
{t("close")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem onSelect={() => closeOtherFileTabs(tab.id)}>
|
<ContextMenuItem onSelect={() => closeOtherFileTabs(tab.id)}>
|
||||||
关闭其它
|
{t("closeOthers")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
<ContextMenuItem onSelect={closeAllFileTabs}>
|
<ContextMenuItem onSelect={closeAllFileTabs}>
|
||||||
关闭所有
|
{t("closeAll")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useEffect, useMemo, useRef, useState } from "react"
|
import { useEffect, useMemo, useRef, useState } from "react"
|
||||||
import { ChevronRight, FileIcon } from "lucide-react"
|
import { ChevronRight, FileIcon } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useFolderContext } from "@/contexts/folder-context"
|
import { useFolderContext } from "@/contexts/folder-context"
|
||||||
import { useTabContext } from "@/contexts/tab-context"
|
import { useTabContext } from "@/contexts/tab-context"
|
||||||
import type { LiveMessage } from "@/contexts/acp-connections-context"
|
import type { LiveMessage } from "@/contexts/acp-connections-context"
|
||||||
@@ -77,8 +78,15 @@ function mergeLiveTurns(params: {
|
|||||||
liveMessage: LiveMessage | null
|
liveMessage: LiveMessage | null
|
||||||
connStatus: ConnectionStatus | null
|
connStatus: ConnectionStatus | null
|
||||||
pendingPromptText: string | null
|
pendingPromptText: string | null
|
||||||
|
fallbackPromptText: string
|
||||||
}): MessageTurn[] {
|
}): MessageTurn[] {
|
||||||
const { turns, liveMessage, connStatus, pendingPromptText } = params
|
const {
|
||||||
|
turns,
|
||||||
|
liveMessage,
|
||||||
|
connStatus,
|
||||||
|
pendingPromptText,
|
||||||
|
fallbackPromptText,
|
||||||
|
} = params
|
||||||
if (!liveMessage || connStatus !== "prompting") return turns
|
if (!liveMessage || connStatus !== "prompting") return turns
|
||||||
|
|
||||||
const liveBlocks = liveMessage.content.flatMap((block) => {
|
const liveBlocks = liveMessage.content.flatMap((block) => {
|
||||||
@@ -118,7 +126,7 @@ function mergeLiveTurns(params: {
|
|||||||
id: `live-user-${liveMessage.id}`,
|
id: `live-user-${liveMessage.id}`,
|
||||||
role: "user",
|
role: "user",
|
||||||
blocks: [
|
blocks: [
|
||||||
{ type: "text", text: pendingPromptText?.trim() || "Current response" },
|
{ type: "text", text: pendingPromptText?.trim() || fallbackPromptText },
|
||||||
],
|
],
|
||||||
timestamp: now,
|
timestamp: now,
|
||||||
})
|
})
|
||||||
@@ -145,6 +153,7 @@ function SessionFilesContent({
|
|||||||
connStatus: ConnectionStatus | null
|
connStatus: ConnectionStatus | null
|
||||||
pendingPromptText: string | null
|
pendingPromptText: string | null
|
||||||
}) {
|
}) {
|
||||||
|
const t = useTranslations("Folder.sessionFiles")
|
||||||
const { detail, loading, refetch } = useDbMessageDetail(conversationId)
|
const { detail, loading, refetch } = useDbMessageDetail(conversationId)
|
||||||
const { openSessionFileDiff } = useWorkspaceContext()
|
const { openSessionFileDiff } = useWorkspaceContext()
|
||||||
const { folder } = useFolderContext()
|
const { folder } = useFolderContext()
|
||||||
@@ -166,8 +175,9 @@ function SessionFilesContent({
|
|||||||
liveMessage,
|
liveMessage,
|
||||||
connStatus,
|
connStatus,
|
||||||
pendingPromptText,
|
pendingPromptText,
|
||||||
|
fallbackPromptText: t("currentResponse"),
|
||||||
}),
|
}),
|
||||||
[detail?.turns, liveMessage, connStatus, pendingPromptText]
|
[detail?.turns, liveMessage, connStatus, pendingPromptText, t]
|
||||||
)
|
)
|
||||||
const groups = useMemo(
|
const groups = useMemo(
|
||||||
() => (turns.length > 0 ? extractSessionFilesGrouped(turns) : []),
|
() => (turns.length > 0 ? extractSessionFilesGrouped(turns) : []),
|
||||||
@@ -182,7 +192,7 @@ function SessionFilesContent({
|
|||||||
) => {
|
) => {
|
||||||
openSessionFileDiff(
|
openSessionFileDiff(
|
||||||
filePath,
|
filePath,
|
||||||
diffContent ?? `No diff data available for ${filePath}`,
|
diffContent ?? t("noDiffDataAvailable", { filePath }),
|
||||||
`msg-${groupIndex + 1}-chg-${changeIndex + 1}`
|
`msg-${groupIndex + 1}-chg-${changeIndex + 1}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -190,7 +200,9 @@ function SessionFilesContent({
|
|||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center h-full p-4">
|
<div className="flex items-center justify-center h-full p-4">
|
||||||
<p className="text-xs text-muted-foreground text-center">Loading...</p>
|
<p className="text-xs text-muted-foreground text-center">
|
||||||
|
{t("loading")}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -199,7 +211,7 @@ function SessionFilesContent({
|
|||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center h-full p-4">
|
<div className="flex items-center justify-center h-full p-4">
|
||||||
<p className="text-xs text-muted-foreground text-center">
|
<p className="text-xs text-muted-foreground text-center">
|
||||||
No file changes found in this conversation
|
{t("noFileChangesInConversation")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -258,12 +270,10 @@ function SessionFilesContent({
|
|||||||
</p>
|
</p>
|
||||||
<div className="mt-2 flex flex-wrap items-center gap-1.5">
|
<div className="mt-2 flex flex-wrap items-center gap-1.5">
|
||||||
<span className="rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] text-muted-foreground">
|
<span className="rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] text-muted-foreground">
|
||||||
{group.files.length}{" "}
|
{t("changeCount", { count: group.files.length })}
|
||||||
{group.files.length === 1 ? "change" : "changes"}
|
|
||||||
</span>
|
</span>
|
||||||
<span className="rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] text-muted-foreground">
|
<span className="rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] text-muted-foreground">
|
||||||
{uniqueFileCount}{" "}
|
{t("fileCount", { count: uniqueFileCount })}
|
||||||
{uniqueFileCount === 1 ? "File" : "Files"}
|
|
||||||
</span>
|
</span>
|
||||||
<span className="inline-flex items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[10px] text-foreground">
|
<span className="inline-flex items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[10px] text-foreground">
|
||||||
<CommitFileAdditions
|
<CommitFileAdditions
|
||||||
@@ -338,7 +348,7 @@ function SessionFilesContent({
|
|||||||
</p>
|
</p>
|
||||||
{isRemoved ? (
|
{isRemoved ? (
|
||||||
<span className="inline-flex shrink-0 items-center rounded-md border border-destructive/30 bg-destructive/10 px-1.5 py-0.5 font-mono text-[10px] text-destructive">
|
<span className="inline-flex shrink-0 items-center rounded-md border border-destructive/30 bg-destructive/10 px-1.5 py-0.5 font-mono text-[10px] text-destructive">
|
||||||
Remove
|
{t("remove")}
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<span className="inline-flex shrink-0 items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[10px] text-foreground">
|
<span className="inline-flex shrink-0 items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[10px] text-foreground">
|
||||||
@@ -366,6 +376,7 @@ function SessionFilesContent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SessionFilesTab() {
|
export function SessionFilesTab() {
|
||||||
|
const t = useTranslations("Folder.sessionFiles")
|
||||||
const { tabs, activeTabId } = useTabContext()
|
const { tabs, activeTabId } = useTabContext()
|
||||||
|
|
||||||
const activeTab = tabs.find((t) => t.id === activeTabId)
|
const activeTab = tabs.find((t) => t.id === activeTabId)
|
||||||
@@ -378,7 +389,7 @@ export function SessionFilesTab() {
|
|||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center h-full p-4">
|
<div className="flex items-center justify-center h-full p-4">
|
||||||
<p className="text-xs text-muted-foreground text-center">
|
<p className="text-xs text-muted-foreground text-center">
|
||||||
Open a conversation to see its file changes
|
{t("openConversationToSeeChanges")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -388,7 +399,7 @@ export function SessionFilesTab() {
|
|||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center h-full p-4">
|
<div className="flex items-center justify-center h-full p-4">
|
||||||
<p className="text-xs text-muted-foreground text-center">
|
<p className="text-xs text-muted-foreground text-center">
|
||||||
No file changes found in this conversation
|
{t("noFileChangesInConversation")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useCallback, useState } from "react"
|
import { useCallback, useState } from "react"
|
||||||
import { FileDiff, Folder, FolderPen, GitCommit } from "lucide-react"
|
import { FileDiff, Folder, FolderPen, GitCommit } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import {
|
import {
|
||||||
useAuxPanelContext,
|
useAuxPanelContext,
|
||||||
type AuxPanelTab,
|
type AuxPanelTab,
|
||||||
@@ -13,6 +14,7 @@ import { GitLogTab } from "./aux-panel-git-log-tab"
|
|||||||
import { SessionFilesTab } from "./aux-panel-session-files-tab"
|
import { SessionFilesTab } from "./aux-panel-session-files-tab"
|
||||||
|
|
||||||
export function AuxPanel() {
|
export function AuxPanel() {
|
||||||
|
const t = useTranslations("Folder.auxPanel.tabs")
|
||||||
const { isOpen, activeTab, setActiveTab } = useAuxPanelContext()
|
const { isOpen, activeTab, setActiveTab } = useAuxPanelContext()
|
||||||
const [hasMountedFileTree, setHasMountedFileTree] = useState(
|
const [hasMountedFileTree, setHasMountedFileTree] = useState(
|
||||||
activeTab === "file_tree"
|
activeTab === "file_tree"
|
||||||
@@ -54,16 +56,32 @@ export function AuxPanel() {
|
|||||||
variant="line"
|
variant="line"
|
||||||
className="h-10 w-full shrink-0 justify-start border-b border-border px-3 group-data-horizontal/tabs:h-10"
|
className="h-10 w-full shrink-0 justify-start border-b border-border px-3 group-data-horizontal/tabs:h-10"
|
||||||
>
|
>
|
||||||
<TabsTrigger value="session_files" title="Diff" aria-label="Diff">
|
<TabsTrigger
|
||||||
|
value="session_files"
|
||||||
|
title={t("diff")}
|
||||||
|
aria-label={t("diff")}
|
||||||
|
>
|
||||||
<FileDiff className="h-3.5 w-3.5" />
|
<FileDiff className="h-3.5 w-3.5" />
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="file_tree" title="Files" aria-label="Files">
|
<TabsTrigger
|
||||||
|
value="file_tree"
|
||||||
|
title={t("files")}
|
||||||
|
aria-label={t("files")}
|
||||||
|
>
|
||||||
<Folder className="h-3.5 w-3.5" />
|
<Folder className="h-3.5 w-3.5" />
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="changes" title="Changes" aria-label="Changes">
|
<TabsTrigger
|
||||||
|
value="changes"
|
||||||
|
title={t("changes")}
|
||||||
|
aria-label={t("changes")}
|
||||||
|
>
|
||||||
<FolderPen className="h-3.5 w-3.5" />
|
<FolderPen className="h-3.5 w-3.5" />
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="git_log" title="Commits" aria-label="Commits">
|
<TabsTrigger
|
||||||
|
value="git_log"
|
||||||
|
title={t("commits")}
|
||||||
|
aria-label={t("commits")}
|
||||||
|
>
|
||||||
<GitCommit className="h-3.5 w-3.5" />
|
<GitCommit className="h-3.5 w-3.5" />
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ChevronDown, Folder, FolderOpen, GitBranch } from "lucide-react"
|
import { ChevronDown, Folder, FolderOpen, GitBranch } from "lucide-react"
|
||||||
import { open } from "@tauri-apps/plugin-dialog"
|
import { open } from "@tauri-apps/plugin-dialog"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
@@ -22,13 +23,14 @@ import { CloneDialog } from "@/components/welcome/clone-dialog"
|
|||||||
import type { FolderHistoryEntry } from "@/lib/types"
|
import type { FolderHistoryEntry } from "@/lib/types"
|
||||||
|
|
||||||
export function FolderNameDropdown() {
|
export function FolderNameDropdown() {
|
||||||
|
const t = useTranslations("Folder.folderNameDropdown")
|
||||||
const { folder } = useFolderContext()
|
const { folder } = useFolderContext()
|
||||||
const [openFolders, setOpenFolders] = useState<FolderHistoryEntry[]>([])
|
const [openFolders, setOpenFolders] = useState<FolderHistoryEntry[]>([])
|
||||||
const [history, setHistory] = useState<FolderHistoryEntry[]>([])
|
const [history, setHistory] = useState<FolderHistoryEntry[]>([])
|
||||||
const [cloneOpen, setCloneOpen] = useState(false)
|
const [cloneOpen, setCloneOpen] = useState(false)
|
||||||
|
|
||||||
const folderPath = folder?.path ?? ""
|
const folderPath = folder?.path ?? ""
|
||||||
const folderName = folder?.name ?? "文件夹"
|
const folderName = folder?.name ?? t("fallbackFolderName")
|
||||||
|
|
||||||
async function handleOpenChange(open: boolean) {
|
async function handleOpenChange(open: boolean) {
|
||||||
if (open) {
|
if (open) {
|
||||||
@@ -77,16 +79,16 @@ export function FolderNameDropdown() {
|
|||||||
<DropdownMenuContent className="min-w-64" align="start">
|
<DropdownMenuContent className="min-w-64" align="start">
|
||||||
<DropdownMenuItem onSelect={handleOpenFolder}>
|
<DropdownMenuItem onSelect={handleOpenFolder}>
|
||||||
<FolderOpen className="h-3.5 w-3.5 shrink-0" />
|
<FolderOpen className="h-3.5 w-3.5 shrink-0" />
|
||||||
Open Folder
|
{t("openFolder")}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onSelect={() => setCloneOpen(true)}>
|
<DropdownMenuItem onSelect={() => setCloneOpen(true)}>
|
||||||
<GitBranch className="h-3.5 w-3.5 shrink-0" />
|
<GitBranch className="h-3.5 w-3.5 shrink-0" />
|
||||||
Clone Repository
|
{t("cloneRepository")}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
{openFolders.length > 0 && (
|
{openFolders.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuLabel>已打开</DropdownMenuLabel>
|
<DropdownMenuLabel>{t("opened")}</DropdownMenuLabel>
|
||||||
{openFolders.map((entry) => (
|
{openFolders.map((entry) => (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
key={entry.path}
|
key={entry.path}
|
||||||
@@ -114,7 +116,7 @@ export function FolderNameDropdown() {
|
|||||||
{history.length > 0 && (
|
{history.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuLabel>最近打开</DropdownMenuLabel>
|
<DropdownMenuLabel>{t("recentOpen")}</DropdownMenuLabel>
|
||||||
{history.map((entry) => (
|
{history.map((entry) => (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
key={entry.path}
|
key={entry.path}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
Search,
|
Search,
|
||||||
Settings,
|
Settings,
|
||||||
} from "lucide-react"
|
} from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { getGitBranch, openFolderWindow, openSettingsWindow } from "@/lib/tauri"
|
import { getGitBranch, openFolderWindow, openSettingsWindow } from "@/lib/tauri"
|
||||||
import { useFolderContext } from "@/contexts/folder-context"
|
import { useFolderContext } from "@/contexts/folder-context"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
@@ -41,22 +42,24 @@ import { SearchCommandDialog } from "@/components/conversations/search-command-d
|
|||||||
const MODE_TABS = [
|
const MODE_TABS = [
|
||||||
{
|
{
|
||||||
mode: "conversation",
|
mode: "conversation",
|
||||||
title: "会话模式",
|
titleKey: "conversation",
|
||||||
icon: MessageSquare,
|
icon: MessageSquare,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
mode: "fusion",
|
mode: "fusion",
|
||||||
title: "融合模式",
|
titleKey: "fusion",
|
||||||
icon: Columns2,
|
icon: Columns2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
mode: "files",
|
mode: "files",
|
||||||
title: "文件模式",
|
titleKey: "files",
|
||||||
icon: FileCode2,
|
icon: FileCode2,
|
||||||
},
|
},
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export function FolderTitleBar() {
|
export function FolderTitleBar() {
|
||||||
|
const tModes = useTranslations("Folder.modes")
|
||||||
|
const tTitleBar = useTranslations("Folder.folderTitleBar")
|
||||||
const { folder } = useFolderContext()
|
const { folder } = useFolderContext()
|
||||||
const { isOpen, toggle } = useSidebarContext()
|
const { isOpen, toggle } = useSidebarContext()
|
||||||
const { isOpen: auxPanelOpen, toggle: toggleAuxPanel } = useAuxPanelContext()
|
const { isOpen: auxPanelOpen, toggle: toggleAuxPanel } = useAuxPanelContext()
|
||||||
@@ -212,7 +215,7 @@ export function FolderTitleBar() {
|
|||||||
center={
|
center={
|
||||||
<div
|
<div
|
||||||
role="tablist"
|
role="tablist"
|
||||||
aria-label="工作区模式"
|
aria-label={tModes("workspaceModesAria")}
|
||||||
className="relative flex h-[27px] items-center rounded-full border border-border/80 bg-background/80 p-0.5"
|
className="relative flex h-[27px] items-center rounded-full border border-border/80 bg-background/80 p-0.5"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -222,6 +225,7 @@ export function FolderTitleBar() {
|
|||||||
{MODE_TABS.map((item) => {
|
{MODE_TABS.map((item) => {
|
||||||
const Icon = item.icon
|
const Icon = item.icon
|
||||||
const isActive = mode === item.mode
|
const isActive = mode === item.mode
|
||||||
|
const title = tModes(item.titleKey)
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={item.mode}
|
key={item.mode}
|
||||||
@@ -235,8 +239,8 @@ export function FolderTitleBar() {
|
|||||||
onClick={() => setMode(item.mode)}
|
onClick={() => setMode(item.mode)}
|
||||||
onKeyDown={(event) => handleModeKeyDown(event, item.mode)}
|
onKeyDown={(event) => handleModeKeyDown(event, item.mode)}
|
||||||
onMouseDown={(event) => event.preventDefault()}
|
onMouseDown={(event) => event.preventDefault()}
|
||||||
title={item.title}
|
title={title}
|
||||||
aria-label={item.title}
|
aria-label={title}
|
||||||
aria-selected={isActive}
|
aria-selected={isActive}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
@@ -259,7 +263,13 @@ export function FolderTitleBar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 hover:text-foreground/80"
|
className="h-6 w-6 hover:text-foreground/80"
|
||||||
onClick={toggle}
|
onClick={toggle}
|
||||||
title={`${isOpen ? "Hide Sidebar" : "Show Sidebar"} (${formatShortcutLabel(shortcuts.toggle_sidebar, isMac)})`}
|
title={tTitleBar("withShortcut", {
|
||||||
|
label: tTitleBar(isOpen ? "hideSidebar" : "showSidebar"),
|
||||||
|
shortcut: formatShortcutLabel(
|
||||||
|
shortcuts.toggle_sidebar,
|
||||||
|
isMac
|
||||||
|
),
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<PanelLeft className="h-3.5 w-3.5" />
|
<PanelLeft className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -268,7 +278,13 @@ export function FolderTitleBar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className={`h-6 w-6 hover:text-foreground/80 ${terminalOpen ? "bg-accent" : ""}`}
|
className={`h-6 w-6 hover:text-foreground/80 ${terminalOpen ? "bg-accent" : ""}`}
|
||||||
onClick={() => toggleTerminal()}
|
onClick={() => toggleTerminal()}
|
||||||
title={`Toggle Terminal (${formatShortcutLabel(shortcuts.toggle_terminal, isMac)})`}
|
title={tTitleBar("withShortcut", {
|
||||||
|
label: tTitleBar("toggleTerminal"),
|
||||||
|
shortcut: formatShortcutLabel(
|
||||||
|
shortcuts.toggle_terminal,
|
||||||
|
isMac
|
||||||
|
),
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<PanelBottom className="h-3.5 w-3.5" />
|
<PanelBottom className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -277,7 +293,13 @@ export function FolderTitleBar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className={`h-6 w-6 hover:text-foreground/80 ${auxPanelOpen ? "bg-accent" : ""}`}
|
className={`h-6 w-6 hover:text-foreground/80 ${auxPanelOpen ? "bg-accent" : ""}`}
|
||||||
onClick={toggleAuxPanel}
|
onClick={toggleAuxPanel}
|
||||||
title={`Toggle Auxiliary Panel (${formatShortcutLabel(shortcuts.toggle_aux_panel, isMac)})`}
|
title={tTitleBar("withShortcut", {
|
||||||
|
label: tTitleBar("toggleAuxPanel"),
|
||||||
|
shortcut: formatShortcutLabel(
|
||||||
|
shortcuts.toggle_aux_panel,
|
||||||
|
isMac
|
||||||
|
),
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<PanelRight className="h-3.5 w-3.5" />
|
<PanelRight className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -286,7 +308,10 @@ export function FolderTitleBar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 hover:text-foreground/80"
|
className="h-6 w-6 hover:text-foreground/80"
|
||||||
onClick={() => setSearchOpen(true)}
|
onClick={() => setSearchOpen(true)}
|
||||||
title={`Search (${formatShortcutLabel(shortcuts.toggle_search, isMac)})`}
|
title={tTitleBar("withShortcut", {
|
||||||
|
label: tTitleBar("search"),
|
||||||
|
shortcut: formatShortcutLabel(shortcuts.toggle_search, isMac),
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<Search className="h-3.5 w-3.5" />
|
<Search className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -295,7 +320,10 @@ export function FolderTitleBar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 hover:text-foreground/80"
|
className="h-6 w-6 hover:text-foreground/80"
|
||||||
onClick={handleOpenSettings}
|
onClick={handleOpenSettings}
|
||||||
title={`Open Settings (${formatShortcutLabel(shortcuts.open_settings, isMac)})`}
|
title={tTitleBar("withShortcut", {
|
||||||
|
label: tTitleBar("openSettings"),
|
||||||
|
shortcut: formatShortcutLabel(shortcuts.open_settings, isMac),
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<Settings className="h-3.5 w-3.5" />
|
<Settings className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useCallback, useRef } from "react"
|
import { useCallback, useRef } from "react"
|
||||||
import { ChevronsDownUp, ChevronsUpDown, Crosshair, Plus } from "lucide-react"
|
import { ChevronsDownUp, ChevronsUpDown, Crosshair, Plus } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useFolderContext } from "@/contexts/folder-context"
|
import { useFolderContext } from "@/contexts/folder-context"
|
||||||
import { useTabContext } from "@/contexts/tab-context"
|
import { useTabContext } from "@/contexts/tab-context"
|
||||||
import { useSidebarContext } from "@/contexts/sidebar-context"
|
import { useSidebarContext } from "@/contexts/sidebar-context"
|
||||||
@@ -12,6 +13,7 @@ import {
|
|||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
|
|
||||||
export function Sidebar() {
|
export function Sidebar() {
|
||||||
|
const t = useTranslations("Folder.sidebar")
|
||||||
const { folder } = useFolderContext()
|
const { folder } = useFolderContext()
|
||||||
const { openNewConversationTab } = useTabContext()
|
const { openNewConversationTab } = useTabContext()
|
||||||
const { isOpen } = useSidebarContext()
|
const { isOpen } = useSidebarContext()
|
||||||
@@ -27,14 +29,14 @@ export function Sidebar() {
|
|||||||
return (
|
return (
|
||||||
<aside className="group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-sidebar text-sidebar-foreground select-none">
|
<aside className="group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-sidebar text-sidebar-foreground select-none">
|
||||||
<div className="flex h-10 items-center justify-between border-b border-border px-4">
|
<div className="flex h-10 items-center justify-between border-b border-border px-4">
|
||||||
<h2 className="text-xs font-bold">Conversations</h2>
|
<h2 className="text-xs font-bold">{t("title")}</h2>
|
||||||
<div className="flex items-center gap-0.5 opacity-0 transition-opacity group-hover/sidebar:opacity-100">
|
<div className="flex items-center gap-0.5 opacity-0 transition-opacity group-hover/sidebar:opacity-100">
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 shrink-0 text-muted-foreground"
|
className="h-6 w-6 shrink-0 text-muted-foreground"
|
||||||
onClick={() => listRef.current?.scrollToActive()}
|
onClick={() => listRef.current?.scrollToActive()}
|
||||||
title="Locate Active Conversation"
|
title={t("locateActiveConversation")}
|
||||||
>
|
>
|
||||||
<Crosshair className="h-3.5 w-3.5" />
|
<Crosshair className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -43,7 +45,7 @@ export function Sidebar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 shrink-0 text-muted-foreground"
|
className="h-6 w-6 shrink-0 text-muted-foreground"
|
||||||
onClick={() => listRef.current?.expandAll()}
|
onClick={() => listRef.current?.expandAll()}
|
||||||
title="Expand All Groups"
|
title={t("expandAllGroups")}
|
||||||
>
|
>
|
||||||
<ChevronsUpDown className="h-3.5 w-3.5" />
|
<ChevronsUpDown className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -52,7 +54,7 @@ export function Sidebar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 shrink-0 text-muted-foreground"
|
className="h-6 w-6 shrink-0 text-muted-foreground"
|
||||||
onClick={() => listRef.current?.collapseAll()}
|
onClick={() => listRef.current?.collapseAll()}
|
||||||
title="Collapse All Groups"
|
title={t("collapseAllGroups")}
|
||||||
>
|
>
|
||||||
<ChevronsDownUp className="h-3.5 w-3.5" />
|
<ChevronsDownUp className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -61,7 +63,7 @@ export function Sidebar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 shrink-0 text-muted-foreground"
|
className="h-6 w-6 shrink-0 text-muted-foreground"
|
||||||
onClick={handleNewConversation}
|
onClick={handleNewConversation}
|
||||||
title="New Conversation"
|
title={t("newConversation")}
|
||||||
>
|
>
|
||||||
<Plus className="h-3.5 w-3.5" />
|
<Plus className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { CircleAlert, X, Trash2 } from "lucide-react"
|
import { CircleAlert, X, Trash2 } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import {
|
import {
|
||||||
useAlertContext,
|
useAlertContext,
|
||||||
type AlertLevel,
|
type AlertLevel,
|
||||||
@@ -110,6 +111,7 @@ function AlertActionButton({ action }: { action: AlertAction }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function StatusBarAlerts() {
|
export function StatusBarAlerts() {
|
||||||
|
const t = useTranslations("Folder.statusBar.alerts")
|
||||||
const { alerts, hasAlerts, dismissAlert, clearAll } = useAlertContext()
|
const { alerts, hasAlerts, dismissAlert, clearAll } = useAlertContext()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -124,7 +126,7 @@ export function StatusBarAlerts() {
|
|||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent side="top" align="end" className="w-80 p-3">
|
<PopoverContent side="top" align="end" className="w-80 p-3">
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
<span className="text-xs font-medium">告警</span>
|
<span className="text-xs font-medium">{t("title")}</span>
|
||||||
{hasAlerts && (
|
{hasAlerts && (
|
||||||
<button
|
<button
|
||||||
onClick={clearAll}
|
onClick={clearAll}
|
||||||
@@ -135,7 +137,7 @@ export function StatusBarAlerts() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{!hasAlerts ? (
|
{!hasAlerts ? (
|
||||||
<div className="text-xs text-muted-foreground py-2">暂无告警信息</div>
|
<div className="text-xs text-muted-foreground py-2">{t("empty")}</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-2 max-h-56 overflow-y-auto">
|
<div className="space-y-2 max-h-56 overflow-y-auto">
|
||||||
{alerts.map((alert) => (
|
{alerts.map((alert) => (
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useCallback, useMemo, useSyncExternalStore } from "react"
|
import { useCallback, useMemo, useSyncExternalStore } from "react"
|
||||||
import { Unplug } from "lucide-react"
|
import { Unplug } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useConnectionStore } from "@/contexts/acp-connections-context"
|
import { useConnectionStore } from "@/contexts/acp-connections-context"
|
||||||
import { useTabContext } from "@/contexts/tab-context"
|
import { useTabContext } from "@/contexts/tab-context"
|
||||||
import { useFolderContext } from "@/contexts/folder-context"
|
import { useFolderContext } from "@/contexts/folder-context"
|
||||||
@@ -15,24 +16,35 @@ import {
|
|||||||
import { AGENT_LABELS } from "@/lib/types"
|
import { AGENT_LABELS } from "@/lib/types"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
const STATUS_STYLE: Record<string, { className: string; title: string }> = {
|
type ConnectionStatusLabelKey =
|
||||||
connected: { className: "opacity-100", title: "Connected" },
|
| "connected"
|
||||||
|
| "connecting"
|
||||||
|
| "downloading"
|
||||||
|
| "prompting"
|
||||||
|
| "error"
|
||||||
|
|
||||||
|
const STATUS_STYLE: Record<
|
||||||
|
string,
|
||||||
|
{ className: string; labelKey: ConnectionStatusLabelKey }
|
||||||
|
> = {
|
||||||
|
connected: { className: "opacity-100", labelKey: "connected" },
|
||||||
connecting: {
|
connecting: {
|
||||||
className: "opacity-100 animate-pulse",
|
className: "opacity-100 animate-pulse",
|
||||||
title: "Connecting...",
|
labelKey: "connecting",
|
||||||
},
|
},
|
||||||
downloading: {
|
downloading: {
|
||||||
className: "opacity-100 animate-pulse",
|
className: "opacity-100 animate-pulse",
|
||||||
title: "Downloading...",
|
labelKey: "downloading",
|
||||||
},
|
},
|
||||||
prompting: {
|
prompting: {
|
||||||
className: "opacity-100 animate-pulse",
|
className: "opacity-100 animate-pulse",
|
||||||
title: "Responding...",
|
labelKey: "prompting",
|
||||||
},
|
},
|
||||||
error: { className: "opacity-50", title: "Connection error" },
|
error: { className: "opacity-50", labelKey: "error" },
|
||||||
}
|
}
|
||||||
|
|
||||||
export function StatusBarConnection() {
|
export function StatusBarConnection() {
|
||||||
|
const t = useTranslations("Folder.statusBar.connection")
|
||||||
const store = useConnectionStore()
|
const store = useConnectionStore()
|
||||||
const { tabs, activeTabId } = useTabContext()
|
const { tabs, activeTabId } = useTabContext()
|
||||||
const { conversations } = useFolderContext()
|
const { conversations } = useFolderContext()
|
||||||
@@ -89,7 +101,7 @@ export function StatusBarConnection() {
|
|||||||
{model && <span>{model}</span>}
|
{model && <span>{model}</span>}
|
||||||
</div>
|
</div>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top">Disconnected</TooltipContent>
|
<TooltipContent side="top">{t("disconnected")}</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
)
|
)
|
||||||
@@ -99,10 +111,11 @@ export function StatusBarConnection() {
|
|||||||
if (!style) return null
|
if (!style) return null
|
||||||
|
|
||||||
const label = AGENT_LABELS[agentType]
|
const label = AGENT_LABELS[agentType]
|
||||||
|
const statusLabel = t(style.labelKey)
|
||||||
const tooltipText =
|
const tooltipText =
|
||||||
status === "error" && activeConn?.error
|
status === "error" && activeConn?.error
|
||||||
? `${label} - ${activeConn.error}`
|
? t("tooltipError", { agent: label, error: activeConn.error })
|
||||||
: `${label} - ${style.title}`
|
: t("tooltip", { agent: label, status: statusLabel })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useMemo } from "react"
|
import { useMemo } from "react"
|
||||||
import { BarChart3 } from "lucide-react"
|
import { BarChart3 } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useFolderContext } from "@/contexts/folder-context"
|
import { useFolderContext } from "@/contexts/folder-context"
|
||||||
import { AGENT_LABELS } from "@/lib/types"
|
import { AGENT_LABELS } from "@/lib/types"
|
||||||
import { AgentIcon } from "@/components/agent-icon"
|
import { AgentIcon } from "@/components/agent-icon"
|
||||||
@@ -12,6 +13,7 @@ import {
|
|||||||
} from "@/components/ui/popover"
|
} from "@/components/ui/popover"
|
||||||
|
|
||||||
export function StatusBarStats() {
|
export function StatusBarStats() {
|
||||||
|
const t = useTranslations("Folder.statusBar.stats")
|
||||||
const { stats } = useFolderContext()
|
const { stats } = useFolderContext()
|
||||||
|
|
||||||
const activeAgents = useMemo(
|
const activeAgents = useMemo(
|
||||||
@@ -26,7 +28,9 @@ export function StatusBarStats() {
|
|||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<button className="flex items-center gap-1.5 hover:text-foreground transition-colors">
|
<button className="flex items-center gap-1.5 hover:text-foreground transition-colors">
|
||||||
<BarChart3 className="h-3 w-3" />
|
<BarChart3 className="h-3 w-3" />
|
||||||
<span>{stats.total_conversations} conversations</span>
|
<span>
|
||||||
|
{t("conversations", { count: stats.total_conversations })}
|
||||||
|
</span>
|
||||||
<span className="flex items-center gap-1 ml-1">
|
<span className="flex items-center gap-1 ml-1">
|
||||||
{activeAgents.map((a) => (
|
{activeAgents.map((a) => (
|
||||||
<AgentIcon
|
<AgentIcon
|
||||||
@@ -40,8 +44,10 @@ export function StatusBarStats() {
|
|||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent side="top" align="start" className="w-64 p-3">
|
<PopoverContent side="top" align="start" className="w-64 p-3">
|
||||||
<div className="text-xs font-medium mb-2">
|
<div className="text-xs font-medium mb-2">
|
||||||
{stats.total_conversations} conversations / {stats.total_messages}{" "}
|
{t("summary", {
|
||||||
messages
|
conversations: stats.total_conversations,
|
||||||
|
messages: stats.total_messages,
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1.5">
|
<div className="space-y-1.5">
|
||||||
{activeAgents.map((a) => (
|
{activeAgents.map((a) => (
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { Clock } from "lucide-react"
|
import { Clock } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useTaskContext } from "@/contexts/task-context"
|
import { useTaskContext } from "@/contexts/task-context"
|
||||||
import { Skeleton } from "@/components/ui/skeleton"
|
import { Skeleton } from "@/components/ui/skeleton"
|
||||||
import {
|
import {
|
||||||
@@ -18,6 +19,7 @@ function Spinner({ className }: { className?: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function StatusBarTasks() {
|
export function StatusBarTasks() {
|
||||||
|
const t = useTranslations("Folder.statusBar.tasks")
|
||||||
const { tasks } = useTaskContext()
|
const { tasks } = useTaskContext()
|
||||||
|
|
||||||
if (tasks.length === 0) return null
|
if (tasks.length === 0) return null
|
||||||
@@ -45,7 +47,7 @@ export function StatusBarTasks() {
|
|||||||
</button>
|
</button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent side="top" align="end" className="w-72 p-3">
|
<PopoverContent side="top" align="end" className="w-72 p-3">
|
||||||
<div className="text-xs font-medium mb-2">任务</div>
|
<div className="text-xs font-medium mb-2">{t("title")}</div>
|
||||||
<div className="space-y-2 max-h-48 overflow-y-auto">
|
<div className="space-y-2 max-h-48 overflow-y-auto">
|
||||||
{tasks.map((task) => (
|
{tasks.map((task) => (
|
||||||
<div key={task.id} className="space-y-1">
|
<div key={task.id} className="space-y-1">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { Coins } from "lucide-react"
|
import { Coins } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useSessionStats } from "@/contexts/session-stats-context"
|
import { useSessionStats } from "@/contexts/session-stats-context"
|
||||||
import {
|
import {
|
||||||
Popover,
|
Popover,
|
||||||
@@ -29,6 +30,7 @@ function formatPercent(percent: number | null): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function StatusBarTokens() {
|
export function StatusBarTokens() {
|
||||||
|
const t = useTranslations("Folder.statusBar.tokens")
|
||||||
const { sessionStats } = useSessionStats()
|
const { sessionStats } = useSessionStats()
|
||||||
const usage = sessionStats?.total_usage
|
const usage = sessionStats?.total_usage
|
||||||
|
|
||||||
@@ -55,17 +57,20 @@ export function StatusBarTokens() {
|
|||||||
|
|
||||||
const dashOffset = ICON_CIRCUMFERENCE * (1 - (contextPercent ?? 0) / 100)
|
const dashOffset = ICON_CIRCUMFERENCE * (1 - (contextPercent ?? 0) / 100)
|
||||||
|
|
||||||
const rows: { label: string; value: number }[] = []
|
const rows: {
|
||||||
|
key: "input" | "output" | "cacheRead" | "cacheWrite" | "total"
|
||||||
|
value: number
|
||||||
|
}[] = []
|
||||||
if (hasUsage) {
|
if (hasUsage) {
|
||||||
rows.push(
|
rows.push(
|
||||||
{ label: "Input", value: usage.input_tokens },
|
{ key: "input", value: usage.input_tokens },
|
||||||
{ label: "Output", value: usage.output_tokens },
|
{ key: "output", value: usage.output_tokens },
|
||||||
{ label: "Cache Read", value: usage.cache_read_input_tokens },
|
{ key: "cacheRead", value: usage.cache_read_input_tokens },
|
||||||
{ label: "Cache Write", value: usage.cache_creation_input_tokens }
|
{ key: "cacheWrite", value: usage.cache_creation_input_tokens }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (total != null) {
|
if (total != null) {
|
||||||
rows.push({ label: "Total", value: total })
|
rows.push({ key: "total", value: total })
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasTokenSection = rows.length > 0
|
const hasTokenSection = rows.length > 0
|
||||||
@@ -79,7 +84,7 @@ export function StatusBarTokens() {
|
|||||||
{hasContext ? (
|
{hasContext ? (
|
||||||
<>
|
<>
|
||||||
<svg
|
<svg
|
||||||
aria-label="Context window usage"
|
aria-label={t("contextWindowUsageAria")}
|
||||||
className="size-3.5"
|
className="size-3.5"
|
||||||
viewBox={`0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`}
|
viewBox={`0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`}
|
||||||
>
|
>
|
||||||
@@ -127,7 +132,7 @@ export function StatusBarTokens() {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between gap-2 text-xs font-medium whitespace-nowrap">
|
<div className="flex items-center justify-between gap-2 text-xs font-medium whitespace-nowrap">
|
||||||
<span>Context Window</span>
|
<span>{t("contextWindow")}</span>
|
||||||
<span className="tabular-nums shrink-0">
|
<span className="tabular-nums shrink-0">
|
||||||
{formatPercent(contextPercent)}
|
{formatPercent(contextPercent)}
|
||||||
</span>
|
</span>
|
||||||
@@ -139,7 +144,7 @@ export function StatusBarTokens() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between text-xs leading-none text-muted-foreground">
|
<div className="flex items-center justify-between text-xs leading-none text-muted-foreground">
|
||||||
<span>Used / Max</span>
|
<span>{t("usedMax")}</span>
|
||||||
<span className="tabular-nums">
|
<span className="tabular-nums">
|
||||||
{contextUsed == null || contextMax == null
|
{contextUsed == null || contextMax == null
|
||||||
? "--"
|
? "--"
|
||||||
@@ -151,19 +156,19 @@ export function StatusBarTokens() {
|
|||||||
{hasTokenSection ? (
|
{hasTokenSection ? (
|
||||||
<>
|
<>
|
||||||
<div className="mb-0 mt-0.5 text-xs leading-none font-medium">
|
<div className="mb-0 mt-0.5 text-xs leading-none font-medium">
|
||||||
Token Usage
|
{t("tokenUsage")}
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-0">
|
<div className="space-y-0">
|
||||||
{rows.map((row) => (
|
{rows.map((row) => (
|
||||||
<div
|
<div
|
||||||
key={row.label}
|
key={row.key}
|
||||||
className={`flex items-center justify-between py-0.5 text-xs leading-none ${
|
className={`flex items-center justify-between py-0.5 text-xs leading-none ${
|
||||||
row.label === "Total"
|
row.key === "total"
|
||||||
? "mt-0.5 border-t border-border pt-0.5 font-medium"
|
? "mt-0.5 border-t border-border pt-0.5 font-medium"
|
||||||
: "text-muted-foreground"
|
: "text-muted-foreground"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<span>{row.label}</span>
|
<span>{t(row.key)}</span>
|
||||||
<span className="tabular-nums">
|
<span className="tabular-nums">
|
||||||
{formatNumber(row.value)}
|
{formatNumber(row.value)}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window"
|
import { getCurrentWindow } from "@tauri-apps/api/window"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { usePlatform } from "@/hooks/use-platform"
|
import { usePlatform } from "@/hooks/use-platform"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
export function WindowControls() {
|
export function WindowControls() {
|
||||||
|
const t = useTranslations("Folder.windowControls")
|
||||||
const { isWindows } = usePlatform()
|
const { isWindows } = usePlatform()
|
||||||
const [isMaximized, setIsMaximized] = useState(false)
|
const [isMaximized, setIsMaximized] = useState(false)
|
||||||
|
|
||||||
@@ -75,8 +77,8 @@ export function WindowControls() {
|
|||||||
console.error("[WindowControls] failed to minimize:", err)
|
console.error("[WindowControls] failed to minimize:", err)
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
aria-label="Minimize window"
|
aria-label={t("minimizeWindow")}
|
||||||
title="Minimize"
|
title={t("minimize")}
|
||||||
>
|
>
|
||||||
<MinimizeIcon />
|
<MinimizeIcon />
|
||||||
</button>
|
</button>
|
||||||
@@ -88,8 +90,8 @@ export function WindowControls() {
|
|||||||
console.error("[WindowControls] failed to toggle maximize:", err)
|
console.error("[WindowControls] failed to toggle maximize:", err)
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
aria-label={isMaximized ? "Restore window" : "Maximize window"}
|
aria-label={t(isMaximized ? "restoreWindow" : "maximizeWindow")}
|
||||||
title={isMaximized ? "Restore" : "Maximize"}
|
title={t(isMaximized ? "restore" : "maximize")}
|
||||||
>
|
>
|
||||||
{isMaximized ? <RestoreIcon /> : <MaximizeIcon />}
|
{isMaximized ? <RestoreIcon /> : <MaximizeIcon />}
|
||||||
</button>
|
</button>
|
||||||
@@ -104,8 +106,8 @@ export function WindowControls() {
|
|||||||
console.error("[WindowControls] failed to close:", err)
|
console.error("[WindowControls] failed to close:", err)
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
aria-label="Close window"
|
aria-label={t("closeWindow")}
|
||||||
title="Close"
|
title={t("close")}
|
||||||
>
|
>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { memo, useCallback, useRef } from "react"
|
import { memo, useCallback, useRef } from "react"
|
||||||
import { Reorder } from "motion/react"
|
import { Reorder } from "motion/react"
|
||||||
import { X } from "lucide-react"
|
import { X } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
import { STATUS_COLORS } from "@/lib/types"
|
import { STATUS_COLORS } from "@/lib/types"
|
||||||
import type { ConversationStatus } from "@/lib/types"
|
import type { ConversationStatus } from "@/lib/types"
|
||||||
@@ -34,6 +35,7 @@ export const TabItem = memo(function TabItem({
|
|||||||
onCloseAll,
|
onCloseAll,
|
||||||
onPin,
|
onPin,
|
||||||
}: TabItemProps) {
|
}: TabItemProps) {
|
||||||
|
const t = useTranslations("Folder.tabs")
|
||||||
const isDragging = useRef(false)
|
const isDragging = useRef(false)
|
||||||
const itemRef = useRef<HTMLDivElement>(null)
|
const itemRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
@@ -129,19 +131,21 @@ export const TabItem = memo(function TabItem({
|
|||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
handleClose()
|
handleClose()
|
||||||
}}
|
}}
|
||||||
aria-label="Close conversation tab"
|
aria-label={t("closeConversationTab")}
|
||||||
>
|
>
|
||||||
<X className="h-3 w-3" />
|
<X className="h-3 w-3" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ContextMenuTrigger>
|
</ContextMenuTrigger>
|
||||||
<ContextMenuContent>
|
<ContextMenuContent>
|
||||||
<ContextMenuItem onSelect={handleClose}>关闭</ContextMenuItem>
|
<ContextMenuItem onSelect={handleClose}>{t("close")}</ContextMenuItem>
|
||||||
<ContextMenuItem onSelect={handleCloseOthers}>
|
<ContextMenuItem onSelect={handleCloseOthers}>
|
||||||
关闭其它
|
{t("closeOthers")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
<ContextMenuItem onSelect={onCloseAll}>关闭所有</ContextMenuItem>
|
<ContextMenuItem onSelect={onCloseAll}>
|
||||||
|
{t("closeAll")}
|
||||||
|
</ContextMenuItem>
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Reorder.Item>
|
</Reorder.Item>
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
import { useRef, useState } from "react"
|
import { useRef, useState } from "react"
|
||||||
import { Minus, Plus, X } from "lucide-react"
|
import { Minus, Plus, X } from "lucide-react"
|
||||||
|
import { useTranslations } from "next-intl"
|
||||||
import { useTerminalContext } from "@/contexts/terminal-context"
|
import { useTerminalContext } from "@/contexts/terminal-context"
|
||||||
|
import { useShortcutSettings } from "@/hooks/use-shortcut-settings"
|
||||||
|
import { useIsMac } from "@/hooks/use-is-mac"
|
||||||
|
import { formatShortcutLabel } from "@/lib/keyboard-shortcuts"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import {
|
import {
|
||||||
ContextMenu,
|
ContextMenu,
|
||||||
@@ -13,6 +17,9 @@ import {
|
|||||||
} from "@/components/ui/context-menu"
|
} from "@/components/ui/context-menu"
|
||||||
|
|
||||||
export function TerminalTabBar() {
|
export function TerminalTabBar() {
|
||||||
|
const t = useTranslations("Folder.terminal")
|
||||||
|
const { shortcuts } = useShortcutSettings()
|
||||||
|
const isMac = useIsMac()
|
||||||
const {
|
const {
|
||||||
tabs,
|
tabs,
|
||||||
activeTabId,
|
activeTabId,
|
||||||
@@ -83,20 +90,20 @@ export function TerminalTabBar() {
|
|||||||
</ContextMenuTrigger>
|
</ContextMenuTrigger>
|
||||||
<ContextMenuContent>
|
<ContextMenuContent>
|
||||||
<ContextMenuItem onSelect={() => startRename(tab.id, tab.title)}>
|
<ContextMenuItem onSelect={() => startRename(tab.id, tab.title)}>
|
||||||
重命名
|
{t("rename")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuSeparator />
|
<ContextMenuSeparator />
|
||||||
<ContextMenuItem onSelect={() => closeTerminal(tab.id)}>
|
<ContextMenuItem onSelect={() => closeTerminal(tab.id)}>
|
||||||
关闭
|
{t("close")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
onSelect={() => closeOtherTerminals(tab.id)}
|
onSelect={() => closeOtherTerminals(tab.id)}
|
||||||
disabled={tabs.length <= 1}
|
disabled={tabs.length <= 1}
|
||||||
>
|
>
|
||||||
关闭其它
|
{t("closeOthers")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
<ContextMenuItem onSelect={() => closeAllTerminals()}>
|
<ContextMenuItem onSelect={() => closeAllTerminals()}>
|
||||||
关闭所有
|
{t("closeAll")}
|
||||||
</ContextMenuItem>
|
</ContextMenuItem>
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
@@ -114,7 +121,9 @@ export function TerminalTabBar() {
|
|||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 shrink-0 ml-auto"
|
className="h-6 w-6 shrink-0 ml-auto"
|
||||||
onClick={toggle}
|
onClick={toggle}
|
||||||
title="Hide Terminal (Ctrl+J)"
|
title={t("hideTerminal", {
|
||||||
|
shortcut: formatShortcutLabel(shortcuts.toggle_terminal, isMac),
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<Minus className="h-3 w-3" />
|
<Minus className="h-3 w-3" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -512,5 +512,205 @@
|
|||||||
},
|
},
|
||||||
"SettingsPages": {
|
"SettingsPages": {
|
||||||
"agentsLoading": "Loading agent settings..."
|
"agentsLoading": "Loading agent settings..."
|
||||||
|
},
|
||||||
|
"Folder": {
|
||||||
|
"common": {
|
||||||
|
"all": "All",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"close": "Close",
|
||||||
|
"closeOthers": "Close Others",
|
||||||
|
"closeAll": "Close All",
|
||||||
|
"confirm": "Confirm",
|
||||||
|
"save": "Save",
|
||||||
|
"delete": "Delete",
|
||||||
|
"rename": "Rename",
|
||||||
|
"loading": "Loading...",
|
||||||
|
"refresh": "Refresh",
|
||||||
|
"refreshing": "Refreshing...",
|
||||||
|
"create": "Create",
|
||||||
|
"createAndSwitch": "Create and Switch",
|
||||||
|
"openFile": "Open File",
|
||||||
|
"viewDiff": "View Diff"
|
||||||
|
},
|
||||||
|
"modes": {
|
||||||
|
"conversation": "Conversation Mode",
|
||||||
|
"fusion": "Fusion Mode",
|
||||||
|
"files": "Files Mode",
|
||||||
|
"workspaceModesAria": "Workspace modes"
|
||||||
|
},
|
||||||
|
"statusLabels": {
|
||||||
|
"in_progress": "In Progress",
|
||||||
|
"pending_review": "Review",
|
||||||
|
"completed": "Completed",
|
||||||
|
"cancelled": "Cancelled"
|
||||||
|
},
|
||||||
|
"sidebar": {
|
||||||
|
"title": "Conversations",
|
||||||
|
"locateActiveConversation": "Locate Active Conversation",
|
||||||
|
"expandAllGroups": "Expand All Groups",
|
||||||
|
"collapseAllGroups": "Collapse All Groups",
|
||||||
|
"newConversation": "New Conversation",
|
||||||
|
"noConversationsFound": "No conversations found.",
|
||||||
|
"importLocalSessions": "Import local sessions",
|
||||||
|
"importing": "Importing...",
|
||||||
|
"error": "Error: {message}",
|
||||||
|
"completeAllSessions": "Complete all sessions",
|
||||||
|
"completeAllReviewTitle": "Complete all review sessions?",
|
||||||
|
"completeAllReviewDescription": "This will mark all {count, plural, one {# session} other {# sessions}} in Review as completed.",
|
||||||
|
"completing": "Completing...",
|
||||||
|
"toasts": {
|
||||||
|
"importedSessions": "Imported {imported, plural, one {# session} other {# sessions}}, skipped {skipped}",
|
||||||
|
"noNewSessionsFound": "No new sessions found (skipped {skipped})",
|
||||||
|
"importFailed": "Import failed: {message}",
|
||||||
|
"reviewCompleted": "Marked {count, plural, one {# review session} other {# review sessions}} as completed",
|
||||||
|
"completeReviewFailed": "Failed to complete review sessions: {message}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"conversation": {
|
||||||
|
"reloadFailed": "Failed to reload conversation: {message}",
|
||||||
|
"reloaded": "Conversation reloaded",
|
||||||
|
"reload": "Reload",
|
||||||
|
"newConversation": "New Conversation",
|
||||||
|
"closeConversation": "Close Conversation"
|
||||||
|
},
|
||||||
|
"conversationCard": {
|
||||||
|
"untitledConversation": "Untitled conversation",
|
||||||
|
"newConversation": "New Conversation",
|
||||||
|
"rename": "Rename",
|
||||||
|
"status": "Status",
|
||||||
|
"delete": "Delete",
|
||||||
|
"importLocalSessions": "Import local sessions",
|
||||||
|
"importing": "Importing...",
|
||||||
|
"renameConversation": "Rename conversation",
|
||||||
|
"deleteConversationTitle": "Delete conversation?",
|
||||||
|
"deleteConversationDescription": "This will delete \"{title}\". This action cannot be undone.",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"save": "Save"
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"dialogTitle": "Search conversations",
|
||||||
|
"placeholder": "Search conversations...",
|
||||||
|
"allAgents": "All",
|
||||||
|
"searching": "Searching...",
|
||||||
|
"typeToSearch": "Type to search conversations",
|
||||||
|
"noResults": "No results found.",
|
||||||
|
"untitledConversation": "Untitled conversation"
|
||||||
|
},
|
||||||
|
"folderTitleBar": {
|
||||||
|
"showSidebar": "Show Sidebar",
|
||||||
|
"hideSidebar": "Hide Sidebar",
|
||||||
|
"toggleTerminal": "Toggle Terminal",
|
||||||
|
"toggleAuxPanel": "Toggle Auxiliary Panel",
|
||||||
|
"search": "Search",
|
||||||
|
"openSettings": "Open Settings",
|
||||||
|
"withShortcut": "{label} ({shortcut})"
|
||||||
|
},
|
||||||
|
"statusBar": {
|
||||||
|
"connection": {
|
||||||
|
"connected": "Connected",
|
||||||
|
"connecting": "Connecting...",
|
||||||
|
"downloading": "Downloading...",
|
||||||
|
"prompting": "Responding...",
|
||||||
|
"error": "Connection error",
|
||||||
|
"disconnected": "Disconnected",
|
||||||
|
"tooltip": "{agent} - {status}",
|
||||||
|
"tooltipError": "{agent} - {error}"
|
||||||
|
},
|
||||||
|
"tasks": {
|
||||||
|
"title": "Tasks"
|
||||||
|
},
|
||||||
|
"alerts": {
|
||||||
|
"title": "Alerts",
|
||||||
|
"empty": "No alerts"
|
||||||
|
},
|
||||||
|
"stats": {
|
||||||
|
"conversations": "{count} conversations",
|
||||||
|
"summary": "{conversations} conversations / {messages} messages"
|
||||||
|
},
|
||||||
|
"tokens": {
|
||||||
|
"contextWindowUsageAria": "Context window usage",
|
||||||
|
"contextWindow": "Context Window",
|
||||||
|
"usedMax": "Used / Max",
|
||||||
|
"tokenUsage": "Token Usage",
|
||||||
|
"input": "Input",
|
||||||
|
"output": "Output",
|
||||||
|
"cacheRead": "Cache Read",
|
||||||
|
"cacheWrite": "Cache Write",
|
||||||
|
"total": "Total"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"auxPanel": {
|
||||||
|
"tabs": {
|
||||||
|
"diff": "Diff",
|
||||||
|
"files": "Files",
|
||||||
|
"changes": "Changes",
|
||||||
|
"commits": "Commits"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"windowControls": {
|
||||||
|
"minimizeWindow": "Minimize window",
|
||||||
|
"minimize": "Minimize",
|
||||||
|
"maximizeWindow": "Maximize window",
|
||||||
|
"maximize": "Maximize",
|
||||||
|
"restoreWindow": "Restore window",
|
||||||
|
"restore": "Restore",
|
||||||
|
"closeWindow": "Close window",
|
||||||
|
"close": "Close"
|
||||||
|
},
|
||||||
|
"tabs": {
|
||||||
|
"closeConversationTab": "Close conversation tab",
|
||||||
|
"close": "Close",
|
||||||
|
"closeOthers": "Close Others",
|
||||||
|
"closeAll": "Close All"
|
||||||
|
},
|
||||||
|
"fileWorkspace": {
|
||||||
|
"files": "Files",
|
||||||
|
"closeFileTab": "Close file tab",
|
||||||
|
"close": "Close",
|
||||||
|
"closeOthers": "Close Others",
|
||||||
|
"closeAll": "Close All"
|
||||||
|
},
|
||||||
|
"terminal": {
|
||||||
|
"rename": "Rename",
|
||||||
|
"close": "Close",
|
||||||
|
"closeOthers": "Close Others",
|
||||||
|
"closeAll": "Close All",
|
||||||
|
"hideTerminal": "Hide Terminal ({shortcut})"
|
||||||
|
},
|
||||||
|
"sessionFiles": {
|
||||||
|
"currentResponse": "Current response",
|
||||||
|
"noDiffDataAvailable": "No diff data available for {filePath}",
|
||||||
|
"loading": "Loading...",
|
||||||
|
"noFileChangesInConversation": "No file changes found in this conversation",
|
||||||
|
"openConversationToSeeChanges": "Open a conversation to see its file changes",
|
||||||
|
"remove": "Remove",
|
||||||
|
"changeCount": "{count, plural, one {# change} other {# changes}}",
|
||||||
|
"fileCount": "{count, plural, one {# file} other {# files}}"
|
||||||
|
},
|
||||||
|
"folderNameDropdown": {
|
||||||
|
"fallbackFolderName": "Folder",
|
||||||
|
"openFolder": "Open Folder",
|
||||||
|
"cloneRepository": "Clone Repository",
|
||||||
|
"opened": "Opened",
|
||||||
|
"recentOpen": "Recently Opened"
|
||||||
|
},
|
||||||
|
"fileWorkspacePanel": {
|
||||||
|
"viewDiff": "View Diff",
|
||||||
|
"openFile": "Open File",
|
||||||
|
"fileCount": "{count, plural, one {# file} other {# files}}",
|
||||||
|
"openFileOrDiff": "Open a file or diff from the right panel",
|
||||||
|
"disk": "Disk",
|
||||||
|
"head": "HEAD",
|
||||||
|
"unsaved": "Unsaved",
|
||||||
|
"workingTree": "Working Tree",
|
||||||
|
"loading": "Loading...",
|
||||||
|
"compareWithBranch": "{path} · compare with {branch}",
|
||||||
|
"hunkCount": "{count, plural, one {# hunk} other {# hunks}}",
|
||||||
|
"prev": "Prev",
|
||||||
|
"next": "Next",
|
||||||
|
"jumpToLine": "Jump to line {line}",
|
||||||
|
"noParsedDiffSections": "No parsed diff sections",
|
||||||
|
"loadingEditor": "Loading editor..."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -512,5 +512,205 @@
|
|||||||
},
|
},
|
||||||
"SettingsPages": {
|
"SettingsPages": {
|
||||||
"agentsLoading": "加载 Agent 设置中..."
|
"agentsLoading": "加载 Agent 设置中..."
|
||||||
|
},
|
||||||
|
"Folder": {
|
||||||
|
"common": {
|
||||||
|
"all": "全部",
|
||||||
|
"cancel": "取消",
|
||||||
|
"close": "关闭",
|
||||||
|
"closeOthers": "关闭其它",
|
||||||
|
"closeAll": "关闭所有",
|
||||||
|
"confirm": "确认",
|
||||||
|
"save": "保存",
|
||||||
|
"delete": "删除",
|
||||||
|
"rename": "重命名",
|
||||||
|
"loading": "加载中...",
|
||||||
|
"refresh": "刷新",
|
||||||
|
"refreshing": "刷新中...",
|
||||||
|
"create": "创建",
|
||||||
|
"createAndSwitch": "创建并切换",
|
||||||
|
"openFile": "打开文件",
|
||||||
|
"viewDiff": "查看差异"
|
||||||
|
},
|
||||||
|
"modes": {
|
||||||
|
"conversation": "会话模式",
|
||||||
|
"fusion": "融合模式",
|
||||||
|
"files": "文件模式",
|
||||||
|
"workspaceModesAria": "工作区模式"
|
||||||
|
},
|
||||||
|
"statusLabels": {
|
||||||
|
"in_progress": "进行中",
|
||||||
|
"pending_review": "待复查",
|
||||||
|
"completed": "已完成",
|
||||||
|
"cancelled": "已取消"
|
||||||
|
},
|
||||||
|
"sidebar": {
|
||||||
|
"title": "会话",
|
||||||
|
"locateActiveConversation": "定位当前会话",
|
||||||
|
"expandAllGroups": "展开全部分组",
|
||||||
|
"collapseAllGroups": "折叠全部分组",
|
||||||
|
"newConversation": "新建会话",
|
||||||
|
"noConversationsFound": "未找到会话。",
|
||||||
|
"importLocalSessions": "导入本地会话",
|
||||||
|
"importing": "导入中...",
|
||||||
|
"error": "错误:{message}",
|
||||||
|
"completeAllSessions": "完成全部会话",
|
||||||
|
"completeAllReviewTitle": "完成全部复查会话?",
|
||||||
|
"completeAllReviewDescription": "这会将复查中的 {count} 个会话全部标记为已完成。",
|
||||||
|
"completing": "处理中...",
|
||||||
|
"toasts": {
|
||||||
|
"importedSessions": "已导入 {imported} 个会话,跳过 {skipped} 个",
|
||||||
|
"noNewSessionsFound": "没有新会话(已跳过 {skipped} 个)",
|
||||||
|
"importFailed": "导入失败:{message}",
|
||||||
|
"reviewCompleted": "已将 {count} 个复查会话标记为已完成",
|
||||||
|
"completeReviewFailed": "批量完成复查会话失败:{message}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"conversation": {
|
||||||
|
"reloadFailed": "会话重新加载失败:{message}",
|
||||||
|
"reloaded": "当前会话已重新加载",
|
||||||
|
"reload": "重新加载",
|
||||||
|
"newConversation": "新建会话",
|
||||||
|
"closeConversation": "关闭会话"
|
||||||
|
},
|
||||||
|
"conversationCard": {
|
||||||
|
"untitledConversation": "未命名会话",
|
||||||
|
"newConversation": "新建会话",
|
||||||
|
"rename": "重命名",
|
||||||
|
"status": "状态",
|
||||||
|
"delete": "删除",
|
||||||
|
"importLocalSessions": "导入本地会话",
|
||||||
|
"importing": "导入中...",
|
||||||
|
"renameConversation": "重命名会话",
|
||||||
|
"deleteConversationTitle": "删除会话?",
|
||||||
|
"deleteConversationDescription": "会删除“{title}”,此操作不可撤销。",
|
||||||
|
"cancel": "取消",
|
||||||
|
"save": "保存"
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"dialogTitle": "搜索会话",
|
||||||
|
"placeholder": "搜索会话...",
|
||||||
|
"allAgents": "全部",
|
||||||
|
"searching": "搜索中...",
|
||||||
|
"typeToSearch": "输入关键词搜索会话",
|
||||||
|
"noResults": "未找到结果。",
|
||||||
|
"untitledConversation": "未命名会话"
|
||||||
|
},
|
||||||
|
"folderTitleBar": {
|
||||||
|
"showSidebar": "显示侧边栏",
|
||||||
|
"hideSidebar": "隐藏侧边栏",
|
||||||
|
"toggleTerminal": "切换终端",
|
||||||
|
"toggleAuxPanel": "切换辅助面板",
|
||||||
|
"search": "搜索",
|
||||||
|
"openSettings": "打开设置",
|
||||||
|
"withShortcut": "{label}({shortcut})"
|
||||||
|
},
|
||||||
|
"statusBar": {
|
||||||
|
"connection": {
|
||||||
|
"connected": "已连接",
|
||||||
|
"connecting": "连接中...",
|
||||||
|
"downloading": "下载中...",
|
||||||
|
"prompting": "响应中...",
|
||||||
|
"error": "连接异常",
|
||||||
|
"disconnected": "未连接",
|
||||||
|
"tooltip": "{agent} - {status}",
|
||||||
|
"tooltipError": "{agent} - {error}"
|
||||||
|
},
|
||||||
|
"tasks": {
|
||||||
|
"title": "任务"
|
||||||
|
},
|
||||||
|
"alerts": {
|
||||||
|
"title": "告警",
|
||||||
|
"empty": "暂无告警信息"
|
||||||
|
},
|
||||||
|
"stats": {
|
||||||
|
"conversations": "{count} 个会话",
|
||||||
|
"summary": "{conversations} 个会话 / {messages} 条消息"
|
||||||
|
},
|
||||||
|
"tokens": {
|
||||||
|
"contextWindowUsageAria": "上下文窗口使用率",
|
||||||
|
"contextWindow": "上下文窗口",
|
||||||
|
"usedMax": "已用 / 上限",
|
||||||
|
"tokenUsage": "Token 用量",
|
||||||
|
"input": "输入",
|
||||||
|
"output": "输出",
|
||||||
|
"cacheRead": "缓存读取",
|
||||||
|
"cacheWrite": "缓存写入",
|
||||||
|
"total": "总计"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"auxPanel": {
|
||||||
|
"tabs": {
|
||||||
|
"diff": "Diff",
|
||||||
|
"files": "Files",
|
||||||
|
"changes": "Changes",
|
||||||
|
"commits": "Commits"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"windowControls": {
|
||||||
|
"minimizeWindow": "最小化窗口",
|
||||||
|
"minimize": "最小化",
|
||||||
|
"maximizeWindow": "最大化窗口",
|
||||||
|
"maximize": "最大化",
|
||||||
|
"restoreWindow": "还原窗口",
|
||||||
|
"restore": "还原",
|
||||||
|
"closeWindow": "关闭窗口",
|
||||||
|
"close": "关闭"
|
||||||
|
},
|
||||||
|
"tabs": {
|
||||||
|
"closeConversationTab": "关闭会话标签",
|
||||||
|
"close": "关闭",
|
||||||
|
"closeOthers": "关闭其它",
|
||||||
|
"closeAll": "关闭所有"
|
||||||
|
},
|
||||||
|
"fileWorkspace": {
|
||||||
|
"files": "文件",
|
||||||
|
"closeFileTab": "关闭文件标签",
|
||||||
|
"close": "关闭",
|
||||||
|
"closeOthers": "关闭其它",
|
||||||
|
"closeAll": "关闭所有"
|
||||||
|
},
|
||||||
|
"terminal": {
|
||||||
|
"rename": "重命名",
|
||||||
|
"close": "关闭",
|
||||||
|
"closeOthers": "关闭其它",
|
||||||
|
"closeAll": "关闭所有",
|
||||||
|
"hideTerminal": "隐藏终端({shortcut})"
|
||||||
|
},
|
||||||
|
"sessionFiles": {
|
||||||
|
"currentResponse": "当前响应",
|
||||||
|
"noDiffDataAvailable": "未找到 {filePath} 的差异数据",
|
||||||
|
"loading": "加载中...",
|
||||||
|
"noFileChangesInConversation": "该会话未发现文件变更",
|
||||||
|
"openConversationToSeeChanges": "打开会话以查看文件变更",
|
||||||
|
"remove": "移除",
|
||||||
|
"changeCount": "{count} 处变更",
|
||||||
|
"fileCount": "{count} 个文件"
|
||||||
|
},
|
||||||
|
"folderNameDropdown": {
|
||||||
|
"fallbackFolderName": "文件夹",
|
||||||
|
"openFolder": "打开文件夹",
|
||||||
|
"cloneRepository": "克隆仓库",
|
||||||
|
"opened": "已打开",
|
||||||
|
"recentOpen": "最近打开"
|
||||||
|
},
|
||||||
|
"fileWorkspacePanel": {
|
||||||
|
"viewDiff": "查看差异",
|
||||||
|
"openFile": "打开文件",
|
||||||
|
"fileCount": "{count} 个文件",
|
||||||
|
"openFileOrDiff": "从右侧面板打开文件或差异",
|
||||||
|
"disk": "磁盘",
|
||||||
|
"head": "HEAD",
|
||||||
|
"unsaved": "未保存",
|
||||||
|
"workingTree": "工作区",
|
||||||
|
"loading": "加载中...",
|
||||||
|
"compareWithBranch": "{path} · 与 {branch} 比较",
|
||||||
|
"hunkCount": "{count} 个区块",
|
||||||
|
"prev": "上一个",
|
||||||
|
"next": "下一个",
|
||||||
|
"jumpToLine": "跳转到第 {line} 行",
|
||||||
|
"noParsedDiffSections": "未解析到差异区块",
|
||||||
|
"loadingEditor": "编辑器加载中..."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -512,5 +512,205 @@
|
|||||||
},
|
},
|
||||||
"SettingsPages": {
|
"SettingsPages": {
|
||||||
"agentsLoading": "載入 Agent 設定中..."
|
"agentsLoading": "載入 Agent 設定中..."
|
||||||
|
},
|
||||||
|
"Folder": {
|
||||||
|
"common": {
|
||||||
|
"all": "全部",
|
||||||
|
"cancel": "取消",
|
||||||
|
"close": "關閉",
|
||||||
|
"closeOthers": "關閉其它",
|
||||||
|
"closeAll": "關閉所有",
|
||||||
|
"confirm": "確認",
|
||||||
|
"save": "儲存",
|
||||||
|
"delete": "刪除",
|
||||||
|
"rename": "重新命名",
|
||||||
|
"loading": "載入中...",
|
||||||
|
"refresh": "刷新",
|
||||||
|
"refreshing": "刷新中...",
|
||||||
|
"create": "建立",
|
||||||
|
"createAndSwitch": "建立並切換",
|
||||||
|
"openFile": "打開檔案",
|
||||||
|
"viewDiff": "查看差異"
|
||||||
|
},
|
||||||
|
"modes": {
|
||||||
|
"conversation": "會話模式",
|
||||||
|
"fusion": "融合模式",
|
||||||
|
"files": "檔案模式",
|
||||||
|
"workspaceModesAria": "工作區模式"
|
||||||
|
},
|
||||||
|
"statusLabels": {
|
||||||
|
"in_progress": "進行中",
|
||||||
|
"pending_review": "待複查",
|
||||||
|
"completed": "已完成",
|
||||||
|
"cancelled": "已取消"
|
||||||
|
},
|
||||||
|
"sidebar": {
|
||||||
|
"title": "會話",
|
||||||
|
"locateActiveConversation": "定位目前會話",
|
||||||
|
"expandAllGroups": "展開全部分組",
|
||||||
|
"collapseAllGroups": "折疊全部分組",
|
||||||
|
"newConversation": "新增會話",
|
||||||
|
"noConversationsFound": "找不到會話。",
|
||||||
|
"importLocalSessions": "匯入本地會話",
|
||||||
|
"importing": "匯入中...",
|
||||||
|
"error": "錯誤:{message}",
|
||||||
|
"completeAllSessions": "完成全部會話",
|
||||||
|
"completeAllReviewTitle": "完成全部複查會話?",
|
||||||
|
"completeAllReviewDescription": "這會將複查中的 {count} 個會話全部標記為已完成。",
|
||||||
|
"completing": "處理中...",
|
||||||
|
"toasts": {
|
||||||
|
"importedSessions": "已匯入 {imported} 個會話,跳過 {skipped} 個",
|
||||||
|
"noNewSessionsFound": "沒有新會話(已跳過 {skipped} 個)",
|
||||||
|
"importFailed": "匯入失敗:{message}",
|
||||||
|
"reviewCompleted": "已將 {count} 個複查會話標記為已完成",
|
||||||
|
"completeReviewFailed": "批次完成複查會話失敗:{message}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"conversation": {
|
||||||
|
"reloadFailed": "會話重新載入失敗:{message}",
|
||||||
|
"reloaded": "目前會話已重新載入",
|
||||||
|
"reload": "重新載入",
|
||||||
|
"newConversation": "新增會話",
|
||||||
|
"closeConversation": "關閉會話"
|
||||||
|
},
|
||||||
|
"conversationCard": {
|
||||||
|
"untitledConversation": "未命名會話",
|
||||||
|
"newConversation": "新增會話",
|
||||||
|
"rename": "重新命名",
|
||||||
|
"status": "狀態",
|
||||||
|
"delete": "刪除",
|
||||||
|
"importLocalSessions": "匯入本地會話",
|
||||||
|
"importing": "匯入中...",
|
||||||
|
"renameConversation": "重新命名會話",
|
||||||
|
"deleteConversationTitle": "刪除會話?",
|
||||||
|
"deleteConversationDescription": "會刪除「{title}」,此操作無法復原。",
|
||||||
|
"cancel": "取消",
|
||||||
|
"save": "儲存"
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"dialogTitle": "搜尋會話",
|
||||||
|
"placeholder": "搜尋會話...",
|
||||||
|
"allAgents": "全部",
|
||||||
|
"searching": "搜尋中...",
|
||||||
|
"typeToSearch": "輸入關鍵字搜尋會話",
|
||||||
|
"noResults": "找不到結果。",
|
||||||
|
"untitledConversation": "未命名會話"
|
||||||
|
},
|
||||||
|
"folderTitleBar": {
|
||||||
|
"showSidebar": "顯示側邊欄",
|
||||||
|
"hideSidebar": "隱藏側邊欄",
|
||||||
|
"toggleTerminal": "切換終端",
|
||||||
|
"toggleAuxPanel": "切換輔助面板",
|
||||||
|
"search": "搜尋",
|
||||||
|
"openSettings": "打開設定",
|
||||||
|
"withShortcut": "{label}({shortcut})"
|
||||||
|
},
|
||||||
|
"statusBar": {
|
||||||
|
"connection": {
|
||||||
|
"connected": "已連線",
|
||||||
|
"connecting": "連線中...",
|
||||||
|
"downloading": "下載中...",
|
||||||
|
"prompting": "回應中...",
|
||||||
|
"error": "連線異常",
|
||||||
|
"disconnected": "未連線",
|
||||||
|
"tooltip": "{agent} - {status}",
|
||||||
|
"tooltipError": "{agent} - {error}"
|
||||||
|
},
|
||||||
|
"tasks": {
|
||||||
|
"title": "任務"
|
||||||
|
},
|
||||||
|
"alerts": {
|
||||||
|
"title": "警示",
|
||||||
|
"empty": "暫無警示資訊"
|
||||||
|
},
|
||||||
|
"stats": {
|
||||||
|
"conversations": "{count} 個會話",
|
||||||
|
"summary": "{conversations} 個會話 / {messages} 則訊息"
|
||||||
|
},
|
||||||
|
"tokens": {
|
||||||
|
"contextWindowUsageAria": "上下文視窗使用率",
|
||||||
|
"contextWindow": "上下文視窗",
|
||||||
|
"usedMax": "已用 / 上限",
|
||||||
|
"tokenUsage": "Token 用量",
|
||||||
|
"input": "輸入",
|
||||||
|
"output": "輸出",
|
||||||
|
"cacheRead": "快取讀取",
|
||||||
|
"cacheWrite": "快取寫入",
|
||||||
|
"total": "總計"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"auxPanel": {
|
||||||
|
"tabs": {
|
||||||
|
"diff": "Diff",
|
||||||
|
"files": "Files",
|
||||||
|
"changes": "Changes",
|
||||||
|
"commits": "Commits"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"windowControls": {
|
||||||
|
"minimizeWindow": "最小化視窗",
|
||||||
|
"minimize": "最小化",
|
||||||
|
"maximizeWindow": "最大化視窗",
|
||||||
|
"maximize": "最大化",
|
||||||
|
"restoreWindow": "還原視窗",
|
||||||
|
"restore": "還原",
|
||||||
|
"closeWindow": "關閉視窗",
|
||||||
|
"close": "關閉"
|
||||||
|
},
|
||||||
|
"tabs": {
|
||||||
|
"closeConversationTab": "關閉會話分頁",
|
||||||
|
"close": "關閉",
|
||||||
|
"closeOthers": "關閉其它",
|
||||||
|
"closeAll": "關閉所有"
|
||||||
|
},
|
||||||
|
"fileWorkspace": {
|
||||||
|
"files": "檔案",
|
||||||
|
"closeFileTab": "關閉檔案分頁",
|
||||||
|
"close": "關閉",
|
||||||
|
"closeOthers": "關閉其它",
|
||||||
|
"closeAll": "關閉所有"
|
||||||
|
},
|
||||||
|
"terminal": {
|
||||||
|
"rename": "重新命名",
|
||||||
|
"close": "關閉",
|
||||||
|
"closeOthers": "關閉其它",
|
||||||
|
"closeAll": "關閉所有",
|
||||||
|
"hideTerminal": "隱藏終端({shortcut})"
|
||||||
|
},
|
||||||
|
"sessionFiles": {
|
||||||
|
"currentResponse": "目前回應",
|
||||||
|
"noDiffDataAvailable": "找不到 {filePath} 的差異資料",
|
||||||
|
"loading": "載入中...",
|
||||||
|
"noFileChangesInConversation": "此會話未發現檔案變更",
|
||||||
|
"openConversationToSeeChanges": "打開會話以查看檔案變更",
|
||||||
|
"remove": "移除",
|
||||||
|
"changeCount": "{count} 處變更",
|
||||||
|
"fileCount": "{count} 個檔案"
|
||||||
|
},
|
||||||
|
"folderNameDropdown": {
|
||||||
|
"fallbackFolderName": "資料夾",
|
||||||
|
"openFolder": "打開資料夾",
|
||||||
|
"cloneRepository": "複製倉庫",
|
||||||
|
"opened": "已打開",
|
||||||
|
"recentOpen": "最近打開"
|
||||||
|
},
|
||||||
|
"fileWorkspacePanel": {
|
||||||
|
"viewDiff": "查看差異",
|
||||||
|
"openFile": "打開檔案",
|
||||||
|
"fileCount": "{count} 個檔案",
|
||||||
|
"openFileOrDiff": "從右側面板打開檔案或差異",
|
||||||
|
"disk": "磁碟",
|
||||||
|
"head": "HEAD",
|
||||||
|
"unsaved": "未儲存",
|
||||||
|
"workingTree": "工作區",
|
||||||
|
"loading": "載入中...",
|
||||||
|
"compareWithBranch": "{path} · 與 {branch} 比較",
|
||||||
|
"hunkCount": "{count} 個區塊",
|
||||||
|
"prev": "上一個",
|
||||||
|
"next": "下一個",
|
||||||
|
"jumpToLine": "跳到第 {line} 行",
|
||||||
|
"noParsedDiffSections": "未解析到差異區塊",
|
||||||
|
"loadingEditor": "編輯器載入中..."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user