Skip to content

Commit

Permalink
added settings
Browse files Browse the repository at this point in the history
  • Loading branch information
samdems committed May 1, 2024
1 parent 8b8930f commit 16b3cde
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/GameSettings.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<template>
<button class="btn" onclick="settingsModal.showModal()">show invite</button>
<button class="btn" onclick="settingsModal.showModal()">settings</button>
<dialog id="settingsModal" class="modal">
<div class="modal-box">
<div class="p-2 flex flex-col justify-center items-center">
<h2 class="text-2xl">Game Settings</h2>
<div class="p-2">
<input class="input input-bordered" v-model="hash"> <button class="btn btn-primary" @click="join">Set Game</button>
</div>
<p>Scan the QR code to join the game</p>
<qrcode-vue :value="value" :size="200" level="H" class="m-4 p-2 bg-white" />
<p class="text-xs">{{value}}</p>
Expand All @@ -19,6 +23,13 @@

<script setup lang="ts">
import QrcodeVue from 'qrcode.vue';
import { ref } from 'vue';
const hash = ref(window.location.hash.substring(1));
const value = window.location.href.replace('http://','');
const join = () => {
window.location.hash = hash.value;
window.location.reload();
}
</script>

0 comments on commit 16b3cde

Please sign in to comment.