feat(web): add global app status surface (#1869)
* feat(web): add app status bar * feat(web): add app status bar visibility toggle * feat(web): persist status bar item order * fix(web): refine app status bar behavior * fix(web): polish app status bar presentation * test(web): split plugin slot coverage groups * fix(web): address status surface review feedback * fix(web): stabilize status bar overlay tests
This commit is contained in:
@@ -4,10 +4,18 @@ import { SessionMobileBottomNav } from "./session-mobile-bottom-nav";
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
describe("SessionMobileBottomNav GitLab review", () => {
|
||||
describe("SessionMobileBottomNav", () => {
|
||||
it("offers a touch-sized review route for linked merge requests", () => {
|
||||
const onPanelChange = vi.fn();
|
||||
render(<SessionMobileBottomNav activePanel="chat" onPanelChange={onPanelChange} hasReview />);
|
||||
render(
|
||||
<SessionMobileBottomNav
|
||||
activePanel="chat"
|
||||
onPanelChange={onPanelChange}
|
||||
hasReview
|
||||
showStatus
|
||||
onOpenStatus={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
const review = screen.getByRole("button", { name: "Review" });
|
||||
expect(review.className).toContain("min-h-11");
|
||||
@@ -16,7 +24,46 @@ describe("SessionMobileBottomNav GitLab review", () => {
|
||||
});
|
||||
|
||||
it("does not consume navigation space without a linked merge request", () => {
|
||||
render(<SessionMobileBottomNav activePanel="chat" onPanelChange={vi.fn()} />);
|
||||
render(
|
||||
<SessionMobileBottomNav
|
||||
activePanel="chat"
|
||||
onPanelChange={vi.fn()}
|
||||
showStatus
|
||||
onOpenStatus={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
expect(screen.queryByRole("button", { name: "Review" })).toBeNull();
|
||||
});
|
||||
|
||||
it("opens Status as an action without changing the selected mobile panel", () => {
|
||||
const onPanelChange = vi.fn();
|
||||
const onOpenStatus = vi.fn();
|
||||
|
||||
render(
|
||||
<SessionMobileBottomNav
|
||||
activePanel="chat"
|
||||
onPanelChange={onPanelChange}
|
||||
showStatus
|
||||
onOpenStatus={onOpenStatus}
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Status" }));
|
||||
|
||||
expect(onOpenStatus).toHaveBeenCalledOnce();
|
||||
expect(onPanelChange).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not reserve navigation space when Status is disabled", () => {
|
||||
render(
|
||||
<SessionMobileBottomNav
|
||||
activePanel="chat"
|
||||
onPanelChange={vi.fn()}
|
||||
showStatus={false}
|
||||
onOpenStatus={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.queryByRole("button", { name: "Status" })).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
IconFolder,
|
||||
IconTerminal2,
|
||||
IconGitMerge,
|
||||
IconActivity,
|
||||
} from "@tabler/icons-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Badge } from "@kandev/ui/badge";
|
||||
@@ -19,14 +20,15 @@ type SessionMobileBottomNavProps = {
|
||||
planBadge?: boolean;
|
||||
changesBadge?: number;
|
||||
hasReview?: boolean;
|
||||
showStatus: boolean;
|
||||
onOpenStatus: () => void;
|
||||
};
|
||||
|
||||
type NavItem = {
|
||||
id: MobileSessionPanel;
|
||||
label: string;
|
||||
icon: React.ReactNode;
|
||||
badge?: React.ReactNode;
|
||||
};
|
||||
} & ({ panel: MobileSessionPanel; onClick?: never } | { panel?: never; onClick: () => void });
|
||||
|
||||
export function SessionMobileBottomNav({
|
||||
activePanel,
|
||||
@@ -34,16 +36,18 @@ export function SessionMobileBottomNav({
|
||||
planBadge = false,
|
||||
changesBadge = 0,
|
||||
hasReview = false,
|
||||
showStatus,
|
||||
onOpenStatus,
|
||||
}: SessionMobileBottomNavProps) {
|
||||
const items: NavItem[] = useMemo(
|
||||
() => [
|
||||
{
|
||||
id: "chat",
|
||||
panel: "chat",
|
||||
label: "Chat",
|
||||
icon: <IconMessage className="h-5 w-5" />,
|
||||
},
|
||||
{
|
||||
id: "plan",
|
||||
panel: "plan",
|
||||
label: "Plan",
|
||||
icon: <IconListCheck className="h-5 w-5" />,
|
||||
badge: planBadge ? (
|
||||
@@ -51,7 +55,7 @@ export function SessionMobileBottomNav({
|
||||
) : undefined,
|
||||
},
|
||||
{
|
||||
id: "changes",
|
||||
panel: "changes",
|
||||
label: "Changes",
|
||||
icon: <IconGitBranch className="h-5 w-5" />,
|
||||
badge:
|
||||
@@ -65,20 +69,35 @@ export function SessionMobileBottomNav({
|
||||
) : undefined,
|
||||
},
|
||||
{
|
||||
id: "files",
|
||||
panel: "files",
|
||||
label: "Files",
|
||||
icon: <IconFolder className="h-5 w-5" />,
|
||||
},
|
||||
...(hasReview
|
||||
? [{ id: "review" as const, label: "Review", icon: <IconGitMerge className="h-5 w-5" /> }]
|
||||
? [
|
||||
{
|
||||
panel: "review" as const,
|
||||
label: "Review",
|
||||
icon: <IconGitMerge className="h-5 w-5" />,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
id: "terminal",
|
||||
panel: "terminal",
|
||||
label: "Terminal",
|
||||
icon: <IconTerminal2 className="h-5 w-5" />,
|
||||
},
|
||||
...(showStatus
|
||||
? [
|
||||
{
|
||||
label: "Status",
|
||||
icon: <IconActivity className="h-5 w-5" />,
|
||||
onClick: onOpenStatus,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
[planBadge, changesBadge, hasReview],
|
||||
[planBadge, changesBadge, hasReview, showStatus, onOpenStatus],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -88,12 +107,12 @@ export function SessionMobileBottomNav({
|
||||
>
|
||||
{items.map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
key={item.label}
|
||||
type="button"
|
||||
onClick={() => onPanelChange(item.id)}
|
||||
onClick={item.onClick ?? (() => onPanelChange(item.panel))}
|
||||
className={cn(
|
||||
"flex min-h-11 flex-col items-center justify-center py-2 px-3 gap-0.5 min-w-0 flex-1 transition-colors",
|
||||
activePanel === item.id
|
||||
activePanel === item.panel
|
||||
? "text-primary"
|
||||
: "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { SessionPanelContent } from "@kandev/ui/pannel-session";
|
||||
import { useSessionLayoutState } from "@/hooks/use-session-layout-state";
|
||||
import { useVisualViewportOffset } from "@/hooks/use-visual-viewport-offset";
|
||||
import { useToast } from "@/components/toast-provider";
|
||||
import { useAppStatusDrawer } from "@/components/app-status-bar/app-status-surface-provider";
|
||||
import { useAppStore } from "@/components/state-provider";
|
||||
import { fetchAndOpenFile } from "../file-browser-hooks";
|
||||
import type { MobileSessionPanel } from "@/lib/state/slices/ui/types";
|
||||
@@ -385,9 +386,51 @@ function useMobileMRSelection(
|
||||
return { mrs, selectedMR, handlePanelChange };
|
||||
}
|
||||
|
||||
type SessionMobileFooterProps = {
|
||||
sessionId: string | null;
|
||||
activePanel: MobileSessionPanel;
|
||||
onPanelChange: (panel: MobileSessionPanel) => void;
|
||||
planBadge: boolean;
|
||||
changesBadge: number;
|
||||
hasReview: boolean;
|
||||
showStatus: boolean;
|
||||
onOpenStatus: () => void;
|
||||
};
|
||||
|
||||
function SessionMobileFooter({
|
||||
sessionId,
|
||||
activePanel,
|
||||
onPanelChange,
|
||||
planBadge,
|
||||
changesBadge,
|
||||
hasReview,
|
||||
showStatus,
|
||||
onOpenStatus,
|
||||
}: SessionMobileFooterProps) {
|
||||
return (
|
||||
<>
|
||||
<MobileTerminalKeybar
|
||||
sessionId={sessionId}
|
||||
visible={activePanel === "terminal"}
|
||||
baseBottomOffset={BOTTOM_NAV_HEIGHT}
|
||||
/>
|
||||
<SessionMobileBottomNav
|
||||
activePanel={activePanel}
|
||||
onPanelChange={onPanelChange}
|
||||
planBadge={planBadge}
|
||||
changesBadge={changesBadge}
|
||||
hasReview={hasReview}
|
||||
showStatus={showStatus}
|
||||
onOpenStatus={onOpenStatus}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export const SessionMobileLayout = memo(function SessionMobileLayout(
|
||||
props: SessionMobileLayoutProps,
|
||||
) {
|
||||
const { enabled: statusDrawerEnabled, openStatusDrawer } = useAppStatusDrawer();
|
||||
const {
|
||||
activeTaskId,
|
||||
effectiveSessionId,
|
||||
@@ -404,10 +447,8 @@ export const SessionMobileLayout = memo(function SessionMobileLayout(
|
||||
handleMenuClick,
|
||||
setMobileSessionTaskSwitcherOpen,
|
||||
} = useSessionLayoutState({ sessionId: props.sessionId });
|
||||
|
||||
const { selectedFile, handleOpenFileFromChat, handleOpenFile, handlePanelChangeAndClearSheet } =
|
||||
useMobilePanelHandlers({ effectiveSessionId, handlePanelChange });
|
||||
|
||||
const mobileMR = useMobileMRSelection(
|
||||
activeTaskId,
|
||||
effectiveSessionId,
|
||||
@@ -444,19 +485,15 @@ export const SessionMobileLayout = memo(function SessionMobileLayout(
|
||||
mrKey={mobileMR.selectedMR ? mrTaskKey(mobileMR.selectedMR) : undefined}
|
||||
/>
|
||||
|
||||
<MobileTerminalKeybar
|
||||
<SessionMobileFooter
|
||||
sessionId={effectiveSessionId ?? null}
|
||||
visible={effectiveMobilePanel === "terminal"}
|
||||
baseBottomOffset={BOTTOM_NAV_HEIGHT}
|
||||
/>
|
||||
|
||||
{/* Fixed Bottom Navigation */}
|
||||
<SessionMobileBottomNav
|
||||
activePanel={effectiveMobilePanel}
|
||||
onPanelChange={mobileMR.handlePanelChange}
|
||||
planBadge={hasUnseenPlanUpdate}
|
||||
changesBadge={totalChangesCount}
|
||||
hasReview={mobileMR.mrs.length > 0}
|
||||
showStatus={statusDrawerEnabled}
|
||||
onOpenStatus={openStatusDrawer}
|
||||
/>
|
||||
|
||||
{/* Task Switcher Sheet */}
|
||||
|
||||
@@ -135,7 +135,7 @@ export function useMergedAgentState(
|
||||
function TaskLoadingState() {
|
||||
return (
|
||||
<div
|
||||
className="flex h-screen w-full items-center justify-center bg-background px-4"
|
||||
className="flex h-full min-h-0 w-full items-center justify-center bg-background px-4"
|
||||
data-testid="task-loading-state"
|
||||
>
|
||||
<div className="flex min-h-24 min-w-0 flex-col items-center justify-center gap-3 text-center text-sm text-muted-foreground">
|
||||
@@ -149,7 +149,7 @@ function TaskLoadingState() {
|
||||
function TaskLoadErrorState() {
|
||||
return (
|
||||
<div
|
||||
className="flex h-screen w-full items-center justify-center bg-background px-4"
|
||||
className="flex h-full min-h-0 w-full items-center justify-center bg-background px-4"
|
||||
data-testid="task-load-error-state"
|
||||
>
|
||||
<div className="flex min-h-24 max-w-sm min-w-0 flex-col items-center justify-center gap-3 text-center text-sm text-muted-foreground">
|
||||
|
||||
@@ -268,7 +268,7 @@ export function TaskPageInner({
|
||||
taskTitle={taskProps.taskTitle}
|
||||
displayBranch={merged.worktreeBranch}
|
||||
>
|
||||
<div className="h-screen w-full flex flex-col bg-background overflow-hidden">
|
||||
<div className="flex h-full min-h-0 w-full flex-col overflow-hidden bg-background">
|
||||
<SessionCommands
|
||||
sessionId={effectiveSessionId}
|
||||
baseBranch={taskProps.baseBranch}
|
||||
|
||||
@@ -9,8 +9,8 @@ import type { TaskSession } from "@/lib/types/http";
|
||||
/**
|
||||
* Props forwarded to every plugin component registered for the `chat-top-bar`
|
||||
* slot (`registry.registerComponent("chat-top-bar", Component)`). This is the
|
||||
* session top bar's right-hand cluster, beside the CPU/DB metrics and the
|
||||
* document / editors / debug controls — the place for at-a-glance status a
|
||||
* session top bar's right-hand cluster, beside the document / editors / debug
|
||||
* controls — the place for at-a-glance status a
|
||||
* plugin wants to surface for the current task.
|
||||
*
|
||||
* A task can hold several sessions; the top bar is bound to one at a time
|
||||
@@ -37,7 +37,7 @@ const EMPTY_SESSIONS: TaskSession[] = [];
|
||||
|
||||
/**
|
||||
* Plugin extension point in the session top bar, rendered alongside the
|
||||
* first-party controls (CPU/DB metrics, document/editor menus, debug toggle).
|
||||
* first-party controls (document/editor menus and debug toggle).
|
||||
* Renders every plugin component registered for the `chat-top-bar` slot (each
|
||||
* isolated behind its own error boundary via `PluginSlot`) and forwards the
|
||||
* current task, workspace, and all of its session ids as `slotProps`.
|
||||
|
||||
@@ -19,8 +19,8 @@ import { PortForwardButton } from "@/components/task/port-forward-dialog";
|
||||
import { ExecutorSettingsButton } from "@/components/task/executor-settings-button";
|
||||
import { TaskUnarchiveButton } from "@/components/task/task-unarchive-button";
|
||||
import { WorkflowStepper, type WorkflowStepperStep } from "@/components/task/workflow-stepper";
|
||||
import { TopbarMetrics } from "@/components/system-metrics/topbar-metrics";
|
||||
import { TaskTopBarPluginActions } from "@/components/task/task-top-bar-plugin-actions";
|
||||
import { TopbarMetrics } from "@/components/system-metrics/topbar-metrics";
|
||||
import { isDebugUI } from "@/lib/config";
|
||||
|
||||
type TaskTopBarProps = {
|
||||
|
||||
Reference in New Issue
Block a user