Modified Dashboard

- added Song timer
- added active VC count
- improved layout
- added querying for VC count to graphql
pull/33/head
Trivernis 6 years ago
parent 36b6416531
commit 1d3ce93561

@ -112,7 +112,8 @@ class Bot {
presences: this.presences, presences: this.presences,
maindb: this.maindb, maindb: this.maindb,
prefix: prefix, prefix: prefix,
getGuildHandler: (guild) => this.getGuildHandler(guild, prefix) getGuildHandler: (guild) => this.getGuildHandler(guild, prefix),
guildHandlers: this.guildHandlers
}); });
} }

@ -166,6 +166,20 @@ exports.WebServer = class {
uptime: () => { uptime: () => {
return objects.client.uptime; return objects.client.uptime;
}, },
voiceConnectionCount: () => {
let dcGuilds = Array.from(objects.client.guilds.values());
return dcGuilds.filter((x) => {
let gh = objects.guildHandlers[x.id];
if (gh) {
if (gh.dj)
return gh.dj.playing;
else
return false;
} else {
return false;
}
}).length;;
}
}, },
prefix: objects.prefix, prefix: objects.prefix,
presences: objects.presences, presences: objects.presences,

@ -55,6 +55,7 @@ type Guild {
type Client { type Client {
guilds(first: Int = 10, offset: Int = 0, id: String): [Guild] guilds(first: Int = 10, offset: Int = 0, id: String): [Guild]
guildCount: Int guildCount: Int
voiceConnectionCount: Int
user: User user: User
ping: Float ping: Float
status: Int status: Int

@ -39,15 +39,20 @@
<span class="label text-right">Guild Count: </span> <span class="label text-right">Guild Count: </span>
<span class="text-left" id="client-guildCount"></span> <span class="text-left" id="client-guildCount"></span>
</div> </div>
<div class="cell">
<span class="label text-right">Active Voice Connections: </span>
<span class="text-left" id="client-vcCount"></span>
</div>
</div> </div>
<div class="column" id="column-right"> <div class="column" id="column-right">
<select class="cell" id="guild-select"> <select class="cell" id="guild-select">
<option value="select-default">-Select a guild-</option> <option value="select-default">-Select a guild-</option>
</select> </select>
<div id="guildinfo" style="display: none"> <div id="guildinfo" style="display: none">
<div class="listContainer">
<div class="cell" id="guild-icon-container"> <div class="cell" id="guild-icon-container">
<img id="guild-icon" src="" alt="Icon"/> <img id="guild-icon" src="" alt="Icon"/>
<div class="listContainer"> <div class="listContainer" id="guild-nameAndIcon">
<h2 class="cell" id="guild-name"></h2> <h2 class="cell" id="guild-name"></h2>
<p class="cell">by</p> <p class="cell">by</p>
<h3 class="cell" id="guild-owner"></h3> <h3 class="cell" id="guild-owner"></h3>
@ -73,7 +78,8 @@
<span class="label text-right">Voice Channel: </span> <span class="label text-right">Voice Channel: </span>
<span class="text-left" id="dj-voiceChannel"></span> <span class="text-left" id="dj-voiceChannel"></span>
</div> </div>
<div class="cell listContainer" id="dj-songinfo" style="display: none"> </div>
<div class="listContainer" id="dj-songinfo" style="display: none">
<a id="songinfo-container"> <a id="songinfo-container">
<span id="dj-songname"></span> <span id="dj-songname"></span>
<img id="dj-songImg" src="" alt=""/> <img id="dj-songImg" src="" alt=""/>

@ -25,7 +25,7 @@ body
margin: 0 auto margin: 0 auto
text-align: center text-align: center
max-height: 100vh max-height: 100vh
height: 100% height: 100vh
.cell .cell
display: list-item display: list-item
@ -63,11 +63,10 @@ div.cell > *
font-weight: bold font-weight: bold
.listContainer .listContainer
display: block display: grid
width: 100% width: 100%
text-align: left text-align: left
overflow: auto overflow: auto
display: inline-block
position: relative position: relative
max-height: 90vh max-height: 90vh
@ -115,6 +114,7 @@ div.cell > *
display: table-cell display: table-cell
.songEntry .songEntry
display: flex
display: flex display: flex
background: lighten($cBackgroundVariant, 5) background: lighten($cBackgroundVariant, 5)
padding: 2px padding: 2px
@ -147,11 +147,16 @@ div.cell > *
#column-left, #column-middle, #column-right #column-left, #column-middle, #column-right
width: 33% width: 33%
height: 100%
#column-middle #column-middle
background: $cBackgroundVariant background: $cBackgroundVariant
border-radius: 20px border-radius: 20px
height: 100%
#column-right
padding: 0 20px 20px
display: grid
align-content: start
#user-avatar #user-avatar
max-width: 300px max-width: 300px
@ -196,11 +201,13 @@ div.cell > *
width: 100% width: 100%
margin: auto margin: auto
border: none border: none
height: 52px
border-radius: 12px border-radius: 12px
-webkit-appearance: none -webkit-appearance: none
#guild-icon-container #guild-icon-container
padding: 10px 0 0 0 padding: 10px 0 0 0
display: flex
#guild-icon #guild-icon
max-width: 100px max-width: 100px
@ -208,10 +215,13 @@ div.cell > *
height: auto height: auto
border-radius: 25% border-radius: 25%
#guild-nameAndIcon
width: 50%
#dj-songinfo #dj-songinfo
display: block
background-color: $cBackgroundVariant background-color: $cBackgroundVariant
border-radius: 20px border-radius: 20px
overflow-x: hidden
#songinfo-container #songinfo-container
display: list-item display: list-item
@ -220,14 +230,26 @@ div.cell > *
padding: 10px padding: 10px
width: calc(100% - 20px) width: calc(100% - 20px)
dj-queue-container #dj-queue-container
display: list-item display: grid
padding: 0 5px 5px
#dj-songname #dj-songname
font-weight: bold
font-weight: bold font-weight: bold
font-size: 120% font-size: 120%
#dj-songImg #dj-songImg
width: 100% align-self: center
width: 80%
height: auto height: auto
margin: 0 10%
border-radius: 5% border-radius: 5%
#guildinfo
max-height: 90vh
overflow-y: auto
#dj-songQueue
display: grid
max-height: 100%

@ -193,6 +193,7 @@ function queryStatus() {
status status
uptime uptime
guildCount guildCount
voiceConnectionCount
user { user {
presence { presence {
game game
@ -211,6 +212,7 @@ function queryStatus() {
.innerText = `${sd.days}d ${sd.hours}h ${sd.minutes}min ${sd.seconds}s`; .innerText = `${sd.days}d ${sd.hours}h ${sd.minutes}min ${sd.seconds}s`;
document.querySelector('#client-guildCount').innerText = d.client.guildCount; document.querySelector('#client-guildCount').innerText = d.client.guildCount;
document.querySelector('#client-vcCount').innerText = d.client.voiceConnectionCount;
if (d.client.status !== 0) { if (d.client.status !== 0) {
document.querySelector('#status-indicator').setAttribute('status', 'offline'); document.querySelector('#status-indicator').setAttribute('status', 'offline');
} else { } else {

Loading…
Cancel
Save