Added Waiting room by name
This commit is contained in:
parent
d939e14c40
commit
a4e117df66
2 changed files with 38 additions and 10 deletions
32
src/App.vue
32
src/App.vue
|
@ -30,7 +30,8 @@ const state = ref({
|
|||
'searching': false,
|
||||
'last_msg': "",
|
||||
'join_msg': null,
|
||||
'uid': null
|
||||
'uid': null,
|
||||
'double_entry': {'artist': null, 'title': null, 'reason': null}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -87,14 +88,31 @@ function checked_append_with_name(entry, name) {
|
|||
} else {
|
||||
$("#getusername").foundation("close");
|
||||
|
||||
var in_queue = false;
|
||||
var splitUserName = name.toLowerCase().split(/\b/).filter(e => e.trim().length > 3);
|
||||
var uid_in_queue = false;
|
||||
var name_in_queue = false;
|
||||
for (const entry of state.value.queue) {
|
||||
if(entry.uid == state.value.uid) {
|
||||
in_queue = true;
|
||||
if(entry.uid == state.value.uid && !state.value.admin) {
|
||||
state.value.double_entry = entry;
|
||||
state.value.double_entry.reason = "uid";
|
||||
uid_in_queue = true;
|
||||
break;
|
||||
}
|
||||
|
||||
var splitEntryUserName = entry.performer.toLowerCase().split(/\b/).filter(e => e.trim().length > 3);
|
||||
var difference = splitUserName.filter(x => splitEntryUserName.includes(x));
|
||||
console.log(splitUserName);
|
||||
console.log(splitEntryUserName);
|
||||
console.log(difference);
|
||||
if (difference.length > 0) {
|
||||
state.value.double_entry = entry;
|
||||
state.value.double_entry.reason = "name";
|
||||
name_in_queue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(in_queue && !state.value.admin) {
|
||||
if(name_in_queue || uid_in_queue) {
|
||||
state.value.current_entry = entry;
|
||||
$("#alreadyqueued").foundation("open");
|
||||
} else {
|
||||
|
@ -109,6 +127,7 @@ function raw_append(ident, name, source, uid) {
|
|||
|
||||
state.value.current_name = null;
|
||||
state.value.current_entry = null;
|
||||
state.value.double_entry = {'artist': null, 'title': null, 'reason': null};
|
||||
state.socket.emit("append", {"ident": ident, "performer": name, "source": source, "uid": uid });
|
||||
$("#queue-tab-title").click();
|
||||
}
|
||||
|
@ -259,8 +278,9 @@ function joinRoom() {
|
|||
/>
|
||||
<AlreadyQueued
|
||||
@append="raw_append(state.current_entry.ident, state.name ? state.name : state.current_name, state.current_entry.source, state.uid)"
|
||||
@wait="wait_append(state.current_entry.ident, state.name ? state.name : state.current_name, state.current_entry.source, state.uid)"
|
||||
@wait="(uid) => wait_append(state.current_entry.ident, state.name ? state.name : state.current_name, state.current_entry.source, uid)"
|
||||
@cancel="close_already_queued"
|
||||
:double_entry="state.double_entry"
|
||||
/>
|
||||
<div class="reveal" id="msg" data-reveal>
|
||||
{{ state.last_msg }}
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
<script setup>
|
||||
const emits = defineEmits(["append", "wait", "cancel"])
|
||||
const emits = defineEmits(["append", "wait", "cancel"]);
|
||||
const props = defineProps(["double_entry"]);
|
||||
</script>
|
||||
<template>
|
||||
<div class="reveal" id="alreadyqueued" data-reveal >
|
||||
<h1>You are already in queue</h1>
|
||||
<p>While you can append the song anyway, you can also add it to the <i>waiting room</i>.</p>
|
||||
<p>It will be appended to the queue as soon, as your next song leaves the queue.</p>
|
||||
<p>You can
|
||||
<ul>
|
||||
<li>append the song anyway, or</li>
|
||||
<li>add it to the <i>waiting room</i>.</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>Your song in the waiting room will be added to the queue, once
|
||||
<b>{{double_entry.artist}} - {{double_entry.title}}</b> <i>({{double_entry.performer}})</i>
|
||||
leaves the queue.</p>
|
||||
<div class="grid-x">
|
||||
<div class="cell medium-6 small-12 btn">
|
||||
<button class="button expanded" @click="$emit('wait')">Waiting room</button>
|
||||
<button class="button expanded" @click="$emit('wait', double_entry.reason == 'uid' ? double_entry.uid : null)">Waiting room</button>
|
||||
</div>
|
||||
<div class="cell medium-6 small-12 btn">
|
||||
<button class="button expanded" @click="$emit('append')">Append anyway</button>
|
||||
|
|
Loading…
Add table
Reference in a new issue