mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
fix(ui): prevent update action overlap and support mobile navigation (#642)
Keep local-edit statuses wide enough so they do not collide with update actions. Wrap update rows on narrow screens and show row actions on touch devices.\n\nReuse the shared dialog for mobile navigation, close it before blocked or successful keyboard navigation, and keep the language picker and tour within the visible mobile UI. Include locale labels, responsive layout documentation, and tour-step regression coverage.\n\nFixes #638.
This commit is contained in:
@@ -67,7 +67,7 @@ export default function LanguagePopover() {
|
||||
ref={panelRef}
|
||||
role="radiogroup"
|
||||
aria-label={t('language.settings')}
|
||||
className="ss-menu absolute left-0 bottom-full mb-3 z-50 !w-[300px] animate-dropdown-in"
|
||||
className="ss-menu absolute left-0 bottom-full mb-3 z-50 !w-[300px] max-w-[calc(100vw-6rem)] max-h-[calc(100dvh-8rem)] overflow-y-auto animate-dropdown-in"
|
||||
>
|
||||
{localeOptions.map((entry) => {
|
||||
const on = locale === entry.code;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Link, Outlet, useNavigate, useLocation } from 'react-router-dom';
|
||||
import { useState, useCallback, useMemo } from 'react';
|
||||
import { useState, useCallback, useMemo, useEffect, useRef } from 'react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import {
|
||||
LayoutDashboard,
|
||||
@@ -17,6 +17,8 @@ import {
|
||||
Settings,
|
||||
Keyboard,
|
||||
Compass,
|
||||
Menu,
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import { api, type AuditAllResponse } from '../api/client';
|
||||
import { queryKeys, staleTimes } from '../lib/queryKeys';
|
||||
@@ -24,6 +26,8 @@ import { pendingCount } from './sync/syncView';
|
||||
import { useAppContext } from '../context/AppContext';
|
||||
import { useGlobalShortcuts } from '../hooks/useGlobalShortcuts';
|
||||
import KeyboardShortcutsModal from './KeyboardShortcutsModal';
|
||||
import DialogShell from './DialogShell';
|
||||
import IconButton from './IconButton';
|
||||
import ShortcutHUD from './ShortcutHUD';
|
||||
import ScrollToTop from './ScrollToTop';
|
||||
import { TargetAgents } from './targetAgents';
|
||||
@@ -88,13 +92,37 @@ function isActive(item: NavItem, pathname: string): boolean {
|
||||
export default function Layout() {
|
||||
const t = useT();
|
||||
const [shortcutsOpen, setShortcutsOpen] = useState(false);
|
||||
const location = useLocation();
|
||||
const [navigationOpen, setNavigationOpen] = useState(false);
|
||||
const [navigationLocation, setNavigationLocation] = useState(location);
|
||||
if (navigationLocation !== location) {
|
||||
setNavigationLocation(location);
|
||||
setNavigationOpen(false);
|
||||
}
|
||||
const menuButton = useRef<HTMLButtonElement>(null);
|
||||
const closeNavigation = useCallback(() => {
|
||||
setNavigationOpen(false);
|
||||
menuButton.current?.focus();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const desktop = window.matchMedia('(min-width: 768px)');
|
||||
const onResize = () => { if (desktop.matches) setNavigationOpen(false); };
|
||||
desktop.addEventListener('change', onResize);
|
||||
return () => desktop.removeEventListener('change', onResize);
|
||||
}, []);
|
||||
const { isProjectMode, projectRoot } = useAppContext();
|
||||
const { startTour } = useTour();
|
||||
const nav = useNavigate();
|
||||
const location = useLocation();
|
||||
const toggleShortcuts = useCallback(() => setShortcutsOpen((v) => !v), []);
|
||||
const handleSync = useCallback(() => nav('/sync'), [nav]);
|
||||
const { modifierHeld } = useGlobalShortcuts({ onToggleHelp: toggleShortcuts, onSync: handleSync });
|
||||
const toggleShortcuts = useCallback(() => {
|
||||
if (navigationOpen) closeNavigation();
|
||||
setShortcutsOpen((v) => !v);
|
||||
}, [navigationOpen, closeNavigation]);
|
||||
const handleNavigate = useCallback((path: string) => {
|
||||
if (navigationOpen) closeNavigation();
|
||||
nav(path);
|
||||
}, [navigationOpen, closeNavigation, nav]);
|
||||
const { modifierHeld } = useGlobalShortcuts({ onToggleHelp: toggleShortcuts, onNavigate: handleNavigate });
|
||||
|
||||
const { data: overview } = useOverviewQuery();
|
||||
const version = overview?.version;
|
||||
@@ -104,9 +132,8 @@ export default function Layout() {
|
||||
const { data: synced } = useSyncedTargetsQuery();
|
||||
const targetAgents = useMemo(() => Object.fromEntries((synced?.targets ?? []).flatMap((x) => (x.agent ? [[x.name, x.agent]] : []))), [synced]);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen">
|
||||
<aside className="ss-side fixed top-0 left-0 z-30 h-screen">
|
||||
const sidebar = (
|
||||
<>
|
||||
<div className="ss-wm">
|
||||
<b>{t('app.name')}</b>
|
||||
<svg className="ss-squig ss-only-playful" width="112" height="7" viewBox="0 0 112 7" aria-hidden="true">
|
||||
@@ -115,7 +142,7 @@ export default function Layout() {
|
||||
<div className="group flex items-center gap-1 min-w-0">
|
||||
<span className="truncate" title={home}>{t(isProjectMode ? 'app.project' : 'app.global')}{home && ` · ${shortenHome(home)}`}</span>
|
||||
{/* The label is truncated, so the tooltip is the only place the full path shows — copying saves retyping it. */}
|
||||
{home && <CopyButton value={home} title={t('common.copyPath')} copiedLabel="" className="opacity-0 group-hover:opacity-100 focus-visible:opacity-100" />}
|
||||
{home && <CopyButton value={home} title={t('common.copyPath')} copiedLabel="" className="md:pointer-fine:opacity-0 group-hover:opacity-100 focus-visible:opacity-100" />}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -129,7 +156,7 @@ export default function Layout() {
|
||||
const Icon = item.icon;
|
||||
const active = isActive(item, location.pathname);
|
||||
return (
|
||||
<Link key={item.to} to={item.to} className={`ss-nv ${active ? 'on' : ''}`} aria-current={active ? 'page' : undefined}>
|
||||
<Link key={item.to} to={item.to} onClick={() => { if (navigationOpen) closeNavigation(); }} className={`ss-nv ${active ? 'on' : ''}`} aria-current={active ? 'page' : undefined}>
|
||||
<Icon size={16} />
|
||||
<span>{t(item.labelKey)}</span>
|
||||
{counts[item.to] > 0 && <span className="n">{counts[item.to]}</span>}
|
||||
@@ -148,15 +175,34 @@ export default function Layout() {
|
||||
<button type="button" className="ss-ib" data-tour="shortcuts-btn" onClick={toggleShortcuts} aria-label={t('shortcuts.title')} title={t('shortcuts.title')} aria-keyshortcuts="?">
|
||||
<Keyboard size={16} />
|
||||
</button>
|
||||
<button type="button" className="ss-ib" onClick={startTour} aria-label={t('layout.tools.quickTour')} title={t('layout.tools.quickTour')}>
|
||||
<button type="button" className="ss-ib" onClick={() => { if (navigationOpen) closeNavigation(); startTour(); }} aria-label={t('layout.tools.quickTour')} title={t('layout.tools.quickTour')}>
|
||||
<Compass size={16} />
|
||||
</button>
|
||||
</span>
|
||||
{version && <span className="font-mono text-[11px] text-ink-3">{/^\d/.test(version) ? `v${version}` : version}</span>}
|
||||
</div>
|
||||
</aside>
|
||||
</>
|
||||
);
|
||||
|
||||
<main className="ml-[232px] min-w-0 px-12 py-10">
|
||||
return (
|
||||
<div className="min-h-screen">
|
||||
<aside className="ss-side fixed top-0 left-0 z-30 h-screen hidden md:flex">{sidebar}</aside>
|
||||
<header className="flex items-center gap-3 px-4 py-3 border-b border-line bg-side md:hidden">
|
||||
<button ref={menuButton} type="button" className="ss-ib" aria-label={t('layout.navigation')} aria-expanded={navigationOpen} aria-controls="mobile-navigation" onClick={() => setNavigationOpen(true)}>
|
||||
<Menu size={20} />
|
||||
</button>
|
||||
<b>{t('app.name')}</b>
|
||||
</header>
|
||||
<DialogShell open={navigationOpen} onClose={closeNavigation} ariaLabel={t('layout.navigation')} maxWidth="sm" padding="none" className="ss-side !w-full h-[calc(100dvh-2rem)]">
|
||||
<div id="mobile-navigation" className="flex flex-col flex-1 min-h-0">
|
||||
<div className="flex justify-end">
|
||||
<IconButton icon={<X size={18} />} label={t('common.close')} onClick={closeNavigation} />
|
||||
</div>
|
||||
{sidebar}
|
||||
</div>
|
||||
</DialogShell>
|
||||
|
||||
<main className="min-w-0 px-4 py-6 md:ml-[232px] md:px-12 md:py-10">
|
||||
<div className="max-w-[1080px] mx-auto">
|
||||
<TargetAgents.Provider value={targetAgents}><Outlet /></TargetAgents.Provider>
|
||||
</div>
|
||||
|
||||
@@ -127,7 +127,7 @@ export function TourProvider({ children }: { children: ReactNode }) {
|
||||
const cached = queryClient.getQueryData<Overview>(queryKeys.overview);
|
||||
const skillCount = cached?.skillCount ?? 0;
|
||||
|
||||
const builtSteps = buildSteps({ isProjectMode, skillCount });
|
||||
const builtSteps = buildSteps({ isProjectMode, skillCount, isMobile: !window.matchMedia('(min-width: 768px)').matches });
|
||||
setSteps(builtSteps);
|
||||
setCurrentStep(0);
|
||||
setIsActive(true);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildSteps } from './tourSteps';
|
||||
|
||||
describe('buildSteps', () => {
|
||||
it('omits the hidden sidebar shortcut target on mobile only', () => {
|
||||
const options = { isProjectMode: false, skillCount: 1 };
|
||||
expect(buildSteps(options).some((s) => s.id === 'shortcuts-btn')).toBe(true);
|
||||
expect(buildSteps({ ...options, isMobile: true }).some((s) => s.id === 'shortcuts-btn')).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -35,11 +35,12 @@ const ALL_STEPS: TourStep[] = [
|
||||
interface BuildStepsOptions {
|
||||
isProjectMode: boolean;
|
||||
skillCount: number;
|
||||
isMobile?: boolean;
|
||||
}
|
||||
|
||||
export function buildSteps({ isProjectMode, skillCount }: BuildStepsOptions): TourStep[] {
|
||||
export function buildSteps({ isProjectMode, skillCount, isMobile = false }: BuildStepsOptions): TourStep[] {
|
||||
// A project keeps its skills in its own repository, so there is no Git Sync page.
|
||||
let steps = isProjectMode ? ALL_STEPS.filter((s) => s.id !== 'git-actions') : ALL_STEPS;
|
||||
let steps = ALL_STEPS.filter((s) => !(isProjectMode && s.id === 'git-actions') && !(isMobile && s.id === 'shortcuts-btn'));
|
||||
if (skillCount === 0) {
|
||||
steps = steps.map((s) => (HAS_EMPTY_COPY.has(s.id) ? { ...s, empty: true } : s));
|
||||
}
|
||||
|
||||
@@ -61,11 +61,12 @@ export function claimSaveShortcut(): () => void {
|
||||
interface UseGlobalShortcutsOptions {
|
||||
onToggleHelp: () => void;
|
||||
onRefresh?: () => void;
|
||||
onSync?: () => void;
|
||||
onNavigate?: (path: string) => void;
|
||||
}
|
||||
|
||||
export function useGlobalShortcuts({ onToggleHelp, onRefresh, onSync }: UseGlobalShortcutsOptions) {
|
||||
const navigate = useNavigate();
|
||||
export function useGlobalShortcuts({ onToggleHelp, onRefresh, onNavigate }: UseGlobalShortcutsOptions) {
|
||||
const defaultNavigate = useNavigate();
|
||||
const navigate = onNavigate ?? defaultNavigate;
|
||||
const pendingChordRef = useRef<string | null>(null);
|
||||
const chordTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const [modifierHeld, setModifierHeld] = useState(false);
|
||||
@@ -93,11 +94,7 @@ export function useGlobalShortcuts({ onToggleHelp, onRefresh, onSync }: UseGloba
|
||||
// Reset modifier state immediately — macOS often swallows the
|
||||
// Meta keyup after a Cmd+key shortcut, leaving the HUD stuck.
|
||||
setModifierHeld(false);
|
||||
if (onSync) {
|
||||
onSync();
|
||||
} else {
|
||||
navigate('/sync');
|
||||
}
|
||||
navigate('/sync');
|
||||
return;
|
||||
}
|
||||
// All other modifier combos: let browser handle natively
|
||||
@@ -197,7 +194,7 @@ export function useGlobalShortcuts({ onToggleHelp, onRefresh, onSync }: UseGloba
|
||||
clearChord();
|
||||
clearModifierTimer();
|
||||
};
|
||||
}, [navigate, onToggleHelp, onRefresh, onSync, clearChord]);
|
||||
}, [navigate, onToggleHelp, onRefresh, clearChord]);
|
||||
|
||||
return { modifierHeld };
|
||||
}
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "Bibliothek",
|
||||
"layout.group.destinations": "Ziele",
|
||||
"layout.group.maintain": "Pflege",
|
||||
"layout.navigation": "Navigation",
|
||||
"layout.nav.audit": "Audit",
|
||||
"layout.nav.dashboard": "Dashboard",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -756,6 +756,7 @@
|
||||
"layout.group.library": "Library",
|
||||
"layout.group.destinations": "Destinations",
|
||||
"layout.group.maintain": "Maintain",
|
||||
"layout.navigation": "Navigation",
|
||||
"layout.nav.audit": "Audit",
|
||||
"layout.nav.dashboard": "Dashboard",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "Biblioteca",
|
||||
"layout.group.destinations": "Destinos",
|
||||
"layout.group.maintain": "Mantenimiento",
|
||||
"layout.navigation": "Navegación",
|
||||
"layout.nav.audit": "Auditoría",
|
||||
"layout.nav.dashboard": "Panel",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "کتابخانه",
|
||||
"layout.group.destinations": "مقصدها",
|
||||
"layout.group.maintain": "نگهداری",
|
||||
"layout.navigation": "ناوبری",
|
||||
"layout.nav.audit": "ممیزی",
|
||||
"layout.nav.dashboard": "داشبورد",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "Bibliothèque",
|
||||
"layout.group.destinations": "Destinations",
|
||||
"layout.group.maintain": "Maintenance",
|
||||
"layout.navigation": "Navigation",
|
||||
"layout.nav.audit": "Audit",
|
||||
"layout.nav.dashboard": "Tableau de bord",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "Pustaka",
|
||||
"layout.group.destinations": "Tujuan",
|
||||
"layout.group.maintain": "Pemeliharaan",
|
||||
"layout.navigation": "Navigasi",
|
||||
"layout.nav.audit": "Audit",
|
||||
"layout.nav.dashboard": "Dasbor",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "ライブラリ",
|
||||
"layout.group.destinations": "同期先",
|
||||
"layout.group.maintain": "メンテナンス",
|
||||
"layout.navigation": "ナビゲーション",
|
||||
"layout.nav.audit": "監査",
|
||||
"layout.nav.dashboard": "ダッシュボード",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "라이브러리",
|
||||
"layout.group.destinations": "대상",
|
||||
"layout.group.maintain": "유지보수",
|
||||
"layout.navigation": "탐색 메뉴",
|
||||
"layout.nav.audit": "감사",
|
||||
"layout.nav.dashboard": "대시보드",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "Biblioteca",
|
||||
"layout.group.destinations": "Destinos",
|
||||
"layout.group.maintain": "Manutenção",
|
||||
"layout.navigation": "Navegação",
|
||||
"layout.nav.audit": "Auditoria",
|
||||
"layout.nav.dashboard": "Painel",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "资源库",
|
||||
"layout.group.destinations": "目的地",
|
||||
"layout.group.maintain": "维护",
|
||||
"layout.navigation": "导航菜单",
|
||||
"layout.nav.audit": "审计",
|
||||
"layout.nav.dashboard": "仪表盘",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -588,6 +588,7 @@
|
||||
"layout.group.library": "資源庫",
|
||||
"layout.group.destinations": "目的地",
|
||||
"layout.group.maintain": "維護",
|
||||
"layout.navigation": "導覽選單",
|
||||
"layout.nav.audit": "稽核",
|
||||
"layout.nav.dashboard": "儀表板",
|
||||
"layout.nav.extras": "Extras",
|
||||
|
||||
@@ -1020,7 +1020,7 @@ export default function ResourcesPage({ kind }: { kind: Kind }) {
|
||||
)}
|
||||
/>
|
||||
|
||||
<nav className="ss-tabs" aria-label={t(isAgent ? 'layout.nav.agents' : 'layout.nav.skills')} data-tour="skills-view">
|
||||
<nav className="ss-tabs overflow-x-auto" aria-label={t(isAgent ? 'layout.nav.agents' : 'layout.nav.skills')} data-tour="skills-view">
|
||||
{([
|
||||
['installed', '', t('resources.tab.installed'), items.length],
|
||||
['updates', '?tab=updates', t('resources.tab.updates'), updateCount],
|
||||
|
||||
+17
-11
@@ -440,7 +440,7 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
|
||||
return <span className="ss-st warn">{t('update.check.stale')}</span>;
|
||||
case 'dirty':
|
||||
return (
|
||||
<span className="inline-flex items-center gap-2">
|
||||
<span className="inline-flex flex-wrap items-center gap-2">
|
||||
<span className="ss-st warn" title={c.message}>{t('update.check.dirty')}</span>
|
||||
{!unit.isRepo && unit.items[0] && <RouterLink className="ss-btn sm" to={`${resourceHref(unit.items[0])}?changes=1`}>{t('update.check.viewChanges')}</RouterLink>}
|
||||
</span>
|
||||
@@ -489,10 +489,10 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
|
||||
: <span className={`ss-cat sm ${kind}`}>{kind === 'agent' ? <Bot size={14} /> : <Puzzle size={14} />}</span>);
|
||||
|
||||
const unitName = (unit: UpdateUnit) => (
|
||||
<span className="flex items-baseline gap-3 min-w-0 flex-1">
|
||||
<span className="nm m truncate shrink-0 max-w-[60%]">{unit.label}</span>
|
||||
<span className="flex flex-wrap md:flex-nowrap items-baseline gap-x-3 gap-y-1 min-w-0 flex-1">
|
||||
<span className="nm m truncate max-w-full md:shrink-0 md:max-w-[60%]">{unit.label}</span>
|
||||
{unit.isRepo && <span className="ss-tag self-center">tracked</span>}
|
||||
<span className="font-mono text-xs text-ink-3 truncate">{sourceLabel(unit.source)}</span>
|
||||
<span className="basis-full md:basis-auto font-mono text-xs text-ink-3 truncate">{sourceLabel(unit.source)}</span>
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -543,7 +543,7 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
|
||||
<section className="ss-box flex flex-col gap-4 -mt-2" aria-live="polite">
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<span className={`ss-update-icon ${hero.tone}`}>{hero.icon}</span>
|
||||
<div className="flex flex-col gap-0.5 min-w-[240px] flex-1">
|
||||
<div className="flex flex-col gap-0.5 min-w-0 sm:min-w-[240px] flex-1 break-words">
|
||||
<div key={String(running) + String(checking) + String(showDone)} className="text-[16px] font-semibold animate-fade-in">{hero.title}</div>
|
||||
<div className="text-[13px] text-ink-2">{hero.sub}</div>
|
||||
</div>
|
||||
@@ -638,9 +638,10 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
|
||||
return (
|
||||
// Rows of one Prune all leave one after another.
|
||||
<div key={unit.name} className={`ss-collapse ${p === 'out' ? 'out' : ''}`} style={{ transitionDelay: p === 'out' ? `${i * 60}ms` : undefined }}>
|
||||
<div className={`ss-r ${p ? 'updating' : ''}`}>
|
||||
<div className={`ss-r flex-wrap md:flex-nowrap ${p ? 'updating' : ''}`}>
|
||||
{unitIcon(unit)}
|
||||
{unitName(unit)}
|
||||
<div className="w-full flex flex-wrap items-center gap-2 pl-[38px] md:contents">
|
||||
{p ? (
|
||||
<span className="inline-flex items-center gap-2 text-[13px] text-ink-2 animate-fade-in"><Loader2 size={13} className="animate-spin" />{t('update.updating.purging')}</span>
|
||||
) : (
|
||||
@@ -649,6 +650,7 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
|
||||
<Button variant="secondary" size="sm" disabled={busy} onClick={() => void prune([unit])}>{t('update.updating.purge')}</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{p && <span className="ss-rowbar" aria-hidden />}
|
||||
</div>
|
||||
</div>
|
||||
@@ -676,12 +678,13 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
|
||||
const trouble = r?.status === 'blocked' || r?.status === 'error';
|
||||
return (
|
||||
<div key={unit.name} className="ss-r flex-col !items-stretch gap-2 py-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex flex-wrap md:flex-nowrap items-center gap-3">
|
||||
{r?.status === 'blocked' ? <span className="w-[26px] grid place-items-center text-bad"><ShieldAlert size={16} /></span> : unitIcon(unit)}
|
||||
<span className="flex flex-col min-w-0 flex-1 gap-0.5">
|
||||
{unitName(unit)}
|
||||
{trouble && message && <span className="text-[13px] text-bad truncate">{failureSummary(message)}</span>}
|
||||
</span>
|
||||
<div className="w-full flex flex-wrap items-center gap-2 pl-[38px] md:contents">
|
||||
{riskTag(unit)}
|
||||
{trouble && message && (
|
||||
<Button variant="ghost" size="sm" aria-expanded={open} onClick={() => setOpenDetails((prev) => {
|
||||
@@ -692,7 +695,8 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
|
||||
{t(open ? 'update.failed.hideDetails' : 'update.failed.showDetails')}
|
||||
</Button>
|
||||
)}
|
||||
<span className="flex items-center justify-end gap-2 min-w-[96px]">{trouble ? failureActions(unit) : statusCell(unit)}</span>
|
||||
<span className="flex flex-wrap items-center justify-end gap-2 md:min-w-[96px]">{trouble ? failureActions(unit) : statusCell(unit)}</span>
|
||||
</div>
|
||||
</div>
|
||||
{trouble && open && message && (
|
||||
<pre className="m-0 ml-[38px] p-3 rounded-lg bg-sunken font-mono text-xs leading-relaxed text-ink-2 whitespace-pre-wrap break-words animate-fade-in">{message}</pre>
|
||||
@@ -748,23 +752,25 @@ export default function UpdatePage({ kind }: { kind: Kind }) {
|
||||
const canUpdate = !r && c !== 'up-to-date' && c !== 'checking';
|
||||
const rowState = r?.status === 'in-progress' ? 'updating' : r?.status === 'pending' || (running && !r) ? 'dim' : r?.status === 'success' ? 'flash' : '';
|
||||
return (
|
||||
<div key={unit.name} className={`ss-r group ${selected.has(unit.name) ? 'sel' : ''} ${rowState}`}>
|
||||
<div key={unit.name} className={`ss-r group flex-wrap md:flex-nowrap ${selected.has(unit.name) ? 'sel' : ''} ${rowState}`}>
|
||||
<Checkbox hideLabel label={unit.label} checked={selected.has(unit.name)} disabled={busy} onChange={() => toggle(unit.name)} />
|
||||
{unitIcon(unit)}
|
||||
{unitName(unit)}
|
||||
<div className="w-full flex flex-wrap items-center gap-2 pl-[66px] md:contents">
|
||||
{riskTag(unit)}
|
||||
{canUpdate && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
className="opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity"
|
||||
className="md:pointer-fine:opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity"
|
||||
disabled={busy}
|
||||
onClick={() => startUpdate([unit.name], force)}
|
||||
>
|
||||
{t('update.row.update')}
|
||||
</Button>
|
||||
)}
|
||||
<span className="w-[140px] flex justify-end">{statusCell(unit)}</span>
|
||||
<span className="max-w-full md:max-w-none md:min-w-[140px] md:shrink-0 flex justify-end ml-auto md:ml-0">{statusCell(unit)}</span>
|
||||
</div>
|
||||
{rowState === 'updating' && <span className="ss-rowbar" aria-hidden />}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -40,6 +40,8 @@ The dashboard supports Clean and Playful styles plus light, dark, and system mod
|
||||
- Route user-visible strings through `useT()`. Preserve existing English technical labels for status, mode, and kind values. Choose between a counted sentence's `.one` and `.other` keys with `plural(key, count)` from `ui/src/i18n`. Tests fail on a key that is not in `en.json`, whether the dashboard or `internal/plugin` refers to it; `ui/src/i18n/README.md` describes them and their escape hatch.
|
||||
- Use existing TanStack Query keys, client helpers, and stale-time patterns. Write no key literal outside `queryKeys.ts`. After a mutation, call `invalidate` with the event that happened; do not list keys or call `invalidateQueries` in a page. A new kind of change gets a new event and a row in `queryEvents.test.ts`.
|
||||
|
||||
Below 768 px, the dashboard shell replaces the fixed sidebar with a navigation button and a `DialogShell` menu, and reduces page padding. The menu shares the desktop navigation and closes before link or keyboard navigation attempts (including blocked unsaved edits), on Escape or backdrop click, or when switching to desktop width. Update rows put their actions and status below the resource name on mobile; row actions stay visible on touch devices. Skills and Agents tabs scroll horizontally when needed. The language picker stays within the viewport and scrolls in short windows; the mobile tour omits the hidden sidebar shortcut step.
|
||||
|
||||
Do not run an unconfigured Prettier in `ui/` because it creates broad unrelated diffs. When Tailwind utilities conflict with the `ss-*` component layer, inspect the cascade before adding more complex selectors.
|
||||
|
||||
The config editor's Beautify and Save actions organize top-level YAML sections: sources and default settings, targets, skills, agents, extras, MCP, plugins, hooks, other settings, ignore, and audit. Sections have blank lines between them; nested mappings and lists retain their order, and unknown keys remain in their original relative order at the end. Comments and anchors are preserved; the `yaml-language-server` schema directive stays at the top of the document, including when repairing a previously misplaced directive. If reordering would change an alias reference, the original section order is retained.
|
||||
|
||||
Reference in New Issue
Block a user