Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions harness-tests/core/composer-references.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import {
BookOpenIcon,
PackageIcon,
PlugIcon,
WrenchIcon,
type Icon,
} from '@phosphor-icons/react'
import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
Expand Down Expand Up @@ -28,6 +35,12 @@ import {
parseReferenceCatalog,
} from '../../src/chat/components/ComposerReferences'

function iconMarkup(Icon: Icon, size: number) {
return renderToStaticMarkup(
createElement(Icon, { size, 'aria-hidden': true }),
)
}

const conversation: MessageReference = {
kind: 'conversation',
botId: 'one',
Expand Down Expand Up @@ -493,7 +506,7 @@ describe('tool reference catalog presentation', () => {
)
expect(transcript).toContain('Alpha connection')
expect(transcript).toContain('Beta connection')
expect(transcript.match(/lucide-wrench/g)).toHaveLength(2)
expect(transcript.split(iconMarkup(WrenchIcon, 14))).toHaveLength(3)
expect(transcript).not.toContain('<a ')
const html = renderToStaticMarkup(
createElement(QueryClientProvider, {
Expand Down Expand Up @@ -575,12 +588,16 @@ describe('plugin reference presentation', () => {
}),
}),
)
for (const html of [transcript, details, composer]) {
for (const [html, size] of [
[transcript, 14],
[details, 17],
[composer, 15],
] as const) {
expect(html).toContain('Weekly planning')
expect(html).toContain('<small>Installed v1</small>')
expect(html).toContain('<small>Installed v3</small>')
expect(html.match(/lucide-package/g)).toHaveLength(2)
expect(html).not.toContain('lucide-plug ')
expect(html.split(iconMarkup(PackageIcon, size))).toHaveLength(3)
expect(html).not.toContain(iconMarkup(PlugIcon, size))
expect(html).not.toContain('Activate')
expect(html).not.toContain(plugin.installationId)
}
Expand Down Expand Up @@ -772,6 +789,6 @@ it('renders selected skill identity and exact version without treating it as a c
)
expect(html).toContain('weekly-update')
expect(html).toContain('Personal · v1')
expect(html).toContain('lucide-book-open')
expect(html).not.toContain('lucide-plug')
expect(html).toContain(iconMarkup(BookOpenIcon, 14))
expect(html).not.toContain(iconMarkup(PlugIcon, 14))
})
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
"jszip": "^3.10.1",
"linkify-it": "^6.1.0",
"lru-cache": "^11.2.7",
"lucide-react": "^1.49.0",
"match-sorter": "^8.3.0",
"mermaid": "^11.14.0",
"motion": "^13.4.6",
Expand Down
18 changes: 0 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 31 additions & 25 deletions src/chat/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ import {
} from './bootstrap-onboarding'
import type { Onboarding as OnboardingSnapshot } from '../core/onboarding'
import {
Settings,
ChevronLeft,
ChevronRight,
ChevronDown,
Check,
PanelLeft,
PanelRight,
LogOut,
Bookmark,
Copy,
} from 'lucide-react'
BookmarkSimpleIcon,
CaretDownIcon,
CaretLeftIcon,
CaretRightIcon,
CheckIcon,
CopyIcon,
GearIcon,
SidebarSimpleIcon,
SignOutIcon,
} from '@phosphor-icons/react'
import { useNavigate, useParams } from '@tanstack/react-router'
import { WorkspaceApiProvider, useWorkspaceApi, ApiError } from './WorkspaceApi'

Expand Down Expand Up @@ -730,7 +729,7 @@ function WorkspaceApp({
else setDesktopSidebarOpen(true)
}}
>
<PanelLeft size={20} aria-hidden />
<SidebarSimpleIcon size={20} aria-hidden />
</IconButton>
)}
<ConversationNavigatorToggle />
Expand All @@ -745,14 +744,14 @@ function WorkspaceApp({
aria-label={parentName}
onClick={() => selectBot(parentId)}
>
<ChevronLeft
<CaretLeftIcon
className="breadcrumb-parent-icon"
size={14}
aria-hidden
/>
<span className="breadcrumb-parent-name">{parentName}</span>
</Button>
<ChevronRight
<CaretRightIcon
className="breadcrumb-separator"
size={15}
aria-hidden
Expand Down Expand Up @@ -790,7 +789,11 @@ function WorkspaceApp({
})
}
>
<PanelRight size={17} aria-hidden />
<SidebarSimpleIcon
style={{ transform: 'scaleX(-1)' }}
size={17}
aria-hidden
/>
</IconButton>
)}
{selected && (
Expand Down Expand Up @@ -860,7 +863,7 @@ function WorkspaceApp({
ref={sidebarTrigger}
onClick={() => setDesktopSidebarOpen((open) => !open)}
>
<PanelLeft size={20} aria-hidden />
<SidebarSimpleIcon size={20} aria-hidden />
</IconButton>
{workspaceShortcuts}
<IconButton
Expand All @@ -869,7 +872,7 @@ function WorkspaceApp({
label="Settings"
onClick={() => setSettings('general')}
>
<Settings size={20} aria-hidden />
<GearIcon size={20} aria-hidden />
</IconButton>
</aside>
)}
Expand Down Expand Up @@ -927,7 +930,7 @@ function WorkspaceApp({
aria-label={`Switch workspace: ${data.workspace.name}`}
>
<strong>TanChat</strong>
<ChevronDown size={15} aria-hidden />
<CaretDownIcon size={15} aria-hidden />
</Menu.Trigger>
<Menu.Portal>
<Menu.Positioner
Expand All @@ -951,7 +954,10 @@ function WorkspaceApp({
>
{item.name}
{item.id === data.workspace.id && (
<Check size={15} aria-label="Current workspace" />
<CheckIcon
size={15}
aria-label="Current workspace"
/>
)}
</Menu.Item>
))}
Expand All @@ -973,7 +979,7 @@ function WorkspaceApp({
aria-controls="workspace-sidebar"
onClick={closeSidebar}
>
<PanelLeft size={20} aria-hidden />
<SidebarSimpleIcon size={20} aria-hidden />
</IconButton>
)}
</div>
Expand Down Expand Up @@ -1091,7 +1097,7 @@ function WorkspaceApp({
className="settings-button"
onClick={() => setSettings('general')}
>
<Settings size={18} />
<GearIcon size={18} />
<span>Settings</span>
<span className="user-avatar">
{data.user.username.slice(0, 1).toUpperCase()}
Expand Down Expand Up @@ -1697,7 +1703,7 @@ function SettingsDialog({
}}
>
<Button type="submit" variant="secondary">
<LogOut size={15} />
<SignOutIcon size={15} />
Sign out
</Button>
</form>
Expand Down Expand Up @@ -2011,7 +2017,7 @@ function SettingsDialog({
</p>
{data.recipes.map((r) => (
<div className="saved-action" key={r.id}>
<Bookmark size={18} />
<BookmarkSimpleIcon size={18} />
<div>
<strong>{r.title}</strong>
<p>{r.description}</p>
Expand All @@ -2025,7 +2031,7 @@ function SettingsDialog({
.then(() => setNotice('Command copied'))
}
>
<Copy size={14} />
<CopyIcon size={14} />
Copy command
</Button>
</div>
Expand Down Expand Up @@ -2094,7 +2100,7 @@ function SettingsDialog({
)}
{notice && (
<p className="success" role="status">
<Check size={15} />
<CheckIcon size={15} />
{notice}
</p>
)}
Expand Down
Loading
Loading