Skip to content

Commit

Permalink
Improve user-interactions
Browse files Browse the repository at this point in the history
Signed-off-by: Knut Ahlers <knut@ahlers.me>
  • Loading branch information
Luzifer committed Jul 13, 2024
1 parent c5a0e1e commit 768b80c
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/components/_headNav.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<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">
<span class="navbar-brand user-select-none">
<span class="navbar-brand">
<i class="fas fa-robot fa-fw me-1 text-info" />
Twitch-Bot
</span>
Expand Down
4 changes: 2 additions & 2 deletions src/components/_sideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
v-for="section in navigation"
:key="section.header"
>
<div class="navHeading user-select-none">
<div class="navHeading">
{{ section.header }}
</div>
<RouterLink
v-for="link in section.links"
:key="link.target"
:to="{name: link.target}"
class="nav-link user-select-none"
class="nav-link"
>
<i :class="`${link.icon} fa-fw me-1`" />
{{ link.name }}
Expand Down
2 changes: 1 addition & 1 deletion src/components/app.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="h-100">
<div class="h-100 user-select-none">
<head-nav :is-logged-in="true" />

<div class="layout">
Expand Down
4 changes: 2 additions & 2 deletions src/components/botauth.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="container my-3 user-select-none">
<div class="container my-3">
<div class="row justify-content-center">
<div class="col col-9">
<div class="card">
Expand All @@ -19,7 +19,7 @@
<div class="input-group">
<input
type="text"
class="form-control user-select-all"
class="form-control"
:value="authURLs?.update_bot_token || ''"
:disabled="!authURLs?.update_bot_token"
readonly
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/_statuspanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { type RouteLocationRaw } from 'vue-router'
export default defineComponent({
computed: {
cardClass(): string {
const classList = ['card user-select-none']
const classList = ['card']
if (this.clickRoute) {
classList.push('pointer-click')
Expand Down
6 changes: 3 additions & 3 deletions src/components/dashboard/activeRaffles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export default defineComponent({
},
mounted() {
this.bus.on(BusEventTypes.RaffleChanged, () => {
this.fetchRaffleCount()
})
// Refresh raffle counts when raffle changed
this.bus.on(BusEventTypes.RaffleChanged, () => this.fetchRaffleCount())
this.fetchRaffleCount()
},
Expand Down
10 changes: 2 additions & 8 deletions src/components/dashboard/changelog.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div class="card user-select-none">
<div class="card">
<div class="card-header">
{{ $t('dashboard.changelog.heading') }}
</div>
<div
class="card-body"
class="card-body user-select-text"
v-html="changelog"
/>
</div>
Expand Down Expand Up @@ -51,9 +51,3 @@ export default defineComponent({
name: 'DashboardChangelog',
})
</script>

<style scoped>
.card-body {
user-select: text !important;
}
</style>
2 changes: 1 addition & 1 deletion src/components/dashboard/eventlog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="card user-select-none">
<div class="card">
<div class="card-header">
{{ $t('dashboard.eventlog.heading') }}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/dashboard/scopes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export default defineComponent({
},
mounted() {
this.bus.on(BusEventTypes.ConfigReload, () => {
this.fetchGeneralConfig()
})
// Scopes might have changed due to authorization change
this.bus.on(BusEventTypes.ConfigReload, () => this.fetchGeneralConfig())
this.fetchGeneralConfig()
},
Expand Down
13 changes: 5 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ const app = createApp({
.then((resp: Response) => this.parseResponseFromJSON(resp))
},

loadVars(): Promise<void | Response> {
return fetch('editor/vars.json')
.then((resp: Response) => resp.json())
loadVars(): Promise<void> {
return this.fetchJSON('editor/vars.json')
.then((data: any) => {
this.vars = data
})
Expand All @@ -100,8 +99,7 @@ const app = createApp({
this.$router.replace({ name: 'dashboard' })
}

fetch(`config-editor/user?user=${this.tokenUser}`, this.$root.fetchOpts)
.then((resp: Response) => this.$root.parseResponseFromJSON(resp))
this.fetchJSON(`config-editor/user?user=${this.tokenUser}`)
.then((data: any) => {
this.userInfo = data
})
Expand Down Expand Up @@ -129,10 +127,9 @@ const app = createApp({
return
}

fetch('config-editor/refreshToken', this.$root.fetchOpts)
.then((resp: Response) => this.$root.parseResponseFromJSON(resp))
this.fetchJSON('config-editor/refreshToken')
.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
this.logout()
throw err
Expand Down
4 changes: 4 additions & 0 deletions src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ html,
body,
#app {
height: 100%;
}

.user-select-text {
user-select: text !important;
}

0 comments on commit 768b80c

Please sign in to comment.