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