Merge branch 'cv-main-z5swdp'

This commit is contained in:
xintaofei
2026-03-28 14:45:24 +08:00
3 changed files with 42 additions and 26 deletions

View File

@@ -91,7 +91,7 @@ export const MessageThreadScrollButton = ({
!isAtBottom && (
<Button
className={cn(
"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted",
"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full bg-background/90 hover:bg-muted/90",
className
)}
onClick={handleScrollToBottom}

View File

@@ -11,11 +11,11 @@ import {
Columns2,
FileCode2,
MessageSquare,
PanelBottom,
PanelLeft,
PanelRight,
Search,
Settings,
SquareTerminal,
} from "lucide-react"
import { useTranslations } from "next-intl"
import { getGitBranch, openFolderWindow, openSettingsWindow } from "@/lib/api"
@@ -340,21 +340,6 @@ export function FolderTitleBar() {
>
<PanelLeft className="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="icon"
className={`h-6 w-6 hover:text-foreground/80 ${terminalOpen ? "bg-accent" : ""}`}
onClick={() => toggleTerminal()}
title={tTitleBar("withShortcut", {
label: tTitleBar("toggleTerminal"),
shortcut: formatShortcutLabel(
shortcuts.toggle_terminal,
isMac
),
})}
>
<PanelBottom className="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="icon"
@@ -370,6 +355,21 @@ export function FolderTitleBar() {
>
<PanelRight className="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="icon"
className={`h-6 w-6 hover:text-foreground/80 ${terminalOpen ? "bg-accent" : ""}`}
onClick={() => toggleTerminal()}
title={tTitleBar("withShortcut", {
label: tTitleBar("toggleTerminal"),
shortcut: formatShortcutLabel(
shortcuts.toggle_terminal,
isMac
),
})}
>
<SquareTerminal className="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="icon"

View File

@@ -5,6 +5,8 @@ import { Settings } from "lucide-react"
import { useTranslations } from "next-intl"
import { toast } from "sonner"
import { loadFolderHistory, openSettingsWindow } from "@/lib/api"
import { matchShortcutEvent } from "@/lib/keyboard-shortcuts"
import { useShortcutSettings } from "@/hooks/use-shortcut-settings"
import type { FolderHistoryEntry } from "@/lib/types"
import { FolderList } from "@/components/welcome/folder-list"
import { FolderActions } from "@/components/welcome/folder-actions"
@@ -18,6 +20,28 @@ export function WelcomeScreen() {
const t = useTranslations("WelcomePage")
const [history, setHistory] = useState<FolderHistoryEntry[]>([])
const [loading, setLoading] = useState(true)
const { shortcuts } = useShortcutSettings()
const handleOpenSettings = useCallback(() => {
openSettingsWindow().catch((err) => {
console.error("[WelcomeScreen] failed to open settings:", err)
const resolvedError = resolveWelcomeError(err)
toast.error(t("toasts.openSettingsFailed"), {
description: resolvedError.detail ?? t(resolvedError.key),
})
})
}, [t])
useEffect(() => {
function handleKeyDown(e: KeyboardEvent) {
if (matchShortcutEvent(e, shortcuts.open_settings)) {
e.preventDefault()
handleOpenSettings()
}
}
document.addEventListener("keydown", handleKeyDown)
return () => document.removeEventListener("keydown", handleKeyDown)
}, [shortcuts, handleOpenSettings])
const refreshHistory = useCallback(async () => {
try {
@@ -49,15 +73,7 @@ export function WelcomeScreen() {
variant="ghost"
size="icon"
className="h-6 w-6 hover:text-foreground/80"
onClick={() => {
openSettingsWindow().catch((err) => {
console.error("[WelcomeScreen] failed to open settings:", err)
const resolvedError = resolveWelcomeError(err)
toast.error(t("toasts.openSettingsFailed"), {
description: resolvedError.detail ?? t(resolvedError.key),
})
})
}}
onClick={handleOpenSettings}
title={t("openSettings")}
aria-label={t("openSettings")}
type="button"