diff --git a/src/css/style.css b/src/css/style.css index e9e8897..4d6ecda 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -472,3 +472,22 @@ footer a:hover { pointer-events: none; } + +/* Create a container that preserves a 16:9 aspect ratio via padding-top. */ +/* Force 16:9 ratio using padding-top technique */ +.ratio-16-9 { + position: relative; + width: 100%; + padding-top: 56.25%; /* 16:9 => 9/16 = 0.5625 => 56.25% */ + background-color: #1e293b; /* fallback background if image doesn't load */ +} + +.ratio-16-9 > img { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + object-fit: cover; +} + diff --git a/src/index.html b/src/index.html index 5e787b5..bb6226b 100644 --- a/src/index.html +++ b/src/index.html @@ -1,6 +1,4 @@ - -
diff --git a/src/js/app.js b/src/js/app.js index acc34ff..d55fa90 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -549,26 +549,23 @@ class bitvidApp { } const videoArray = Array.isArray(videos) ? videos : [videos]; - if (videoArray.length === 0) { console.error("VIDEO ARRAY IS EMPTY"); this.videoList.innerHTML = `No videos available.
`; return; } - // Sort by creation date + // Sort newest first videoArray.sort((a, b) => b.created_at - a.created_at); + // Fetch user profiles const userProfiles = new Map(); const uniquePubkeys = [...new Set(videoArray.map((v) => v.pubkey))]; - - // Fetch user profiles for (const pubkey of uniquePubkeys) { try { const userEvents = await nostrClient.pool.list(nostrClient.relays, [ { kinds: [0], authors: [pubkey], limit: 1 }, ]); - if (userEvents[0]?.content) { const profile = JSON.parse(userEvents[0].content); userProfiles.set(pubkey, { @@ -590,7 +587,7 @@ class bitvidApp { } } - // Build video cards + // Build each video card const renderedVideos = videoArray .map((video, index) => { try { @@ -599,24 +596,24 @@ class bitvidApp { return ""; } - // Create share URL + // Create a share URL const nevent = window.NostrTools.nip19.neventEncode({ id: video.id }); const shareUrl = `${window.location.pathname}?v=${encodeURIComponent(nevent)}`; - // Get profile info + // Gather profile info const profile = userProfiles.get(video.pubkey) || { name: "Unknown", picture: `https://robohash.org/${video.pubkey}`, }; const timeAgo = this.formatTimeAgo(video.created_at); - // Determine edit capability + // Check if user can edit const canEdit = video.pubkey === this.pubkey; const highlightClass = video.isPrivate && canEdit ? "border-2 border-yellow-500" : "border-none"; - // If user can edit, show gear menu + // Gear menu if canEdit const gearMenu = canEdit ? `- ${this.escapeHTML(profile.name)} -
-+ ${this.escapeHTML(profile.name)} +
+No valid videos to display.
`; return;