2026-05-26 12:07:13 +08:00
|
|
|
import { useI18n } from "../../../i18n";
|
2026-05-25 05:25:57 +08:00
|
|
|
import type { Post } from "../../../types/post";
|
|
|
|
|
import { autolink } from "../utils/autolink";
|
2026-05-26 12:07:13 +08:00
|
|
|
import { postDisplayText } from "../utils/postText";
|
2026-05-29 23:49:59 +08:00
|
|
|
import { CollapsibleText } from "../CollapsibleText";
|
2026-05-29 22:16:55 +08:00
|
|
|
import { SingleImageFrame } from "./SingleImageFrame";
|
2026-05-25 05:25:57 +08:00
|
|
|
|
|
|
|
|
export function ImageWithTextBubble({ post }: { post: Post }) {
|
2026-05-27 12:33:26 +08:00
|
|
|
const { lang } = useI18n();
|
2026-05-25 05:25:57 +08:00
|
|
|
const att = post.attachments[0];
|
2026-05-26 12:07:13 +08:00
|
|
|
const text = postDisplayText(post, lang);
|
2026-05-25 05:25:57 +08:00
|
|
|
if (!att) return null;
|
|
|
|
|
return (
|
2026-05-28 10:36:38 +08:00
|
|
|
<div className="flex flex-col">
|
2026-06-03 14:30:34 +08:00
|
|
|
<SingleImageFrame
|
|
|
|
|
postId={post.id}
|
|
|
|
|
attachment={att}
|
|
|
|
|
text={text}
|
|
|
|
|
showFilename={post.categorySlug === "official-assets"}
|
|
|
|
|
/>
|
2026-05-26 12:07:13 +08:00
|
|
|
{text ? (
|
2026-05-29 23:49:59 +08:00
|
|
|
<CollapsibleText
|
|
|
|
|
wrapperClassName="px-4 pt-3"
|
|
|
|
|
className="message-stream-copyable-text select-text whitespace-pre-wrap break-words text-[14px] leading-6 text-neutral-100"
|
|
|
|
|
>
|
2026-05-28 10:36:38 +08:00
|
|
|
{autolink(text)}
|
2026-05-29 23:49:59 +08:00
|
|
|
</CollapsibleText>
|
2026-05-25 05:25:57 +08:00
|
|
|
) : null}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|