Refactor video modal sharing options into a unified Share menu

- Replaced the standalone "Copy Magnet" button and "Share" button with a new Share menu.
- Implemented `createVideoShareMenuPanel` to render the new menu with "Copy URL", "Share on Nostr", "Copy Magnet", and "Copy CDN Link" options.
- Updated `VideoModal.js` to manage the share menu state and handle actions.
- Added `video:share-nostr` and `video:copy-cdn` event handlers in `app.js`.
- Removed the `#copyMagnetBtn` element from `video-modal.html`.
- Preserved existing functionality for "Copy URL" and "Copy Magnet".
- "Share on Nostr" is currently a placeholder logging a message, disabled for logged-out users.
- "Copy CDN Link" is disabled if no URL is available.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-22 04:17:29 +00:00
1 parent 4c9ae3b882
commit bd868fb7ea
8 files changed
+140 -24

No files matched your search

+9 -5
View File
@@ -8459,7 +8459,7 @@ class Application {
this.currentVideo.torrentSupported = !!magnetForPlayback;
}
this.currentMagnetUri = magnetForPlayback || null;
this.setCopyMagnetState(!!magnetForPlayback);
// this.setCopyMagnetState(!!magnetForPlayback); // Removed
const unsubscribers = [];
const subscribe = (eventName, handler) => {
@@ -8757,8 +8757,8 @@ class Application {
this.currentMagnetUri = sanitizedMagnet || null;
this.setCopyMagnetState(!!sanitizedMagnet);
this.setShareButtonState(true);
// this.setCopyMagnetState(!!sanitizedMagnet); // Removed
// this.setShareButtonState(true); // Moved to after showModalWithPoster
const nevent = window.NostrTools.nip19.neventEncode({ id: eventId });
const pushUrl =
@@ -8781,6 +8781,8 @@ class Application {
await this.showModalWithPoster(this.currentVideo);
this.setShareButtonState(true);
this.commentController?.load(this.currentVideo);
const playbackOptions = {
@@ -9131,8 +9133,8 @@ class Application {
this.currentMagnetUri = sanitizedMagnet || null;
this.setCopyMagnetState(!!sanitizedMagnet);
this.setShareButtonState(false);
// this.setCopyMagnetState(!!sanitizedMagnet);
// this.setShareButtonState(false);
if (this.videoModal) {
this.videoModal.updateMetadata({
@@ -9150,6 +9152,8 @@ class Application {
await this.showModalWithPoster(this.currentVideo, hasTrigger ? { trigger } : {});
this.setShareButtonState(false);
this.commentController?.load(null);
const shareUrl = this.buildShareUrlFromEventId(this.currentVideo.id);