🔨 Add music add

This commit is contained in:
SebClem 2022-06-24 17:59:32 +02:00
parent 65684c2317
commit 798617bf89
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
2 changed files with 36 additions and 25 deletions

View File

@ -40,7 +40,9 @@ eventQueuStore.$subscribe((mutation, state) => {
let event = eventQueuStore.shift(); let event = eventQueuStore.shift();
if (event?.uuid) { if (event?.uuid) {
if ( if (
snacks.value.filter((value) => value.text == event?.text).length == 0 snacks.value.filter(
(value) => event?.type == "error" && value.text == event?.text
).length == 0
) { ) {
snacks.value.push({ snacks.value.push({
snack: true, snack: true,

View File

@ -145,7 +145,7 @@
</v-row> </v-row>
<v-row class="mt-2 px-lg-6 px-0"> <v-row class="mt-2 px-lg-6 px-0">
<v-col class="d-flex justify-start"> <v-col class="d-flex justify-start">
<v-menu :close-on-content-click="false"> <v-menu :close-on-content-click="false" v-model="urlPopup">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn <v-btn
icon="mdi-plus" icon="mdi-plus"
@ -156,8 +156,9 @@
v-bind="props" v-bind="props"
></v-btn> ></v-btn>
</template> </template>
<v-card min-width="300" v-model="urlPopup"> <v-card min-width="300">
<v-card-content> <v-card-content>
<v-form @submit.prevent="add">
<v-text-field <v-text-field
v-model="url" v-model="url"
density="compact" density="compact"
@ -180,6 +181,7 @@
</v-icon> </v-icon>
</template> </template>
</v-text-field> </v-text-field>
</v-form>
</v-card-content> </v-card-content>
</v-card> </v-card>
</v-menu> </v-menu>
@ -287,6 +289,7 @@ import type { Guild } from "@/data/guild/Guild";
import type { Status } from "@/data/music/Status"; import type { Status } from "@/data/music/Status";
import * as audioService from "@/services/audioService"; import * as audioService from "@/services/audioService";
import { getVoiceChannels } from "@/services/guildService"; import { getVoiceChannels } from "@/services/guildService";
import { useEventQueuStore } from "@/stores/eventQueu";
import { computed } from "@vue/reactivity"; import { computed } from "@vue/reactivity";
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { onBeforeRouteLeave, onBeforeRouteUpdate } from "vue-router"; import { onBeforeRouteLeave, onBeforeRouteUpdate } from "vue-router";
@ -470,6 +473,12 @@ function add() {
urlLoading.value = false; urlLoading.value = false;
urlPopup.value = false; urlPopup.value = false;
url.value = ""; url.value = "";
const eventQueuStore = useEventQueuStore();
eventQueuStore.push({
uuid: undefined,
type: "success",
text: "Track added to playlist !",
});
}) })
.catch(() => { .catch(() => {
urlLoading.value = false; urlLoading.value = false;