Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop): match GFS preview controls

Ma175f80bcaa6
diff --git a/desktop-app/ui/src/components/GfsImagePreview/GfsImagePreview.test.tsx b/desktop-app/ui/src/components/GfsImagePreview/GfsImagePreview.test.tsx
index 3d9c19ecd..f5ac94d92 100644
--- a/desktop-app/ui/src/components/GfsImagePreview/GfsImagePreview.test.tsx
+++ b/desktop-app/ui/src/components/GfsImagePreview/GfsImagePreview.test.tsx
@@ -73,6 +73,13 @@ describe('GfsImagePreview layout', () => {
)
const modal = screen.getByRole('presentation')
+ const copyButton = screen.getByRole('button', { name: 'Copy image to clipboard' })
+ expect(copyButton.classList.contains('ui-button')).toBe(true)
+ expect(copyButton.classList.contains('da-gfs-image-preview-dialog__copy')).toBe(true)
+ expect(copyButton.textContent).toContain('Copy')
+ const closeButton = screen.getByRole('button', { name: 'Close image preview' })
+ expect(closeButton.classList.contains('ui-button')).toBe(true)
+ expect(closeButton.classList.contains('da-gfs-image-preview-dialog__close')).toBe(true)
expect((modal as HTMLElement).style.left).toBe('74px')
expect((modal as HTMLElement).style.right).toBe('0px')
diff --git a/desktop-app/ui/src/components/GfsImagePreview/index.tsx b/desktop-app/ui/src/components/GfsImagePreview/index.tsx
index fa5230b15..c6802006b 100644
--- a/desktop-app/ui/src/components/GfsImagePreview/index.tsx
+++ b/desktop-app/ui/src/components/GfsImagePreview/index.tsx
@@ -1,6 +1,6 @@
import { type CSSProperties, useEffect, useId, useLayoutEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
-import { IconButton, StatusBanner } from '@components/Common'
+import { Button, StatusBanner } from '@components/Common'
import { IconClose, IconCopy } from '@components/SidebarNav/icons'
import { assertGfsImagePreviewSize } from '@lib/gfsImagePreview'
import type { GfsImagePreviewProps } from './types'
@@ -179,26 +179,32 @@ export function GfsImagePreview({
<header className="da-gfs-image-preview-dialog__header">
<h3 id={titleId}>{fileName}</h3>
<div className="da-gfs-image-preview-dialog__header-actions">
- <IconButton
- label={
+ <Button
+ className="da-gfs-image-preview-dialog__copy"
+ aria-label={
copyState === 'copied' ? 'Copied image to clipboard' : 'Copy image to clipboard'
}
+ color="neutral"
disabled={!sourceBlob}
onClick={() => void copyImageToClipboard()}
- size="sm"
variant="ghost"
>
- <IconCopy />
- </IconButton>
- <IconButton
+ <IconCopy width={18} height={18} />
+ <span className="da-gfs-preview-button__label">
+ {copyState === 'copied' ? 'Copied' : 'Copy'}
+ </span>
+ </Button>
+ <Button
+ className="da-gfs-image-preview-dialog__close"
+ data-preview-close
ref={closeButtonRef}
- label="Close image preview"
+ aria-label="Close image preview"
+ color="neutral"
onClick={onClose}
- size="sm"
variant="ghost"
>
- <IconClose />
- </IconButton>
+ <IconClose width={18} height={18} />
+ </Button>
</div>
</header>
<div className="da-gfs-image-preview-dialog__body">
diff --git a/desktop-app/ui/src/components/GfsMarkdownPreview/index.tsx b/desktop-app/ui/src/components/GfsMarkdownPreview/index.tsx
index 013c0ffea..dbade65fc 100644
--- a/desktop-app/ui/src/components/GfsMarkdownPreview/index.tsx
+++ b/desktop-app/ui/src/components/GfsMarkdownPreview/index.tsx
@@ -1,7 +1,7 @@
import { Fragment, useEffect, useId, useMemo, useRef, useState } from 'react'
import type { ReactNode } from 'react'
import { createPortal } from 'react-dom'
-import { IconButton, StatusBanner } from '@components/Common'
+import { Button, StatusBanner } from '@components/Common'
import { IconClose, IconCopy } from '@components/SidebarNav/icons'
import { assertGfsMarkdownPreviewSize } from '@lib/gfsMarkdownPreview'
import { parseVanillaMarkdown } from '@lib/vanillaMarkdown'
@@ -166,28 +166,34 @@ export function GfsMarkdownPreview({
<header className="da-gfs-markdown-preview-dialog__header">
<h3 id={titleId}>{fileName}</h3>
<div className="da-gfs-markdown-preview-dialog__header-actions">
- <IconButton
- label={
+ <Button
+ className="da-gfs-markdown-preview-dialog__copy"
+ aria-label={
copyState === 'copied'
? 'Copied preview contents to clipboard'
: 'Copy preview contents to clipboard'
}
+ color="neutral"
disabled={source === null}
onClick={() => void copySourceToClipboard()}
- size="sm"
variant="ghost"
>
- <IconCopy />
- </IconButton>
- <IconButton
+ <IconCopy width={18} height={18} />
+ <span className="da-gfs-preview-button__label">
+ {copyState === 'copied' ? 'Copied' : 'Copy'}
+ </span>
+ </Button>
+ <Button
+ className="da-gfs-markdown-preview-dialog__close"
+ data-preview-close
ref={closeButtonRef}
- label="Close preview"
+ aria-label="Close preview"
+ color="neutral"
onClick={onClose}
- size="sm"
variant="ghost"
>
- <IconClose />
- </IconButton>
+ <IconClose width={18} height={18} />
+ </Button>
</div>
</header>
<div className="da-gfs-markdown-preview-dialog__body">
diff --git a/desktop-app/ui/src/components/GfsVideoPreview/index.tsx b/desktop-app/ui/src/components/GfsVideoPreview/index.tsx
index 46e4efb2f..b4cfee6a5 100644
--- a/desktop-app/ui/src/components/GfsVideoPreview/index.tsx
+++ b/desktop-app/ui/src/components/GfsVideoPreview/index.tsx
@@ -1,6 +1,6 @@
import { useEffect, useId, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
-import { IconButton, StatusBanner } from '@components/Common'
+import { Button, StatusBanner } from '@components/Common'
import { IconClose } from '@components/SidebarNav/icons'
import { assertGfsVideoPreviewSize } from '@lib/gfsVideoPreview'
import type { GfsVideoPreviewProps } from './types'
@@ -74,15 +74,17 @@ export function GfsVideoPreview({
>
<header className="da-gfs-video-preview-dialog__header">
<h3 id={titleId}>{fileName}</h3>
- <IconButton
+ <Button
+ className="da-gfs-video-preview-dialog__close"
+ data-preview-close
ref={closeButtonRef}
- label="Close video preview"
+ aria-label="Close video preview"
+ color="neutral"
onClick={onClose}
- size="sm"
variant="ghost"
>
- <IconClose />
- </IconButton>
+ <IconClose width={18} height={18} />
+ </Button>
</header>
<div className="da-gfs-video-preview-dialog__body">
{previewError ? <StatusBanner tone="error" text={previewError} /> : null}
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index 7ac75d237..6f7ce694b 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -14890,6 +14890,34 @@ pre {
gap: var(--space-2);
}
+.da-gfs-image-preview-dialog__close.ui-button,
+.da-gfs-markdown-preview-dialog__close.ui-button,
+.da-gfs-video-preview-dialog__close.ui-button {
+ width: 2.25rem;
+ min-width: 2.25rem;
+ height: 2.25rem;
+ padding: 0;
+ border-radius: 999px;
+}
+
+.da-gfs-image-preview-dialog__copy.ui-button,
+.da-gfs-markdown-preview-dialog__copy.ui-button {
+ height: 2.25rem;
+ padding-inline: var(--space-3);
+ border-radius: 999px;
+ color: var(--text-muted);
+}
+
+.da-gfs-image-preview-dialog__copy.ui-button:hover:enabled,
+.da-gfs-markdown-preview-dialog__copy.ui-button:hover:enabled {
+ color: color-mix(in srgb, var(--accent-strong) 62%, var(--text-muted) 38%);
+}
+
+.da-gfs-preview-button__label {
+ font-size: var(--font-size-xs);
+ font-weight: var(--font-weight-semibold);
+}
+
.da-gfs-text-preview__content {
min-width: 0;
min-height: 0;