diff --git a/src/components/LatestUpdateCard.tsx b/src/components/LatestUpdateCard.tsx
index 7043f89..e901272 100644
--- a/src/components/LatestUpdateCard.tsx
+++ b/src/components/LatestUpdateCard.tsx
@@ -147,57 +147,112 @@ function FileCard({ post, att }: { post: Post; att: Attachment }) {
);
}
+function PillDownloadIcon() {
+ return (
+
+ );
+}
+
+function MediaSizeChip({ att }: { att: Attachment }) {
+ return (
+
+
+
+
+
+ {formatBytes(att.sizeBytes)}
+
+
+ );
+}
+
+function MediaTile({
+ att,
+ showExtra,
+}: {
+ att: Attachment;
+ showExtra?: number;
+}) {
+ const src = attachmentPreview(att);
+ const isVideo = att.kind === "video" || att.mime.startsWith("video/");
+ return (
+
+ {src ? (
+

+ ) : null}
+
+ {isVideo ? (
+
+ ) : null}
+ {showExtra ? (
+
+ +{showExtra}
+
+ ) : null}
+
+ );
+}
+
function MediaGrid({ attachments }: { attachments: Attachment[] }) {
const visible = attachments.slice(0, 4);
const extra = Math.max(0, attachments.length - visible.length);
- if (visible.length <= 1) {
- const src = attachmentPreview(visible[0]);
- return src ? (
-
- ) : (
-
+ if (visible.length === 0) return ;
+ if (visible.length === 1) return ;
+ if (visible.length === 2) {
+ return (
+
+ {visible.map((att) => (
+
+ ))}
+
+ );
+ }
+ if (visible.length === 3) {
+ return (
+
);
}
return (
{visible.map((att, index) => (
-
-
})
- {extra > 0 && index === visible.length - 1 ? (
-
- +{extra}
-
- ) : null}
-
+
0 && index === visible.length - 1 ? extra : 0}
+ />
))}
);
}
-function MediaBadge({ att }: { att?: Attachment }) {
- if (!att) return null;
- return (
-
-
-
-
- {formatBytes(att.sizeBytes)}
-
- );
-}
-
function VisualCard({ post }: { post: Post }) {
const { lang } = useI18n();
const att = post.attachments[0];
@@ -213,21 +268,13 @@ function VisualCard({ post }: { post: Post }) {
}`}
>
-
- {isVideo ? (
-
- ) : null}
{text || post.title ? (
{autolink(text || post.title || "")}
) : null}
-
+
);
}