From 960e0ce15e4952b07abbe28a4b7f518db610649a Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 28 Aug 2022 16:29:11 +0200 Subject: [PATCH 1/9] add share dialog --- src/components/ShareModal.vue | 87 +++++++++++++++++++++++++++++++++++ src/components/WatchVideo.vue | 22 +++++---- src/locales/en.json | 9 +++- src/main.js | 2 + 4 files changed, 109 insertions(+), 11 deletions(-) create mode 100644 src/components/ShareModal.vue diff --git a/src/components/ShareModal.vue b/src/components/ShareModal.vue new file mode 100644 index 00000000..908c307b --- /dev/null +++ b/src/components/ShareModal.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index b2acbb2f..5db8d7fd 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -88,6 +88,12 @@ /> +
@@ -105,15 +111,10 @@ - - - - - - - - - + LBRY @@ -211,6 +212,7 @@ import ErrorHandler from "./ErrorHandler.vue"; import CommentItem from "./CommentItem.vue"; import ChaptersBar from "./ChaptersBar.vue"; import PlaylistAddModal from "./PlaylistAddModal.vue"; +import ShareModal from "./ShareModal.vue"; import PlaylistVideos from "./PlaylistVideos.vue"; export default { @@ -222,6 +224,7 @@ export default { CommentItem, ChaptersBar, PlaylistAddModal, + ShareModal, PlaylistVideos, }, data() { @@ -245,6 +248,7 @@ export default { smallViewQuery: smallViewQuery, smallView: smallViewQuery.matches, showModal: false, + showShareModal: false, isMobile: true, currentTime: 0, }; diff --git a/src/locales/en.json b/src/locales/en.json index ac4e4322..028effbc 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -97,7 +97,12 @@ "confirm_reset_preferences": "Are you sure you want to reset your preferences?", "backup_preferences": "Backup preferences", "restore_preferences": "Restore preferences", - "back_to_home": "Back to home" + "back_to_home": "Back to home", + "share": "Share", + "with_timecode": "Share with time code", + "piped_link": "Piped link", + "follow_link": "Follow link", + "copy_link": "Copy link" }, "comment": { "pinned_by": "Pinned by", @@ -146,4 +151,4 @@ "preferences_note": "Note: preferences are saved in the local storage of your browser. Deleting your browser data will reset them.", "page_not_found": "Page not found" } -} \ No newline at end of file +} diff --git a/src/main.js b/src/main.js index 6c9d9642..db65e6aa 100644 --- a/src/main.js +++ b/src/main.js @@ -16,6 +16,7 @@ import { faCircleMinus, faXmark, faClone, + faShare, } from "@fortawesome/free-solid-svg-icons"; import { faGithub, faBitcoin, faYoutube } from "@fortawesome/free-brands-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; @@ -38,6 +39,7 @@ library.add( faCircleMinus, faXmark, faClone, + faShare, ); import router from "@/router/router.js"; From ed9379dad715336cd0fd82de8937650588a7badf Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 28 Aug 2022 16:35:40 +0200 Subject: [PATCH 2/9] add copy functionality --- src/components/ShareModal.vue | 16 ++++++++++++---- src/locales/en.json | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/ShareModal.vue b/src/components/ShareModal.vue index 908c307b..87cdec60 100644 --- a/src/components/ShareModal.vue +++ b/src/components/ShareModal.vue @@ -14,7 +14,7 @@

@@ -68,10 +68,18 @@ export default { event.preventDefault(); }, followLink() { - window.location.href = this.generatedLink; + window.open(this.generatedLink, "_blank").focus(); }, - copyLink() { - this.$emit("close"); + async copyLink() { + await this.copyURL(this.generatedLink); + }, + async copyURL(mytext) { + try { + await navigator.clipboard.writeText(mytext); + alert(this.$t("info.copied")); + } catch ($e) { + alert(this.$t("info.cannot_copy")); + } }, }, computed: { diff --git a/src/locales/en.json b/src/locales/en.json index 028effbc..3eacdaa8 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -149,6 +149,8 @@ }, "info": { "preferences_note": "Note: preferences are saved in the local storage of your browser. Deleting your browser data will reset them.", - "page_not_found": "Page not found" + "page_not_found": "Page not found", + "copied": "Copied!", + "cannot_copy": "Can't copy!" } } From 26f77e4aec91b6d9a7646afa8f1623a5d14fc5a8 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 28 Aug 2022 16:42:55 +0200 Subject: [PATCH 3/9] improve playlist modal UI --- src/components/PlaylistAddModal.vue | 44 +++++++++++++++-------------- src/components/ShareModal.vue | 28 +++++++++--------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/components/PlaylistAddModal.vue b/src/components/PlaylistAddModal.vue index aeb20921..d61b6235 100644 --- a/src/components/PlaylistAddModal.vue +++ b/src/components/PlaylistAddModal.vue @@ -6,7 +6,7 @@ - From 629303411c09996c4d8712f94d117c492b048309 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:49:31 +0530 Subject: [PATCH 8/9] Add timestamp only if gt 0. --- src/components/ShareModal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ShareModal.vue b/src/components/ShareModal.vue index 1274ee56..47cfb212 100644 --- a/src/components/ShareModal.vue +++ b/src/components/ShareModal.vue @@ -69,7 +69,7 @@ export default { var href = this.pipedLink ? window.location.origin + "/watch?v=" + this.videoId : "https://youtu.be/" + this.videoId; - if (this.withTimeCode && this.timeStamp) href += "?t=" + this.timeStamp; + if (this.withTimeCode && this.timeStamp > 0) href += "?t=" + this.timeStamp; return href; }, }, From 0afe3953a5a46ce633cf4c5801d2683ce8aef11d Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:55:05 +0530 Subject: [PATCH 9/9] Add close button in share modal. --- src/components/ShareModal.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/ShareModal.vue b/src/components/ShareModal.vue index 47cfb212..8ab2422f 100644 --- a/src/components/ShareModal.vue +++ b/src/components/ShareModal.vue @@ -1,6 +1,9 @@