fix: mobile and lesson issues

This commit is contained in:
Jannat Patel
2024-05-10 18:41:39 +05:30
parent 528ab8f796
commit 10ed37ec67
13 changed files with 94 additions and 27 deletions

View File

@@ -29,15 +29,42 @@
<script setup>
import { getSidebarLinks } from '../utils'
import { useRouter } from 'vue-router'
import { computed, inject } from 'vue'
import { computed } from 'vue'
import { sessionStore } from '@/stores/session'
import { usersStore } from '@/stores/user'
import { LogOut, LogIn, UserRound } from 'lucide-vue-next'
const { logout, user } = sessionStore()
const { logout, user, username } = sessionStore()
let { isLoggedIn } = sessionStore()
const router = useRouter()
let { userResource } = usersStore()
const tabs = computed(() => {
return getSidebarLinks()
let links = getSidebarLinks()
if (user) {
links.push({
label: 'Profile',
icon: UserRound,
activeFor: [
'Profile',
'ProfileAbout',
'ProfileCertification',
'ProfileEvaluator',
'ProfileRoles',
],
})
links.push({
label: 'Log out',
icon: LogOut,
})
} else {
links.push({
label: 'Log in',
icon: LogIn,
})
}
return links
})
let isActive = (tab) => {
@@ -50,6 +77,13 @@ const handleClick = (tab) => {
logout.submit().then(() => {
isLoggedIn = false
})
else if (tab.label == 'Profile')
router.push({
name: 'Profile',
params: {
username: userResource.data?.username,
},
})
else router.push({ name: tab.to })
}