mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-26 02:31:40 +00:00
fix(ui): unify custom tooltips and keep Custom CSS docs in help modal (#4360)
This commit is contained in:
39 files changed
+719
-435
No files matched your search
@@ -475,7 +475,7 @@ export const enCoreMessages: Messages = {
|
||||
'settings.appearance.themeColor.dark': 'Dark palette',
|
||||
'settings.appearance.customCss': 'Custom CSS',
|
||||
'settings.appearance.customCss.desc':
|
||||
'Add custom CSS to personalize the app appearance. Changes apply immediately. Selected top tabs (`.top-tab[data-active="true"]`) read `--top-tab-active-bg`, `--top-tab-active-fg`, and `--top-tab-active-border`. Leave them unset to keep the current look.',
|
||||
'Add custom CSS to personalize the app appearance. Changes apply immediately.',
|
||||
'settings.appearance.customCss.help.ariaLabel': 'Custom CSS help',
|
||||
'settings.appearance.customCss.help.title': 'Custom CSS guide',
|
||||
'settings.appearance.customCss.help.body': `Major UI regions expose a \`data-section\` attribute you can target. Changes apply as soon as you edit the CSS.
|
||||
|
||||
@@ -475,7 +475,7 @@ export const esCoreMessages: Messages = {
|
||||
'settings.appearance.themeColor.dark': 'Paleta oscura',
|
||||
'settings.appearance.customCss': 'CSS personalizado',
|
||||
'settings.appearance.customCss.desc':
|
||||
'Agrega CSS personalizado para personalizar la apariencia de la aplicación. Los cambios se aplican de inmediato. Las pestañas superiores seleccionadas (`.top-tab[data-active="true"]`) leen `--top-tab-active-bg`, `--top-tab-active-fg` y `--top-tab-active-border`. Si no las defines, se conserva el aspecto actual.',
|
||||
'Agrega CSS personalizado para personalizar la apariencia de la aplicación. Los cambios se aplican de inmediato.',
|
||||
'settings.appearance.customCss.help.ariaLabel': 'Ayuda de CSS personalizado',
|
||||
'settings.appearance.customCss.help.title': 'Guía de CSS personalizado',
|
||||
'settings.appearance.customCss.help.body': `Las principales regiones de la interfaz exponen un atributo \`data-section\` que puedes usar como destino. Los cambios se aplican en cuanto editas el CSS.
|
||||
|
||||
@@ -432,7 +432,7 @@ export const ruCoreMessages: Messages = {
|
||||
'settings.appearance.themeColor.dark': 'Палитра тёмной темы',
|
||||
'settings.appearance.customCss': 'Пользовательский CSS',
|
||||
'settings.appearance.customCss.desc':
|
||||
'Добавьте пользовательский CSS, чтобы настроить внешний вид. Изменения применяются сразу. Выбранные верхние вкладки (`.top-tab[data-active="true"]`) читают `--top-tab-active-bg`, `--top-tab-active-fg` и `--top-tab-active-border`. Не задавайте их, чтобы сохранить текущий вид.',
|
||||
'Добавьте пользовательский CSS, чтобы настроить внешний вид. Изменения применяются сразу.',
|
||||
'settings.appearance.customCss.help.ariaLabel': 'Справка по пользовательскому CSS',
|
||||
'settings.appearance.customCss.help.title': 'Руководство по пользовательскому CSS',
|
||||
'settings.appearance.customCss.help.body': `Основные области интерфейса помечены атрибутом \`data-section\` для CSS-селекторов. Изменения применяются сразу после правки.
|
||||
|
||||
@@ -482,7 +482,7 @@ export const zhCNCoreMessages: Messages = {
|
||||
'settings.appearance.themeColor.dark': '深色主题',
|
||||
'settings.appearance.customCss': '自定义 CSS',
|
||||
'settings.appearance.customCss.desc':
|
||||
'使用自定义 CSS 个性化界面,修改会立即生效。选中的顶部标签(`.top-tab[data-active="true"]`)会读取 `--top-tab-active-bg`、`--top-tab-active-fg` 和 `--top-tab-active-border`。不设置则保持当前外观。',
|
||||
'使用自定义 CSS 个性化界面,修改会立即生效。',
|
||||
'settings.appearance.customCss.help.ariaLabel': '自定义 CSS 说明',
|
||||
'settings.appearance.customCss.help.title': '自定义 CSS 说明',
|
||||
'settings.appearance.customCss.help.body': `主要 UI 区块都暴露了 \`data-section\` 属性,供你用 CSS 定位。编辑后会立即生效。
|
||||
|
||||
@@ -482,7 +482,7 @@ export const zhTWCoreMessages: Messages = {
|
||||
'settings.appearance.themeColor.dark': '深色主題',
|
||||
'settings.appearance.customCss': '自訂 CSS',
|
||||
'settings.appearance.customCss.desc':
|
||||
'使用自訂 CSS 個人化介面,修改會立即生效。選取的頂部分頁(`.top-tab[data-active="true"]`)會讀取 `--top-tab-active-bg`、`--top-tab-active-fg` 和 `--top-tab-active-border`。不設定則維持目前外觀。',
|
||||
'使用自訂 CSS 個人化介面,修改會立即生效。',
|
||||
'settings.appearance.customCss.help.ariaLabel': '自訂 CSS 說明',
|
||||
'settings.appearance.customCss.help.title': '自訂 CSS 說明',
|
||||
'settings.appearance.customCss.help.body': `主要 UI 區塊都公開了 \`data-section\` 屬性,供你用 CSS 定位。編輯後會立即生效。
|
||||
|
||||
@@ -36,6 +36,8 @@ import {
|
||||
type VariableSizeVirtualListHandle,
|
||||
} from './ui/VariableSizeVirtualList';
|
||||
import { Input } from './ui/input';
|
||||
import { SnippetCommandTooltipContent } from './snippets/SnippetCommandTooltipContent';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './ui/tooltip';
|
||||
import { TERMINAL_SIDE_PANEL_INNER_HEADER_CLASS } from './terminalLayer/terminalSidePanelChrome';
|
||||
|
||||
export type HistoryPanelScope = 'host' | 'global';
|
||||
@@ -273,6 +275,7 @@ const HistorySidePanelInner: React.FC<HistorySidePanelProps> = ({
|
||||
// Stay mounted when the side panel parks this tree. Returning null here
|
||||
// would remount the virtual list on every Notes <-> History switch.
|
||||
return (
|
||||
<TooltipProvider delayDuration={300}>
|
||||
<div
|
||||
className="h-full flex flex-col bg-background overflow-hidden"
|
||||
data-section="history-panel"
|
||||
@@ -295,28 +298,40 @@ const HistorySidePanelInner: React.FC<HistorySidePanelProps> = ({
|
||||
/>
|
||||
</div>
|
||||
{scope === 'host' && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleRefresh}
|
||||
disabled={!isSupportedSession || state.loading}
|
||||
title={t('history.action.refresh')}
|
||||
aria-label={t('history.action.refresh')}
|
||||
className="shrink-0 h-6 w-6 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors disabled:opacity-40 disabled:hover:text-muted-foreground disabled:hover:bg-transparent"
|
||||
>
|
||||
<RefreshCw size={14} className={cn(state.loading && 'animate-spin')} />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="inline-flex shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleRefresh}
|
||||
disabled={!isSupportedSession || state.loading}
|
||||
aria-label={t('history.action.refresh')}
|
||||
className="h-6 w-6 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors disabled:opacity-40 disabled:hover:text-muted-foreground disabled:hover:bg-transparent"
|
||||
>
|
||||
<RefreshCw size={14} className={cn(state.loading && 'animate-spin')} />
|
||||
</button>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t('history.action.refresh')}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
{scope === 'global' && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setClearAllOpen(true)}
|
||||
disabled={!onClearGlobalHistory}
|
||||
title={t('history.action.clearAll')}
|
||||
aria-label={t('history.action.clearAll')}
|
||||
className="shrink-0 h-6 w-6 flex items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-40 disabled:hover:text-muted-foreground disabled:hover:bg-transparent"
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="inline-flex shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setClearAllOpen(true)}
|
||||
disabled={!onClearGlobalHistory}
|
||||
aria-label={t('history.action.clearAll')}
|
||||
className="h-6 w-6 flex items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-40 disabled:hover:text-muted-foreground disabled:hover:bg-transparent"
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t('history.action.clearAll')}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -447,6 +462,7 @@ const HistorySidePanelInner: React.FC<HistorySidePanelProps> = ({
|
||||
onConfirm={handleClearAll}
|
||||
/>
|
||||
</div>
|
||||
</TooltipProvider>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -457,23 +473,27 @@ const ScopeTab: React.FC<{
|
||||
onClick: () => void;
|
||||
className?: string;
|
||||
}> = ({ active, label, icon, onClick, className }) => (
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={active}
|
||||
onClick={onClick}
|
||||
title={label}
|
||||
className={cn(
|
||||
'inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] leading-4 transition-colors min-w-0 shrink whitespace-nowrap',
|
||||
active
|
||||
? 'bg-muted text-foreground font-medium'
|
||||
: 'text-muted-foreground hover:text-foreground',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{icon}
|
||||
<span className="truncate">{label}</span>
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={active}
|
||||
onClick={onClick}
|
||||
className={cn(
|
||||
'inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] leading-4 transition-colors min-w-0 shrink whitespace-nowrap',
|
||||
active
|
||||
? 'bg-muted text-foreground font-medium'
|
||||
: 'text-muted-foreground hover:text-foreground',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{icon}
|
||||
<span className="truncate">{label}</span>
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{label}</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
const EmptyState: React.FC<{ message: string }> = ({ message }) => (
|
||||
@@ -564,11 +584,18 @@ const HistoryRow: React.FC<HistoryRowProps> = memo(
|
||||
}
|
||||
};
|
||||
|
||||
const rowTitle = isSelected
|
||||
? undefined
|
||||
: [entry.command, showHostLabel && entry.hostLabel ? entry.hostLabel : null]
|
||||
.filter(Boolean)
|
||||
.join('\n');
|
||||
const textContent = (
|
||||
<div className="w-0 flex-1 min-w-0">
|
||||
<div className="font-mono text-[11px] truncate whitespace-nowrap">
|
||||
{entry.command}
|
||||
</div>
|
||||
{showHostLabel && entry.hostLabel ? (
|
||||
<div className="text-[10px] text-muted-foreground truncate">
|
||||
{entry.hostLabel}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -579,21 +606,21 @@ const HistoryRow: React.FC<HistoryRowProps> = memo(
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-expanded={isSelected}
|
||||
title={rowTitle}
|
||||
onClick={onSelect}
|
||||
onKeyDown={handleKeyDown}
|
||||
onMouseDown={handleMouseDown}
|
||||
>
|
||||
<div className="w-0 flex-1 min-w-0">
|
||||
<div className="font-mono text-[11px] truncate whitespace-nowrap">
|
||||
{entry.command}
|
||||
</div>
|
||||
{showHostLabel && entry.hostLabel ? (
|
||||
<div className="text-[10px] text-muted-foreground truncate">
|
||||
{entry.hostLabel}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
{isSelected ? textContent : (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>{textContent}</TooltipTrigger>
|
||||
<TooltipContent side="left" align="start">
|
||||
<SnippetCommandTooltipContent
|
||||
label={showHostLabel ? entry.hostLabel : undefined}
|
||||
command={entry.command}
|
||||
/>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
<div
|
||||
className="flex shrink-0 items-center gap-0.5 opacity-0 group-hover:opacity-100 focus-within:opacity-100"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
@@ -624,15 +651,19 @@ const IconButton: React.FC<{
|
||||
onClick: () => void;
|
||||
children: React.ReactNode;
|
||||
}> = ({ title, onClick, children }) => (
|
||||
<button
|
||||
type="button"
|
||||
title={title}
|
||||
aria-label={title}
|
||||
onClick={onClick}
|
||||
className="h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-muted/70 transition-colors"
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={title}
|
||||
onClick={onClick}
|
||||
className="h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-muted/70 transition-colors"
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{title}</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
export const HistorySidePanel = memo(HistorySidePanelInner);
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
type AsidePanelResizeProps,
|
||||
} from './ui/aside-panel';
|
||||
import { HostNotesEditor } from './host/HostNotesEditor';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip';
|
||||
import { cn } from '../lib/utils';
|
||||
|
||||
interface SerialHostDetailsPanelProps {
|
||||
@@ -292,19 +293,23 @@ export const SerialHostDetailsPanel: React.FC<SerialHostDetailsPanelPropsWithRes
|
||||
/>
|
||||
<div className="absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-0.5">
|
||||
{(initialData.password !== undefined || password !== '') && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setPassword('');
|
||||
setPasswordChanged(true);
|
||||
setPasswordCleared(true);
|
||||
}}
|
||||
title={t('serial.field.clearPassword')}
|
||||
aria-label={t('serial.field.clearPassword')}
|
||||
className="p-1 text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setPassword('');
|
||||
setPasswordChanged(true);
|
||||
setPasswordCleared(true);
|
||||
}}
|
||||
aria-label={t('serial.field.clearPassword')}
|
||||
className="p-1 text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t('serial.field.clearPassword')}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useStickToBottomContext } from 'use-stick-to-bottom';
|
||||
import { useI18n } from '../../application/i18n/I18nProvider';
|
||||
import type { ChatJumpEntry } from '../../domain/chatJumpNav';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
|
||||
export interface ChatJumpNavProps {
|
||||
entries: ChatJumpEntry[];
|
||||
@@ -83,21 +84,25 @@ const ChatJumpNav: React.FC<ChatJumpNavProps> = ({
|
||||
|
||||
return (
|
||||
<div ref={rootRef} className="absolute top-3 right-3 z-20 flex flex-col items-end gap-1.5">
|
||||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
'h-7 w-7 rounded-full border border-border/40 bg-background/90 backdrop-blur-sm',
|
||||
'flex items-center justify-center shadow-sm',
|
||||
'text-muted-foreground hover:text-foreground hover:bg-muted transition-colors cursor-pointer',
|
||||
open && 'text-foreground bg-muted',
|
||||
)}
|
||||
aria-label={t('ai.chat.jumpNav')}
|
||||
aria-expanded={open}
|
||||
title={t('ai.chat.jumpNav')}
|
||||
onClick={() => setOpen((value) => !value)}
|
||||
>
|
||||
{open ? <X size={14} /> : <ListTree size={14} />}
|
||||
</button>
|
||||
<Tooltip open={open ? false : undefined}>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
'h-7 w-7 rounded-full border border-border/40 bg-background/90 backdrop-blur-sm',
|
||||
'flex items-center justify-center shadow-sm',
|
||||
'text-muted-foreground hover:text-foreground hover:bg-muted transition-colors cursor-pointer',
|
||||
open && 'text-foreground bg-muted',
|
||||
)}
|
||||
aria-label={t('ai.chat.jumpNav')}
|
||||
aria-expanded={open}
|
||||
onClick={() => setOpen((value) => !value)}
|
||||
>
|
||||
{open ? <X size={14} /> : <ListTree size={14} />}
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="left">{t('ai.chat.jumpNav')}</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
{open && (
|
||||
<div
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
import type { AgentModelPreset, ProviderConfig } from '../../infrastructure/ai/types';
|
||||
import { formatRelativeTime } from '../AIChatSessionHistoryDrawer';
|
||||
import { ProviderIconBadge } from '../settings/tabs/ai/ProviderIconBadge';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
||||
import { useProviderModelCatalog } from './useProviderModelCatalog';
|
||||
|
||||
export const COMPOSER_PROVIDER_PICKER_WIDTH = 260;
|
||||
@@ -416,15 +417,21 @@ export const ComposerModelPicker: React.FC<ComposerModelPickerProps> = ({
|
||||
<span className="min-w-0 flex-1 truncate" title={catalogChipText}>{catalogChipText}</span>
|
||||
)}
|
||||
{showRefreshButton && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={refreshLabel}
|
||||
title={refreshLabel}
|
||||
onClick={onRefreshCatalog}
|
||||
className="shrink-0 rounded p-0.5 text-muted-foreground/55 transition-colors hover:bg-muted/40 hover:text-foreground/75 cursor-pointer"
|
||||
>
|
||||
<RotateCw size={11} />
|
||||
</button>
|
||||
<TooltipProvider delayDuration={300}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={refreshLabel}
|
||||
onClick={onRefreshCatalog}
|
||||
className="shrink-0 rounded p-0.5 text-muted-foreground/55 transition-colors hover:bg-muted/40 hover:text-foreground/75 cursor-pointer"
|
||||
>
|
||||
<RotateCw size={11} />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{refreshLabel}</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { useHostBrowserControls } from '../../application/state/useHostBrow
|
||||
import { useI18n } from '../../application/i18n/I18nProvider';
|
||||
import { Button } from '../ui/button';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
|
||||
function size(bytes: number) {
|
||||
const units = ['B', 'KB', 'MB', 'GB'];
|
||||
@@ -15,7 +16,15 @@ function size(bytes: number) {
|
||||
export function BrowserDownloads({ items, command }: { items: HostBrowserDownload[]; command: ReturnType<typeof useHostBrowserControls>['downloadCommand'] }) {
|
||||
const { t } = useI18n();
|
||||
return <div className="min-w-0">
|
||||
<div className="flex items-center justify-between gap-2 border-b border-border/50 px-3 py-2"><div className="min-w-0"><p className="text-xs font-medium">{t('terminal.browser.downloads')}</p><p className="mt-1 text-[11px] text-muted-foreground">{t('terminal.browser.downloadLocation')}</p></div><Button size="icon" variant="ghost" className="h-6 w-6 shrink-0" aria-label={t('terminal.browser.openFolder')} title={t('terminal.browser.openFolder')} onClick={() => void command('open-folder')}><FolderOpen size={14} /></Button></div>
|
||||
<div className="flex items-center justify-between gap-2 border-b border-border/50 px-3 py-2">
|
||||
<div className="min-w-0"><p className="text-xs font-medium">{t('terminal.browser.downloads')}</p><p className="mt-1 text-[11px] text-muted-foreground">{t('terminal.browser.downloadLocation')}</p></div>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button size="icon" variant="ghost" className="h-6 w-6 shrink-0" aria-label={t('terminal.browser.openFolder')} onClick={() => void command('open-folder')}><FolderOpen size={14} /></Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t('terminal.browser.openFolder')}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className="max-h-80 overflow-y-auto p-1">
|
||||
{!items.length && <p className="px-3 py-8 text-center text-xs text-muted-foreground">{t('terminal.browser.downloadEmpty')}</p>}
|
||||
{items.map((item) => {
|
||||
@@ -24,8 +33,21 @@ export function BrowserDownloads({ items, command }: { items: HostBrowserDownloa
|
||||
return <div key={item.id} data-download-id={item.id} className="flex min-w-0 items-center gap-2 rounded-md px-2 py-2 hover:bg-secondary/50">
|
||||
<File size={16} className="shrink-0 text-muted-foreground" /><div className="min-w-0 flex-1"><p className="truncate text-xs" title={item.filename}>{item.filename}</p><p className="mt-0.5 text-[11px] text-muted-foreground">{t(`terminal.browser.${item.missing ? 'missing' : item.status}`)}{item.status === 'progressing' ? ` · ${size(item.received)}${item.total ? ` / ${size(item.total)}` : ''}` : item.status === 'completed' ? ` · ${size(item.total || item.received)}` : ''}</p>
|
||||
{item.status === 'progressing' && <div className="mt-1 h-1 overflow-hidden rounded bg-secondary"><div className={`h-full bg-primary${item.total ? '' : ' animate-pulse'}`} style={{ width: `${item.total ? Math.min(100, item.received * 100 / item.total) : 20}%` }} /></div>}</div>
|
||||
{running ? <Button variant="ghost" size="icon" className="h-6 w-6 shrink-0" aria-label={t('terminal.browser.cancelDownload')} title={t('terminal.browser.cancelDownload')} onClick={() => void command('cancel', item.id)}><X size={13} /></Button>
|
||||
: canOpen ? <Button variant="ghost" size="icon" className="h-6 w-6 shrink-0" title={t('terminal.browser.reveal')} onClick={() => void command('reveal', item.id)}><FolderOpen size={13} /></Button> : null}
|
||||
{running ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="h-6 w-6 shrink-0" aria-label={t('terminal.browser.cancelDownload')} onClick={() => void command('cancel', item.id)}><X size={13} /></Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{t('terminal.browser.cancelDownload')}</TooltipContent>
|
||||
</Tooltip>
|
||||
) : canOpen ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="h-6 w-6 shrink-0" aria-label={t('terminal.browser.reveal')} onClick={() => void command('reveal', item.id)}><FolderOpen size={13} /></Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{t('terminal.browser.reveal')}</TooltipContent>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
<Popover><PopoverTrigger asChild><Button variant="ghost" size="icon" className="h-6 w-6 shrink-0" aria-label={t('terminal.browser.more')}><MoreHorizontal size={13} /></Button></PopoverTrigger><PopoverContent align="end" className="w-40 p-1">
|
||||
{canOpen && <Button variant="ghost" size="sm" className="w-full justify-start text-xs" onClick={() => void command('open', item.id)}>{t('terminal.browser.openFile')}</Button>}
|
||||
{canOpen && <Button variant="ghost" size="sm" className="w-full justify-start text-xs" onClick={() => void command('save-as', item.id)}>{t('terminal.browser.saveAs')}</Button>}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { cn } from '../../lib/utils';
|
||||
import { Button } from '../ui/button';
|
||||
import { Input } from '../ui/input';
|
||||
import { Label } from '../ui/label';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
|
||||
export interface BrowserIconSelection {
|
||||
mode: 'website' | 'text' | 'image';
|
||||
@@ -76,9 +77,14 @@ export function BrowserIconEditor({ value, onChange, readIcon, onBusyChange, all
|
||||
style={{ backgroundColor: color }} onClick={() => onChange({ color })}>
|
||||
{value.color.toLowerCase() === color && <Check size={12} className="text-white" />}
|
||||
</button>)}
|
||||
<label className="relative grid h-6 w-6 cursor-pointer place-items-center rounded-full border border-border text-muted-foreground hover:text-foreground focus-within:ring-1 focus-within:ring-ring" title={t('terminal.browser.customColor')}>
|
||||
<Pipette size={12} /><input aria-label={t('terminal.browser.customColor')} type="color" className="absolute inset-0 h-full w-full cursor-pointer opacity-0" value={value.color} onChange={(event) => onChange({ color: event.target.value })} />
|
||||
</label>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<label className="relative grid h-6 w-6 cursor-pointer place-items-center rounded-full border border-border text-muted-foreground hover:text-foreground focus-within:ring-1 focus-within:ring-ring">
|
||||
<Pipette size={12} /><input aria-label={t('terminal.browser.customColor')} type="color" className="absolute inset-0 h-full w-full cursor-pointer opacity-0" value={value.color} onChange={(event) => onChange({ color: event.target.value })} />
|
||||
</label>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t('terminal.browser.customColor')}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>}
|
||||
{value.mode === 'image' && <div className="space-y-2" onDragOver={(event) => { event.preventDefault(); setDragging(true); }} onDragLeave={(event) => { if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setDragging(false); }}
|
||||
|
||||
@@ -52,6 +52,7 @@ import {
|
||||
import { buildSshNoteLinkOpenHost } from "../../domain/sshDeepLink";
|
||||
import { copyToClipboard } from "../keychain/utils";
|
||||
import { toast } from "../ui/toast";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip";
|
||||
import { cn } from "../../lib/utils";
|
||||
import { FixedSizeVirtualList, type FixedSizeVirtualListHandle } from "../ui/FixedSizeVirtualList";
|
||||
import type { Host } from "../../types";
|
||||
@@ -2119,18 +2120,25 @@ export const InlineMarkdownEditor = React.memo(
|
||||
/>
|
||||
)}
|
||||
{editorMode === "edit" && linkAction && (
|
||||
<button
|
||||
type="button"
|
||||
data-note-link-action="true"
|
||||
title={`打开 ${linkAction.label}`}
|
||||
className="absolute z-40 flex h-7 w-7 items-center justify-center rounded-md bg-popover text-muted-foreground shadow-sm hover:bg-secondary hover:text-foreground"
|
||||
style={{ left: linkAction.left, top: linkAction.top }}
|
||||
onPointerDown={(event) => activateLinkAction(event, linkAction)}
|
||||
onMouseDown={(event) => activateLinkAction(event, linkAction)}
|
||||
onClick={(event) => activateLinkAction(event, linkAction)}
|
||||
>
|
||||
<ExternalLink size={14} />
|
||||
</button>
|
||||
<TooltipProvider delayDuration={300}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
data-note-link-action="true"
|
||||
aria-label={`打开 ${linkAction.label}`}
|
||||
className="absolute z-40 flex h-7 w-7 items-center justify-center rounded-md bg-popover text-muted-foreground shadow-sm hover:bg-secondary hover:text-foreground"
|
||||
style={{ left: linkAction.left, top: linkAction.top }}
|
||||
onPointerDown={(event) => activateLinkAction(event, linkAction)}
|
||||
onMouseDown={(event) => activateLinkAction(event, linkAction)}
|
||||
onClick={(event) => activateLinkAction(event, linkAction)}
|
||||
>
|
||||
<ExternalLink size={14} />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{`打开 ${linkAction.label}`}</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
{hostPicker.open && (
|
||||
<div
|
||||
|
||||
@@ -9,7 +9,9 @@ import {
|
||||
type VaultNote,
|
||||
} from "../../domain/notes";
|
||||
import { copyToClipboard } from "../keychain/utils";
|
||||
import { Button } from "../ui/button";
|
||||
import { toast } from "../ui/toast";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
||||
|
||||
export interface NoteExportMenuProps {
|
||||
note: VaultNote | null;
|
||||
@@ -101,17 +103,24 @@ export const NoteExportMenu: React.FC<NoteExportMenuProps> = ({
|
||||
|
||||
return (
|
||||
<div className={`relative inline-block ${className}`} ref={menuRef}>
|
||||
<button
|
||||
ref={triggerRef}
|
||||
type="button"
|
||||
className="p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors"
|
||||
title={t("notes.export.share")}
|
||||
onClick={() => setOpen((prev) => !prev)}
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={open}
|
||||
>
|
||||
<Share2 size={16} />
|
||||
</button>
|
||||
<Tooltip open={open ? false : undefined}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
ref={triggerRef}
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="app-no-drag h-8 w-8 shrink-0 rounded-md p-0 text-muted-foreground transition-colors hover:bg-secondary/70 hover:text-foreground"
|
||||
aria-label={t("notes.export.share")}
|
||||
onClick={() => setOpen((prev) => !prev)}
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={open}
|
||||
>
|
||||
<Share2 size={16} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t("notes.export.share")}</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
{open && (
|
||||
<div role="menu" className="absolute right-0 top-full mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-lg py-1.5 z-50 text-sm animate-in fade-in-50 zoom-in-95">
|
||||
|
||||
@@ -26,4 +26,5 @@ test("note outline renders a borderless hierarchy without heading-level labels",
|
||||
assert.match(markup, /padding-left:22px/);
|
||||
assert.doesNotMatch(markup, />H[1-6]</);
|
||||
assert.doesNotMatch(markup, /border-l|border-b|uppercase|tracking-wider/);
|
||||
assert.doesNotMatch(markup, /\btitle=/);
|
||||
});
|
||||
@@ -2,6 +2,7 @@ import { ListTree, X } from "lucide-react";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { extractNoteHeadings, type NoteHeadingItem } from "../../domain/notes";
|
||||
import { useI18n } from "../../application/i18n/I18nProvider";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip";
|
||||
|
||||
export interface NoteOutlineProps {
|
||||
content: string;
|
||||
@@ -31,6 +32,7 @@ export const NoteOutline: React.FC<NoteOutlineProps> = ({
|
||||
}, [content]);
|
||||
|
||||
return (
|
||||
<TooltipProvider delayDuration={300}>
|
||||
<nav
|
||||
aria-label={t("notes.outline.title")}
|
||||
data-note-outline="true"
|
||||
@@ -45,15 +47,19 @@ export const NoteOutline: React.FC<NoteOutlineProps> = ({
|
||||
</span>
|
||||
</div>
|
||||
{onClose && (
|
||||
<button
|
||||
type="button"
|
||||
className="rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/60"
|
||||
onClick={onClose}
|
||||
title={t("common.close")}
|
||||
aria-label={t("common.close")}
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="rounded-md p-1 text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/60"
|
||||
onClick={onClose}
|
||||
aria-label={t("common.close")}
|
||||
>
|
||||
<X size={14} />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t("common.close")}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -67,28 +73,34 @@ export const NoteOutline: React.FC<NoteOutlineProps> = ({
|
||||
</div>
|
||||
) : (
|
||||
headings.map((item, index) => (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
data-note-outline-item={item.id}
|
||||
data-heading-level={item.level}
|
||||
className={`flex w-full items-center rounded-md py-1.5 pr-2 text-left text-xs leading-5 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/60 ${
|
||||
activeHeadingId === item.id
|
||||
? "bg-secondary/60 font-medium text-foreground"
|
||||
: "text-muted-foreground hover:bg-secondary/40 hover:text-foreground"
|
||||
}`}
|
||||
style={{ paddingLeft: `${10 + Math.min(item.level - minimumHeadingLevel, 4) * 12}px` }}
|
||||
onClick={() => {
|
||||
setActiveHeadingId(item.id);
|
||||
onSelectHeading?.(item, index);
|
||||
}}
|
||||
title={item.text}
|
||||
>
|
||||
<span className="truncate">{item.text}</span>
|
||||
</button>
|
||||
<Tooltip key={item.id}>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
data-note-outline-item={item.id}
|
||||
data-heading-level={item.level}
|
||||
className={`flex w-full items-center rounded-md py-1.5 pr-2 text-left text-xs leading-5 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/60 ${
|
||||
activeHeadingId === item.id
|
||||
? "bg-secondary/60 font-medium text-foreground"
|
||||
: "text-muted-foreground hover:bg-secondary/40 hover:text-foreground"
|
||||
}`}
|
||||
style={{ paddingLeft: `${10 + Math.min(item.level - minimumHeadingLevel, 4) * 12}px` }}
|
||||
onClick={() => {
|
||||
setActiveHeadingId(item.id);
|
||||
onSelectHeading?.(item, index);
|
||||
}}
|
||||
>
|
||||
<span className="truncate">{item.text}</span>
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="left" className="max-w-xs break-words">
|
||||
{item.text}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</nav>
|
||||
</TooltipProvider>
|
||||
);
|
||||
};
|
||||
@@ -78,9 +78,11 @@ test("NoteToolbar fits formatting controls to the available row width", async (t
|
||||
assert.ok(!element.classList.contains("flex-wrap"));
|
||||
return element;
|
||||
};
|
||||
const buttonLabel = (element: HTMLButtonElement) =>
|
||||
element.getAttribute("aria-label") || element.textContent?.trim() || "";
|
||||
const button = (label: string, parent: ParentNode = window.document) => {
|
||||
const element = Array.from(parent.querySelectorAll<HTMLButtonElement>("button"))
|
||||
.find((candidate) => candidate.title === label || candidate.textContent?.trim() === label);
|
||||
.find((candidate) => buttonLabel(candidate) === label);
|
||||
assert.ok(element, `${label} should be reachable`);
|
||||
return element;
|
||||
};
|
||||
@@ -114,10 +116,11 @@ test("NoteToolbar fits formatting controls to the available row width", async (t
|
||||
|
||||
try {
|
||||
await render();
|
||||
const defaultOrder = Array.from(row().querySelectorAll("button"), (element) => element.title);
|
||||
const defaultOrder = Array.from(row().querySelectorAll<HTMLButtonElement>("button"), buttonLabel);
|
||||
|
||||
await t.test("wide row preserves all controls inline without a scrollbar track", async () => {
|
||||
assert.equal(defaultOrder.length, 19);
|
||||
assert.equal(row().querySelectorAll("button[title]").length, 0, "toolbar buttons should use custom tooltips instead of native title");
|
||||
assert.deepEqual(defaultOrder.slice(0, 5), ["Undo (Ctrl+Z)", "Redo (Ctrl+Y)", "Code font and typography settings", "Heading Level", "Bold (Ctrl+B)"]);
|
||||
assert.equal(defaultOrder.at(-1), "Insert Image");
|
||||
assert.equal(row().querySelector("[data-toolbar-overflow-trigger]"), null);
|
||||
@@ -131,11 +134,15 @@ test("NoteToolbar fits formatting controls to the available row width", async (t
|
||||
|
||||
await t.test("narrow row spills the end of the existing order and keeps every action reachable", async () => {
|
||||
await resize(320);
|
||||
const inlineLabels = Array.from(row().querySelectorAll<HTMLButtonElement>("button[title]"), (element) => element.title);
|
||||
const inlineLabels = Array.from(
|
||||
row().querySelectorAll<HTMLButtonElement>("button:not([data-toolbar-overflow-trigger])"),
|
||||
buttonLabel,
|
||||
);
|
||||
assert.ok(inlineLabels.length < defaultOrder.length);
|
||||
assert.deepEqual(inlineLabels, defaultOrder.slice(0, inlineLabels.length));
|
||||
const menu = await openOverflow();
|
||||
const overflowLabels = Array.from(menu.querySelectorAll("button"), (element) => element.title);
|
||||
const overflowLabels = Array.from(menu.querySelectorAll<HTMLButtonElement>("button"), buttonLabel);
|
||||
assert.equal(menu.querySelectorAll("button[title]").length, 0);
|
||||
assert.deepEqual([...inlineLabels, ...overflowLabels], defaultOrder);
|
||||
const expectedActions = ["bullet", "number", "task", "quote", "codeblock", "math", "table", "divider", "link", "image"];
|
||||
for (let index = 0; index < overflowLabels.length; index += 1) {
|
||||
@@ -179,7 +186,7 @@ test("NoteToolbar fits formatting controls to the available row width", async (t
|
||||
|
||||
await t.test("resizing back to wide restores controls and removes the overflow trigger", async () => {
|
||||
await resize(900);
|
||||
assert.deepEqual(Array.from(row().querySelectorAll("button"), (element) => element.title), defaultOrder);
|
||||
assert.deepEqual(Array.from(row().querySelectorAll<HTMLButtonElement>("button"), buttonLabel), defaultOrder);
|
||||
assert.equal(row().querySelector("[data-toolbar-overflow-trigger]"), null);
|
||||
});
|
||||
|
||||
@@ -234,7 +241,9 @@ test("full notes and the sidebar overlay both render the shared format toolbar",
|
||||
assert.equal(rows.length, 1, `${displayMode} should use NoteToolbar`);
|
||||
assert.doesNotMatch(rows[0].className, /overflow-x-auto|overflow-auto|scrollbar/);
|
||||
assert.equal(rows[0].querySelectorAll("button").length, 19);
|
||||
assert.equal(dom.window.document.querySelector("[data-note-title-row] button[title='Undo (Ctrl+Z)']"), null);
|
||||
assert.equal(rows[0].querySelectorAll("button[title]").length, 0);
|
||||
assert.equal(dom.window.document.querySelector("[data-note-title-row] button[aria-label='Undo (Ctrl+Z)']"), null);
|
||||
assert.equal(dom.window.document.querySelector("[data-note-title-row] button[title]"), null);
|
||||
} finally {
|
||||
dom.window.close();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import { EMPTY_ACTIVE_FORMATS } from "./noteEditorTypes";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
||||
import { ToolbarOverflowMenu, useToolbarOverflowClose } from "../ui/toolbar-item-layout";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger } from "../ui/select";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
||||
import { cn } from "../../lib/utils";
|
||||
|
||||
export interface NoteToolbarProps {
|
||||
@@ -102,21 +103,30 @@ const NoteToolbarPopover: React.FC<{
|
||||
children: React.ReactNode;
|
||||
}> = ({ label, icon, collapsed, contentClassName, children }) => {
|
||||
const closeOverflow = useToolbarOverflowClose();
|
||||
const triggerButton = (
|
||||
<button
|
||||
type="button"
|
||||
className={collapsed ? overflowItemClass : toolbarButtonClass}
|
||||
aria-label={label}
|
||||
data-toolbar-overflow-keep-open="true"
|
||||
onMouseDown={(event) => event.preventDefault()}
|
||||
>
|
||||
{icon}
|
||||
{collapsed && <span>{label}</span>}
|
||||
</button>
|
||||
);
|
||||
return (
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className={collapsed ? overflowItemClass : toolbarButtonClass}
|
||||
title={label}
|
||||
aria-label={label}
|
||||
data-toolbar-overflow-keep-open="true"
|
||||
onMouseDown={(event) => event.preventDefault()}
|
||||
>
|
||||
{icon}
|
||||
{collapsed && <span>{label}</span>}
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
{collapsed ? (
|
||||
<PopoverTrigger asChild>{triggerButton}</PopoverTrigger>
|
||||
) : (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<PopoverTrigger asChild>{triggerButton}</PopoverTrigger>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{label}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
<PopoverContent
|
||||
align="start"
|
||||
className={contentClassName}
|
||||
@@ -411,9 +421,9 @@ export const NoteToolbar: React.FC<NoteToolbarProps> = ({
|
||||
);
|
||||
}
|
||||
const active = "format" in item && activeFormats[item.format];
|
||||
return (
|
||||
const actionButton = (
|
||||
<button
|
||||
key={item.id}
|
||||
key={collapsed ? item.id : undefined}
|
||||
type="button"
|
||||
className={cn(
|
||||
collapsed ? overflowItemClass : toolbarButtonClass,
|
||||
@@ -421,13 +431,19 @@ export const NoteToolbar: React.FC<NoteToolbarProps> = ({
|
||||
)}
|
||||
onMouseDown={(event) => event.preventDefault()}
|
||||
onClick={() => onAction?.(item.id)}
|
||||
title={label}
|
||||
aria-label={label}
|
||||
>
|
||||
<Icon size={14} />
|
||||
{collapsed && <span>{label}</span>}
|
||||
</button>
|
||||
);
|
||||
if (collapsed) return actionButton;
|
||||
return (
|
||||
<Tooltip key={item.id}>
|
||||
<TooltipTrigger asChild>{actionButton}</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{label}</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -1955,14 +1955,19 @@ export const NotesManager: React.FC<NotesManagerProps> = ({
|
||||
>
|
||||
<Hash size={12} className="opacity-70" />
|
||||
<span className={noteMetadataLabelClass}>{tag}</span>
|
||||
<button
|
||||
type="button"
|
||||
className="-mr-0.5 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground"
|
||||
onClick={() => removeTagFromNote(selectedNoteView.id, tag)}
|
||||
title={t("notes.tag.remove")}
|
||||
>
|
||||
<X size={10} />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="-mr-0.5 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground"
|
||||
onClick={() => removeTagFromNote(selectedNoteView.id, tag)}
|
||||
aria-label={t("notes.tag.remove")}
|
||||
>
|
||||
<X size={10} />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t("notes.tag.remove")}</TooltipContent>
|
||||
</Tooltip>
|
||||
</span>
|
||||
))}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { isFontInstalled } from '../../lib/fontAvailability';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { Button } from '../ui/button';
|
||||
import { Combobox, type ComboboxOption } from '../ui/combobox';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
import {
|
||||
buildTerminalCjkFontOptions,
|
||||
getTerminalCjkFontSelectionStatus,
|
||||
@@ -107,18 +108,24 @@ export const TerminalCjkFontSelect: React.FC<Props> = ({
|
||||
onInputValueChange={setPreviewValue}
|
||||
disabled={disabled}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="h-9 w-9 shrink-0"
|
||||
aria-label={t('settings.terminal.font.cjk.refresh')}
|
||||
title={t('settings.terminal.font.cjk.refresh')}
|
||||
disabled={disabled || isLoading}
|
||||
onClick={() => void refreshFonts()}
|
||||
>
|
||||
<RefreshCw size={14} className={cn(isLoading && 'animate-spin')} />
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="inline-flex shrink-0">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="h-9 w-9"
|
||||
aria-label={t('settings.terminal.font.cjk.refresh')}
|
||||
disabled={disabled || isLoading}
|
||||
onClick={() => void refreshFonts()}
|
||||
>
|
||||
<RefreshCw size={14} className={cn(isLoading && 'animate-spin')} />
|
||||
</Button>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t('settings.terminal.font.cjk.refresh')}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -595,14 +595,19 @@ function SettingsAppearanceTab(props: {
|
||||
<h3 className="text-sm font-semibold text-foreground">
|
||||
{t("settings.appearance.customCss")}
|
||||
</h3>
|
||||
<button
|
||||
type="button"
|
||||
className="flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
|
||||
aria-label={t("settings.appearance.customCss.help.ariaLabel")}
|
||||
onClick={() => setCustomCssHelpOpen(true)}
|
||||
>
|
||||
<HelpCircle size={13} />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
|
||||
aria-label={t("settings.appearance.customCss.help.ariaLabel")}
|
||||
onClick={() => setCustomCssHelpOpen(true)}
|
||||
>
|
||||
<HelpCircle size={13} />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("settings.appearance.customCss.help.ariaLabel")}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<p className="text-xs text-muted-foreground">
|
||||
|
||||
@@ -28,6 +28,7 @@ import { Button } from "../../ui/button";
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "../../ui/dialog";
|
||||
import { Input } from "../../ui/input";
|
||||
import { Select as ShadcnSelect, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/select";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../../ui/tooltip";
|
||||
import { SectionHeader, Select, SettingsAnchor, SettingsTabContent, SettingRow, Toggle } from "../settings-ui";
|
||||
import { ThemeSelectModal } from "../ThemeSelectModal";
|
||||
import { TerminalFontSelect } from "../TerminalFontSelect";
|
||||
@@ -930,18 +931,23 @@ function SettingsTerminalTab(props: {
|
||||
</SelectContent>
|
||||
</ShadcnSelect>
|
||||
{showCustomShellInput && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={openCustomShellModal}
|
||||
title={t("common.edit")}
|
||||
className="flex items-center gap-1 text-xs text-muted-foreground max-w-48 hover:text-foreground"
|
||||
>
|
||||
<Pencil size={11} className="shrink-0" />
|
||||
<span className="truncate">
|
||||
{terminalSettings.localShell}
|
||||
{terminalSettings.localShellArgs?.length ? ` ${formatShellArgs(terminalSettings.localShellArgs)}` : ""}
|
||||
</span>
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
onClick={openCustomShellModal}
|
||||
aria-label={t("common.edit")}
|
||||
className="flex items-center gap-1 text-xs text-muted-foreground max-w-48 hover:text-foreground"
|
||||
>
|
||||
<Pencil size={11} className="shrink-0" />
|
||||
<span className="truncate">
|
||||
{terminalSettings.localShell}
|
||||
{terminalSettings.localShellArgs?.length ? ` ${formatShellArgs(terminalSettings.localShellArgs)}` : ""}
|
||||
</span>
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("common.edit")}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
{!showCustomShellInput && defaultShell && !terminalSettings.localShell && (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Check, Copy, Eye, EyeOff } from "lucide-react";
|
||||
import { cn } from "../../../../lib/utils";
|
||||
import { useI18n } from "../../../../application/i18n/I18nProvider";
|
||||
import { Button } from "../../../ui/button";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../../../ui/tooltip";
|
||||
|
||||
type CopyableCodeBlockProps = {
|
||||
label?: string;
|
||||
@@ -52,18 +53,24 @@ export const CopyableCodeBlock: React.FC<CopyableCodeBlockProps> = ({
|
||||
{sensitive && value ? <Button type="button" variant="ghost" size="sm" className="absolute right-10 top-1.5 h-7 w-7 p-0" onClick={() => setRevealed(!revealed)} aria-label={t(revealed ? "ai.toolSettings.hideSecret" : "ai.toolSettings.showSecret")}>
|
||||
{revealed ? <EyeOff size={14} /> : <Eye size={14} />}
|
||||
</Button> : null}
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled={!canCopy}
|
||||
className="absolute right-1.5 top-1.5 h-7 w-7 p-0 text-muted-foreground hover:text-foreground"
|
||||
onClick={() => void onCopy(copyKey, value)}
|
||||
aria-label={isCopied ? copiedLabel : copyLabel}
|
||||
title={isCopied ? copiedLabel : copyLabel}
|
||||
>
|
||||
{isCopied ? <Check size={14} className="text-emerald-500" /> : <Copy size={14} />}
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="absolute right-1.5 top-1.5 inline-flex">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
disabled={!canCopy}
|
||||
className="h-7 w-7 p-0 text-muted-foreground hover:text-foreground"
|
||||
onClick={() => void onCopy(copyKey, value)}
|
||||
aria-label={isCopied ? copiedLabel : copyLabel}
|
||||
>
|
||||
{isCopied ? <Check size={14} className="text-emerald-500" /> : <Copy size={14} />}
|
||||
</Button>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{isCopied ? copiedLabel : copyLabel}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -19,6 +19,7 @@ import { encryptField, decryptField } from "../../../../infrastructure/persisten
|
||||
import { OPENCODE_GO_PROVIDER_ID } from "../../../../infrastructure/ai/opencodeGo";
|
||||
import { useI18n } from "../../../../application/i18n/I18nProvider";
|
||||
import { Button } from "../../../ui/button";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../../../ui/tooltip";
|
||||
import { cn } from "../../../../lib/utils";
|
||||
import type { BuiltinProviderIcon } from "./types";
|
||||
import { BUILTIN_PROVIDER_ICONS, getFetchBridge } from "./types";
|
||||
@@ -444,21 +445,25 @@ export const ProviderConfigForm: React.FC<{
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-xs font-medium text-muted-foreground">{t('ai.providers.name')}</label>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowIconPicker((v) => !v)}
|
||||
className="group relative shrink-0 rounded-md transition-all hover:brightness-110 hover:ring-2 hover:ring-primary/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60"
|
||||
aria-label={t('ai.providers.icon.change')}
|
||||
title={t('ai.providers.icon.change')}
|
||||
>
|
||||
<ProviderIconBadge provider={previewProvider} />
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute -bottom-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full border border-background bg-primary text-primary-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
|
||||
>
|
||||
<Pencil size={9} strokeWidth={2.5} />
|
||||
</span>
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowIconPicker((v) => !v)}
|
||||
className="group relative shrink-0 rounded-md transition-all hover:brightness-110 hover:ring-2 hover:ring-primary/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60"
|
||||
aria-label={t('ai.providers.icon.change')}
|
||||
>
|
||||
<ProviderIconBadge provider={previewProvider} />
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute -bottom-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full border border-background bg-primary text-primary-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
|
||||
>
|
||||
<Pencil size={9} strokeWidth={2.5} />
|
||||
</span>
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t('ai.providers.icon.change')}</TooltipContent>
|
||||
</Tooltip>
|
||||
<input
|
||||
type="text"
|
||||
value={form.name}
|
||||
@@ -521,7 +526,6 @@ export const ProviderConfigForm: React.FC<{
|
||||
size="sm"
|
||||
onClick={() => setShowIconPicker(false)}
|
||||
aria-label={t('ai.providers.icon.close')}
|
||||
title={t('ai.providers.icon.close')}
|
||||
>
|
||||
<X size={12} className="mr-1.5" />
|
||||
{t('ai.providers.icon.close')}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { cn } from "../../../../lib/utils";
|
||||
import { useToolAccessGuidanceState } from "../../../../application/state/useToolAccessGuidanceState";
|
||||
import { ToolSettingsDialog } from "./ToolSettingsDialog";
|
||||
import { EXTERNAL_MCP_DISCOVERY_ENV_VAR } from "./ExternalMcpCard";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../../../ui/tooltip";
|
||||
|
||||
/** Build a ready-to-paste prompt so an external AI client can register Netcatty MCP itself. */
|
||||
export function buildMcpOnboardingPrompt(
|
||||
@@ -76,16 +77,22 @@ const CopyRow: React.FC<CopyRowProps> = ({ value, label, copyLabel, copiedLabel,
|
||||
>
|
||||
{value}
|
||||
</pre>
|
||||
<button
|
||||
type="button"
|
||||
disabled={!canCopy}
|
||||
className="absolute right-1.5 top-1.5 flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground disabled:opacity-40"
|
||||
onClick={() => void handleCopy()}
|
||||
aria-label={copied ? copiedLabel : copyLabel}
|
||||
title={copied ? copiedLabel : copyLabel}
|
||||
>
|
||||
{copied ? <Check size={14} className="text-emerald-500" /> : <Copy size={14} />}
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="absolute right-1.5 top-1.5 inline-flex">
|
||||
<button
|
||||
type="button"
|
||||
disabled={!canCopy}
|
||||
className="flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground disabled:opacity-40"
|
||||
onClick={() => void handleCopy()}
|
||||
aria-label={copied ? copiedLabel : copyLabel}
|
||||
>
|
||||
{copied ? <Check size={14} className="text-emerald-500" /> : <Copy size={14} />}
|
||||
</button>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{copied ? copiedLabel : copyLabel}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{copyError ? <p role="alert" className="text-xs text-destructive">{t("ai.externalMcp.copyFailed")}</p> : null}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { useI18n } from "../../application/i18n/I18nProvider";
|
||||
import { formatMonitorRate as rate } from "../../domain/monitorFormatting";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
||||
|
||||
/** Shared rate formatting for aggregate summaries and per-mount readings. */
|
||||
export function DiskIoSummary({ stats }: {
|
||||
@@ -8,10 +9,15 @@ export function DiskIoSummary({ stats }: {
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
return (
|
||||
<div data-disk-io className="flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] tabular-nums text-muted-foreground" title={t("monitor.diskIoHint")}>
|
||||
<span>{t("monitor.diskIo")}</span>
|
||||
<span className="whitespace-nowrap">{t("monitor.diskRead")} {rate(stats?.diskReadSpeed)}</span>
|
||||
<span className="whitespace-nowrap">{t("monitor.diskWrite")} {rate(stats?.diskWriteSpeed)}</span>
|
||||
</div>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div data-disk-io className="flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] tabular-nums text-muted-foreground">
|
||||
<span>{t("monitor.diskIo")}</span>
|
||||
<span className="whitespace-nowrap">{t("monitor.diskRead")} {rate(stats?.diskReadSpeed)}</span>
|
||||
<span className="whitespace-nowrap">{t("monitor.diskWrite")} {rate(stats?.diskWriteSpeed)}</span>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t("monitor.diskIoHint")}</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import type {
|
||||
AcceleratorSnapshot,
|
||||
} from '../../domain/systemManager/types';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
import { ResourceBar } from './ResourceBar';
|
||||
import { GpuVendorBadge, vendorDisplayLabel } from './GpuVendorBadge';
|
||||
import {
|
||||
@@ -134,18 +135,28 @@ const DeviceCard = memo(function DeviceCard({
|
||||
</div>
|
||||
<div className="flex items-center gap-2 shrink-0 text-[10px] text-muted-foreground tabular-nums">
|
||||
{Number.isFinite(device.temperatureC) ? (
|
||||
<span className="inline-flex items-center gap-0.5" title={t('systemManager.gpu.temperature')}>
|
||||
<Thermometer size={10} />
|
||||
{Math.round(Number(device.temperatureC))}°C
|
||||
</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="inline-flex items-center gap-0.5">
|
||||
<Thermometer size={10} />
|
||||
{Math.round(Number(device.temperatureC))}°C
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t('systemManager.gpu.temperature')}</TooltipContent>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
{Number.isFinite(device.powerDrawW) ? (
|
||||
<span className="inline-flex items-center gap-0.5" title={t('systemManager.gpu.power')}>
|
||||
<Zap size={10} />
|
||||
{Number(device.powerDrawW).toFixed(0)}
|
||||
{Number.isFinite(device.powerLimitW) ? `/${Math.round(Number(device.powerLimitW))}` : ''}
|
||||
W
|
||||
</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="inline-flex items-center gap-0.5">
|
||||
<Zap size={10} />
|
||||
{Number(device.powerDrawW).toFixed(0)}
|
||||
{Number.isFinite(device.powerLimitW) ? `/${Math.round(Number(device.powerLimitW))}` : ''}
|
||||
W
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{t('systemManager.gpu.power')}</TooltipContent>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@ import React, { memo } from 'react';
|
||||
import { useI18n } from '../../application/i18n/I18nProvider';
|
||||
import type { AcceleratorVendor } from '../../domain/systemManager/types';
|
||||
import { cn } from '../../lib/utils';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
||||
|
||||
/** Simple Icons NVIDIA path (CC0-1.0) — monochrome, uses currentColor. */
|
||||
const NVIDIA_PATH =
|
||||
@@ -61,17 +62,21 @@ export const GpuVendorBadge = memo(function GpuVendorBadge({
|
||||
: null;
|
||||
|
||||
return (
|
||||
<span
|
||||
title={label}
|
||||
className={cn(
|
||||
'inline-flex h-6 shrink-0 items-center justify-center gap-1 rounded-full px-2 text-[10px] font-medium',
|
||||
// Match SystemPanelStatusBadge muted tone so logos stay legible.
|
||||
'bg-slate-500 text-white dark:bg-slate-400 dark:text-slate-950',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{mark}
|
||||
<span className="max-w-[4.5rem] truncate leading-none">{label}</span>
|
||||
</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span
|
||||
className={cn(
|
||||
'inline-flex h-6 shrink-0 items-center justify-center gap-1 rounded-full px-2 text-[10px] font-medium',
|
||||
// Match SystemPanelStatusBadge muted tone so logos stay legible.
|
||||
'bg-slate-500 text-white dark:bg-slate-400 dark:text-slate-950',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{mark}
|
||||
<span className="max-w-[4.5rem] truncate leading-none">{label}</span>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{label}</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
});
|
||||
@@ -456,21 +456,27 @@ export const SystemPanelActionChip = memo(function SystemPanelActionChip({
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
title={title}
|
||||
aria-label={title}
|
||||
disabled={disabled}
|
||||
onClick={onClick}
|
||||
className={cn(
|
||||
'h-6 px-2 inline-flex items-center gap-1 rounded text-[10px] transition-colors disabled:opacity-40',
|
||||
destructive
|
||||
? 'text-muted-foreground hover:text-destructive hover:bg-destructive/10'
|
||||
: 'text-muted-foreground hover:text-foreground hover:bg-muted/70',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="inline-flex">
|
||||
<button
|
||||
type="button"
|
||||
aria-label={title}
|
||||
disabled={disabled}
|
||||
onClick={onClick}
|
||||
className={cn(
|
||||
'h-6 px-2 inline-flex items-center gap-1 rounded text-[10px] transition-colors disabled:opacity-40',
|
||||
destructive
|
||||
? 'text-muted-foreground hover:text-destructive hover:bg-destructive/10'
|
||||
: 'text-muted-foreground hover:text-foreground hover:bg-muted/70',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{title}</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
SCRIPT_OVERLAY_FINISHED_DISMISS_DELAY_MS,
|
||||
ScriptExecutionOverlay,
|
||||
} from "./ScriptExecutionOverlay.tsx";
|
||||
import { installDomEnvironment } from "../test-support/renderReactDom.tsx";
|
||||
import type { ScriptRun } from "@/types/global/netcatty-bridge-script.d.ts";
|
||||
|
||||
const completedRun: ScriptRun = {
|
||||
@@ -50,6 +51,7 @@ test("script overlay covers compact speed-dial full-width instead of reserving a
|
||||
});
|
||||
|
||||
test("script overlay dismisses a completed run after five seconds", () => {
|
||||
const dom = installDomEnvironment();
|
||||
mock.timers.enable({ apis: ["setTimeout"] });
|
||||
let dismissCount = 0;
|
||||
let renderer: ReturnType<typeof create> | undefined;
|
||||
@@ -81,7 +83,10 @@ test("script overlay dismisses a completed run after five seconds", () => {
|
||||
mock.timers.tick(1);
|
||||
assert.equal(dismissCount, 1);
|
||||
} finally {
|
||||
renderer?.unmount();
|
||||
act(() => {
|
||||
renderer?.unmount();
|
||||
});
|
||||
mock.timers.reset();
|
||||
dom.cleanup();
|
||||
}
|
||||
});
|
||||
@@ -3,6 +3,7 @@ import React, { useEffect, useEffectEvent, useMemo, useState } from 'react';
|
||||
import { useI18n } from '@/application/i18n/I18nProvider';
|
||||
import type { ScriptRun } from '@/types/global/netcatty-bridge-script.d.ts';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
import { cn } from '@/lib/utils.ts';
|
||||
|
||||
export interface ScriptExecutionOverlayProps {
|
||||
@@ -258,9 +259,16 @@ export const ScriptExecutionOverlay: React.FC<ScriptExecutionOverlayProps> = ({
|
||||
) : null}
|
||||
<div className="flex items-center gap-1 shrink-0">
|
||||
{isFinished ? (
|
||||
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={onDismiss} title={t('scripts.running.dismiss')}>
|
||||
<X size={14} />
|
||||
</Button>
|
||||
<TooltipProvider delayDuration={300}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={onDismiss} aria-label={t('scripts.running.dismiss')}>
|
||||
<X size={14} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t('scripts.running.dismiss')}</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
) : (
|
||||
<>
|
||||
{run.status === 'running' ? (
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Pause, Play, Square } from 'lucide-react';
|
||||
import React from 'react';
|
||||
import { useI18n } from '@/application/i18n/I18nProvider';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
import { cn } from '@/lib/utils.ts';
|
||||
|
||||
export interface ScriptRecordingIndicatorProps {
|
||||
@@ -35,17 +36,32 @@ export const ScriptRecordingIndicator: React.FC<ScriptRecordingIndicatorProps> =
|
||||
</span>
|
||||
<span className="tabular-nums text-muted-foreground">{formatElapsed(elapsedMs)}</span>
|
||||
{isPaused ? (
|
||||
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={onResume} title={t('scripts.recording.resume')}>
|
||||
<Play size={14} />
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={onResume} aria-label={t('scripts.recording.resume')}>
|
||||
<Play size={14} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t('scripts.recording.resume')}</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={onPause} title={t('scripts.recording.pause')}>
|
||||
<Pause size={14} />
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={onPause} aria-label={t('scripts.recording.pause')}>
|
||||
<Pause size={14} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t('scripts.recording.pause')}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={onStop} title={t('scripts.recording.stop')}>
|
||||
<Square size={14} />
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button size="icon" variant="ghost" className="h-7 w-7" onClick={onStop} aria-label={t('scripts.recording.stop')}>
|
||||
<Square size={14} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t('scripts.recording.stop')}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -246,25 +246,29 @@ const ComposeBarSnippetManagePopover = memo(function ComposeBarSnippetManagePopo
|
||||
if (!next) setSearch('');
|
||||
}}
|
||||
>
|
||||
<PopoverTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="h-6 w-6 flex-shrink-0 flex items-center justify-center rounded transition-colors duration-150"
|
||||
style={{ color: theme.mutedFg }}
|
||||
onMouseEnter={(e) => {
|
||||
e.currentTarget.style.backgroundColor = theme.hoverBg;
|
||||
e.currentTarget.style.color = theme.resolvedFg;
|
||||
}}
|
||||
onMouseLeave={(e) => {
|
||||
e.currentTarget.style.backgroundColor = 'transparent';
|
||||
e.currentTarget.style.color = theme.mutedFg;
|
||||
}}
|
||||
aria-label={manageLabel}
|
||||
title={manageLabel}
|
||||
>
|
||||
<Plus size={12} />
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
<Tooltip open={open ? false : undefined}>
|
||||
<TooltipTrigger asChild>
|
||||
<PopoverTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="h-6 w-6 flex-shrink-0 flex items-center justify-center rounded transition-colors duration-150"
|
||||
style={{ color: theme.mutedFg }}
|
||||
onMouseEnter={(e) => {
|
||||
e.currentTarget.style.backgroundColor = theme.hoverBg;
|
||||
e.currentTarget.style.color = theme.resolvedFg;
|
||||
}}
|
||||
onMouseLeave={(e) => {
|
||||
e.currentTarget.style.backgroundColor = 'transparent';
|
||||
e.currentTarget.style.color = theme.mutedFg;
|
||||
}}
|
||||
aria-label={manageLabel}
|
||||
>
|
||||
<Plus size={12} />
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{manageLabel}</TooltipContent>
|
||||
</Tooltip>
|
||||
<PopoverContent
|
||||
className="w-72 p-0"
|
||||
align="end"
|
||||
|
||||
@@ -795,22 +795,26 @@ function TerminalViewInner({ ctx, isPaneMagnified = false }: { ctx: TerminalView
|
||||
)}
|
||||
>
|
||||
{!showHostInfoBar && inWorkspace && onDetachPointerDown && (
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={-1}
|
||||
title={t("terminal.toolbar.dragPane")}
|
||||
aria-label={t("terminal.toolbar.dragPane")}
|
||||
className={cn(
|
||||
"flex h-6 w-5 shrink-0 items-center justify-center rounded-md",
|
||||
"cursor-grab active:cursor-grabbing",
|
||||
"text-[color:var(--terminal-toolbar-fg)] opacity-45 hover:opacity-90",
|
||||
"hover:bg-[color:var(--terminal-toolbar-btn-hover)] transition-colors",
|
||||
)}
|
||||
data-terminal-detach-drag-handle="true"
|
||||
onPointerDown={onDetachPointerDown}
|
||||
>
|
||||
<GripVertical size={12} strokeWidth={2} aria-hidden="true" />
|
||||
</div>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={-1}
|
||||
aria-label={t("terminal.toolbar.dragPane")}
|
||||
className={cn(
|
||||
"flex h-6 w-5 shrink-0 items-center justify-center rounded-md",
|
||||
"cursor-grab active:cursor-grabbing",
|
||||
"text-[color:var(--terminal-toolbar-fg)] opacity-45 hover:opacity-90",
|
||||
"hover:bg-[color:var(--terminal-toolbar-btn-hover)] transition-colors",
|
||||
)}
|
||||
data-terminal-detach-drag-handle="true"
|
||||
onPointerDown={onDetachPointerDown}
|
||||
>
|
||||
<GripVertical size={12} strokeWidth={2} aria-hidden="true" />
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t("terminal.toolbar.dragPane")}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
{showHostInfoBar && <div
|
||||
className={cn(
|
||||
|
||||
@@ -46,6 +46,7 @@ test('history keep-alive source stays mounted and gates the shell-history subscr
|
||||
assert.match(listSource, /remeasure/);
|
||||
assert.match(listSource, /scrollToIndex\(index, 'auto'\)/);
|
||||
assert.match(listSource, /if \(!measureEnabledRef\.current && next === 0\) return/);
|
||||
assert.doesNotMatch(historySource, /<(?:button|div)[^>]*\btitle=/);
|
||||
});
|
||||
|
||||
const hostA = {
|
||||
|
||||
@@ -162,7 +162,7 @@ test('custom CSS help mentions the top tab hooks in every locale', () => {
|
||||
assert.equal(typeof help, 'string', locale.name);
|
||||
assert.equal(typeof placeholder, 'string', locale.name);
|
||||
for (const hook of HOOKS) {
|
||||
assert.ok(desc.includes(hook), `${locale.name} description missing ${hook}`);
|
||||
assert.ok(!desc.includes(hook), `${locale.name} description should keep ${hook} inside help modal`);
|
||||
assert.ok(help.includes(hook), `${locale.name} help missing ${hook}`);
|
||||
assert.ok(placeholder.includes(hook), `${locale.name} placeholder missing ${hook}`);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useI18n } from "../../application/i18n/I18nProvider";
|
||||
import type { MonitorStats } from "../../domain/monitorRuntime";
|
||||
import { formatMonitorRate } from "../../domain/monitorFormatting";
|
||||
import { buildMonitorDiskListLayout, type MonitorDiskListLayout } from "../../domain/monitorDisks";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip";
|
||||
import { MonitorSystemDiskToggle } from "./MonitorSystemDiskToggle";
|
||||
|
||||
type DiskRates = { diskReadSpeed?: number | null; diskWriteSpeed?: number | null };
|
||||
@@ -34,26 +35,41 @@ export function MonitorDiskIo({ stats, listLayout, showSystemToggle = false, onT
|
||||
const { t } = useI18n();
|
||||
const layout = listLayout ?? buildMonitorDiskListLayout(stats);
|
||||
return (
|
||||
<div className="w-full min-w-0 space-y-1.5 text-[10px] tabular-nums text-muted-foreground">
|
||||
{layout.rows.map((row, index) => {
|
||||
if (row.kind === "system") return showSystemToggle
|
||||
? <MonitorSystemDiskToggle key="system" row={row} onToggle={onToggleSystem} />
|
||||
: <div key="system" data-monitor-system-io-slot aria-hidden="true" className="h-4" />;
|
||||
const { disk } = row;
|
||||
return (
|
||||
<div key={`${disk.mountPoint}-${index}`} data-monitor-disk-io={disk.mountPoint}
|
||||
className="grid h-4 grid-cols-2 items-center gap-2"
|
||||
title={`${disk.mountPoint}\n${t("monitor.partitionIoHint")}`}>
|
||||
<span className="sr-only">{disk.mountPoint} </span>
|
||||
<Rates stats={disk} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div data-monitor-disk-io-total className="flex h-5 items-center justify-between gap-2 border-t border-border/40 pt-1"
|
||||
title={t("monitor.diskIoHint")}>
|
||||
<span>{t("monitor.diskIoTotal")}</span>
|
||||
<div className="flex items-center gap-2"><Rates stats={stats} /></div>
|
||||
<TooltipProvider delayDuration={180}>
|
||||
<div className="w-full min-w-0 space-y-1.5 text-[10px] tabular-nums text-muted-foreground">
|
||||
{layout.rows.map((row, index) => {
|
||||
if (row.kind === "system") return showSystemToggle
|
||||
? <MonitorSystemDiskToggle key="system" row={row} onToggle={onToggleSystem} />
|
||||
: <div key="system" data-monitor-system-io-slot aria-hidden="true" className="h-4" />;
|
||||
const { disk } = row;
|
||||
return (
|
||||
<Tooltip key={`${disk.mountPoint}-${index}`}>
|
||||
<TooltipTrigger asChild>
|
||||
<div
|
||||
data-monitor-disk-io={disk.mountPoint}
|
||||
aria-label={`${disk.mountPoint}: ${t("monitor.partitionIoHint")}`}
|
||||
className="grid h-4 grid-cols-2 items-center gap-2"
|
||||
>
|
||||
<span className="sr-only">{disk.mountPoint} </span>
|
||||
<Rates stats={disk} />
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top" className="max-w-xs whitespace-pre-line">
|
||||
{`${disk.mountPoint}\n${t("monitor.partitionIoHint")}`}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
})}
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div data-monitor-disk-io-total className="flex h-5 items-center justify-between gap-2 border-t border-border/40 pt-1">
|
||||
<span>{t("monitor.diskIoTotal")}</span>
|
||||
<div className="flex items-center gap-2"><Rates stats={stats} /></div>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{t("monitor.diskIoHint")}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
@@ -212,7 +212,8 @@ test("disk I/O distinguishes warming up or unsupported from idle and reports bot
|
||||
)).window.document;
|
||||
const io = document.querySelector("[data-monitor-disk-io]")!;
|
||||
for (const text of expected) assert.ok(io.textContent?.includes(text));
|
||||
assert.match(io.getAttribute("title")!, /block device.*not supported on macOS/);
|
||||
assert.equal(io.getAttribute("title"), null);
|
||||
assert.match(io.getAttribute("aria-label")!, /block device.*not supported on macOS/);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ import { useMonitorDiskGroups } from "../../application/state/useMonitorDiskGrou
|
||||
import { formatMonitorRate as rate } from "../../domain/monitorFormatting";
|
||||
import { VaultHeaderSearch, VaultPageHeader, vaultHeaderIconButtonClass, vaultHeaderSecondaryButtonClass } from "./VaultPageHeader";
|
||||
import { toast } from "../ui/toast";
|
||||
import { TooltipProvider } from "../ui/tooltip";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip";
|
||||
import { MonitorHostCollection } from "./MonitorHostCollection";
|
||||
import { MonitorHostLatency, MonitorHostNotes, MonitorHostTags } from "./MonitorHostMetadata";
|
||||
|
||||
@@ -471,6 +471,7 @@ export function MonitorPanels({
|
||||
if (detail && !detailAvailable) setDetail(null);
|
||||
}, [detail, detailAvailable]);
|
||||
return (
|
||||
<TooltipProvider delayDuration={180}>
|
||||
<section
|
||||
className="relative flex min-h-0 min-w-0 flex-1 overflow-hidden"
|
||||
data-section="vault-monitor"
|
||||
@@ -531,32 +532,40 @@ export function MonitorPanels({
|
||||
)}
|
||||
<div className="min-w-0 flex-1" />
|
||||
{panel && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
className={cn(vaultHeaderSecondaryButtonClass, "shrink-0")}
|
||||
aria-label={t(running ? "monitor.stop" : "monitor.start")}
|
||||
title={t(running ? "monitor.stop" : "monitor.start")}
|
||||
onClick={() =>
|
||||
running
|
||||
? monitorActions.stop(panel.id)
|
||||
: monitorActions.start(panel.id)
|
||||
}
|
||||
>
|
||||
{running ? <Square size={13} /> : <Play size={13} />}
|
||||
<span className="monitor-header-action-label">{t(running ? "monitor.stop" : "monitor.start")}</span>
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
className={cn(vaultHeaderSecondaryButtonClass, "shrink-0")}
|
||||
aria-label={t(running ? "monitor.stop" : "monitor.start")}
|
||||
onClick={() =>
|
||||
running
|
||||
? monitorActions.stop(panel.id)
|
||||
: monitorActions.start(panel.id)
|
||||
}
|
||||
>
|
||||
{running ? <Square size={13} /> : <Play size={13} />}
|
||||
<span className="monitor-header-action-label">{t(running ? "monitor.stop" : "monitor.start")}</span>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t(running ? "monitor.stop" : "monitor.start")}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Button
|
||||
variant="secondary"
|
||||
className={cn(vaultHeaderSecondaryButtonClass, "shrink-0")}
|
||||
aria-label={t("monitor.create")}
|
||||
title={t("monitor.create")}
|
||||
onClick={() => startEdit(null)}
|
||||
>
|
||||
<Plus size={14} />
|
||||
<span className="monitor-header-action-label">{t("monitor.create")}</span>
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="secondary"
|
||||
className={cn(vaultHeaderSecondaryButtonClass, "shrink-0")}
|
||||
aria-label={t("monitor.create")}
|
||||
onClick={() => startEdit(null)}
|
||||
>
|
||||
<Plus size={14} />
|
||||
<span className="monitor-header-action-label">{t("monitor.create")}</span>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">{t("monitor.create")}</TooltipContent>
|
||||
</Tooltip>
|
||||
</VaultPageHeader>
|
||||
{runtime.unavailable && (
|
||||
<p
|
||||
@@ -677,7 +686,6 @@ export function MonitorPanels({
|
||||
{t("monitor.noMatches")}
|
||||
</div>
|
||||
) : (
|
||||
<TooltipProvider delayDuration={180}>
|
||||
<MonitorHostCollection
|
||||
items={rows}
|
||||
view={panel.view}
|
||||
@@ -815,22 +823,28 @@ export function MonitorPanels({
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="absolute right-3 top-3 h-7 w-7 text-muted-foreground"
|
||||
data-monitor-terminal={id}
|
||||
aria-label={`${t("monitor.openTerminal")}: ${host?.label ?? t("monitor.missingHost")}`}
|
||||
title={t("monitor.openTerminal")}
|
||||
disabled={!host}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
if (host) onConnect(host);
|
||||
}}
|
||||
>
|
||||
<Terminal size={14} />
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="absolute right-3 top-3 inline-flex">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-7 w-7 text-muted-foreground"
|
||||
data-monitor-terminal={id}
|
||||
aria-label={`${t("monitor.openTerminal")}: ${host?.label ?? t("monitor.missingHost")}`}
|
||||
disabled={!host}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
if (host) onConnect(host);
|
||||
}}
|
||||
>
|
||||
<Terminal size={14} />
|
||||
</Button>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{t("monitor.openTerminal")}</TooltipContent>
|
||||
</Tooltip>
|
||||
</article>
|
||||
)}
|
||||
renderCells={({ id, host, state }, visibleColumns) => {
|
||||
@@ -952,27 +966,32 @@ export function MonitorPanels({
|
||||
</td>),
|
||||
status: (<td>{stateBadge(host, state)}</td>),
|
||||
terminal: (<td className="sticky right-0 z-10 justify-center !bg-background before:pointer-events-none before:absolute before:inset-0 before:rounded-r-xl before:bg-card/70 group-hover:before:bg-card">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="relative h-7 w-7 text-muted-foreground"
|
||||
data-monitor-terminal={id}
|
||||
aria-label={`${t("monitor.openTerminal")}: ${host?.label ?? t("monitor.missingHost")}`}
|
||||
title={t("monitor.openTerminal")}
|
||||
disabled={!host}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
if (host) onConnect(host);
|
||||
}}
|
||||
>
|
||||
<Terminal size={14} />
|
||||
</Button>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="relative inline-flex">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-7 w-7 text-muted-foreground"
|
||||
data-monitor-terminal={id}
|
||||
aria-label={`${t("monitor.openTerminal")}: ${host?.label ?? t("monitor.missingHost")}`}
|
||||
disabled={!host}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
if (host) onConnect(host);
|
||||
}}
|
||||
>
|
||||
<Terminal size={14} />
|
||||
</Button>
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{t("monitor.openTerminal")}</TooltipContent>
|
||||
</Tooltip>
|
||||
</td>)
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
@@ -1369,5 +1388,6 @@ export function MonitorPanels({
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</section>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
@@ -2,16 +2,16 @@ import React from "react";
|
||||
import { ChevronRight, TriangleAlert } from "lucide-react";
|
||||
import { useI18n } from "../../application/i18n/I18nProvider";
|
||||
import type { MonitorDiskListRow } from "../../domain/monitorDisks";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
||||
|
||||
export function MonitorSystemDiskToggle({ row, onToggle }: {
|
||||
row: Extract<MonitorDiskListRow, { kind: "system" }>;
|
||||
onToggle?: () => void;
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
return (
|
||||
const button = (
|
||||
<button type="button" data-monitor-system-disks aria-expanded={row.expanded}
|
||||
disabled={row.alert || !onToggle}
|
||||
title={row.alert ? t("monitor.systemDisksAlert") : undefined}
|
||||
onClick={event => { event.stopPropagation(); onToggle?.(); }}
|
||||
className={`flex h-4 w-full items-center gap-1 rounded text-left text-[10px] outline-none focus-visible:ring-1 focus-visible:ring-ring ${row.alert ? "font-medium text-destructive" : "text-muted-foreground hover:text-foreground"}`}>
|
||||
<ChevronRight size={11} aria-hidden="true" className={row.expanded ? "rotate-90" : ""} />
|
||||
@@ -19,4 +19,13 @@ export function MonitorSystemDiskToggle({ row, onToggle }: {
|
||||
{row.alert && <TriangleAlert size={11} aria-hidden="true" />}
|
||||
</button>
|
||||
);
|
||||
if (!row.alert) return button;
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="block w-full">{button}</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{t("monitor.systemDisksAlert")}</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user