This commit is contained in:
암냥 2026-04-23 19:11:16 +09:00
commit 3c601295b1
No known key found for this signature in database
5 changed files with 82 additions and 13 deletions

View file

@ -10,6 +10,8 @@ type Upload = {
mediaIndex: number;
mediaUrl: string;
s3Key: string;
mediaType?: "image" | "video";
thumbnailUrl?: string;
author?: string;
tweet: {
url: string;
@ -30,6 +32,8 @@ type GalleryPhoto = {
alt: string;
author: string;
source: string;
mediaType?: "image" | "video";
thumbnailUrl?: string;
};
type Me = {
@ -435,7 +439,8 @@ export default function App() {
(upload) =>
new Promise<GalleryPhoto | null>((resolve) => {
const image = new Image();
image.src = upload.mediaUrl;
const srcToLoad = (upload.mediaType === "video" && upload.thumbnailUrl) ? upload.thumbnailUrl : upload.mediaUrl;
image.src = srcToLoad;
image.onload = () => {
resolve({
src: upload.mediaUrl,
@ -445,6 +450,8 @@ export default function App() {
alt: `tweet ${upload.tweetId} media ${upload.mediaIndex + 1}`,
author: upload.author?.trim() || "unknown",
source: upload.tweet?.url || "",
mediaType: upload.mediaType,
thumbnailUrl: upload.thumbnailUrl,
});
};
image.onerror = () => {
@ -456,6 +463,8 @@ export default function App() {
alt: `tweet ${upload.tweetId} media ${upload.mediaIndex + 1}`,
author: upload.author?.trim() || "unknown",
source: upload.tweet?.url || "",
mediaType: upload.mediaType,
thumbnailUrl: upload.thumbnailUrl,
});
};
}),
@ -547,6 +556,13 @@ export default function App() {
decoding="async"
className="block w-full"
/>
{photo.mediaType === "video" && (
<div className="absolute right-2 top-2 rounded-full bg-black/40 p-1.5 text-white backdrop-blur-sm">
<svg className="h-3.5 w-3.5" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z" clipRule="evenodd" />
</svg>
</div>
)}
<div className="absolute inset-x-3 bottom-3 translate-y-3 opacity-0 transition-all duration-200 group-hover:translate-y-0 group-hover:opacity-100">
<button
type="button"
@ -603,6 +619,22 @@ export default function App() {
<div className="my-1 h-px bg-border" />
</>
) : null}
<button
type="button"
className="block w-full rounded px-3 py-2 text-left text-sm hover:bg-accent"
onClick={() => {
navigator.clipboard.writeText(contextMenu.photo.source).then(() => {
setContextMenu(null);
}).catch((err) => {
console.error("Failed to copy link:", err);
alert("링크 복사에 실패했습니다.");
});
}}
>
</button>
<div className="my-1 h-px bg-border" />
<button
type="button"
className="block w-full rounded px-3 py-2 text-left text-sm hover:bg-accent"