terry-staging #9
@@ -1,7 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
Archive,
|
Archive,
|
||||||
Download,
|
Download,
|
||||||
Eye,
|
|
||||||
File,
|
File,
|
||||||
FileText,
|
FileText,
|
||||||
Image as ImageIcon,
|
Image as ImageIcon,
|
||||||
@@ -20,9 +19,7 @@ import { resourceTypeLabel } from "../resourceTypeLabels";
|
|||||||
import { cleanCategoryDisplayName } from "../utils/categoryDisplay";
|
import { cleanCategoryDisplayName } from "../utils/categoryDisplay";
|
||||||
import { formatDateYmd } from "../utils/format";
|
import { formatDateYmd } from "../utils/format";
|
||||||
import { postToResource } from "../utils/postResourceAdapter";
|
import { postToResource } from "../utils/postResourceAdapter";
|
||||||
import type { Attachment, Post } from "../types/post";
|
import type { Post } from "../types/post";
|
||||||
import { useLightbox } from "./messageStream/overlays/ImageLightbox";
|
|
||||||
import { useVideoPlayer } from "./messageStream/overlays/VideoPlayer";
|
|
||||||
import { downloadAttachment } from "./messageStream/utils/downloadFile";
|
import { downloadAttachment } from "./messageStream/utils/downloadFile";
|
||||||
import { useToast } from "./Toast";
|
import { useToast } from "./Toast";
|
||||||
|
|
||||||
@@ -94,8 +91,6 @@ function PopularRankRow({
|
|||||||
}) {
|
}) {
|
||||||
const { t, lang } = useI18n();
|
const { t, lang } = useI18n();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { openLightbox } = useLightbox();
|
|
||||||
const { openVideo } = useVideoPlayer();
|
|
||||||
const { showToast } = useToast();
|
const { showToast } = useToast();
|
||||||
const [isDownloading, setIsDownloading] = useState(false);
|
const [isDownloading, setIsDownloading] = useState(false);
|
||||||
const [coverFailed, setCoverFailed] = useState(false);
|
const [coverFailed, setCoverFailed] = useState(false);
|
||||||
@@ -104,22 +99,6 @@ function PopularRankRow({
|
|||||||
const cover = r.coverImage && !coverFailed ? assetUrl(r.coverImage) : "";
|
const cover = r.coverImage && !coverFailed ? assetUrl(r.coverImage) : "";
|
||||||
const isTop3 = index < MEDALS.length;
|
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 () => {
|
const handleDownload = async () => {
|
||||||
if (isDownloading || !r.downloadPostId || !r.downloadAttachmentId) return;
|
if (isDownloading || !r.downloadPostId || !r.downloadAttachmentId) return;
|
||||||
setIsDownloading(true);
|
setIsDownloading(true);
|
||||||
@@ -185,15 +164,6 @@ function PopularRankRow({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="relative z-10 flex shrink-0 items-center gap-1">
|
<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 ? (
|
{r.isDownloadable ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
Reference in New Issue
Block a user