'use client'; import { memo, useCallback } from 'react'; import { SessionMobileTopBar } from './session-mobile-top-bar'; import { SessionMobileBottomNav } from './session-mobile-bottom-nav'; import { SessionTaskSwitcherSheet } from './session-task-switcher-sheet'; import { TaskChatPanel } from '../task-chat-panel'; import { TaskPlanPanel } from '../task-plan-panel'; import { TaskChangesPanel } from '../task-changes-panel'; import { TaskFilesPanel } from '../task-files-panel'; import { ShellTerminal } from '../shell-terminal'; import { PassthroughTerminal } from '../passthrough-terminal'; import { SessionPanelContent } from '@kandev/ui/pannel-session'; import { useSessionLayoutState } from '@/hooks/use-session-layout-state'; type SessionMobileLayoutProps = { workspaceId: string | null; boardId: string | null; sessionId?: string | null; baseBranch?: string; worktreeBranch?: string | null; taskTitle?: string; }; export const SessionMobileLayout = memo(function SessionMobileLayout({ workspaceId, boardId, sessionId, baseBranch, worktreeBranch, taskTitle, }: SessionMobileLayoutProps) { // Use shared layout state hook const { activeTaskId, effectiveSessionId, isPassthroughMode, selectedDiff, handleSelectDiff, handleClearSelectedDiff, totalChangesCount, hasUnseenPlanUpdate, showApproveButton, handleApprove, currentMobilePanel, handlePanelChange, isTaskSwitcherOpen, handleMenuClick, setMobileSessionTaskSwitcherOpen, } = useSessionLayoutState({ sessionId }); // Mobile-specific handlers that also switch panels const handleSelectDiffAndSwitchPanel = useCallback((path: string, content?: string) => { handleSelectDiff(path, content); handlePanelChange('changes'); }, [handleSelectDiff, handlePanelChange]); const handleOpenFileFromChat = useCallback((path: string) => { handleSelectDiff(path); handlePanelChange('changes'); }, [handleSelectDiff, handlePanelChange]); const handleOpenFile = useCallback((file: { path: string }) => { handleSelectDiff(file.path); handlePanelChange('changes'); }, [handleSelectDiff, handlePanelChange]); // Top nav height (~56px) + bottom nav height (~52px) const topNavHeight = '3.5rem'; const bottomNavHeight = '3.25rem'; return (
{/* Fixed Top Bar */}
{/* Content Area - fixed height panels that manage their own scrolling */}
{currentMobilePanel === 'chat' && (
{activeTaskId ? ( isPassthroughMode ? (
) : ( ) ) : (
No task selected
)}
)} {currentMobilePanel === 'plan' && (
)} {currentMobilePanel === 'changes' && (
)} {currentMobilePanel === 'files' && (
)} {currentMobilePanel === 'terminal' && (
)}
{/* Fixed Bottom Navigation */} {/* Task Switcher Sheet */}
); });