terry-staging #9
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
Archive,
|
||||
Download,
|
||||
Eye,
|
||||
File,
|
||||
FileText,
|
||||
Image as ImageIcon,
|
||||
@@ -20,9 +19,7 @@ import { resourceTypeLabel } from "../resourceTypeLabels";
|
||||
import { cleanCategoryDisplayName } from "../utils/categoryDisplay";
|
||||
import { formatDateYmd } from "../utils/format";
|
||||
import { postToResource } from "../utils/postResourceAdapter";
|
||||
import type { Attachment, Post } from "../types/post";
|
||||
import { useLightbox } from "./messageStream/overlays/ImageLightbox";
|
||||
import { useVideoPlayer } from "./messageStream/overlays/VideoPlayer";
|
||||
import type { Post } from "../types/post";
|
||||
import { downloadAttachment } from "./messageStream/utils/downloadFile";
|
||||
import { useToast } from "./Toast";
|
||||
|
||||
@@ -94,8 +91,6 @@ function PopularRankRow({
|
||||
}) {
|
||||
const { t, lang } = useI18n();
|
||||
const navigate = useNavigate();
|
||||
const { openLightbox } = useLightbox();
|
||||
const { openVideo } = useVideoPlayer();
|
||||
const { showToast } = useToast();
|
||||
const [isDownloading, setIsDownloading] = useState(false);
|
||||
const [coverFailed, setCoverFailed] = useState(false);
|
||||
@@ -104,22 +99,6 @@ function PopularRankRow({
|
||||
const cover = r.coverImage && !coverFailed ? assetUrl(r.coverImage) : "";
|
||||
const isTop3 = index < MEDALS.length;
|
||||
|
||||
const first: Attachment | undefined = post.attachments[0];
|
||||
const imageAttachments = post.attachments.filter((a) => a.kind === "image");
|
||||
|
||||
const handlePreview = () => {
|
||||
if (first?.kind === "video") {
|
||||
openVideo(first);
|
||||
return;
|
||||
}
|
||||
if (imageAttachments.length > 0) {
|
||||
openLightbox(imageAttachments, 0, r.title, post.id);
|
||||
return;
|
||||
}
|
||||
// Documents / links have no inline overlay — fall through to the detail page.
|
||||
navigate(`/resource/${post.id}`);
|
||||
};
|
||||
|
||||
const handleDownload = async () => {
|
||||
if (isDownloading || !r.downloadPostId || !r.downloadAttachmentId) return;
|
||||
setIsDownloading(true);
|
||||
@@ -185,15 +164,6 @@ function PopularRankRow({
|
||||
</div>
|
||||
|
||||
<div className="relative z-10 flex shrink-0 items-center gap-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handlePreview}
|
||||
aria-label={t("preview")}
|
||||
title={t("preview")}
|
||||
className="flex h-9 w-9 items-center justify-center rounded-lg text-neutral-300 outline-none transition hover:bg-white/5 hover:text-ark-gold focus-visible:ring-2 focus-visible:ring-ark-gold/70"
|
||||
>
|
||||
<Eye className="h-[18px] w-[18px]" />
|
||||
</button>
|
||||
{r.isDownloadable ? (
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user