max height for proposal details

This commit is contained in:
Will Chen
2025-04-23 13:07:00 -07:00
parent 3b2fb12def
commit d651a6aa7e

View File

@@ -345,6 +345,19 @@ function ChatInputActions({
const otherFilesChanged = const otherFilesChanged =
proposal.filesChanged?.filter((f: FileChange) => !f.isServerFunction) ?? []; proposal.filesChanged?.filter((f: FileChange) => !f.isServerFunction) ?? [];
function formatTitle({
title,
isDetailsVisible,
}: {
title: string;
isDetailsVisible: boolean;
}) {
if (isDetailsVisible) {
return title;
}
return title.slice(0, 60) + "...";
}
return ( return (
<div className="border-b border-border"> <div className="border-b border-border">
<div className="p-2"> <div className="p-2">
@@ -360,7 +373,9 @@ function ChatInputActions({
) : ( ) : (
<ChevronDown size={16} className="mr-1 flex-shrink-0" /> <ChevronDown size={16} className="mr-1 flex-shrink-0" />
)} )}
<span className="font-medium">{proposal.title}</span> <span className="font-medium">
{formatTitle({ title: proposal.title, isDetailsVisible })}
</span>
</div> </div>
<div className="text-xs text-muted-foreground ml-6"> <div className="text-xs text-muted-foreground ml-6">
<ProposalSummary <ProposalSummary
@@ -414,6 +429,7 @@ function ChatInputActions({
</div> </div>
</div> </div>
<div className="overflow-y-auto max-h-[calc(100vh-300px)]">
{isDetailsVisible && ( {isDetailsVisible && (
<div className="p-3 border-t border-border bg-muted/50 text-sm"> <div className="p-3 border-t border-border bg-muted/50 text-sm">
{!!proposal.securityRisks.length && ( {!!proposal.securityRisks.length && (
@@ -488,7 +504,10 @@ function ChatInputActions({
{serverFunctions.map((file: FileChange, index: number) => ( {serverFunctions.map((file: FileChange, index: number) => (
<li key={index} className="flex items-center space-x-2"> <li key={index} className="flex items-center space-x-2">
{getIconForFileChange(file)} {getIconForFileChange(file)}
<span title={file.path} className="truncate cursor-default"> <span
title={file.path}
className="truncate cursor-default"
>
{file.name} {file.name}
</span> </span>
<span className="text-muted-foreground text-xs truncate"> <span className="text-muted-foreground text-xs truncate">
@@ -507,7 +526,10 @@ function ChatInputActions({
{otherFilesChanged.map((file: FileChange, index: number) => ( {otherFilesChanged.map((file: FileChange, index: number) => (
<li key={index} className="flex items-center space-x-2"> <li key={index} className="flex items-center space-x-2">
{getIconForFileChange(file)} {getIconForFileChange(file)}
<span title={file.path} className="truncate cursor-default"> <span
title={file.path}
className="truncate cursor-default"
>
{file.name} {file.name}
</span> </span>
<span className="text-muted-foreground text-xs truncate"> <span className="text-muted-foreground text-xs truncate">
@@ -521,6 +543,7 @@ function ChatInputActions({
</div> </div>
)} )}
</div> </div>
</div>
); );
} }