Frontend: added openUserProfile composable

main
TZGyn 2 years ago
parent 01aa374f4f
commit 31eb17a9be
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -29,9 +29,7 @@ const userOptions: Array<UserOption> = [
{ {
title: 'Profile', title: 'Profile',
icon: 'user', icon: 'user',
onClick: () => { onClick: () => openUserProfile(),
useRouter().push('/profile')
},
}, },
] ]
@ -58,17 +56,21 @@ onClickOutside(sidebar, () => {
class="hover:cursor-pointer" /> class="hover:cursor-pointer" />
</div> </div>
<Icon <Icon
@click="openUserProfile()"
name="user" name="user"
size="36" size="36"
ref="userIcon" /> ref="userIcon"
<div> class="hover:cursor-pointer" />
<div
@click="openUserProfile()"
class="hover:cursor-pointer hover:underline">
{{ user }} {{ user }}
</div> </div>
</div> </div>
<div ref="userOptionsCard"> <div ref="userOptionsCard">
<div <div
v-for="userOption in userOptions" v-for="userOption in userOptions"
class="flex w-full items-center p-4 text-xl hover:bg-lightgray" class="flex w-full items-center p-4 text-xl hover:cursor-pointer hover:bg-lightgray"
@click="userOption.onClick()"> @click="userOption.onClick()">
<Icon <Icon
v-if="userOption.icon" v-if="userOption.icon"

@ -2,8 +2,12 @@ const openUrl = (url: string) => {
window.open(url, '_blank') window.open(url, '_blank')
} }
const openUserProfile = () => {
useRouter().push('/profile')
}
const useSidebar = () => useState<Boolean>('isSidebarActive', () => false) const useSidebar = () => useState<Boolean>('isSidebarActive', () => false)
const openSidebar = () => [(useSidebar().value = true)] const openSidebar = () => [(useSidebar().value = true)]
const closeSidebar = () => [(useSidebar().value = false)] const closeSidebar = () => [(useSidebar().value = false)]
export { closeSidebar, openSidebar, openUrl, useSidebar } export { closeSidebar, openSidebar, openUrl, openUserProfile, useSidebar }

Loading…
Cancel
Save