mirror of https://github.com/kortix-ai/suna.git
fix
This commit is contained in:
parent
f915f3faaa
commit
73bd555e5d
|
@ -36,6 +36,7 @@ interface AttachmentGroupProps {
|
|||
collapsed?: boolean; // Add new collapsed prop
|
||||
project?: Project; // Add project prop
|
||||
standalone?: boolean; // Add standalone prop for minimal styling
|
||||
alignRight?: boolean; // Add alignRight prop
|
||||
}
|
||||
|
||||
export function AttachmentGroup({
|
||||
|
@ -50,7 +51,8 @@ export function AttachmentGroup({
|
|||
gridImageHeight = 180, // Increased from 120 for better visibility
|
||||
collapsed = true, // By default, HTML/MD files are collapsed
|
||||
project, // Add project prop
|
||||
standalone = false // Add standalone prop
|
||||
standalone = false, // Add standalone prop
|
||||
alignRight = false // Add alignRight prop
|
||||
}: AttachmentGroupProps) {
|
||||
// State for modal
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
|
@ -263,6 +265,7 @@ export function AttachmentGroup({
|
|||
project={project} // Pass project to FileAttachment
|
||||
isSingleItemGrid={uniqueFiles.length === 1} // Pass single item detection
|
||||
standalone={standalone} // Pass standalone prop
|
||||
alignRight={alignRight} // Pass alignRight prop
|
||||
/>
|
||||
{onRemove && (
|
||||
<div
|
||||
|
@ -304,6 +307,7 @@ export function AttachmentGroup({
|
|||
showPreview={showPreviews}
|
||||
localPreviewUrl={getLocalPreviewUrl(item.file)}
|
||||
collapsed={true} // Always collapsed in inline mode
|
||||
alignRight={alignRight} // Pass alignRight prop
|
||||
/>
|
||||
{onRemove && (
|
||||
<div
|
||||
|
@ -471,6 +475,7 @@ export function AttachmentGroup({
|
|||
project={project}
|
||||
isSingleItemGrid={uniqueFiles.length === 1} // Pass single item detection to modal too
|
||||
standalone={false} // Never standalone in modal
|
||||
alignRight={false} // Never align right in modal
|
||||
/>
|
||||
{onRemove && (
|
||||
<div
|
||||
|
|
|
@ -29,17 +29,16 @@ export function renderStandaloneAttachments(attachments: string[], fileViewerHan
|
|||
if (validAttachments.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className={`w-full my-4 ${alignRight ? 'flex justify-end' : ''}`}>
|
||||
<div className={alignRight ? 'max-w-[85%] w-full' : 'w-full'}>
|
||||
<FileAttachmentGrid
|
||||
attachments={validAttachments}
|
||||
onFileClick={fileViewerHandler}
|
||||
showPreviews={true}
|
||||
sandboxId={sandboxId}
|
||||
project={project}
|
||||
standalone={true}
|
||||
/>
|
||||
</div>
|
||||
<div className="w-full my-4">
|
||||
<FileAttachmentGrid
|
||||
attachments={validAttachments}
|
||||
onFileClick={fileViewerHandler}
|
||||
showPreviews={true}
|
||||
sandboxId={sandboxId}
|
||||
project={project}
|
||||
standalone={true}
|
||||
alignRight={alignRight}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -159,6 +159,7 @@ interface FileAttachmentProps {
|
|||
project?: Project;
|
||||
isSingleItemGrid?: boolean; // New prop to detect single item in grid
|
||||
standalone?: boolean; // New prop for minimal standalone styling
|
||||
alignRight?: boolean; // New prop to control right alignment
|
||||
}
|
||||
|
||||
// Cache fetched content between mounts to avoid duplicate fetches
|
||||
|
@ -177,7 +178,8 @@ export function FileAttachment({
|
|||
collapsed = true,
|
||||
project,
|
||||
isSingleItemGrid = false,
|
||||
standalone = false
|
||||
standalone = false,
|
||||
alignRight = false
|
||||
}: FileAttachmentProps) {
|
||||
// Authentication
|
||||
const { session } = useAuth();
|
||||
|
@ -577,7 +579,7 @@ export function FileAttachment({
|
|||
delete safeStyle.height;
|
||||
delete (safeStyle as any)['--attachment-height'];
|
||||
|
||||
return (
|
||||
const fileButton = (
|
||||
<button
|
||||
onClick={handleClick}
|
||||
className={cn(
|
||||
|
@ -612,6 +614,19 @@ export function FileAttachment({
|
|||
</div>
|
||||
</button>
|
||||
);
|
||||
|
||||
// Wrap with alignment container if alignRight is true
|
||||
if (alignRight) {
|
||||
return (
|
||||
<div className="w-full flex justify-end">
|
||||
<div className="max-w-[85%]">
|
||||
{fileButton}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return fileButton;
|
||||
}
|
||||
|
||||
interface FileAttachmentGridProps {
|
||||
|
@ -623,6 +638,7 @@ interface FileAttachmentGridProps {
|
|||
collapsed?: boolean;
|
||||
project?: Project;
|
||||
standalone?: boolean;
|
||||
alignRight?: boolean;
|
||||
}
|
||||
|
||||
export function FileAttachmentGrid({
|
||||
|
@ -633,14 +649,15 @@ export function FileAttachmentGrid({
|
|||
showPreviews = true,
|
||||
collapsed = false,
|
||||
project,
|
||||
standalone = false
|
||||
standalone = false,
|
||||
alignRight = false
|
||||
}: FileAttachmentGridProps) {
|
||||
if (!attachments || attachments.length === 0) return null;
|
||||
|
||||
// For standalone rendering, always expand previews to show content
|
||||
const shouldCollapse = standalone ? false : collapsed;
|
||||
|
||||
return (
|
||||
const content = (
|
||||
<AttachmentGroup
|
||||
files={attachments}
|
||||
onFileClick={onFileClick}
|
||||
|
@ -652,6 +669,20 @@ export function FileAttachmentGrid({
|
|||
collapsed={shouldCollapse}
|
||||
project={project}
|
||||
standalone={standalone}
|
||||
alignRight={alignRight}
|
||||
/>
|
||||
);
|
||||
|
||||
// Wrap with alignment container if alignRight is true
|
||||
if (alignRight) {
|
||||
return (
|
||||
<div className="w-full flex justify-end">
|
||||
<div className="max-w-[85%]">
|
||||
{content}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
|
@ -383,7 +383,7 @@ export function CreateSlideToolView({
|
|||
iconColor="text-blue-500 dark:text-blue-400"
|
||||
bgColor="bg-gradient-to-b from-blue-100 to-blue-50 shadow-inner dark:from-blue-800/40 dark:to-blue-900/60 dark:shadow-blue-950/20"
|
||||
title="Creating slide"
|
||||
filePath="Generating HTML..."
|
||||
filePath="Creating Slide..."
|
||||
showProgress={true}
|
||||
/>
|
||||
) : error || (!slideData && !fileContent) ? (
|
||||
|
|
Loading…
Reference in New Issue