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