From 596f2b1baa71c503278752f91116d565ec250880 Mon Sep 17 00:00:00 2001 From: Christoph Stahl Date: Fri, 25 Nov 2022 15:54:36 +0100 Subject: [PATCH] able to select new username on each append --- src/App.vue | 20 ++++++++++++++++---- src/components/WelcomeReveal.vue | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/App.vue b/src/App.vue index 98239fd..84c7b39 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,7 +20,9 @@ const state = ref({ 'socket': undefined, 'is_small': window.innerWidth < 768, 'admin': false, - 'secret': undefined + 'secret': undefined, + 'current_entry': undefined, + 'current_name': undefined, }) onMounted(() => { @@ -31,6 +33,7 @@ onMounted(() => { function setRoomCode(room) { state.value.room = room } function setSecret(secret) { state.value.secret = secret } function setName(name) { state.value.name = name } +function setCurrentName(name) { state.value.current_name = name } function updateName(evt) { evt.target.textContent = state.value.name;} function setServer(server) { state.value.server = server } function setSearchTerm(searchTerm) { state.value.search.searchTerm = searchTerm } @@ -42,9 +45,13 @@ function search() { function append(entry) {_append(entry, state.value.name) } function _append(entry, name) { if(name == "" || name == undefined) { + state.value.current_entry = entry $("#getusername").foundation("open") } else { - state.socket.emit("append", {"id": entry.id, "performer": state.value.name, "source": entry.source }) + $("#getusername").foundation("close") + state.value.current_entry = undefined + state.value.current_name = undefined + state.socket.emit("append", {"id": entry.id, "performer": name, "source": entry.source }) } } @@ -94,8 +101,13 @@ function joinRoom() { -
- Test123 +
+

Please enter your name

+ + +