Skip to content

#573 Separate The Apply Positions Page From The Manage Positions Page - #592

Open
b-at-neu wants to merge 2 commits into
devfrom
573-separate-apply-positions-from-manage-positions
Open

#573 Separate The Apply Positions Page From The Manage Positions Page#592
b-at-neu wants to merge 2 commits into
devfrom
573-separate-apply-positions-from-manage-positions

Conversation

@b-at-neu

Copy link
Copy Markdown
Collaborator

Closes #573

Summary

  • /positions is now purely the applicant browse page — every viewer, signed in or not, sees the same Open / Recently Closed list, and a signed-in viewer's own applications now mark the relevant cards (draft/withdrawn/applied badge + matching CTA).
  • The reviewer's workbench moves to a new /my-positions: the create action, the active/archived partition, and per-position application stats. Admins get a flat "All Positions" list including drafts.
  • nav-items.ts gains a myPositionsNavItem under Manage; Positions stays under Apply for managers/admins too, so they can still browse and apply like any other user.
  • docs/WORKFLOWS.md (AN-1, AN-2, PM-2, AD-1, the PM/AD persona intros, PM-3's trigger) is updated to match, and a new AP-17 documents the applied marker.

Changes

  • app/(main)/(auth)/my-positions/page.tsx, loading.tsx — new; the reviewer view, gated by requireManagerOrAdminOr404, with the admin flat-list branch and the manager managed-list branch moved off /positions.
  • app/(main)/positions/page.tsx — stripped to browse-only: getOpenPositions() + getRecentlyClosedPositions() + the viewer's applied-application map (getMyApplicationsByPosition); no admin branch, no managed-position filtering.
  • app/(main)/positions/[id]/page.tsx — back link goes to /my-positions when the viewer can manage the position, /positions otherwise.
  • components/features/position-card.tsx — new optional myApplication prop driving an ApplicationStatusBadge and the applicant CTA (Continue application / Edit & resubmit / View application).
  • components/features/managed-positions-section.tsx — heading is now "Active" (it sits under an H1 that already says "My Positions").
  • components/features/managed-positions-widget.tsx, open-positions-summary.tsx — "See all" / "Manage positions" links → /my-positions; the admin widget's position title now links to the position detail page.
  • components/features/position-danger-zone.tsx — post-delete redirect → /my-positions.
  • components/layouts/nav-items.ts, use-nav-items.ts — new myPositionsNavItem; managers/admins now see Positions under Apply and My Positions under Manage.
  • prisma/data/applications.ts — new getMyApplicationsByPosition(userId).
  • lib/types.ts — new MyPositionApplication.
  • prisma/actions/position-actions.ts/my-positions added alongside every existing /positions revalidation.
  • prisma/actions/applications.tscreateDraftApplication and deleteDraftApplication now also revalidate /positions so the applied marker can't go stale.
  • docs/WORKFLOWS.md — AN-1, AN-2, PM-2, AD-1, PM-3's trigger, and the PM/AD persona intros rewritten; new AP-17; TOC updated.
  • tests/db/authorization.test.ts — caller-scoping test for getMyApplicationsByPosition.

Testing plan

  • Signed out, visit /positions: Open Positions and (if any) Recently Closed render, cards show View Details + Apply, and Apply routes through /login?redirectTo=….
  • Signed out, visit /my-positions: 404.
  • As a plain applicant, visit /my-positions: 404. Sidebar shows Positions and My Applications, no Manage group.
  • As an applicant, start a draft on an open position, reload /positions: card shows Draft badge + Continue application; delete the draft and the badge/button disappear without a manual refresh.
  • Submit that application, reload /positions: Applied badge, View application goes to your /my-applications/[id], no Apply button. Withdraw it → Withdrawn badge + Edit & resubmit while still accepting.
  • As a manager, sidebar shows Positions under Apply and My Positions under Manage; both reachable with correct active state.
  • As a manager on /my-positions: only your positions, "Active" first with stats, "Archived (N)" collapsed if applicable, New position in the header. Create a position → appears here after redirect, never on /positions while a draft.
  • As a manager, /positions now lists the open positions you manage too, with the applicant card (no Edit button).
  • Open /positions/[id] for a position you manage: back link reads "Back to my positions" → /my-positions. Open one you don't manage: "Back to positions" → /positions.
  • As an admin on /my-positions: flat list including drafts, stats on every card, New position. Change a position's status in Edit and return — list reflects it immediately.
  • As an admin, delete a position from /positions/[id]/edit → land on /my-positions, row is gone.
  • Manager dashboard "My Positions → See all" and the admin dashboard's Open Positions links land on /my-positions; the admin widget's position titles open the position detail page.
  • At 320px wide: both pages usable, the two badges wrap, sidebar collapses to the drawer with both nav items present.

Automated checks

  • npm run prettier:check — pass
  • npm run eslint:check — pass
  • npm run tsc:check — pass
  • npm run test:unit — 227 passed (Postgres unavailable in this environment, so tests/db/** — including the new getMyApplicationsByPosition case — could not be run locally; CI runs the full db project)

Notes

  • Route name /my-positions mirrors the flat /my-applications / /applications pair already in the nav, per the plan's stated rationale.
  • /positions/[id] does not split — it stays the single, shareable, generateMetadata'd URL for a position; only its back-link target is viewer-dependent.
  • The applied marker lands on the list only; the detail page's "Apply now" CTA stays unconditional, and the apply page's existing "You've already applied" card remains the guard there — a deliberate follow-up, not an omission.
  • No interaction with Design the Position Edit Policy #398's edit policy beyond location — checkPositionEditable / isPositionActive / ARCHIVED_POSITION_EDIT_ERROR are untouched.

/positions is now purely the applicant browse page for every viewer,
signed in or not, and marks positions the caller already applied to.
The reviewer workbench (create action, active/archived split, stats)
moves to /my-positions, mirroring the flat /my-applications pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@b-at-neu b-at-neu added the claude Will be worked on by Claude label Aug 24, 2026
@b-at-neu b-at-neu self-assigned this Aug 24, 2026
@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aplio Ready Ready Preview Aug 24, 2026 10:06pm

@b-at-neu b-at-neu added ready for review PR ready for review agent reviewing Review agent working (in-flight) and removed ready for review PR ready for review agent labels Aug 24, 2026

@b-at-neu b-at-neu left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Code Review — Cycle 1 · needs revision

1 open — 1 🟡 Low (see inline)

Comment thread prisma/data/applications.ts Outdated
@b-at-neu b-at-neu added needs revision Review found issues that need fixing revising Revise agent working (in-flight) and removed reviewing Review agent working (in-flight) needs revision Review found issues that need fixing labels Aug 24, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@b-at-neu

Copy link
Copy Markdown
Collaborator Author

Revision — Cycle 1

fixed R1-L1 · 433bbd0

@b-at-neu b-at-neu added ready for review PR ready for review agent reviewing Review agent working (in-flight) and removed revising Revise agent working (in-flight) ready for review PR ready for review agent labels Aug 24, 2026

@b-at-neu b-at-neu left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Code Review — Cycle 2 · approved

0 open — clean

@b-at-neu b-at-neu added approved Review passed, ready to merge refresh branch Rebase onto base and force-push to trigger a fresh preview deployment refreshing Revise agent refreshing the branch (in-flight) and removed reviewing Review agent working (in-flight) refresh branch Rebase onto base and force-push to trigger a fresh preview deployment labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Review passed, ready to merge claude Will be worked on by Claude refreshing Revise agent refreshing the branch (in-flight)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Separate The Apply Positions Page From The Manage Positions Page

1 participant