-
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.
Make the system settings a bit nicer
- Loading branch information
Showing
12 changed files
with
170 additions
and
127 deletions.
There are no files selected for viewing
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script setup lang="ts"> | ||
import { TextField, TextButton, SelectField } from '@ropescore/components' | ||
import { apiDomain, localManual, localApis } from '../apollo' | ||
import { useAuth } from '../hooks/auth' | ||
import { ref } from 'vue' | ||
const auth = useAuth() | ||
const newName = ref('') | ||
</script> | ||
|
||
<template> | ||
<div | ||
class="grid bg-white border-t px-4 items-stretch gap-4" | ||
:class="{ | ||
'grid-cols-1': !auth.isLoggedIn.value, | ||
'grid-cols-[max-content,max-content,auto]': auth.isLoggedIn.value | ||
}" | ||
> | ||
<div class="flex items-center gap-2"> | ||
<span>Server: {{ apiDomain }}</span> | ||
<select-field | ||
v-model="localManual" | ||
dense | ||
label="Preferred Server" | ||
:data-list="localApis" | ||
class="min-w-[14ch]" | ||
/> | ||
</div> | ||
|
||
<p v-if="auth.isLoggedIn.value" class="border-l pl-4 flex items-center"> | ||
System ID: <code class="bg-gray-100 px-2 rounded">{{ auth.loading.value ? 'Loading...' : auth.user.value?.id }}</code> | ||
</p> | ||
|
||
<form v-if="auth.isLoggedIn.value" class="border-l pl-4 grid grid-cols-[max-content,auto,max-content] gap-2 items-center" @submit.prevent="auth.update({ name: newName })"> | ||
System name: | ||
<text-field | ||
:model-value="auth.user.value?.name ?? ''" | ||
label="System Name" | ||
dense | ||
:disabled="auth.loadingUpdate.value" | ||
@update:model-value="newName = $event" | ||
/> | ||
<text-button color="blue" dense :loading="auth.loadingUpdate.value"> | ||
Update | ||
</text-button> | ||
</form> | ||
</div> | ||
</template> |
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,19 +1,37 @@ | ||
import { createWebHistory, createRouter } from 'vue-router' | ||
import { useAuth } from './hooks/auth' | ||
|
||
export default createRouter({ | ||
const router = createRouter({ | ||
history: createWebHistory(), | ||
routes: [ | ||
{ path: '/', component: async () => import('./views/Home.vue') }, | ||
{ path: '/auth', component: async () => import('./views/Auth.vue') }, | ||
|
||
{ path: '/groups', component: async () => import('./views/Groups.vue') }, | ||
{ path: '/groups/:groupId/live', component: async () => import('./views/Live.vue'), meta: { fullscreen: true } }, | ||
{ path: '/groups/:groupId/on-floor', component: async () => import('./views/OnFloor.vue'), meta: { fullscreen: true } }, | ||
{ path: '/groups/:groupId/next-up', component: async () => import('./views/NextUp.vue'), meta: { fullscreen: true } }, | ||
{ path: '/groups', component: async () => import('./views/Groups.vue'), meta: { authRequired: true } }, | ||
{ path: '/groups/:groupId/live', component: async () => import('./views/Live.vue'), meta: { fullscreen: true, authRequired: true } }, | ||
{ path: '/groups/:groupId/on-floor', component: async () => import('./views/OnFloor.vue'), meta: { fullscreen: true, authRequired: true } }, | ||
{ path: '/groups/:groupId/next-up', component: async () => import('./views/NextUp.vue'), meta: { fullscreen: true, authRequired: true } }, | ||
|
||
{ path: '/device-stream', component: async () => import('./views/DeviceStreamSetup.vue') }, | ||
{ path: '/device-stream/live', component: async () => import('./views/DeviceStreamLive.vue'), meta: { fullscreen: true } }, | ||
{ path: '/device-stream', component: async () => import('./views/DeviceStreamSetup.vue'), meta: { authRequired: true } }, | ||
{ path: '/device-stream/live', component: async () => import('./views/DeviceStreamLive.vue'), meta: { fullscreen: true, authRequired: true } }, | ||
|
||
{ path: '/podium', component: async () => import('./views/PodiumConfig.vue') }, | ||
{ path: '/podium/live', component: async () => import('./views/PodiumLive.vue'), meta: { fullscreen: true } } | ||
] | ||
}) | ||
export default router | ||
|
||
router.beforeEach((to) => { | ||
if (!to.meta.authRequired) return | ||
|
||
const auth = useAuth() | ||
if (auth.token.value == null) { | ||
return { | ||
path: '/auth', | ||
query: { | ||
'return-to': encodeURIComponent(to.fullPath) | ||
}, | ||
replace: true | ||
} | ||
} | ||
}) |
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,54 @@ | ||
<script setup lang="ts"> | ||
import { ref, watch } from 'vue' | ||
import { useAuth } from '../hooks/auth' | ||
import { TextButton, TextField } from '@ropescore/components' | ||
import { useRoute, useRouter } from 'vue-router' | ||
const auth = useAuth() | ||
const newName = ref('') | ||
const route = useRoute() | ||
const router = useRouter() | ||
watch(auth.user, newUser => { | ||
if (newUser) { | ||
const returnTo = route.query['return-to'] as string | undefined | ||
router.replace(returnTo ? decodeURIComponent(returnTo) : '/') | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<form v-if="!auth.token.value" class="mx-auto container" @submit.prevent="auth.register({ name: newName })"> | ||
<h1 class="font-semibold text-2xl mt-4"> | ||
Register | ||
</h1> | ||
<text-field v-model="newName" label="System name" /> | ||
|
||
<div | ||
class="border-l border-l-4 py-2 px-4 mt-2 bg-blue-100 border-l-blue-300" | ||
> | ||
Note that live scoring will send and store data in the cloud, | ||
Swantzter is the data controller for this and can be reached on | ||
<a | ||
class="text-blue-700 hover:text-blue-900 underline" | ||
href="mailto:[email protected]" | ||
target="_blank" | ||
>[email protected]</a>. | ||
Please make sure you have read the (short and simple!) privacy policy | ||
available on | ||
<a | ||
class="text-blue-700 hover:text-blue-900 underline" | ||
href="https://ropescore.com/privacy" | ||
target="_blank" | ||
>https://ropescore.com/privacy</a> | ||
</div> | ||
|
||
<text-button type="submit"> | ||
Register | ||
</text-button> | ||
</form> | ||
<p v-if="auth.loading.value" class="container mx-auto"> | ||
Loading... | ||
</p> | ||
</template> |
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
Oops, something went wrong.