fix: clarify multi-document downloads
This commit is contained in:
@@ -9,6 +9,7 @@ import { VideoBubble } from "./bubbles/VideoBubble";
|
||||
import { LinkPreviewCard } from "./LinkPreviewCard";
|
||||
import { formatDateTime } from "./utils/formatTime";
|
||||
import { FavoriteButton } from "../../favorites/FavoriteButton";
|
||||
import { BubbleAttachmentDownloadButton } from "./BubbleAttachmentDownloadButton";
|
||||
|
||||
export type MessageBubbleVariant = "default" | "latest";
|
||||
|
||||
@@ -106,6 +107,12 @@ export function MessageBubble({
|
||||
onFavoriteChange?.(post.id, favorited)
|
||||
}
|
||||
/>
|
||||
{isFileBubble && post.attachments.length === 1 ? (
|
||||
<BubbleAttachmentDownloadButton
|
||||
postId={post.id}
|
||||
attachment={post.attachments[0]}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
@@ -19,7 +19,15 @@ import { FavoriteButton } from "../../../favorites/FavoriteButton";
|
||||
import { BubbleAttachmentDownloadButton } from "../BubbleAttachmentDownloadButton";
|
||||
import type { MessageBubbleVariant } from "../MessageBubble";
|
||||
|
||||
function AttachmentRow({ postId, att }: { postId: string; att: Attachment }) {
|
||||
function AttachmentRow({
|
||||
postId,
|
||||
att,
|
||||
showDownload,
|
||||
}: {
|
||||
postId: string;
|
||||
att: Attachment;
|
||||
showDownload: boolean;
|
||||
}) {
|
||||
const { Icon, color } = fileIcon({ mime: att.mime, filename: att.filename });
|
||||
const displayFilename = filenameWithExtension(att.filename, att.mime);
|
||||
const [previewFailed, setPreviewFailed] = useState(false);
|
||||
@@ -70,7 +78,9 @@ function AttachmentRow({ postId, att }: { postId: string; att: Attachment }) {
|
||||
{formatBytes(att.sizeBytes)}
|
||||
</div>
|
||||
</div>
|
||||
{showDownload ? (
|
||||
<BubbleAttachmentDownloadButton postId={postId} attachment={att} />
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -195,7 +205,12 @@ export function FileDocBubble({
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
{post.attachments.map((att) => (
|
||||
<AttachmentRow key={att.id} postId={post.id} att={att} />
|
||||
<AttachmentRow
|
||||
key={att.id}
|
||||
postId={post.id}
|
||||
att={att}
|
||||
showDownload={post.attachments.length >= 2}
|
||||
/>
|
||||
))}
|
||||
{text ? (
|
||||
<CollapsibleText className="message-stream-copyable-text select-text whitespace-pre-wrap break-words text-[15px] font-medium leading-6 text-neutral-100">
|
||||
|
||||
Reference in New Issue
Block a user