Skip to content

Mentor dashboard#335

Draft
Akshayvs-Tech wants to merge 7 commits into
gtech-mulearn:devfrom
Akshayvs-Tech:mentor-dashboard
Draft

Mentor dashboard#335
Akshayvs-Tech wants to merge 7 commits into
gtech-mulearn:devfrom
Akshayvs-Tech:mentor-dashboard

Conversation

@Akshayvs-Tech

Copy link
Copy Markdown
Contributor

feat: enhance mentor dashboard navigation and UI with interactive cards, task tracking, and improved availability empty state.

@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

👷 Deploy request for staging-mulearn pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 91ff02f

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR enhances the mentor dashboard with interactive navigation cards (task requests, sessions), adds deep-link support for the task-requests tab via ?tab= search params, gates mentor nav items behind isMentorVerified, improves the availability empty state, and introduces expectedErrorStatuses to the API client to suppress expected 400 console errors during onboarding status checks.

  • API client (client.ts): adds expectedErrorStatuses option and a matching test; mentor register/update mutations now use a lighter MentorApplicationMutationResponseSchema that doesn't require a full profile shape in the response.
  • Mentor home (mentor-home.tsx): wraps the Task Requests card in a Link and fetches pending task count via useMentorTasks, but the import bypasses the feature barrel (no index.ts at src/features/mentor/tasks/), and the count reflects only the current page rather than the total.
  • Shared MultiSelect (multi-select.tsx): adds maxSelections enforcement with a toast guard, but the toast text hardcodes "Interest Group" in a generic UI primitive, and minSelections is declared yet never enforced.

Confidence Score: 4/5

Safe to merge after addressing the missing feature barrel and the open pagination undercount from prior review threads.

The core changes — expectedErrorStatuses in the API client, the separate mutation schema, nav gating via isMentorVerified, and the deep-link tab default — are all sound. Two concerns hold back a clean merge: mentor-home.tsx imports useMentorTasks directly from the internal hooks path with no published barrel, creating a fragile cross-feature dependency; and the pending task count displayed on the home card reflects only the backend's current page, not the full total.

src/features/home/components/mentor-home.tsx (deep import and count accuracy), src/components/ui/multi-select.tsx (dead minSelections prop, domain-specific toast text)

Important Files Changed

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]
Loading

Reviews (3): Last reviewed commit: "feat: add dynamic check for mentor verif..." | Re-trigger Greptile

Comment on lines +736 to +737
const searchParams = useSearchParams();
const defaultTab = searchParams.get("tab") ?? "all";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Unknown Tab Hides Every List

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.

Suggested change
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!

Comment thread src/lib/nav-config.ts
Comment on lines +137 to +138
dynamicCheck: (roles) =>
!roles.some((r) => r === ROLES.COMPANY || r === ROLES.MENTOR),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Suggested change
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!

Comment on lines +38 to +42
"/dashboard/learning-circle": {
roles: [ROLES.ADMIN],
dynamicCheck: (roles) =>
!roles.some((r) => r === ROLES.MENTOR || r === ROLES.COMPANY),
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

@alvin-dennis
alvin-dennis marked this pull request as draft July 24, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage
Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants