-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Knut Ahlers <knut@ahlers.me>
- Loading branch information
Showing
16 changed files
with
444 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,54 @@ | ||
<template> | ||
<div class="container"> | ||
<!----> | ||
<div class="container my-3"> | ||
<div class="row justify-content-center"> | ||
<!-- Here Number Scheduled Events Panel --> | ||
<div | ||
v-for="component in statusComponents" | ||
:key="component" | ||
class="col col-2" | ||
> | ||
<component | ||
:is="component" | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div class="row mt-3"> | ||
<div class="col"> | ||
<!-- Here Bot-Logs: #44 --> | ||
</div> | ||
<div class="col"> | ||
<DashboardChangelog /> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import DashboardActiveRaffles from './dashboard/activeRaffles.vue' | ||
import DashboardBotScopes from './dashboard/scopes.vue' | ||
import DashboardChangelog from './dashboard/changelog.vue' | ||
import DashboardHealthCheck from './dashboard/healthcheck.vue' | ||
import { defineComponent } from 'vue' | ||
export default defineComponent({ | ||
components: { | ||
DashboardActiveRaffles, | ||
DashboardBotScopes, | ||
DashboardChangelog, | ||
DashboardHealthCheck, | ||
}, | ||
data() { | ||
return { | ||
statusComponents: [ | ||
'DashboardHealthCheck', | ||
'DashboardBotScopes', | ||
'DashboardActiveRaffles', | ||
], | ||
} | ||
}, | ||
name: 'TwitchBotEditorDashboard', | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<template> | ||
<div | ||
:class="cardClass" | ||
@click="navigate" | ||
> | ||
<div class="card-body"> | ||
<div class="fs-6 text-center"> | ||
{{ header }} | ||
</div> | ||
<template v-if="loading"> | ||
<div class="fs-1 text-center"> | ||
<i class="fa-solid fa-circle-notch fa-spin" /> | ||
</div> | ||
</template> | ||
<template v-else> | ||
<div :class="valueClass"> | ||
{{ value }} | ||
</div> | ||
</template> | ||
<div | ||
v-if="caption" | ||
class="text-muted text-center" | ||
> | ||
<small>{{ caption }}</small> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, type PropType } from 'vue' | ||
import { type RouteLocationRaw } from 'vue-router' | ||
export default defineComponent({ | ||
computed: { | ||
cardClass(): string { | ||
const classList = ['card user-select-none'] | ||
if (this.clickRoute) { | ||
classList.push('pointer-click') | ||
} | ||
return classList.join(' ') | ||
}, | ||
valueClass(): string { | ||
const classList = ['fs-1 text-center'] | ||
if (this.valueExtraClass) { | ||
classList.push(this.valueExtraClass) | ||
} | ||
return classList.join(' ') | ||
}, | ||
}, | ||
methods: { | ||
navigate(): void { | ||
if (!this.clickRoute) { | ||
return | ||
} | ||
this.$router.push(this.clickRoute) | ||
}, | ||
}, | ||
name: 'DashboardStatusPanel', | ||
props: { | ||
caption: { | ||
default: null, | ||
type: String, | ||
}, | ||
clickRoute: { | ||
default: null, | ||
type: {} as PropType<RouteLocationRaw>, | ||
}, | ||
header: { | ||
required: true, | ||
type: String, | ||
}, | ||
loading: { | ||
default: false, | ||
type: Boolean, | ||
}, | ||
value: { | ||
required: true, | ||
type: String, | ||
}, | ||
valueExtraClass: { | ||
default: null, | ||
type: String, | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.pointer-click { | ||
cursor: pointer; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<StatusPanel | ||
:header="$t('dashboard.activeRaffles.header')" | ||
:loading="loading" | ||
:value="value" | ||
:click-route="{name: 'rafflesList'}" | ||
:caption="$t('dashboard.activeRaffles.caption')" | ||
/> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import BusEventTypes from '../../helpers/busevents' | ||
import { defineComponent } from 'vue' | ||
import StatusPanel from './_statuspanel.vue' | ||
export default defineComponent({ | ||
components: { StatusPanel }, | ||
computed: { | ||
value(): string { | ||
return `${this.activeRaffles}` | ||
}, | ||
}, | ||
data() { | ||
return { | ||
activeRaffles: 0, | ||
loading: true, | ||
} | ||
}, | ||
methods: { | ||
fetchRaffleCount(): void { | ||
fetch('raffle/', this.$root?.fetchOpts) | ||
.then((resp: Response) => this.$root?.parseResponseFromJSON(resp)) | ||
.then((data: any) => { | ||
this.activeRaffles = data.filter((raffle: any) => raffle.status === 'active').length | ||
this.loading = false | ||
}) | ||
}, | ||
}, | ||
mounted() { | ||
this.bus.on(BusEventTypes.RaffleChanged, () => { | ||
this.fetchRaffleCount() | ||
}) | ||
this.fetchRaffleCount() | ||
}, | ||
name: 'DashboardBotRaffles', | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div class="card user-select-none"> | ||
<div class="card-header"> | ||
{{ $t('dashboard.changelog.heading') }} | ||
</div> | ||
<div | ||
class="card-body" | ||
v-html="changelog" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
// @ts-ignore - Has an esbuild loader to be loaded as text | ||
import ChangeLog from '../../../History.md' | ||
import { defineComponent } from 'vue' | ||
import { parse as marked } from 'marked' | ||
export default defineComponent({ | ||
computed: { | ||
changelog(): string { | ||
const latestVersions = (ChangeLog as string) | ||
.split('\n') | ||
.filter((line: string) => line) // Remove empty lines to fix broken output | ||
.join('\n') | ||
.split('#') | ||
.slice(0, 3) // Last 2 versions (first element is empty) | ||
.join('###') | ||
const parts = [ | ||
latestVersions, | ||
'---', | ||
this.$t('dashboard.changelog.fullLink'), | ||
] | ||
return marked(parts.join('\n'), { | ||
async: false, | ||
breaks: false, | ||
extensions: null, | ||
gfm: true, | ||
hooks: null, | ||
pedantic: false, | ||
silent: true, | ||
tokenizer: null, | ||
walkTokens: null, | ||
}) as string | ||
}, | ||
}, | ||
name: 'DashboardChangelog', | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.card-body { | ||
user-select: text !important; | ||
} | ||
</style> |
Oops, something went wrong.