🔨 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();
if (event?.uuid) {
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({
snack: true,

View File

@ -145,7 +145,7 @@
</v-row>
<v-row class="mt-2 px-lg-6 px-0">
<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 }">
<v-btn
icon="mdi-plus"
@ -156,30 +156,32 @@
v-bind="props"
></v-btn>
</template>
<v-card min-width="300" v-model="urlPopup">
<v-card min-width="300">
<v-card-content>
<v-text-field
v-model="url"
density="compact"
variant="outlined"
label="Url"
hide-details="auto"
color="primary"
autofocus
:loading="urlLoading"
:disabled="urlLoading"
>
<template v-slot:append>
<v-icon
@click="add"
color="primary"
:style="urlLoading ? '' : 'opacity: 1'"
:disabled="urlLoading"
>
mdi-plus-circle
</v-icon>
</template>
</v-text-field>
<v-form @submit.prevent="add">
<v-text-field
v-model="url"
density="compact"
variant="outlined"
label="Url"
hide-details="auto"
color="primary"
autofocus
:loading="urlLoading"
:disabled="urlLoading"
>
<template v-slot:append>
<v-icon
@click="add"
color="primary"
:style="urlLoading ? '' : 'opacity: 1'"
:disabled="urlLoading"
>
mdi-plus-circle
</v-icon>
</template>
</v-text-field>
</v-form>
</v-card-content>
</v-card>
</v-menu>
@ -287,6 +289,7 @@ import type { Guild } from "@/data/guild/Guild";
import type { Status } from "@/data/music/Status";
import * as audioService from "@/services/audioService";
import { getVoiceChannels } from "@/services/guildService";
import { useEventQueuStore } from "@/stores/eventQueu";
import { computed } from "@vue/reactivity";
import { ref, watch } from "vue";
import { onBeforeRouteLeave, onBeforeRouteUpdate } from "vue-router";
@ -470,6 +473,12 @@ function add() {
urlLoading.value = false;
urlPopup.value = false;
url.value = "";
const eventQueuStore = useEventQueuStore();
eventQueuStore.push({
uuid: undefined,
type: "success",
text: "Track added to playlist !",
});
})
.catch(() => {
urlLoading.value = false;