Skip to content

Commit

Permalink
Merge pull request #79 from DurhamAcademy/events-dropdown
Browse files Browse the repository at this point in the history
Add Event Selector under Settings
  • Loading branch information
Ryan-Bauroth authored Feb 2, 2024
2 parents 8ffa21d + d2b7c02 commit 4b283da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 12 additions & 2 deletions components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ console.log(sessionState?.value?.userCtx?.roles)
if (sessionState?.value?.userCtx?.roles?.indexOf('_admin') != -1)
links.push({ label: "Users", to: "/users" })
const events = ['2024test', '2024trial']
let selectedEvent = ref(window.localStorage.getItem("event"))
function updateEvent(value: string){
window.localStorage.setItem("event", value)
}
</script>

<template>
Expand All @@ -59,8 +65,12 @@ if (sessionState?.value?.userCtx?.roles?.indexOf('_admin') != -1)
<template #header>
{{usernameState}}
</template>

<UButton block label="Logout" square @click="logout"/>
<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>
Expand Down
5 changes: 3 additions & 2 deletions pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ const {updateUsernameState}: { updateUsernameState: () => void } = inject(loginS
}
}
const events = ['2024test']
//also change in navbar
const events = ['2024test', '2024trial']
const selectedEvent = ref(events[0])
const selectedEvent = ref(window.localStorage.getItem('event') != undefined ? window.localStorage.getItem('event') : events[0])
</script>

<template>
Expand Down

0 comments on commit 4b283da

Please sign in to comment.