Skip to content

Commit b2bb47c

Browse files
andresdjassoclaude
andcommitted
fix(home,chat-switcher): align new-chat view + chat-switcher chrome with main
- chat-switcher: title uses the canonical chip label (chipContentLabelClass — normal weight, --text-body, text-sm) instead of bold --text-primary; dropdown chevron sized to the canonical 10x6 (h-[6px] w-[10px]) to match the workspace switcher - home new-chat: remove the grey 'Recents' tray (ChatHistory) so the empty state is just the chat input, as on main; delete the now-orphaned ChatHistory component + its barrel export (ChatHistoryList stays — used by the chat-switcher) - home new-chat: restore main's empty-state centering (justify-center + pt-[2vh] pb-[22vh]) so the heading/input cluster sits at the same optical center Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c13f4f7 commit b2bb47c

5 files changed

Lines changed: 24 additions & 137 deletions

File tree

apps/sim/app/workspace/[workspaceId]/components/chat-switcher/chat-switcher.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useMemo, useState } from 'react'
44
import { useParams, usePathname, useRouter } from 'next/navigation'
55
import {
6+
chipContentLabelClass,
67
POPOVER_ANIMATION_CLASSES,
78
Popover,
89
PopoverAnchor,
@@ -168,9 +169,7 @@ export function ChatSwitcher({
168169
className='before:-z-10 relative isolate flex min-w-0 items-center gap-1.5 rounded-l-lg pr-1 pl-2 before:absolute before:inset-0 before:rounded-l-lg before:bg-[var(--surface-active)] before:opacity-0 before:transition-opacity hover-hover:hover:before:opacity-100'
169170
>
170171
{chipIcon}
171-
<span className='min-w-0 max-w-[200px] truncate font-medium text-[14px] text-[var(--text-primary)]'>
172-
{title}
173-
</span>
172+
<span className={cn(chipContentLabelClass, 'max-w-[200px]')}>{title}</span>
174173
</button>
175174
</Tooltip.Trigger>
176175
<Tooltip.Content side='bottom'>
@@ -189,7 +188,7 @@ export function ChatSwitcher({
189188
open && 'before:opacity-100'
190189
)}
191190
>
192-
<ChevronDown className='size-[14px] flex-shrink-0 text-[var(--text-icon)]' />
191+
<ChevronDown className='h-[6px] w-[10px] flex-shrink-0 text-[var(--text-icon)]' />
193192
</button>
194193
</Tooltip.Trigger>
195194
<Tooltip.Content side='bottom'>
@@ -210,9 +209,7 @@ export function ChatSwitcher({
210209
className='before:-z-10 relative isolate flex min-w-0 items-center gap-1.5 rounded-l-lg pr-1 pl-2 before:absolute before:inset-0 before:rounded-l-lg before:bg-[var(--surface-active)] before:opacity-0 before:transition-opacity hover-hover:hover:before:opacity-100'
211210
>
212211
{chipIcon}
213-
<span className='min-w-0 truncate font-medium text-[14px] text-[var(--text-primary)]'>
214-
{title}
215-
</span>
212+
<span className={chipContentLabelClass}>{title}</span>
216213
</button>
217214
</Tooltip.Trigger>
218215
<Tooltip.Content side='bottom'>
@@ -231,7 +228,7 @@ export function ChatSwitcher({
231228
open && 'before:opacity-100'
232229
)}
233230
>
234-
<ChevronDown className='size-[14px] flex-shrink-0 text-[var(--text-icon)]' />
231+
<ChevronDown className='h-[6px] w-[10px] flex-shrink-0 text-[var(--text-icon)]' />
235232
</button>
236233
</Tooltip.Trigger>
237234
<Tooltip.Content side='bottom'>
@@ -254,9 +251,7 @@ export function ChatSwitcher({
254251
)}
255252
>
256253
{chipIcon}
257-
<span className='min-w-0 truncate font-medium text-[14px] text-[var(--text-primary)]'>
258-
{title}
259-
</span>
254+
<span className={chipContentLabelClass}>{title}</span>
260255
</button>
261256
<span aria-hidden='true' className='relative w-px self-stretch bg-[var(--bg)]' />
262257
<Tooltip.Root>
@@ -270,7 +265,7 @@ export function ChatSwitcher({
270265
open && 'before:opacity-100'
271266
)}
272267
>
273-
<ChevronDown className='size-[14px] flex-shrink-0 text-[var(--text-icon)]' />
268+
<ChevronDown className='h-[6px] w-[10px] flex-shrink-0 text-[var(--text-icon)]' />
274269
</button>
275270
</Tooltip.Trigger>
276271
<Tooltip.Content side='bottom'>

apps/sim/app/workspace/[workspaceId]/home/components/chat-history/chat-history.tsx

Lines changed: 0 additions & 86 deletions
This file was deleted.

apps/sim/app/workspace/[workspaceId]/home/components/chat-history/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/sim/app/workspace/[workspaceId]/home/components/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export { ChatHistory } from './chat-history'
21
export { ChatMessageAttachments } from './chat-message-attachments'
32
export { ChatSurfaceProvider, useChatSurface } from './chat-surface-context'
43
export { ContextMentionIcon } from './context-mention-icon'

apps/sim/app/workspace/[workspaceId]/home/home.tsx

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import { useOAuthReturnRouter } from '@/hooks/use-oauth-return'
3939
import { useMothershipStageStore } from '@/stores/mothership-stage/store'
4040
import type { ChatContext } from '@/stores/panel'
4141
import {
42-
ChatHistory,
4342
ChatSurfaceProvider,
4443
CreditsChip,
4544
MothershipChat,
@@ -203,7 +202,6 @@ export function Home({ chatId, userName, userId, initialResourceId = null }: Hom
203202
sendMessage,
204203
stopGeneration,
205204
resolvedChatId,
206-
adoptResolvedChatId,
207205
resources,
208206
addResource,
209207
removeResource,
@@ -376,18 +374,6 @@ export function Home({ chatId, userName, userId, initialResourceId = null }: Hom
376374
* and rewrites the URL to /task/[id] via replaceState; flipping
377375
* `isInputEntering` plays the same slide-in morph as sending a new message.
378376
*/
379-
const handleOpenExistingChat = useCallback(
380-
(selectedChatId: string) => {
381-
captureEvent(posthogRef.current, 'task_opened_from_history', {
382-
workspace_id: workspaceId,
383-
chat_id: selectedChatId,
384-
})
385-
setIsInputEntering(true)
386-
adoptResolvedChatId(selectedChatId, { replaceHomeHistory: true })
387-
},
388-
[adoptResolvedChatId, workspaceId]
389-
)
390-
391377
useEffect(() => {
392378
const handler = (e: Event) => {
393379
const message = (e as CustomEvent<MothershipSendMessageDetail>).detail?.message
@@ -549,32 +535,26 @@ export function Home({ chatId, userName, userId, initialResourceId = null }: Hom
549535
<CreditsChip />
550536
</div>
551537
<div className='relative flex-1 overflow-y-auto [scrollbar-gutter:stable_both-edges]'>
552-
<div className='flex min-h-full flex-col items-center px-6 pt-[calc(24vh-44px)] pb-[2vh]'>
538+
{/* Asymmetric padding biases the group up so the full cluster (heading + input + suggestions) sits at the optical center — matching main */}
539+
<div className='flex min-h-full flex-col items-center justify-center px-6 pt-[2vh] pb-[22vh]'>
553540
<h1 className='mb-7 max-w-[48rem] text-balance font-season text-[30px] text-[var(--text-primary)]'>
554541
What should we get done{firstName ? `, ${firstName}` : ''}?
555542
</h1>
556-
<div ref={initialViewInputRef} className='w-full'>
557-
{/* Stacked card (Figma node 1-3): grey tray sits behind the input
558-
with a 1px frame on top/sides. The docked "All Chats" launcher
559-
lives in the shelf below and animates the chat list open inside
560-
the grey tray — growing downward as the input rides up. */}
561-
<div className='mx-auto w-full max-w-[48rem] overflow-hidden rounded-[18px] bg-[var(--surface-3)] p-px'>
562-
<ChatSurfaceProvider
563-
userId={userId}
564-
onContextAdd={handleContextAdd}
565-
onContextRemove={handleInitialContextRemove}
566-
>
567-
<UserInput
568-
ref={initialViewUserInputRef}
569-
defaultValue={initialPrompt}
570-
draftScopeKey={draftScopeKey}
571-
onSubmit={handleSubmit}
572-
isSending={isSending}
573-
onStopGeneration={handleStopGeneration}
574-
/>
575-
</ChatSurfaceProvider>
576-
<ChatHistory onSelectChat={handleOpenExistingChat} />
577-
</div>
543+
<div ref={initialViewInputRef} className='relative w-full max-w-[48rem]'>
544+
<ChatSurfaceProvider
545+
userId={userId}
546+
onContextAdd={handleContextAdd}
547+
onContextRemove={handleInitialContextRemove}
548+
>
549+
<UserInput
550+
ref={initialViewUserInputRef}
551+
defaultValue={initialPrompt}
552+
draftScopeKey={draftScopeKey}
553+
onSubmit={handleSubmit}
554+
isSending={isSending}
555+
onStopGeneration={handleStopGeneration}
556+
/>
557+
</ChatSurfaceProvider>
578558
<SuggestedActions
579559
onSelectPrompt={(prompt) => initialViewUserInputRef.current?.populatePrompt(prompt)}
580560
/>

0 commit comments

Comments
 (0)