Skip to content

Lite: add commands#13266

Open
OliverJAsh wants to merge 3 commits intomasterfrom
commands
Open

Lite: add commands#13266
OliverJAsh wants to merge 3 commits intomasterfrom
commands

Conversation

@OliverJAsh
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 10, 2026 17:07
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Skipped Skipped Apr 10, 2026 6:19pm

Request Review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 887be0f779

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +86 to +90
<WorkspaceCommandButton
command={WorkspaceCommand.ClosePreview()}
type="button"
className={uiStyles.button}
onClick={() => dispatch(projectActions.closePreview({ projectId }))}
>
{closePreviewBinding.description}
</ShortcutButton>
/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid workspace-only button in shared preview layout

ProjectPreviewLayout is used by both workspace and branches pages, but this new close button now depends on WorkspaceCommandRuntimeContext via WorkspaceCommandButton. The branches page (routes/project/$id/branches/route.tsx) does not provide that context, so if fullscreen preview is open when this layout renders there, assert(use(WorkspaceCommandRuntimeContext)) throws and crashes the page. This shared layout should keep a context-free close action (or receive a handler via props) instead of hard-binding to workspace runtime.

Useful? React with 👍 / 👎.

Comment on lines 95 to 98
<header className={styles.topBar}>
<ProjectSelect />
{projectMatch && <TopBarActions />}
{projectMatch && <div className={styles.topBarActions} ref={actionsRef} />}
</header>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep preview controls mounted for all project routes

This replaces root-level preview toggles with an empty portal mount, but only the workspace route now fills that portal (PositionedTopBarActions in workspace/route.tsx). Other project routes like branches still use ProjectPreviewLayout and shared layout state, so they lose any UI to toggle preview/fullscreen. A concrete regression is navigating to branches with preview hidden in state: there is no control there to reopen it until returning to workspace.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a command-based abstraction for the Lite workspace, centralizing shortcut handling and wiring UI controls (buttons/menu items) through a shared WorkspaceCommand runtime.

Changes:

  • Add WorkspaceCommand tagged-enum + useRunWorkspaceCommand to execute commands from shortcuts and UI elements.
  • Refactor workspace shortcuts to emit commands (instead of bespoke action unions) and provide scope metadata (label, allowWhenTyping).
  • Replace prior “ShortcutButton” patterns with a generalized CommandButton, plus workspace-specific command button/menu item components; add a top-bar actions portal.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
apps/lite/ui/src/ui.module.css Adds styling for displaying shortcut key hints.
apps/lite/ui/src/shortcuts.ts Simplifies shortcut binding generics; removes old helper types/label builder.
apps/lite/ui/src/routes/project/$id/workspace/WorkspaceShortcuts.ts Refactors workspace shortcut scopes to produce/dispatch WorkspaceCommands.
apps/lite/ui/src/routes/project/$id/workspace/WorkspaceCommands.ts New command model + executor hook for workspace actions/mutations.
apps/lite/ui/src/routes/project/$id/workspace/WorkspaceCommandRuntime.tsx New context to share { runCommand, scope } across workspace UI.
apps/lite/ui/src/routes/project/$id/workspace/WorkspaceCommandMenuItem.tsx New menu-item renderer that runs a workspace command and shows shortcut keys.
apps/lite/ui/src/routes/project/$id/workspace/WorkspaceCommandButton.tsx New button wrapper that runs a workspace command and forwards shortcut keys to tooltips/aria-labels.
apps/lite/ui/src/routes/project/$id/workspace/route.tsx Wires command runtime into workspace route; converts many UI actions to commands; adds top-bar actions + shortcut bar label handling.
apps/lite/ui/src/routes/project/$id/workspace/OperationTooltip.tsx Switches operation-mode controls to command buttons.
apps/lite/ui/src/routes/project/$id/workspace/OperationTargets.tsx Simplifies operation target controls to a boolean “controls present” flag.
apps/lite/ui/src/routes/project/$id/workspace/OperationSource.ts Exports operationSourceIdentityKey for command identity keys.
apps/lite/ui/src/routes/project/$id/TopBarActions.tsx Adds portal context/component for rendering route-provided top-bar actions.
apps/lite/ui/src/routes/project/$id/ShortcutsBar.tsx Updates shortcut bar typings/label handling to match new scope model.
apps/lite/ui/src/routes/project/$id/ProjectPreviewLayout.tsx Replaces close-preview control with a workspace command button.
apps/lite/ui/src/routes/__root.tsx Reworks top bar to host a portal target instead of owning workspace preview buttons.
apps/lite/ui/src/CommandButton.tsx Replaces old shortcut-button behavior with a generic command button + tooltip/aria-label formatting.

Comment on lines 82 to +90
>
<Dialog.Portal>
<Dialog.Popup aria-label="Preview" className={sharedStyles.previewDialogPopup}>
<div className={sharedStyles.previewDialogBody}>
<ShortcutButton
binding={closePreviewBinding}
<WorkspaceCommandButton
command={WorkspaceCommand.ClosePreview()}
type="button"
className={uiStyles.button}
onClick={() => dispatch(projectActions.closePreview({ projectId }))}
>
{closePreviewBinding.description}
</ShortcutButton>
/>
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProjectPreviewLayout is used by other routes (e.g. /project/$id/branches), but it now renders WorkspaceCommandButton, which hard-requires WorkspaceCommandRuntimeContext. Those routes don’t provide that context, so opening the fullscreen preview dialog will crash. Either keep this close-preview control wired directly to dispatch(projectActions.closePreview({ projectId })), or ensure a runtime provider is mounted for all ProjectPreviewLayout usages.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants