fix: profile slot and schedule tab visibility

This commit is contained in:
Jannat Patel
2025-11-10 12:09:51 +05:30
parent d5c5faf0ca
commit fff9769791
10 changed files with 54 additions and 28 deletions

View File

@@ -190,15 +190,22 @@ const isSessionUser = () => {
return $user.data?.email === profile.data?.email
}
const hasHigherAccess = () => {
const currentUserHasHigherAccess = () => {
return $user.data?.is_evaluator || $user.data?.is_moderator
}
const isEvaluatorOrModerator = () => {
return (
profile.data?.roles?.includes('Batch Evaluator') ||
profile.data?.roles?.includes('Moderator')
)
}
const getTabButtons = () => {
let buttons = [{ label: 'About' }, { label: 'Certificates' }]
if ($user.data?.is_moderator) buttons.push({ label: 'Roles' })
if (hasHigherAccess()) {
if (currentUserHasHigherAccess() && isEvaluatorOrModerator()) {
buttons.push({ label: 'Slots' })
buttons.push({ label: 'Schedule' })
}