finisch sharing functionality
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Artem Anufrij
2023-02-16 23:59:01 +01:00
parent efef863e66
commit 4d4fb4b4e9
13 changed files with 567 additions and 110 deletions

View File

@@ -40,7 +40,13 @@
<button v-if="!selectedAlbum.share._id" @click="shareEnable">
<awesome-icon icon="share" />Share this album
</button>
<button v-else @click="shareDisable">
<button
v-if="selectedAlbum.share._id"
@click="addShareUrlToClipboard"
>
<awesome-icon icon="clipboard" />Copy url into clipboard
</button>
<button v-if="selectedAlbum.share._id" @click="shareDisable">
<awesome-icon icon="share" />Remove share
</button>
</div>
@@ -110,6 +116,11 @@ export default {
};
},
methods: {
addShareUrlToClipboard() {
let url =
window.location.origin + "/#/share?id=" + this.selectedAlbum.share._id;
navigator.clipboard.writeText(url);
},
dblclick() {
this.$store.commit("tracks/resetSelectedTrack");
this.$store.commit("radios/resetSelectedRadio");
@@ -208,7 +219,11 @@ export default {
this.$store.dispatch("albums/selectAlbum", album);
},
shareEnable() {
this.$store.dispatch("albums/shareEnable", this.selectedAlbum);
this.$store
.dispatch("albums/shareEnable", this.selectedAlbum)
.then(() => {
this.addShareUrlToClipboard();
});
},
shareDisable() {
this.$store.dispatch("albums/shareDisable", this.selectedAlbum);
@@ -342,7 +357,7 @@ export default {
border-top: 1px solid #ffffff20;
border-bottom: 1px solid #00000020;
}
#stats button {
.dropdown-activator button {
width: 32px;
height: 32px;
}

View File

@@ -41,7 +41,13 @@
<button v-if="!selectedBox.share._id" @click="shareEnable">
<awesome-icon icon="share" />Share this box
</button>
<button v-else @click="shareDisable">
<button
v-if="selectedBox.share._id"
@click="addShareUrlToClipboard"
>
<awesome-icon icon="clipboard" />Copy url into clipboard
</button>
<button v-if="selectedBox.share._id" @click="shareDisable">
<awesome-icon icon="share" />Remove share
</button>
</div>
@@ -95,6 +101,11 @@ import { mapGetters } from "vuex";
export default {
methods: {
addShareUrlToClipboard() {
let url =
window.location.origin + "/#/share?id=" + this.selectedBox.share._id;
navigator.clipboard.writeText(url);
},
dblclick() {
this.$store.commit("tracks/resetSelectedTrack");
this.$store.commit("radios/resetSelectedRadio");
@@ -174,7 +185,9 @@ export default {
this.$store.dispatch("boxes/resetCover", this.selectedBox);
},
shareEnable() {
this.$store.dispatch("boxes/shareEnable", this.selectedBox);
this.$store.dispatch("boxes/shareEnable", this.selectedBox).then(() => {
this.addShareUrlToClipboard();
});
},
shareDisable() {
this.$store.dispatch("boxes/shareDisable", this.selectedBox);
@@ -274,7 +287,7 @@ export default {
border-top: 1px solid #ffffff20;
border-bottom: 1px solid #00000020;
}
#stats button {
.dropdown-activator button {
width: 32px;
height: 32px;
}

View File

@@ -89,6 +89,9 @@ export default {
this.$store.dispatch("videos/playNextTo", this.selectedVideo);
},
pushHistoryItem() {
if (!this.currentUser._id) {
return;
}
let item = {
id: this.selectedVideo.parent._id,
type: "box",
@@ -154,6 +157,9 @@ export default {
},
},
computed: {
currentUser() {
return this.$store.getters["user/user"];
},
selectedVideo() {
return this.$store.getters["videos/selectedVideo"];
},