Skip to content

Commit b12c8b2

Browse files
authored
Merge pull request #9119 from gitbutlerapp/action-source-editor-logos
action-source-editor-logos
2 parents 516d3ed + 4c29106 commit b12c8b2

File tree

6 files changed

+143
-14
lines changed

6 files changed

+143
-14
lines changed

apps/desktop/src/components/v3/FeedItem.svelte

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import { User } from '$lib/user/user';
77
import { getContext } from '@gitbutler/shared/context';
88
import { getContextStore } from '@gitbutler/shared/context';
9+
import EditorLogo from '@gitbutler/ui/EditorLogo.svelte';
910
import Icon from '@gitbutler/ui/Icon.svelte';
1011
import TimeAgo from '@gitbutler/ui/TimeAgo.svelte';
11-
import Tooltip from '@gitbutler/ui/Tooltip.svelte';
1212
import Markdown from '@gitbutler/ui/markdown/Markdown.svelte';
1313
import toasts from '@gitbutler/ui/toasts';
14+
import { isStr } from '@gitbutler/ui/utils/string';
1415
1516
type Props = {
1617
projectId: string;
@@ -66,22 +67,27 @@
6667

6768
<div class="action-item">
6869
{#if action instanceof ButlerAction}
69-
<div class="action-item__robot">
70-
<Icon name="robot" />
71-
</div>
70+
{#if isStr(action.source) || !action.source.Mcp}
71+
<div class="action-item__robot">
72+
<Icon name="robot" />
73+
</div>
74+
{:else}
75+
<div>
76+
<EditorLogo name={action.source.Mcp?.name} />
77+
</div>
78+
{/if}
7279
<div class="action-item__content">
7380
<div class="action-item__content__header">
7481
<div>
75-
<p class="text-13 text-bold">Updated workspace</p>
82+
<p class="text-13 text-bold">Recorded changes</p>
7683
<p class="text-13 text-bold text-grey">(MCP call)</p>
7784
<span class="text-13 text-greyer"
7885
><TimeAgo date={new Date(action.createdAt)} addSuffix /></span
7986
>
80-
<Tooltip text={action.externalPrompt}><div class="pill text-12">Prompt</div></Tooltip>
8187
</div>
8288
</div>
8389
<span class="text-14 text-darkgrey">
84-
<Markdown content={action.externalSummary} />
90+
<Markdown content={action.externalPrompt} />
8591
</span>
8692
{#if action.response && action.response.updatedBranches.length > 0}
8793
<div class="action-item__content__metadata">
@@ -271,11 +277,4 @@
271277
.text-greyer {
272278
color: var(--clr-text-3);
273279
}
274-
275-
.pill {
276-
padding: 2px 6px;
277-
border: 1px solid var(--clr-border-2);
278-
border-radius: 99px;
279-
background-color: var(--clr-bg-2);
280-
}
281280
</style>

apps/desktop/src/lib/actions/types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ export type Outcome = {
1212
};
1313

1414
export type ActionHandler = 'handleChangesSimple';
15+
16+
export type ActionSource =
17+
| 'ButCli'
18+
| 'GitButler'
19+
| 'Unknown'
20+
| {
21+
Mcp: {
22+
name: string;
23+
version: string;
24+
} | null;
25+
};
1526
/** Represents a snapshot of an automatic action taken by a GitButler automation. */
1627
export class ButlerAction {
1728
/** UUID identifier of the action */
@@ -33,6 +44,8 @@ export class ButlerAction {
3344
response?: Outcome;
3445
/** An error message if the action failed. */
3546
error?: string;
47+
/** The source of the action, if known. */
48+
source!: ActionSource;
3649
}
3750

3851
export class ActionListing {

packages/ui/src/lib/EditorLogo.svelte

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<script lang="ts">
2+
import cursorLogoSvg from '$lib/assets/cursor.svg?raw';
3+
import vsCodeInsidersLogoSvg from '$lib/assets/vscode-insiders.svg?raw';
4+
import vsCodeLogoSvg from '$lib/assets/vscode.svg?raw';
5+
6+
type Props = {
7+
name: string;
8+
};
9+
10+
const { name }: Props = $props();
11+
const isCursor = $derived(name.toLowerCase().includes('cursor'));
12+
const vsCodeKeywords = ['vscode', 'visual studio code'];
13+
const isVsCode = $derived(vsCodeKeywords.some((keyword) => name.toLowerCase().includes(keyword)));
14+
const isVsCodeInsiders = $derived(isVsCode && name.toLowerCase().includes('insiders'));
15+
</script>
16+
17+
<div class="editor-logo">
18+
{#if isCursor}
19+
{@html cursorLogoSvg}
20+
{:else if isVsCodeInsiders}
21+
{@html vsCodeInsidersLogoSvg}
22+
{:else if isVsCode}
23+
{@html vsCodeLogoSvg}
24+
{/if}
25+
</div>
26+
27+
<style lang="postcss">
28+
.editor-logo {
29+
display: flex;
30+
align-items: center;
31+
justify-content: center;
32+
width: 26px;
33+
height: 26px;
34+
padding: 2px;
35+
border-radius: 8px;
36+
background-color: var(--clr-core-ntrl-10);
37+
}
38+
</style>

packages/ui/src/lib/assets/cursor.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 37 additions & 0 deletions
Loading

packages/ui/src/lib/assets/vscode.svg

Lines changed: 41 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)