433 lines
No EOL
7.8 KiB
HTML
433 lines
No EOL
7.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>CGE Poll Manager</title>
|
|
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js" async></script>
|
|
<style>
|
|
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
|
|
|
|
html, body {
|
|
background: #2c2f32;
|
|
color: white;
|
|
font-family: 'Roboto', sans-serif;
|
|
}
|
|
|
|
div#app {
|
|
display: flex;
|
|
}
|
|
|
|
div#past-polls {
|
|
flex-grow: 1
|
|
}
|
|
|
|
div#poll-creator {
|
|
flex-grow: 2;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
div.poll-data {
|
|
margin: 5px;
|
|
padding: 10px;
|
|
background: #202225;
|
|
border-radius: 7px;
|
|
flex-grow: 1;
|
|
border-width: 2px;
|
|
border-style: solid;
|
|
border-color: transparent;
|
|
}
|
|
|
|
.poll-data > h4 {
|
|
margin: 0;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.poll-data.important {
|
|
border-color: red;
|
|
}
|
|
</style>
|
|
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
|
|
</head>
|
|
<body>
|
|
<h2>CGE Poll Quick-Creator</h2>
|
|
<hr>
|
|
<div id="app">
|
|
<div id="past-polls">
|
|
<h2>Previous Polls</h2>
|
|
<button
|
|
@click.stop="get_past_polls"
|
|
>
|
|
Test Poll Fetch
|
|
</button>
|
|
<div
|
|
v-for="poll in pastPolls"
|
|
:key="poll.id"
|
|
>
|
|
<h4>{{poll.title}}</h4>
|
|
Winner: {{poll.winner.title}}
|
|
</div>
|
|
</div>
|
|
<div id="poll-creator">
|
|
<div
|
|
v-for="poll in polls"
|
|
class="poll-data"
|
|
:class="poll.important ? 'important' : ''"
|
|
>
|
|
<h4>{{poll.name}}</h4>
|
|
<p>
|
|
Duration: {{poll.data.duration}} seconds
|
|
<br>
|
|
Choices:
|
|
</p>
|
|
<ul>
|
|
<li v-for="choice in poll.data.choices">
|
|
{{choice.title}}
|
|
</li>
|
|
</ul>
|
|
<button
|
|
@click.stop="start_poll(poll.data)"
|
|
>
|
|
Start Poll
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script>
|
|
let app = new Vue({
|
|
el: "#app",
|
|
methods: {
|
|
async get_past_polls() {
|
|
try {
|
|
let r = await axios.get("/polls/twitch/czechgamesedition/poll");
|
|
this.allPolls = r.data;
|
|
} catch (err) {
|
|
console.error(err);
|
|
};
|
|
},
|
|
async start_poll(poll_data) {
|
|
try {
|
|
await axios.post("/polls/twitch/czechgamesedition/poll", poll_data);
|
|
let qs = new URLSearchParams(window.location.search);
|
|
if (!qs.has("no_alert")) {
|
|
alert("Poll should've been created successfully.");
|
|
};
|
|
} catch (err) {
|
|
console.error(err);
|
|
alert("Something went wrong starting the poll, check to see if one is made already.");
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
pastPolls() {
|
|
return this.allPolls
|
|
.filter(p => [`completed`, `terminated`, `invalid`].includes(p.status))
|
|
.map(p => {
|
|
return {
|
|
id: p.id,
|
|
winner: p.choices.sort((a, b) => a.votes > b.votes)[0],
|
|
title: p.title,
|
|
status: p.status,
|
|
};
|
|
});
|
|
},
|
|
},
|
|
mounted() {
|
|
this.get_past_polls();
|
|
// this.previous_poll_interval = setInterval(this.get_past_polls, 5_000);
|
|
},
|
|
data: {
|
|
allPolls: [],
|
|
polls: [
|
|
{
|
|
name: "Wavelength Region Choice (FIRST POLL)",
|
|
important: true,
|
|
data: {
|
|
title: "Which Region?",
|
|
choices: [
|
|
{
|
|
title: "1"
|
|
},
|
|
{
|
|
title: "2"
|
|
},
|
|
{
|
|
title: "3"
|
|
},
|
|
{
|
|
title: "4"
|
|
},
|
|
],
|
|
duration: 45,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Section Choice (NO TIE)",
|
|
important: true,
|
|
data: {
|
|
title: "Which Section?",
|
|
choices: [
|
|
{
|
|
title: "A"
|
|
},
|
|
{
|
|
title: "B"
|
|
},
|
|
],
|
|
duration: 45,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Section Choice (12 TIE)",
|
|
data: {
|
|
title: "Which Section?",
|
|
choices: [
|
|
{
|
|
title: "1A"
|
|
},
|
|
{
|
|
title: "1B"
|
|
},
|
|
{
|
|
title: "2A"
|
|
},
|
|
{
|
|
title: "2B"
|
|
},
|
|
],
|
|
duration: 45,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Section Choice (23 TIE)",
|
|
data: {
|
|
title: "Which Section?",
|
|
choices: [
|
|
{
|
|
title: "2A"
|
|
},
|
|
{
|
|
title: "2B"
|
|
},
|
|
{
|
|
title: "3A"
|
|
},
|
|
{
|
|
title: "3B"
|
|
},
|
|
],
|
|
duration: 45,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Section Choice (34 TIE)",
|
|
data: {
|
|
title: "Which Section?",
|
|
choices: [
|
|
{
|
|
title: "3A"
|
|
},
|
|
{
|
|
title: "3B"
|
|
},
|
|
{
|
|
title: "4A"
|
|
},
|
|
{
|
|
title: "4B"
|
|
},
|
|
],
|
|
duration: 45,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Section Choice (13 TIE)",
|
|
data: {
|
|
title: "Which Section?",
|
|
choices: [
|
|
{
|
|
title: "1A"
|
|
},
|
|
{
|
|
title: "1B"
|
|
},
|
|
{
|
|
title: "3A"
|
|
},
|
|
{
|
|
title: "3B"
|
|
},
|
|
],
|
|
duration: 45,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Section Choice (14 TIE)",
|
|
data: {
|
|
title: "Which Section?",
|
|
choices: [
|
|
{
|
|
title: "1A"
|
|
},
|
|
{
|
|
title: "1B"
|
|
},
|
|
{
|
|
title: "4A"
|
|
},
|
|
{
|
|
title: "4B"
|
|
},
|
|
],
|
|
duration: 45,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Section Choice (24 TIE)",
|
|
data: {
|
|
title: "Which Section?",
|
|
choices: [
|
|
{
|
|
title: "2A"
|
|
},
|
|
{
|
|
title: "2B"
|
|
},
|
|
{
|
|
title: "4A"
|
|
},
|
|
{
|
|
title: "4B"
|
|
},
|
|
],
|
|
duration: 45,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Region Choice Tie-Breaker (123 TIE)",
|
|
data: {
|
|
title: "Which Region (Tie-Breaker)?",
|
|
choices: [
|
|
{
|
|
title: "1"
|
|
},
|
|
{
|
|
title: "2"
|
|
},
|
|
{
|
|
title: "3"
|
|
},
|
|
],
|
|
duration: 30,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Region Choice Tie-Breaker (124 TIE)",
|
|
data: {
|
|
title: "Which Region (Tie-Breaker)?",
|
|
choices: [
|
|
{
|
|
title: "1"
|
|
},
|
|
{
|
|
title: "2"
|
|
},
|
|
{
|
|
title: "4"
|
|
},
|
|
],
|
|
duration: 30,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Region Choice Tie-Breaker (134 TIE)",
|
|
data: {
|
|
title: "Which Region (Tie-Breaker)?",
|
|
choices: [
|
|
{
|
|
title: "1"
|
|
},
|
|
{
|
|
title: "3"
|
|
},
|
|
{
|
|
title: "4"
|
|
},
|
|
],
|
|
duration: 30,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
{
|
|
name: "Wavelength Region Choice Tie-Breaker (234 TIE)",
|
|
data: {
|
|
title: "Which Region (Tie-Breaker)?",
|
|
choices: [
|
|
{
|
|
title: "2"
|
|
},
|
|
{
|
|
title: "3"
|
|
},
|
|
{
|
|
title: "4"
|
|
}
|
|
],
|
|
duration: 30,
|
|
bits_voting_enabled: true,
|
|
bits_per_vote: 10,
|
|
channel_points_voting_enabled: true,
|
|
channel_points_per_vote: 200
|
|
}
|
|
},
|
|
]
|
|
}
|
|
});
|
|
</script>
|
|
</html> |