Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating coaches page #84

Merged
merged 35 commits into from
Feb 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c6f7e54
fixed file uploader for the dropbox and chooser
tslom Jan 19, 2024
342f073
fixed typo, tweaked file uploader (only works with jpegs)
tslom Jan 18, 2024
8337da1
added delete attachment feature
tslom Jan 18, 2024
8e6ce3b
fixed delete attachment feature confirm window to show the image, tea…
tslom Jan 26, 2024
8331831
oops
tslom Jan 26, 2024
110b6b7
fixed the files displaying after upload
tslom Jan 31, 2024
f2146f7
hopefully fixing docker ci issue
tslom Jan 31, 2024
006a24a
Merge branch 'dev' into 41-delete-attachments-feature
tslom Jan 31, 2024
c14433c
Merge remote-tracking branch 'origin/41-delete-attachments-feature' i…
tslom Jan 31, 2024
a5e9b0d
hopefully fixing docker ci issue
tslom Jan 31, 2024
447527d
Merge remote-tracking branch 'origin/41-delete-attachments-feature' i…
tslom Jan 31, 2024
96258f3
hopefully fixing docker ci issue
tslom Jan 31, 2024
b70b886
Merge pull request #69 from DurhamAcademy/41-delete-attachments-feature
Ryan-Bauroth Jan 31, 2024
24322b0
added tags feature
tslom Feb 1, 2024
3fb91b3
deleted attachment name and team number input
tslom Feb 2, 2024
034e36f
fixed bug with earlier change on viewing img
tslom Feb 2, 2024
c71f983
Added tooltip when hovering over Extra Notes button
tslom Feb 2, 2024
b3a3327
fixed min and max team number
tslom Feb 2, 2024
452cc40
switched order of file size
tslom Feb 2, 2024
1db48a3
fixed oopsie
tslom Feb 2, 2024
6ca286a
messing around with databases
tslom Feb 2, 2024
dc3d696
Merge branch '68-revamp-attachments' into dev
Ryan-Bauroth Feb 2, 2024
d9cefab
Merge branch '68-revamp-attachments' into dev
Ryan-Bauroth Feb 2, 2024
412558b
Merge remote-tracking branch 'origin/dev' into dev
Ryan-Bauroth Feb 2, 2024
ae35932
removed unused const and fixed issue with session roles not being acc…
Ryan-Bauroth Feb 3, 2024
f7e11f9
uninstalled heic2any
Ryan-Bauroth Feb 3, 2024
0916ca7
added back heic2any i was being goofy
Ryan-Bauroth Feb 3, 2024
33a34fc
made significant changes to OuterComponents.vue and Navbar.vue to rem…
Ryan-Bauroth Feb 3, 2024
4dde9bb
made significant changes to OuterComponents.vue and Navbar.vue to rem…
Ryan-Bauroth Feb 3, 2024
cae2225
Merge remote-tracking branch 'origin/outcomponents-changes' into outc…
Ryan-Bauroth Feb 3, 2024
50260fe
quick fix
Ryan-Bauroth Feb 3, 2024
cb779d7
changed style to css
Ryan-Bauroth Feb 3, 2024
384324c
updated stuff to use useState instead of ref. reformatted OuterCompon…
Ryan-Bauroth Feb 4, 2024
e464bb3
Merge pull request #81 from DurhamAcademy/outcomponents-changes
Ryan-Bauroth Feb 4, 2024
aef417c
Merge branch 'coaches-page' into dev
Ryan-Bauroth Feb 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated stuff to use useState instead of ref. reformatted OuterCompon…
…ents.vue
Ryan-Bauroth committed Feb 4, 2024
commit 384324c9eb21b1b785ce6f4c9c7af4421112549a
2 changes: 1 addition & 1 deletion components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ const {usernameState, sessionState, logout}: {

const events = ['2024test', '2024trial']

let selectedEvent = ref(window.localStorage.getItem("event"))
let selectedEvent = useState('selectedEvent', () => window.localStorage.getItem("event"))

let props = defineProps({
scoutMode: {
120 changes: 61 additions & 59 deletions components/OuterComponents.vue
Original file line number Diff line number Diff line change
@@ -1,77 +1,79 @@
<script setup lang="ts">
import {useWindowSize} from "@vueuse/core";
import LoginState from "~/utils/authorization/LoginState";
import {loginStateKey} from "~/utils/keys";
import AddButton from "~/components/AddButton.vue";
import type {VerticalNavigationLink} from "#ui/types";
import type {Ref} from "@vue/reactivity";
import type {UnwrapRef} from "vue";
import {couchDBBaseURL} from "~/utils/URIs";
import {useWindowSize} from "@vueuse/core";
import LoginState from "~/utils/authorization/LoginState";
import {loginStateKey} from "~/utils/keys";
import AddButton from "~/components/AddButton.vue";
import type {VerticalNavigationLink} from "#ui/types";
import type {Ref} from "@vue/reactivity";
import type {UnwrapRef} from "vue";
import {couchDBBaseURL} from "~/utils/URIs";

const usersDB = new PouchDB(`${couchDBBaseURL}/_users`, {skip_setup: true});
const session = await usersDB.getSession()
const usersDB = new PouchDB(`${couchDBBaseURL}/_users`, {skip_setup: true});
const session = await usersDB.getSession()

let {width, height} = useWindowSize()
let {width, height} = useWindowSize()

let route = useRoute()
let route = useRoute()

const events = ['2024test', '2024trial']
const events = ['2024test', '2024trial']

let selectedEvent = ref(window.localStorage.getItem("event"))
const selectedEvent = useState('selectedEvent', () => window.localStorage.getItem("event"))

function updateEvent(value: string){
window.localStorage.setItem("event", value)
}
function updateEvent(value: string) {
window.localStorage.setItem("event", value)
}

const {usernameState, sessionState, logout}: {
logout: () => Promise<void>;
// noinspection TypeScriptUnresolvedReference
loginState: Ref<UnwrapRef<LoginState>>;
// noinspection TypeScriptUnresolvedReference
sessionState: Ref<UnwrapRef<PouchDB.Authentication.SessionResponse>>;
// noinspection TypeScriptUnresolvedReference
usernameState: Ref<UnwrapRef<string>>;
updateUsernameState: () => Promise<boolean>
} = inject(loginStateKey)!
const {usernameState, sessionState, logout}: {
logout: () => Promise<void>;
// noinspection TypeScriptUnresolvedReference
loginState: Ref<UnwrapRef<LoginState>>;
// noinspection TypeScriptUnresolvedReference
sessionState: Ref<UnwrapRef<PouchDB.Authentication.SessionResponse>>;
// noinspection TypeScriptUnresolvedReference
usernameState: Ref<UnwrapRef<string>>;
updateUsernameState: () => Promise<boolean>
} = inject(loginStateKey)!

let links: VerticalNavigationLink[] = [
{ label: "Dashboard", to: "/dashboard" },
{ label: "Matches", to: "/matches" },
{ label: "Teams", to: "/teams" },
{ label: "Attachments", to: "/attachments" }
]
if (session.userCtx.roles?.indexOf("_admin") != -1){
links.push({ label: "Users", to: "/users" })
}
let links: VerticalNavigationLink[] = [
{label: "Dashboard", to: "/dashboard"},
{label: "Matches", to: "/matches"},
{label: "Teams", to: "/teams"},
{label: "Attachments", to: "/attachments"}
]
if (session.userCtx.roles?.indexOf("_admin") != -1) {
links.push({label: "Users", to: "/users"})
}

</script>

<template>
<div class="flex min-h-screen w-screen flex-col">
<Navbar class="flex-grow basis-auto" :disable-sidebar="width > 800"/>
<div class="flex flex-grow flex-shrink basis-auto flex-row w-screen overflow-x-clip max-h-none place-content-around min-h-full">
<div
class="flex flex-grow flex-shrink basis-auto flex-row w-screen overflow-x-clip max-h-none place-content-around min-h-full">
<Transition name="width-fade">
<div v-show="width > 800" class="vis min-h-screen h-screen max-w-full">
<UCard class="h-full" :ui="{rounded: 'rounded-none'}">
<UVerticalNavigation :links="links"/>
<div class="settingsPopupDiv">
<UPopover>
<UButton icon="i-heroicons-cog-6-tooth" square :size="'xl'" :variant="'ghost'" :color="'gray'"/>
<template #panel>
<UCard class="p-2">
<template #header>
<div class="usernameLabel text-zinc-900 max-w-32">
{{usernameState}}
</div>
</template>
<UFormGroup class="inputDiv" label="Event" name="event">
<USelectMenu v-model="selectedEvent" :options="events" @update:model-value ="value => {updateEvent(value)}"/>
</UFormGroup>
<template #footer>
<UButton block label="Logout" square @click="logout"/>
</template>
</UCard>
</template>
<UButton icon="i-heroicons-cog-6-tooth" square :size="'xl'" :variant="'ghost'" :color="'gray'"/>
<template #panel>
<UCard class="p-2">
<template #header>
<div class="usernameLabel text-zinc-900 max-w-32">
{{ usernameState }}
</div>
</template>
<UFormGroup class="inputDiv" label="Event" name="event">
<USelectMenu v-model="selectedEvent" :options="events"
@update:model-value="value => {updateEvent(value)}"/>
</UFormGroup>
<template #footer>
<UButton block label="Logout" square @click="logout"/>
</template>
</UCard>
</template>
</UPopover>
</div>
</UCard>
@@ -90,16 +92,16 @@
.vis {
width: 20em;
left: 0;
position:relative;
position: relative;
}

.usernameLabel{
overflow:hidden
.usernameLabel {
overflow: hidden
}

.settingsPopupDiv{
position:absolute;
left:5.7%;
.settingsPopupDiv {
position: absolute;
left: 5.7%;
bottom: 2.15%
}

9 changes: 3 additions & 6 deletions pages/login.vue
Original file line number Diff line number Diff line change
@@ -8,13 +8,15 @@ const usersDB = new PouchDB(`${couchDBBaseURL}/_users`, {skip_setup: true});
let password = ref("");
let error = ref(false)

const events = ['2024test', '2024trial']
let selectedEvent = useState('selectedEvent', () => window.localStorage.getItem("event"))

const {updateUsernameState}: { updateUsernameState: () => void } = inject(loginStateKey)!

async function login(username: string, password: string) {
try
{
window.localStorage.setItem("event", selectedEvent.value)
window.localStorage.setItem("event", selectedEvent.value != null ? selectedEvent.value: "")

usersDB.logIn(username, password, async function (err, response) {
if (response) {
@@ -68,11 +70,6 @@ async function login(username: string, password: string) {
})
}


//also change in navbar
const events = ['2024test', '2024trial']

const selectedEvent = ref(window.localStorage.getItem('event') != undefined ? window.localStorage.getItem('event') : events[0])
</script>

<template>