Improve user-interactions

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-07-13 13:45:14 +02:00
parent b0cdf92433
commit bcf58483c7
Signed by: luzifer
SSH Key Fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E
11 changed files with 26 additions and 31 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<nav class="navbar fixed-top navbar-expand-lg bg-body-tertiary user-select-none"> <nav class="navbar fixed-top navbar-expand-lg bg-body-tertiary">
<div class="container-fluid"> <div class="container-fluid">
<span class="navbar-brand user-select-none"> <span class="navbar-brand">
<i class="fas fa-robot fa-fw me-1 text-info" /> <i class="fas fa-robot fa-fw me-1 text-info" />
Twitch-Bot Twitch-Bot
</span> </span>

View File

@ -4,14 +4,14 @@
v-for="section in navigation" v-for="section in navigation"
:key="section.header" :key="section.header"
> >
<div class="navHeading user-select-none"> <div class="navHeading">
{{ section.header }} {{ section.header }}
</div> </div>
<RouterLink <RouterLink
v-for="link in section.links" v-for="link in section.links"
:key="link.target" :key="link.target"
:to="{name: link.target}" :to="{name: link.target}"
class="nav-link user-select-none" class="nav-link"
> >
<i :class="`${link.icon} fa-fw me-1`" /> <i :class="`${link.icon} fa-fw me-1`" />
{{ link.name }} {{ link.name }}

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="h-100"> <div class="h-100 user-select-none">
<head-nav :is-logged-in="true" /> <head-nav :is-logged-in="true" />
<div class="layout"> <div class="layout">

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="container my-3 user-select-none"> <div class="container my-3">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col col-9"> <div class="col col-9">
<div class="card"> <div class="card">
@ -19,7 +19,7 @@
<div class="input-group"> <div class="input-group">
<input <input
type="text" type="text"
class="form-control user-select-all" class="form-control"
:value="authURLs?.update_bot_token || ''" :value="authURLs?.update_bot_token || ''"
:disabled="!authURLs?.update_bot_token" :disabled="!authURLs?.update_bot_token"
readonly readonly

View File

@ -34,7 +34,7 @@ import { type RouteLocationRaw } from 'vue-router'
export default defineComponent({ export default defineComponent({
computed: { computed: {
cardClass(): string { cardClass(): string {
const classList = ['card user-select-none'] const classList = ['card']
if (this.clickRoute) { if (this.clickRoute) {
classList.push('pointer-click') classList.push('pointer-click')

View File

@ -40,9 +40,9 @@ export default defineComponent({
}, },
mounted() { mounted() {
this.bus.on(BusEventTypes.RaffleChanged, () => { // Refresh raffle counts when raffle changed
this.fetchRaffleCount() this.bus.on(BusEventTypes.RaffleChanged, () => this.fetchRaffleCount())
})
this.fetchRaffleCount() this.fetchRaffleCount()
}, },

View File

@ -1,10 +1,10 @@
<template> <template>
<div class="card user-select-none"> <div class="card">
<div class="card-header"> <div class="card-header">
{{ $t('dashboard.changelog.heading') }} {{ $t('dashboard.changelog.heading') }}
</div> </div>
<div <div
class="card-body" class="card-body user-select-text"
v-html="changelog" v-html="changelog"
/> />
</div> </div>
@ -51,9 +51,3 @@ export default defineComponent({
name: 'DashboardChangelog', name: 'DashboardChangelog',
}) })
</script> </script>
<style scoped>
.card-body {
user-select: text !important;
}
</style>

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="card user-select-none"> <div class="card">
<div class="card-header"> <div class="card-header">
{{ $t('dashboard.eventlog.heading') }} {{ $t('dashboard.eventlog.heading') }}
</div> </div>

View File

@ -51,9 +51,9 @@ export default defineComponent({
}, },
mounted() { mounted() {
this.bus.on(BusEventTypes.ConfigReload, () => { // Scopes might have changed due to authorization change
this.fetchGeneralConfig() this.bus.on(BusEventTypes.ConfigReload, () => this.fetchGeneralConfig())
})
this.fetchGeneralConfig() this.fetchGeneralConfig()
}, },

View File

@ -82,9 +82,8 @@ const app = createApp({
.then((resp: Response) => this.parseResponseFromJSON(resp)) .then((resp: Response) => this.parseResponseFromJSON(resp))
}, },
loadVars(): Promise<void | Response> { loadVars(): Promise<void> {
return fetch('editor/vars.json') return this.fetchJSON('editor/vars.json')
.then((resp: Response) => resp.json())
.then((data: any) => { .then((data: any) => {
this.vars = data this.vars = data
}) })
@ -100,8 +99,7 @@ const app = createApp({
this.$router.replace({ name: 'dashboard' }) this.$router.replace({ name: 'dashboard' })
} }
fetch(`config-editor/user?user=${this.tokenUser}`, this.$root.fetchOpts) this.fetchJSON(`config-editor/user?user=${this.tokenUser}`)
.then((resp: Response) => this.$root.parseResponseFromJSON(resp))
.then((data: any) => { .then((data: any) => {
this.userInfo = data this.userInfo = data
}) })
@ -129,10 +127,9 @@ const app = createApp({
return return
} }
fetch('config-editor/refreshToken', this.$root.fetchOpts) this.fetchJSON('config-editor/refreshToken')
.then((resp: Response) => this.$root.parseResponseFromJSON(resp))
.then((data: any) => this.login(data.token, new Date(data.expiresAt), data.user)) .then((data: any) => this.login(data.token, new Date(data.expiresAt), data.user))
.catch(err => { .catch((err: Error) => {
// Being unable to renew a token is a reason to logout // Being unable to renew a token is a reason to logout
this.logout() this.logout()
throw err throw err

View File

@ -2,4 +2,8 @@ html,
body, body,
#app { #app {
height: 100%; height: 100%;
}
.user-select-text {
user-select: text !important;
} }