Show workspace scripts on mobile header (#1093)
This commit is contained in:
@@ -177,6 +177,12 @@ const EMPTY_PINNED_AGENT_IDS = new Set<string>();
|
||||
const EMPTY_SET = new Set<string>();
|
||||
const COMPACT_WEB_GESTURE_TOUCH_ACTION = isWeb ? "auto" : "pan-y";
|
||||
|
||||
function getWorkspaceScripts(
|
||||
workspaceDescriptor: WorkspaceDescriptor | null | undefined,
|
||||
): WorkspaceDescriptor["scripts"] {
|
||||
return workspaceDescriptor?.scripts ?? EMPTY_WORKSPACE_SCRIPTS;
|
||||
}
|
||||
|
||||
const ThemedActivityIndicator = withUnistyles(ActivityIndicator);
|
||||
const ThemedEllipsis = withUnistyles(Ellipsis);
|
||||
const ThemedEllipsisVertical = withUnistyles(EllipsisVertical);
|
||||
@@ -949,6 +955,8 @@ interface WorkspaceHeaderTitleBarProps {
|
||||
isGitCheckout: boolean;
|
||||
normalizedServerId: string;
|
||||
normalizedWorkspaceId: string;
|
||||
workspaceScripts: WorkspaceDescriptor["scripts"];
|
||||
liveTerminalIds: string[];
|
||||
showWorkspaceSetup: boolean;
|
||||
showCreateBrowserTab: boolean;
|
||||
isMobile: boolean;
|
||||
@@ -967,6 +975,9 @@ interface WorkspaceHeaderTitleBarProps {
|
||||
onCopyWorkspacePath: () => void;
|
||||
onCopyBranchName: () => void;
|
||||
onOpenSetupTab: () => void;
|
||||
onScriptTerminalStarted: (terminalId: string) => void;
|
||||
onViewScriptTerminal: (terminalId: string) => void;
|
||||
onOpenUrlInBrowserTab: (url: string) => void;
|
||||
}
|
||||
|
||||
function WorkspaceHeaderTitleBar({
|
||||
@@ -978,6 +989,8 @@ function WorkspaceHeaderTitleBar({
|
||||
isGitCheckout,
|
||||
normalizedServerId,
|
||||
normalizedWorkspaceId,
|
||||
workspaceScripts,
|
||||
liveTerminalIds,
|
||||
showWorkspaceSetup,
|
||||
showCreateBrowserTab,
|
||||
isMobile,
|
||||
@@ -996,6 +1009,9 @@ function WorkspaceHeaderTitleBar({
|
||||
onCopyWorkspacePath,
|
||||
onCopyBranchName,
|
||||
onOpenSetupTab,
|
||||
onScriptTerminalStarted,
|
||||
onViewScriptTerminal,
|
||||
onOpenUrlInBrowserTab,
|
||||
}: WorkspaceHeaderTitleBarProps) {
|
||||
return (
|
||||
<View style={styles.headerTitleContainer}>
|
||||
@@ -1045,6 +1061,18 @@ function WorkspaceHeaderTitleBar({
|
||||
onCopyBranchName={onCopyBranchName}
|
||||
onOpenSetupTab={onOpenSetupTab}
|
||||
/>
|
||||
{isMobile && workspaceScripts.length > 0 ? (
|
||||
<WorkspaceScriptsButton
|
||||
serverId={normalizedServerId}
|
||||
workspaceId={normalizedWorkspaceId}
|
||||
scripts={workspaceScripts}
|
||||
liveTerminalIds={liveTerminalIds}
|
||||
onScriptTerminalStarted={onScriptTerminalStarted}
|
||||
onViewTerminal={onViewScriptTerminal}
|
||||
onOpenUrlInBrowserTab={onOpenUrlInBrowserTab}
|
||||
hideLabels
|
||||
/>
|
||||
) : null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -1471,6 +1499,7 @@ function WorkspaceScreenContent({
|
||||
[workspaceId],
|
||||
);
|
||||
const workspaceDescriptor = useWorkspace(normalizedServerId, normalizedWorkspaceId);
|
||||
const workspaceScripts = getWorkspaceScripts(workspaceDescriptor);
|
||||
const { handleRetryHost, handleManageHost, handleDismissMissingWorkspace } =
|
||||
useWorkspaceRouteActions(normalizedServerId);
|
||||
|
||||
@@ -1570,7 +1599,7 @@ function WorkspaceScreenContent({
|
||||
normalizedServerId,
|
||||
normalizedWorkspaceId,
|
||||
workspaceDirectory,
|
||||
workspaceScripts: workspaceDescriptor?.scripts ?? EMPTY_WORKSPACE_SCRIPTS,
|
||||
workspaceScripts,
|
||||
hasHydratedWorkspaces,
|
||||
isMissingWorkspaceExecutionAuthority,
|
||||
onTerminalCreated: handleTerminalCreated,
|
||||
@@ -3257,6 +3286,8 @@ function WorkspaceScreenContent({
|
||||
isGitCheckout={isGitCheckout}
|
||||
normalizedServerId={normalizedServerId}
|
||||
normalizedWorkspaceId={normalizedWorkspaceId}
|
||||
workspaceScripts={workspaceScripts}
|
||||
liveTerminalIds={liveTerminalIds}
|
||||
showWorkspaceSetup={showWorkspaceSetup}
|
||||
showCreateBrowserTab={showCreateBrowserTab}
|
||||
isMobile={isMobile}
|
||||
@@ -3275,6 +3306,9 @@ function WorkspaceScreenContent({
|
||||
onCopyWorkspacePath={handleCopyWorkspacePath}
|
||||
onCopyBranchName={handleCopyBranchName}
|
||||
onOpenSetupTab={handleOpenSetupTab}
|
||||
onScriptTerminalStarted={handleScriptTerminalStarted}
|
||||
onViewScriptTerminal={handleViewScriptTerminal}
|
||||
onOpenUrlInBrowserTab={handleOpenUrlInBrowserTab}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user