Compare commits
2
Commits
91ff390180
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f8eaca8e1 | ||
|
|
84fa3ee3b4 |
No files matched your search
@@ -0,0 +1,13 @@
|
||||
services:
|
||||
exodus-burg-stett-king-arth-web:
|
||||
image: git.excaliburs-erben.de/exodus/web-king-arth-maintenance:latest
|
||||
|
||||
container_name: web-king-arth-maintenance
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MQTT_TOPIC_ROOT: "outdoor/king-arthur/sword/"
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: proxy_net
|
||||
external: true
|
||||
+13
-40
@@ -3,57 +3,30 @@
|
||||
setup password
|
||||
|
||||
```sh
|
||||
docker exec --user 1883 -it mosquitto mosquitto_passwd /mosquitto/config/passwd nextuser
|
||||
docker exec --user 1883 -it mosquitto mosquitto_passwd /mosquitto/config/passwd exodususer
|
||||
|
||||
|
||||
|
||||
|
||||
docker exec --user 1883 -it mosquitto mosquitto_passwd -c /mosquitto/config/passwd exodususer
|
||||
awesomeexodusoutdooradventures
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
## simple
|
||||
|
||||
```sh
|
||||
mosquitto_sub -h 91.99.29.8 -t outdoor/king-arthur/sword/run
|
||||
```
|
||||
|
||||
## safe
|
||||
mosquitto_pub -h nerdyssey.de -p 8883 -t "outdoor/king-arthur/sword/int" -m "Hello Secure World!" -u "exodususer" -P "awesomeexodusoutdooradventures"
|
||||
|
||||
```sh
|
||||
mosquitto_sub -L mqtts://excaliburs-erben.de:8883/outdoor/king-arthur/sword/run -d
|
||||
mosquitto_sub -L mqtts://excaliburs-erben.de:8883/outdoor/king-arthur/sword/int -d
|
||||
mosquitto_sub -h nerdyssey.de -p 8883 -t "outdoor/king-arthur/sword/int" -u "exodususer" -P "awesomeexodusoutdooradventures" --capath /etc/ssl/certs/ -d
|
||||
```
|
||||
|
||||
mosquitto_pub -L mqtts://excaliburs-erben.de:8883 -t outdoor/king-arthur/sword/run -m "SetMaintanance"
|
||||
|
||||
mosquitto_sub -h mqtts://excaliburs-erben.de:8883 -t "outdoor/king-arthur/sword/int" -u "exodususer" -P "awesomeexodusoutdooradventures"
|
||||
mosquitto_pub -h <your-server-ip-or-proxy> -t "outdoor/king-arthur/sword/int" -m "Hello Secure World!" -u "exodususer" -P "awesomeexodusoutdooradventures"
|
||||
```
|
||||
mosquitto_pub -h excaliburs-erben.de -p 8883 -t "outdoor/king-arthur/sword/int" -m "Hello Secure World!" -u "exodususer" -P "awesomeexodusoutdooradventures"
|
||||
|
||||
mosquitto_sub -h excaliburs-erben.de -p 8883 -t "outdoor/king-arthur/sword/int" -u "exodususer" -P "awesomeexodusoutdooradventures" --capath /etc/ssl/certs/ -d
|
||||
```
|
||||
|
||||
- `+` Single-level wildcard: `t1/+/sub2/sub3`
|
||||
- `#` Multi-level wildcard: `t1/#/sub3`, `t1/#`
|
||||
|
||||
```sh
|
||||
# Publishing topic with message
|
||||
# -h: Host (optional)
|
||||
# -t: Topic
|
||||
# -m: Message
|
||||
# -q: Quality of service
|
||||
# -r: Retain (keep this after failed connection)
|
||||
# -h: Print help info
|
||||
mosquitto_pub -t someTopic -m 123 -q 1
|
||||
mosquitto_pub -r -t someTopic -m "on"
|
||||
mosquitto_pub -h 91.99.29.8 -t someTopic -m 123 -q 1
|
||||
|
||||
# Subscribing to
|
||||
# -h: Host (optional)
|
||||
# -t: Topic s
|
||||
# + is wildcard
|
||||
# # is wildcard for full subtree
|
||||
# -T: Exclude topic
|
||||
# -q: Quality of service
|
||||
mosquitto_sub -t someTopic -q 1
|
||||
mosquitto_sub -t someTopic/+/subTopic
|
||||
mosquitto_sub -t bbc/# -T bbc/radio3
|
||||
mosquitto_sub -h 91.99.29.8 -t someTopic -q 1
|
||||
```
|
||||
|
||||
nc -vz excaliburs-erben.de 8883
|
||||
nc -vz nerdyssey.de 8883
|
||||
+4
-2
@@ -6,8 +6,10 @@ services:
|
||||
# ports:
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
# environment:
|
||||
# - VITE_APP_ENV=production
|
||||
# MQTT topic root: staging default lives in the app; the productive
|
||||
# system strips the staging/ prefix via this environment variable.
|
||||
environment:
|
||||
MQTT_TOPIC_ROOT: "outdoor/king-arthur/sword/"
|
||||
|
||||
networks:
|
||||
default:
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="/config.js"></script>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
// Local development defaults, served by the Vite dev server.
|
||||
// In Docker, server.js serves /config.js dynamically from the
|
||||
// MQTT_TOPIC_ROOT environment variable instead (this copy is shadowed).
|
||||
window.__APP_CONFIG__ = {
|
||||
mqttTopicRoot: 'staging/outdoor/king-arthur/sword/'
|
||||
};
|
||||
@@ -5,6 +5,14 @@ import { fileURLToPath } from 'url';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const app = express();
|
||||
|
||||
// Runtime app configuration, served as window.__APP_CONFIG__.
|
||||
// Must be registered before the static/catch-all routes.
|
||||
const mqttTopicRoot = process.env.MQTT_TOPIC_ROOT || 'staging/outdoor/king-arthur/sword/';
|
||||
app.get('/config.js', (req, res) => {
|
||||
res.type('application/javascript').send(`window.__APP_CONFIG__ = ${JSON.stringify({ mqttTopicRoot })};`);
|
||||
});
|
||||
console.log(`MQTT topic root: ${mqttTopicRoot}`);
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'dist')));
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
|
||||
@@ -2,9 +2,6 @@ import { createRouter, createWebHistory } from 'vue-router'
|
||||
import Home from '../views/Home.vue'
|
||||
import Maintenance from '../views/Maintenance.vue'
|
||||
import Setup from '../views/Setup.vue'
|
||||
import Players from '../views/Players.vue'
|
||||
import Start from '../views/Start.vue'
|
||||
import Text from '../views/Text.vue'
|
||||
|
||||
const routeBase: string = "excaliburs-erben.de/exodus/king-arthur"
|
||||
|
||||
@@ -14,21 +11,6 @@ const routes: any[] = [
|
||||
name: 'Home',
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: '/players',
|
||||
name: 'PlayersDirect',
|
||||
component: Players
|
||||
},
|
||||
{
|
||||
path: '/start',
|
||||
name: 'StartDirect',
|
||||
component: Start
|
||||
},
|
||||
{
|
||||
path: '/text',
|
||||
name: 'TextDirect',
|
||||
component: Text
|
||||
},
|
||||
{
|
||||
path: '/setup',
|
||||
name: 'Setup',
|
||||
@@ -38,24 +20,6 @@ const routes: any[] = [
|
||||
path: '/maintenance',
|
||||
name: 'Maintenance',
|
||||
component: Maintenance,
|
||||
redirect: '/maintenance/players',
|
||||
children: [
|
||||
{
|
||||
path: 'players',
|
||||
name: 'PlayersInMaintenance',
|
||||
component: Players
|
||||
},
|
||||
{
|
||||
path: 'start',
|
||||
name: 'StartInMaintenance',
|
||||
component: Start
|
||||
},
|
||||
{
|
||||
path: 'text',
|
||||
name: 'TextInMaintenance',
|
||||
component: Text
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
interface AppConfig {
|
||||
mqttTopicRoot?: string
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__APP_CONFIG__?: AppConfig
|
||||
}
|
||||
}
|
||||
|
||||
const defaultTopicRoot = 'staging/outdoor/king-arthur/sword/'
|
||||
|
||||
/**
|
||||
* Runtime configuration injected by the server (/config.js -> window.__APP_CONFIG__).
|
||||
* Falls back to the Vite build-time env var, then to the staging default.
|
||||
*/
|
||||
export function getMqttTopicRoot(): string {
|
||||
const configured = window.__APP_CONFIG__?.mqttTopicRoot ?? import.meta.env.VITE_MQTT_TOPIC_ROOT
|
||||
const topicRoot = configured || defaultTopicRoot
|
||||
return topicRoot.endsWith('/') ? topicRoot : topicRoot + '/'
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
import mqtt from 'mqtt'
|
||||
import { getMqttTopicRoot } from './appConfig'
|
||||
|
||||
const mqttBrokerHost = 'mqtt.excaliburs-erben.de'
|
||||
const mqttBrokerPort = 443 // 9001 if not secure
|
||||
const mqttBrokerPath = '/mqtt'
|
||||
const mqttUseTls = true
|
||||
const mqttTopicRoot = 'staging/outdoor/king-arthur/sword/'
|
||||
const mqttTopicRoot = getMqttTopicRoot()
|
||||
const mqttMessage = 'start-hit'
|
||||
const mqttUser = "exodususer";
|
||||
const mqttPassword = "awesomeexodusoutdooradventures";
|
||||
@@ -138,8 +139,8 @@ export function enterMaintananceMode(
|
||||
const verMqttTopic = mqttTopicRoot + 'ver'
|
||||
|
||||
client.on('connect', () => {
|
||||
publishCmd(client, "SetMaintanance")
|
||||
client.subscribe(statMqttTopic, { qos: 1 }, (error) => {
|
||||
publishCmd(client, "setMaintanance")
|
||||
client.subscribe([statMqttTopic, verMqttTopic], { qos: 1 }, (error) => {
|
||||
if (error) {
|
||||
console.error('MQTT subscribe failed:', error)
|
||||
}
|
||||
@@ -166,6 +167,7 @@ export function enterMaintananceMode(
|
||||
}
|
||||
if (topic === verMqttTopic) {
|
||||
const messageStr = message.toString()
|
||||
console.log(messageStr)
|
||||
verCallback(messageStr)
|
||||
}
|
||||
})
|
||||
@@ -175,8 +177,9 @@ export function enterMaintananceMode(
|
||||
|
||||
export function exitMaintananceMode(client: mqtt.MqttClient): void {
|
||||
publishCmd(client, "Exit")
|
||||
const mqttTopic = mqttTopicRoot + 'stat'
|
||||
client.unsubscribe(mqttTopic, (error) => {
|
||||
const statMqttTopic = mqttTopicRoot + 'stat'
|
||||
const verMqttTopic = mqttTopicRoot + 'ver'
|
||||
client.unsubscribe([statMqttTopic, verMqttTopic], (error) => {
|
||||
if (error) {
|
||||
console.error('MQTT unsubscribe failed:', error)
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
export const usePlayersStore = defineStore('players', () => {
|
||||
const players = ref<string[]>([])
|
||||
const currentName = ref<string>('')
|
||||
|
||||
const playersCount = computed(() => players.value.length)
|
||||
|
||||
function loadPlayers(): void {
|
||||
const saved = localStorage.getItem('players')
|
||||
if (!saved) return
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(saved)
|
||||
if (Array.isArray(parsed)) {
|
||||
players.value = parsed.filter((item): item is string => typeof item === 'string' && item.trim().length > 0)
|
||||
}
|
||||
} catch {
|
||||
players.value = []
|
||||
}
|
||||
}
|
||||
|
||||
function savePlayers(): void {
|
||||
localStorage.setItem('players', JSON.stringify(players.value))
|
||||
}
|
||||
|
||||
function addPlayer(name: string): void {
|
||||
const trimmed = name.trim()
|
||||
if (!trimmed) return
|
||||
players.value.push(trimmed)
|
||||
savePlayers()
|
||||
}
|
||||
|
||||
function deletePlayer(index: number): void {
|
||||
players.value.splice(index, 1)
|
||||
savePlayers()
|
||||
}
|
||||
|
||||
function clearAllPlayers(): void {
|
||||
players.value = []
|
||||
savePlayers()
|
||||
}
|
||||
|
||||
function selectRandomPlayer(): void {
|
||||
if (players.value.length === 0) {
|
||||
currentName.value = 'Please add players on page 1 first.'
|
||||
} else {
|
||||
const randomIndex = Math.floor(Math.random() * players.value.length)
|
||||
currentName.value = players.value[randomIndex]
|
||||
}
|
||||
}
|
||||
|
||||
function setCurrentName(name: string): void {
|
||||
currentName.value = name
|
||||
}
|
||||
|
||||
loadPlayers()
|
||||
|
||||
return {
|
||||
players,
|
||||
currentName,
|
||||
playersCount,
|
||||
addPlayer,
|
||||
deletePlayer,
|
||||
clearAllPlayers,
|
||||
selectRandomPlayer,
|
||||
setCurrentName
|
||||
}
|
||||
})
|
||||
+84
-7
@@ -216,13 +216,6 @@ button {
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.players-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.btn-primary,
|
||||
.btn-secondary {
|
||||
padding: 10px 16px;
|
||||
@@ -251,3 +244,87 @@ button {
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
|
||||
.status-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.status-frame {
|
||||
border: 2px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
background: #f9fafb;
|
||||
margin-bottom: 16px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.setup-frame {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
.control-buttons {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.status-value {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.status-label {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
background: #e5e7eb;
|
||||
color: #6b7280;
|
||||
transition: background 0.3s, color 0.3s;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-item.active {
|
||||
background: #10b981;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.slider-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.slider-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.slider-label {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.slider-value {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.slider-input {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -2,26 +2,12 @@
|
||||
<main class="app">
|
||||
<nav class="nav">
|
||||
<router-link to="/" class="nav-link">Home</router-link>
|
||||
<router-link to="/players" class="nav-link" :class="{ active: route.path === '/players' }">
|
||||
Page 1: Players</router-link>
|
||||
<router-link to="/start" class="nav-link" :class="{ active: route.path === '/start' }">
|
||||
Page 2: Start</router-link>
|
||||
<router-link to="/text" class="nav-link" :class="{ active: route.path === '/text' }">
|
||||
Page 3: Text</router-link>
|
||||
</nav>
|
||||
<section class="page-content">
|
||||
<Players v-if="route.path === '/players'" />
|
||||
<Start v-else-if="route.path === '/start'" />
|
||||
<Text v-else-if="route.path === '/text'" />
|
||||
</section>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router'
|
||||
import Players from './Players.vue'
|
||||
import Start from './Start.vue'
|
||||
import Text from './Text.vue'
|
||||
|
||||
const route = useRoute()
|
||||
</script>
|
||||
+1
-9
@@ -7,7 +7,7 @@
|
||||
<div class="info-section">
|
||||
<div class="info-box">
|
||||
<h3>Version</h3>
|
||||
<p id="version-number">0.8.0</p>
|
||||
<p id="version-number">1.0.0</p>
|
||||
</div>
|
||||
<div class="info-box">
|
||||
<h3>Service Hotline</h3>
|
||||
@@ -27,14 +27,6 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-container">
|
||||
<span class="status-label">Game</span>
|
||||
<div class="status-frame setup-frame">
|
||||
<router-link to="/players" class="nav-button">Players</router-link>
|
||||
<router-link to="/start" class="nav-button">Start</router-link>
|
||||
<router-link to="/text" class="nav-button">Text</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
+8
-137
@@ -28,8 +28,8 @@
|
||||
<h3>Outputs</h3>
|
||||
<div class="status-frame">
|
||||
<div class="control-buttons">
|
||||
<button @click="handleLock" class="btn-lock">Lock</button>
|
||||
<button @click="handleUnlock" class="btn-unlock">Unlock</button>
|
||||
<button @click="handleLock" class="btn-primary">Lock</button>
|
||||
<button @click="handleUnlock" class="btn-secondary">Unlock</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -42,17 +42,17 @@
|
||||
</div>
|
||||
<div class="status-frame">
|
||||
<div class="control-buttons">
|
||||
<button @click="handleMute" class="btn-lock">Mute</button>
|
||||
<button @click="handleUnMute" class="btn-unlock">Un-Mute</button>
|
||||
<button @click="handleMute" class="btn-primary">Mute</button>
|
||||
<button @click="handleUnMute" class="btn-secondary">Un-Mute</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Sounds</h3>
|
||||
<div class="status-frame">
|
||||
<div class="control-buttons">
|
||||
<button @click="handlePlayX(1)" class="btn-unlock">Play sound 1</button>
|
||||
<button @click="handlePlayX(2)" class="btn-unlock">Play sound 2</button>
|
||||
<button @click="handlePlayX(3)" class="btn-unlock">Play sound 3</button>
|
||||
<button @click="handlePlayX(1)" class="btn-secondary">Play sound 1</button>
|
||||
<button @click="handlePlayX(2)" class="btn-secondary">Play sound 2</button>
|
||||
<button @click="handlePlayX(3)" class="btn-secondary">Play sound 3</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -86,19 +86,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Game Views</h2>
|
||||
<nav class="nav">
|
||||
<router-link to="/maintenance/players" class="nav-link" :class="{ active: isActive('/maintenance/players') }">Page
|
||||
1: Players</router-link>
|
||||
<router-link to="/maintenance/start" class="nav-link" :class="{ active: isActive('/maintenance/start') }">Page 2:
|
||||
Start</router-link>
|
||||
<router-link to="/maintenance/text" class="nav-link" :class="{ active: isActive('/maintenance/text') }">Page 3:
|
||||
Text</router-link>
|
||||
</nav>
|
||||
<section class="page-content">
|
||||
<router-view></router-view>
|
||||
</section>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
@@ -203,120 +190,4 @@ onUnmounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.status-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.status-frame {
|
||||
border: 2px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
background: #f9fafb;
|
||||
margin-bottom: 16px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.setup-frame {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.slider-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.slider-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.slider-label {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.slider-value {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.slider-input {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
background: #e5e7eb;
|
||||
color: #6b7280;
|
||||
transition: background 0.3s, color 0.3s;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-item.active {
|
||||
background: #10b981;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.status-label {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.status-value {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.control-buttons {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.btn-lock,
|
||||
.btn-unlock {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
.btn-lock {
|
||||
background: #111827;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-lock:hover {
|
||||
background: #1f2937;
|
||||
}
|
||||
|
||||
.btn-unlock {
|
||||
background: #e5e7eb;
|
||||
color: #111827;
|
||||
border: 1px solid #d1d5db;
|
||||
}
|
||||
|
||||
.btn-unlock:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
</style>
|
||||
<style scoped></style>
|
||||
@@ -1,51 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>Add players</h2>
|
||||
<div class="row">
|
||||
<input v-model="playerInput" type="text" placeholder="Enter player name" @keydown.enter="addPlayer" />
|
||||
<button @click="addPlayer" type="button">Add</button>
|
||||
</div>
|
||||
<ul class="player-list">
|
||||
<li v-for="(player, index) in playersStore.players" :key="index" class="player-item">
|
||||
<span class="player-name">{{ player }}</span>
|
||||
<button class="delete-btn" @click="deletePlayer(index)" title="Delete player">
|
||||
<svg class="trash-icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-9l-1 1H5v2h14V4z"
|
||||
fill="currentColor" />
|
||||
</svg>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="players-actions">
|
||||
<button @click="clearAll" type="button" class="btn-secondary">Clear All</button>
|
||||
<button @click="finished" type="button" class="btn-primary">Finished</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { usePlayersStore } from '../stores/players'
|
||||
|
||||
const playerInput = ref<string>('')
|
||||
const playersStore = usePlayersStore()
|
||||
|
||||
function addPlayer(): void {
|
||||
playersStore.addPlayer(playerInput.value)
|
||||
playerInput.value = ''
|
||||
}
|
||||
|
||||
function deletePlayer(index: number): void {
|
||||
playersStore.deletePlayer(index)
|
||||
}
|
||||
|
||||
function clearAll(): void {
|
||||
if (confirm('Are you sure you want to delete all players?')) {
|
||||
playersStore.clearAllPlayers()
|
||||
}
|
||||
}
|
||||
|
||||
function finished(): void {
|
||||
router.push('/start')
|
||||
}
|
||||
</script>
|
||||
+3
-117
@@ -33,8 +33,8 @@
|
||||
</div>
|
||||
<div class="status-frame">
|
||||
<div class="control-buttons">
|
||||
<button @click="handleMute" class="btn-lock">Mute</button>
|
||||
<button @click="handleUnMute" class="btn-unlock">Un-Mute</button>
|
||||
<button @click="handleMute" class="btn-primary">Mute</button>
|
||||
<button @click="handleUnMute" class="btn-secondary">Un-Mute</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -126,7 +126,7 @@ onMounted(() => {
|
||||
volume.value = vol
|
||||
promoDelay.value = delay
|
||||
},
|
||||
(ver) => {})
|
||||
(ver) => { })
|
||||
window.addEventListener('beforeunload', cleanup)
|
||||
if (mqttClient) {
|
||||
publishCmd(mqttClient, `promoDelay:${promoDelay.value}`)
|
||||
@@ -141,119 +141,5 @@ onUnmounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.status-container {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.status-frame {
|
||||
border: 2px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
background: #f9fafb;
|
||||
margin-bottom: 16px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.setup-frame {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.slider-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.slider-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.slider-label {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.slider-value {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.slider-input {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
background: #e5e7eb;
|
||||
color: #6b7280;
|
||||
transition: background 0.3s, color 0.3s;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-item.active {
|
||||
background: #10b981;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.status-label {
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.status-value {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.control-buttons {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.btn-lock,
|
||||
.btn-unlock {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
.btn-lock {
|
||||
background: #111827;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-lock:hover {
|
||||
background: #1f2937;
|
||||
}
|
||||
|
||||
.btn-unlock {
|
||||
background: #e5e7eb;
|
||||
color: #111827;
|
||||
border: 1px solid #d1d5db;
|
||||
}
|
||||
|
||||
.btn-unlock:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
</style>
|
||||
@@ -1,19 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>Start</h2>
|
||||
<button @click="startGame" id="start-btn" type="button">Start</button>
|
||||
<p id="selected-name">{{ playersStore.currentName || 'No name selected yet' }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { usePlayersStore } from '../stores/players'
|
||||
import { publishStartHit } from '../services/mqtt'
|
||||
|
||||
const playersStore = usePlayersStore()
|
||||
|
||||
function startGame(): void {
|
||||
publishStartHit()
|
||||
playersStore.selectRandomPlayer()
|
||||
}
|
||||
</script>
|
||||
@@ -1,9 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>Some text</h2>
|
||||
<p>This is the third page with static text.</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
Reference in new issue
Block a user