Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

ui(task): add more obvious copy branch name btn (#4669)

Seamus30355a34477e
diff --git a/js/app/packages/block-md/component/InlineTaskGithubPullRequests.tsx b/js/app/packages/block-md/component/InlineTaskGithubPullRequests.tsx
index 7ab8fff62f..ff883bea8f 100644
--- a/js/app/packages/block-md/component/InlineTaskGithubPullRequests.tsx
+++ b/js/app/packages/block-md/component/InlineTaskGithubPullRequests.tsx
@@ -1,9 +1,12 @@
import { GithubPullRequestStatusIcon } from '@app/component/side-panel';
import { useBlockAliasedName, useBlockId } from '@core/block';
+import { TOKENS } from '@core/hotkey/tokens';
+import { copyBranchNameToClipboard } from '@core/util/branchName';
import GithubIcon from '@icon/mcp-github.svg';
+import GitBranch from '@phosphor/git-branch.svg';
import { useDocumentGithubPullRequestsQuery } from '@queries/storage/github-pull-requests';
import type { GithubPullRequest } from '@service-storage/generated/schemas';
-import { Layer } from '@ui';
+import { Button, Layer } from '@ui';
import { cn } from '@ui/utils/classname';
import { createMemo, For, type JSX, Show, Suspense } from 'solid-js';
@@ -70,14 +73,10 @@ function InlineTaskGithubPullRequestsContent(props: {
!query.isError && query.isFetching && pullRequests().length === 0;
return (
- <Show
- when={pullRequests().length > 0}
- fallback={
- <Show when={isWaitingForPullRequests()}>
- <InlineTaskGithubPullRequestsSkeleton />
- </Show>
- }
- >
+ <>
+ <Show when={isWaitingForPullRequests()}>
+ <InlineTaskGithubPullRequestsSkeleton />
+ </Show>
<For each={pullRequests()}>
{(pr) => {
const name = pullRequestName(pr);
@@ -135,7 +134,20 @@ function InlineTaskGithubPullRequestsContent(props: {
);
}}
</For>
- </Show>
+ <Show when={!isWaitingForPullRequests() && pullRequests().length === 0}>
+ <Button
+ variant="ghost"
+ size="sm"
+ depth={2}
+ tooltip="Copy branch name"
+ hotkey={TOKENS.entity.action.copyBranchName}
+ class={cn(PILL_CLASS, 'bg-surface px-1.5')}
+ onClick={() => void copyBranchNameToClipboard(props.blockId)}
+ >
+ <GitBranch class="size-3 shrink-0" />
+ </Button>
+ </Show>
+ </>
);
}
diff --git a/js/app/packages/block-md/component/InlineTaskProperties.tsx b/js/app/packages/block-md/component/InlineTaskProperties.tsx
index 186e5aa742..e57326ad5f 100644
--- a/js/app/packages/block-md/component/InlineTaskProperties.tsx
+++ b/js/app/packages/block-md/component/InlineTaskProperties.tsx
@@ -50,6 +50,9 @@ export function InlineTaskProperties() {
.map((id) => props.find((p) => p.propertyDefinitionId === id))
.filter((p): p is Property => p !== undefined);
});
+ const shouldShowRow = createMemo(
+ () => blockName === 'task' || inlineProperties().length > 0
+ );
const saveMutation = useBulkSaveEntityPropertiesMutation();
@@ -66,7 +69,7 @@ export function InlineTaskProperties() {
return (
<Suspense>
- <Show when={inlineProperties().length > 0}>
+ <Show when={shouldShowRow()}>
<PropertiesProvider
entityType={entityType}
canEdit={canEdit()}
diff --git a/js/app/packages/block-md/component/TaskCopyBranchButton.tsx b/js/app/packages/block-md/component/TaskCopyBranchButton.tsx
new file mode 100644
index 0000000000..fe86c28c3e
--- /dev/null
+++ b/js/app/packages/block-md/component/TaskCopyBranchButton.tsx
@@ -0,0 +1,31 @@
+import { useBlockId } from '@core/block';
+import { TOKENS } from '@core/hotkey/tokens';
+import { copyBranchNameToClipboard } from '@core/util/branchName';
+import GitBranch from '@phosphor/git-branch.svg';
+import { Button, cn } from '@ui';
+import { Show } from 'solid-js';
+
+export function TaskCopyBranchButton(props: {
+ showLabel?: boolean;
+ class?: string;
+}) {
+ const blockId = useBlockId();
+ const showLabel = () => props.showLabel ?? true;
+
+ return (
+ <Button
+ variant="ghost"
+ size="sm"
+ depth={2}
+ tooltip={showLabel() ? undefined : 'Copy branch name'}
+ hotkey={TOKENS.entity.action.copyBranchName}
+ class={cn('gap-1.5 rounded-full px-2 ring ring-edge-muted', props.class)}
+ onClick={() => void copyBranchNameToClipboard(blockId)}
+ >
+ <GitBranch class="size-3.5" />
+ <Show when={showLabel()}>
+ <span class="text-xs font-medium">Copy branch name</span>
+ </Show>
+ </Button>
+ );
+}