Mentor dashboard#335
Conversation
…ts from mentee page
…ds, task tracking, and improved availability empty state.
👷 Deploy request for staging-mulearn pending review.Visit the deploys page to approve it
|
|
Someone is attempting to deploy a commit to the awindsr's projects Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR enhances the mentor dashboard with interactive navigation cards (task requests, sessions), adds deep-link support for the task-requests tab via
|
| Filename | Overview |
|---|---|
| src/api/client.ts | Adds expectedErrorStatuses option to suppress development console errors for expected business-error HTTP responses; clean and well-tested change. |
| src/api/client.test.ts | New Vitest test covering the expectedErrorStatuses behaviour; correctly stubs fetch and verifies console.error is not called for expected 400s. |
| src/components/ui/multi-select.tsx | Adds maxSelections (visual counter + toast guard) and minSelections (declared but never enforced — dead code); toast message hardcodes "Interest Group" in a shared UI primitive. |
| src/features/home/components/event-calendar-card.tsx | Refactors event row to use a dynamic Wrapper tag for link events, but loses target="_blank" and rel="noopener noreferrer" that the old icon-link carried. |
| src/features/home/components/mentor-home.tsx | Adds pending task count from useMentorTasks (displaying only the current page length, not the total) and wraps the Task Requests card in a Link; imports useMentorTasks via a deep path that has no barrel. |
| src/features/mentor/onboarding/api/onboarding.api.ts | Switches register/update mutations to use MentorApplicationMutationResponseSchema and suppresses expected 400 console errors on status check. |
| src/features/mentor/onboarding/schemas/index.ts | Adds MentorApplicationMutationResponseSchema using z.unknown() for the mutation response body, correctly separating the mutation ack schema from the profile read schema. |
| src/lib/auth/route-access.ts | Renames /learning-circles → /learning-circle and adds a dynamicCheck that blocks Mentor and Company users; the Admin bypass is safe but multi-role account interaction was flagged in prior review threads. |
| src/lib/nav-config.ts | Extends Learning Circle nav dynamicCheck to also exclude Mentors, and gates Mentees nav entry behind isMentorVerified context flag — correct use of the DynamicNavContext pattern. |
| src/features/mentor/task-requests/components/task-requests-page.tsx | Reads ?tab= from search params to set the default Radix tab value, allowing deep-linking from the home dashboard. |
| src/features/mentor/profile/components/tabs/availability-tab.tsx | Improves the empty-state styling with stronger border and background; purely cosmetic change. |
| src/features/mentor/mentees/components/mentees-page.tsx | Removes the Join Session button and its associated dialog state; clean removal. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Mentor Home Dashboard] -->|Link| B[Task Requests Page]
A -->|Link per session| C[Sessions Page]
A -->|useMentorTasks pending| D[Pending Task Count Card]
D -->|deep import no barrel| E[mentor/tasks/hooks/use-mentor-tasks]
B -->|useSearchParams tab param| F{defaultTab}
F -->|all or pending or approved or rejected| G[Radix Tabs Content]
H[nav-config] -->|isMentorVerified context| I[Show or Hide Mentor Nav Items]
Reviews (3): Last reviewed commit: "feat: add dynamic check for mentor verif..." | Re-trigger Greptile
| const searchParams = useSearchParams(); | ||
| const defaultTab = searchParams.get("tab") ?? "all"; |
There was a problem hiding this comment.
When tab contains any value other than all, pending, approved, or rejected, Radix initializes with no matching trigger or content. A URL such as ?tab=foo therefore shows no task list even though the queries loaded successfully.
| const searchParams = useSearchParams(); | |
| const defaultTab = searchParams.get("tab") ?? "all"; | |
| const searchParams = useSearchParams(); | |
| const requestedTab = searchParams.get("tab"); | |
| const defaultTab = | |
| requestedTab === "pending" || | |
| requestedTab === "approved" || | |
| requestedTab === "rejected" | |
| ? requestedTab | |
| : "all"; |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| dynamicCheck: (roles) => | ||
| !roles.some((r) => r === ROLES.COMPANY || r === ROLES.MENTOR), |
There was a problem hiding this comment.
Multi-Role Admin Loses Navigation
An account holding both Admin and Mentor now fails this predicate, so its Learning Circle link disappears. The route policy still admits that account through the Admin role, leaving an authorized page reachable directly but absent from navigation.
| dynamicCheck: (roles) => | |
| !roles.some((r) => r === ROLES.COMPANY || r === ROLES.MENTOR), | |
| dynamicCheck: (roles) => | |
| roles.includes(ROLES.ADMIN) || | |
| !roles.some((r) => r === ROLES.COMPANY || r === ROLES.MENTOR), |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…error handling and multi-select limits
| "/dashboard/learning-circle": { | ||
| roles: [ROLES.ADMIN], | ||
| dynamicCheck: (roles) => | ||
| !roles.some((r) => r === ROLES.MENTOR || r === ROLES.COMPANY), | ||
| }, |
There was a problem hiding this comment.
Multi-role admins remain blocked. The static role check admits an Admin, but this
dynamicCheck then rejects the same account whenever it also has Mentor or Company. An Admin+Mentor or Admin+Company user is therefore redirected away from Learning Circle even though the Admin role is explicitly allowed. Keep Admin access independent of additional roles and align this policy with the navigation rule.
…profile edit modal
feat: enhance mentor dashboard navigation and UI with interactive cards, task tracking, and improved availability empty state.