fix(desktop): cap the changed-files card and fade its overflow
A turn that rewrote twenty files grew a twenty-row card, so the summary that is supposed to close the turn became the thing you scroll past to reach the composer. Cap the rows at ~5 and let the clipped edge fade, the way every other overflow in the app reads. The horizontal padding moves onto the scroller so a row's hover fill still bleeds to the card's edge instead of stopping at a scroll gutter.
This commit is contained in:
@@ -5,11 +5,16 @@ import { useSessionView } from '@/app/chat/session-view'
|
||||
import { deriveChangedFiles } from '@/components/assistant-ui/thread/changed-files'
|
||||
import { WIDGET_SHELL_CLASS } from '@/components/chat/widget-shell'
|
||||
import { DiffCount } from '@/components/ui/diff-count'
|
||||
import { FadeScroll } from '@/components/ui/fade-scroll'
|
||||
import { FileTypeIcon } from '@/components/ui/file-type-icon'
|
||||
import { useI18n } from '@/i18n'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { openReviewForPath, revealReview } from '@/store/review'
|
||||
|
||||
// ~5 rows. A turn that rewrites twenty files should still read as one card in
|
||||
// the transcript, not a wall the user has to scroll past to reach the composer.
|
||||
const MAX_ROWS_HEIGHT = '9.375rem'
|
||||
|
||||
/**
|
||||
* Cursor-style "N files changed" summary closing out the newest assistant turn:
|
||||
* one row per file it edited with that file's +/-, and a Review action opening
|
||||
@@ -47,10 +52,10 @@ export const ChangedFilesCard: FC<{ parts: readonly unknown[] }> = ({ parts }) =
|
||||
{copy.reviewChanges}
|
||||
</button>
|
||||
</div>
|
||||
<div className="mt-1.5 flex flex-col">
|
||||
<FadeScroll className="-mx-1.5 mt-1.5 flex flex-col px-1.5" maxHeight={MAX_ROWS_HEIGHT}>
|
||||
{files.map(file => (
|
||||
<button
|
||||
className="row-hover -mx-1.5 flex items-center gap-2 rounded-md px-1.5 py-1 text-left"
|
||||
className="row-hover flex shrink-0 items-center gap-2 rounded-md px-1.5 py-1 text-left"
|
||||
key={file.path}
|
||||
onClick={() => void openReviewForPath(file.path, scopeCwd)}
|
||||
title={file.path}
|
||||
@@ -61,7 +66,7 @@ export const ChangedFilesCard: FC<{ parts: readonly unknown[] }> = ({ parts }) =
|
||||
<DiffCount added={file.added} removed={file.removed} />
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</FadeScroll>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user