Fix: Entry not forwarded correctly in kiosk mode

This commit is contained in:
Christoph Stahl 2024-10-11 00:56:32 +02:00
parent 47c2b9337d
commit ebd8d1c6e0
2 changed files with 12 additions and 11 deletions

View file

@ -106,14 +106,14 @@ function checked_append_with_name(entry, name) {
} }
} }
function append_anyway(ident, name, source, uid) { function append_anyway(entry) {
$("#getusername").foundation("close"); $("#getusername").foundation("close");
$("#alreadyqueued").foundation("close"); $("#alreadyqueued").foundation("close");
state.value.current_name = null; state.value.current_name = null;
state.value.current_entry = null; state.value.current_entry = null;
state.value.double_entry = {'artist': null, 'title': null, 'reason': null}; state.value.double_entry = {'artist': null, 'title': null, 'reason': null};
state.socket.emit("append-anyway", {"ident": ident, "performer": name, "source": source, "uid": uid }); state.socket.emit("append-anyway", {"ident": entry.ident, "performer": entry.performer, "source": entry.source, "uid": null });
$("#queue-tab-title").click(); $("#queue-tab-title").click();
} }
@ -128,13 +128,14 @@ function raw_append(ident, name, source, uid) {
$("#queue-tab-title").click(); $("#queue-tab-title").click();
} }
function wait_append(ident, name, source, uid) { function wait_append(entry) {
$("#getusername").foundation("close"); $("#getusername").foundation("close");
$("#alreadyqueued").foundation("close"); $("#alreadyqueued").foundation("close");
console.log(entry)
state.socket.emit("waiting-room-append", {"ident": entry.ident, "performer": entry.performer, "source": entry.source, "uid": null });
state.value.current_name = null; state.value.current_name = null;
state.value.current_entry = null; state.value.current_entry = null;
state.socket.emit("waiting-room-append", {"ident": ident, "performer": name, "source": source, "uid": uid });
$("#queue-tab-title").click(); $("#queue-tab-title").click();
} }
@ -321,11 +322,12 @@ function joinRoom() {
@close_name="close_name" @close_name="close_name"
/> />
<AlreadyQueued <AlreadyQueued
@append="append_anyway(state.current_entry.ident, state.name ? state.name : state.current_name, state.current_entry.source, state.uid)" @append="append_anyway"
@wait="(uid) => wait_append(state.current_entry.ident, state.name ? state.name : state.current_name, state.current_entry.source, null)" @wait="wait_append"
@cancel="close_already_queued" @cancel="close_already_queued"
:waiting_room_policy="state.waiting_room_policy" :waiting_room_policy="state.waiting_room_policy"
:double_entry="state.double_entry" :double_entry="state.double_entry"
:current_entry="state.current_entry"
/> />
<div class="reveal" id="msg" data-reveal> <div class="reveal" id="msg" data-reveal>
{{ state.last_msg }} {{ state.last_msg }}

View file

@ -1,6 +1,6 @@
<script setup> <script setup>
const emits = defineEmits(["append", "wait", "cancel"]); const emits = defineEmits(["append", "wait", "cancel"]);
const props = defineProps(["double_entry", "waiting_room_policy"]); const props = defineProps(["double_entry", "current_entry", "waiting_room_policy"]);
</script> </script>
<template> <template>
<div class="reveal" id="alreadyqueued" data-reveal > <div class="reveal" id="alreadyqueued" data-reveal >
@ -10,21 +10,20 @@ const props = defineProps(["double_entry", "waiting_room_policy"]);
</p> </p>
<p>To give everyone a chance to sing, you are limited to one song in the active queue, but you can add yourself to the <b>waiting room</b>. <p>To give everyone a chance to sing, you are limited to one song in the active queue, but you can add yourself to the <b>waiting room</b>.
Songs in the waiting room will be added to the queue, once your old song leaves the queue.</p> Songs in the waiting room will be added to the queue, once your old song leaves the queue.</p>
<p>If you think this is an error, you can <p>If you think this is an error, you can</p>
<ul> <ul>
<li>choose another name, or</li> <li>choose another name, or</li>
<li>add it to the waiting room and talk to the organizers for manual insertion into the queue.</li> <li>add it to the waiting room and talk to the organizers for manual insertion into the queue.</li>
</ul> </ul>
</p>
<div class="grid-x"> <div class="grid-x">
<div class="cell medium-6 small-12 btn"> <div class="cell medium-6 small-12 btn">
<button class="button expanded" @click="$emit('wait', double_entry.reason == 'uid' ? double_entry.uid : null)">Add to waiting room</button> <button class="button expanded" @click="$emit('wait', current_entry)">Add to waiting room</button>
</div> </div>
<div class="cell medium-6 small-12 btn"> <div class="cell medium-6 small-12 btn">
<button class="button expanded alert" @click="$emit('cancel')">Cancel</button> <button class="button expanded alert" @click="$emit('cancel')">Cancel</button>
</div> </div>
<div v-show="waiting_room_policy && waiting_room_policy.toLowerCase() == 'optional'" class="cell medium-12 small-12 btn"> <div v-show="waiting_room_policy && waiting_room_policy.toLowerCase() == 'optional'" class="cell medium-12 small-12 btn">
<button class="button expanded" @click="$emit('append')">Append Anyway</button> <button class="button expanded" @click="$emit('append', current_entry)">Append Anyway</button>
</div> </div>
</div> </div>
</div> </div>