1021d61be3
Moved 43 component files into 9 feature domains: - features/git/ — commit-dialog, commit-panel, file-editor, git-mount-editor, git-toolbar, merge-dialog - features/project/ — repositories-settings-tab, repository-create-dialog - features/terminal/ — special-keys-panel, special-keys-strip, terminal-session-tabs, terminal - features/workspace/ — workspace-card, workspace-create-form, workspace-header, workspace-instance-chips - features/session/ — create-session-form, session-card, session-list - features/tool/ — instance-list, manifest-editor, start-tool-fab, start-tool-modal, tool-starter, tools-bottom-sheet - features/notification/ — event-toast-bridge, notification-center, notification-item - features/settings/ — settings-tab-layout - features/mobile/ — mobile-action-sheet, mobile-detail-view, mobile-edit-view, mobile-fab, mobile-list-view, mobile-nav, mobile-page-header, mobile-terminal-header, mobile-terminal-wrapper Updated all imports across pages and components. Root components/ now only contains generic UI pieces: app-shell, code-editor, data-states, icon, protected-route, syntax-highlighter. Quality gates: verified no remaining old imports.
117 lines
3.5 KiB
TypeScript
117 lines
3.5 KiB
TypeScript
import React, { useState, useCallback } from "react";
|
|
import { TerminalComponent } from "./terminal";
|
|
import { MobileTerminalHeader } from "./mobile-terminal-header";
|
|
import { SpecialKeysStrip } from "./special-keys-strip";
|
|
import { SpecialKeysPanel } from "./special-keys-panel";
|
|
import { useMobileViewport } from "../hooks/use-mobile-viewport";
|
|
import { useVirtualKeyboard } from "../hooks/use-virtual-keyboard";
|
|
import { useAutoHide } from "../hooks/use-auto-hide";
|
|
import type { ModifierKey } from "../hooks/use-special-keys";
|
|
|
|
interface MobileTerminalWrapperProps {
|
|
instanceId: string;
|
|
instanceName?: string;
|
|
onClose?: () => void;
|
|
onBack?: () => void;
|
|
onMenuToggle?: () => void;
|
|
}
|
|
|
|
export const MobileTerminalWrapper: React.FC<MobileTerminalWrapperProps> = ({
|
|
instanceId,
|
|
instanceName,
|
|
onClose,
|
|
onBack,
|
|
onMenuToggle,
|
|
}) => {
|
|
const isMobile = useMobileViewport();
|
|
const { isOpen: isKeyboardOpen, height: keyboardHeight } =
|
|
useVirtualKeyboard();
|
|
const [showPanel, setShowPanel] = useState(false);
|
|
const [activeModifier, setActiveModifier] = useState<ModifierKey | null>(null);
|
|
const [terminalRef, setTerminalRef] = useState<{
|
|
sendData: (data: string) => void;
|
|
connectionStatus: "connecting" | "connected" | "disconnected" | "error" | "resetting";
|
|
focusInput: () => void;
|
|
changeFontSize: (delta: number) => void;
|
|
} | null>(null);
|
|
|
|
const headerAutoHide = useAutoHide({ timeout: 3000, enabled: isMobile });
|
|
|
|
const handleTerminalTap = useCallback(() => {
|
|
headerAutoHide.toggle();
|
|
}, [headerAutoHide]);
|
|
|
|
const handleTerminalReady = useCallback(
|
|
(sendData: (data: string) => void, connectionStatus: "connecting" | "connected" | "disconnected" | "error" | "resetting", focusInput: () => void, changeFontSize: (delta: number) => void) => {
|
|
setTerminalRef({ sendData, connectionStatus, focusInput, changeFontSize });
|
|
},
|
|
[]
|
|
);
|
|
|
|
const handleSendKey = useCallback(
|
|
(data: string) => {
|
|
terminalRef?.sendData(data);
|
|
},
|
|
[terminalRef]
|
|
);
|
|
|
|
if (!isMobile) {
|
|
return (
|
|
<TerminalComponent
|
|
instanceId={instanceId}
|
|
onClose={onClose}
|
|
isMobile={false}
|
|
/>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="mobile-terminal-wrapper">
|
|
<MobileTerminalHeader
|
|
instanceName={instanceName}
|
|
onBack={onBack}
|
|
onMenuToggle={onMenuToggle}
|
|
onClose={onClose}
|
|
onFontSizeChange={(delta) => terminalRef?.changeFontSize(delta)}
|
|
isVisible={headerAutoHide.isVisible}
|
|
connectionStatus={terminalRef?.connectionStatus}
|
|
/>
|
|
|
|
<div
|
|
className="mobile-terminal-content"
|
|
style={{
|
|
paddingBottom: isKeyboardOpen ? keyboardHeight : 0,
|
|
}}
|
|
onClick={handleTerminalTap}
|
|
>
|
|
<TerminalComponent
|
|
instanceId={instanceId}
|
|
onClose={onClose}
|
|
isMobile={true}
|
|
activeModifier={activeModifier}
|
|
onModifierChange={setActiveModifier}
|
|
onTerminalReady={handleTerminalReady}
|
|
/>
|
|
</div>
|
|
|
|
<SpecialKeysStrip
|
|
onSend={handleSendKey}
|
|
isVisible={!showPanel}
|
|
onMoreClick={() => setShowPanel(true)}
|
|
onKeepFocus={() => terminalRef?.focusInput()}
|
|
activeModifier={activeModifier}
|
|
onModifierChange={setActiveModifier}
|
|
/>
|
|
|
|
<SpecialKeysPanel
|
|
onSend={handleSendKey}
|
|
isOpen={showPanel}
|
|
onClose={() => setShowPanel(false)}
|
|
onKeepFocus={() => terminalRef?.focusInput()}
|
|
activeModifier={activeModifier}
|
|
onModifierChange={setActiveModifier}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|