diff --git a/refactoring/about.html b/refactoring/about.html deleted file mode 100644 index 8b4acd4..0000000 --- a/refactoring/about.html +++ /dev/null @@ -1,207 +0,0 @@ - - -
- - -- ${escapeHTML(message)} -
`; - } - } - - async renderVideoList(videos) { - try { - console.log("RENDER VIDEO LIST - Start", { - videosReceived: videos, - videosCount: videos ? videos.length : "N/A", - videosType: typeof videos, - }); - - if (!videos || videos.length === 0) { - this.renderEmptyState("No videos found."); - return; - } - - // Sort by creation date - const videoArray = [...videos].sort( - (a, b) => b.created_at - a.created_at - ); - - // Fetch user profiles - const userProfiles = await this.fetchUserProfiles(videoArray); - - // Build HTML for each video - const renderedVideos = videoArray - .map((video, index) => this.renderVideoCard(video, index, userProfiles)) - .filter(Boolean); - - if (renderedVideos.length === 0) { - this.renderEmptyState("No valid videos to display."); - return; - } - - this.videoList.innerHTML = renderedVideos.join(""); - console.log("Videos rendered successfully"); - } catch (error) { - console.error("Rendering error:", error); - this.renderEmptyState("Error loading videos."); - } - } - - async fetchUserProfiles(videos) { - const userProfiles = new Map(); - const uniquePubkeys = [...new Set(videos.map((v) => v.pubkey))]; - - for (const pubkey of uniquePubkeys) { - try { - const profile = await nostrClient.fetchUserProfile(pubkey); - userProfiles.set(pubkey, profile); - } catch (error) { - console.error(`Profile fetch error for ${pubkey}:`, error); - userProfiles.set(pubkey, { - name: "Unknown", - picture: `https://robohash.org/${pubkey}`, - }); - } - } - - return userProfiles; - } - - renderVideoCard(video, index, userProfiles) { - try { - if (!this.validateVideo(video, index)) { - console.error(`Invalid video: ${video.title}`); - return ""; - } - - const profile = userProfiles.get(video.pubkey) || { - name: "Unknown", - picture: `https://robohash.org/${video.pubkey}`, - }; - - const canEdit = video.pubkey === this.pubkey; - const highlightClass = - video.isPrivate && canEdit - ? "border-2 border-yellow-500" - : "border-none"; - - return ` -- ${escapeHTML(profile.name)} -
-