Merge branch 'cv-main-z5swdp'
This commit is contained in:
@@ -91,7 +91,7 @@ export const MessageThreadScrollButton = ({
|
|||||||
!isAtBottom && (
|
!isAtBottom && (
|
||||||
<Button
|
<Button
|
||||||
className={cn(
|
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
|
className
|
||||||
)}
|
)}
|
||||||
onClick={handleScrollToBottom}
|
onClick={handleScrollToBottom}
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
Columns2,
|
Columns2,
|
||||||
FileCode2,
|
FileCode2,
|
||||||
MessageSquare,
|
MessageSquare,
|
||||||
PanelBottom,
|
|
||||||
PanelLeft,
|
PanelLeft,
|
||||||
PanelRight,
|
PanelRight,
|
||||||
Search,
|
Search,
|
||||||
Settings,
|
Settings,
|
||||||
|
SquareTerminal,
|
||||||
} from "lucide-react"
|
} from "lucide-react"
|
||||||
import { useTranslations } from "next-intl"
|
import { useTranslations } from "next-intl"
|
||||||
import { getGitBranch, openFolderWindow, openSettingsWindow } from "@/lib/api"
|
import { getGitBranch, openFolderWindow, openSettingsWindow } from "@/lib/api"
|
||||||
@@ -340,21 +340,6 @@ export function FolderTitleBar() {
|
|||||||
>
|
>
|
||||||
<PanelLeft className="h-3.5 w-3.5" />
|
<PanelLeft className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</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
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
@@ -370,6 +355,21 @@ export function FolderTitleBar() {
|
|||||||
>
|
>
|
||||||
<PanelRight className="h-3.5 w-3.5" />
|
<PanelRight className="h-3.5 w-3.5" />
|
||||||
</Button>
|
</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
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { Settings } from "lucide-react"
|
|||||||
import { useTranslations } from "next-intl"
|
import { useTranslations } from "next-intl"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
import { loadFolderHistory, openSettingsWindow } from "@/lib/api"
|
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 type { FolderHistoryEntry } from "@/lib/types"
|
||||||
import { FolderList } from "@/components/welcome/folder-list"
|
import { FolderList } from "@/components/welcome/folder-list"
|
||||||
import { FolderActions } from "@/components/welcome/folder-actions"
|
import { FolderActions } from "@/components/welcome/folder-actions"
|
||||||
@@ -18,6 +20,28 @@ export function WelcomeScreen() {
|
|||||||
const t = useTranslations("WelcomePage")
|
const t = useTranslations("WelcomePage")
|
||||||
const [history, setHistory] = useState<FolderHistoryEntry[]>([])
|
const [history, setHistory] = useState<FolderHistoryEntry[]>([])
|
||||||
const [loading, setLoading] = useState(true)
|
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 () => {
|
const refreshHistory = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
@@ -49,15 +73,7 @@ export function WelcomeScreen() {
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
className="h-6 w-6 hover:text-foreground/80"
|
className="h-6 w-6 hover:text-foreground/80"
|
||||||
onClick={() => {
|
onClick={handleOpenSettings}
|
||||||
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),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
title={t("openSettings")}
|
title={t("openSettings")}
|
||||||
aria-label={t("openSettings")}
|
aria-label={t("openSettings")}
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
Reference in New Issue
Block a user