fix(ui): keep mobile terminal clear of cockpit

This commit is contained in:
ogt
2026-07-14 14:48:35 +08:00
parent fa28aa4e8d
commit 1cc0737529
2 changed files with 34 additions and 2 deletions

View File

@@ -17,7 +17,7 @@
import { useCallback } from 'react'
import { useTranslations } from 'next-intl'
import { usePathname } from 'next/navigation'
import { Menu, ShieldCheck } from 'lucide-react'
import { Menu, ShieldCheck, Terminal } from 'lucide-react'
import { Z_INDEX } from '@/lib/constants/z-index'
// =============================================================================
@@ -48,6 +48,7 @@ export function Header({
const tDashboard = useTranslations('dashboard')
const tNav = useTranslations('nav')
const tSidebar = useTranslations('sidebar')
const tTerminal = useTranslations('omniTerminal')
const pathname = usePathname()
const switchLocale = useCallback((newLocale: string) => {
@@ -193,6 +194,37 @@ export function Header({
{tDashboard('title')}
</span>
{compact && (
<button
type="button"
onClick={() => {
const event = new KeyboardEvent('keydown', {
key: 'j',
metaKey: true,
bubbles: true,
})
window.dispatchEvent(event)
}}
aria-label={tTerminal('open')}
title={tTerminal('open')}
style={{
width: 38,
height: 38,
borderRadius: 8,
border: '0.5px solid #d8d4c8',
background: '#fff',
color: '#334155',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
cursor: 'pointer',
flexShrink: 0,
}}
>
<Terminal size={17} aria-hidden="true" strokeWidth={2.2} />
</button>
)}
{/* ⌘K Command Palette 入口提示 */}
<button
onClick={() => {

View File

@@ -100,7 +100,7 @@ export const OmniTerminal = () => {
return (
<button
onClick={openTerminal}
className="fixed bottom-4 right-4 flex h-11 w-11 items-center justify-center rounded-md border border-gray-200 bg-white/80 text-nothing-black shadow-sm backdrop-blur-[20px] transition-all hover:bg-white sm:h-12 sm:w-12"
className="fixed bottom-4 right-4 hidden h-12 w-12 items-center justify-center rounded-md border border-gray-200 bg-white/80 text-nothing-black shadow-sm backdrop-blur-[20px] transition-all hover:bg-white sm:flex"
style={{ zIndex: Z_INDEX.OMNI_TERMINAL }}
aria-label={t('open')}
title={`${t('open')} (${t('shortcut')})`}