feat: added grade details page - #157
Conversation
- implemented grade details page with the perspective of apprentice and coach/formateur - added claude.md and components.md to make sure claude does the correct thing - added sample pdf closes #144
Greptile SummaryThis PR adds an authenticated grade-details page, a global navigation entry, a bundled sample PDF, role-perspective controls, and a client-side comment interface. It also adds contributor/component guidance and a pnpm release-age exception.
How to test manually
Confidence Score: 2/5The PR is not safe to merge as a working grade-details feature because it displays fabricated data for every grade URL, ignores record-level permissions, and loses published comments on reload. Three independent behavioral failures remain: the route does not resolve or authorize the requested grade, comment publication is non-persistent, and coach-only controls are determined by a viewer-controlled toggle rather than authenticated permissions. Files Needing Attention: routes/web.php and resources/js/pages/GradeDetails.vue
|
| Filename | Overview |
|---|---|
| routes/web.php | Adds the grade-details route, but ignores its resource parameter and returns the same static payload without record-level authorization. |
| resources/js/pages/GradeDetails.vue | Implements the new details UI, but uses a presentation toggle as permission state and only simulates comment publication locally. |
| resources/js/layouts/MainNavbar.vue | Adds global grade navigation, including a detail link fixed to grade ID 1. |
| pnpm-workspace.yaml | Adds a release-age exception matching the declared and locked @lucide/vue version. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Authenticated user] --> B[Global navbar]
B --> C["/grades/{grade}"]
C --> D[Resolve requested grade]
D --> E{Authorized for grade?}
E -->|No| F[Reject request]
E -->|Yes| G[GradeDetails page]
G --> H[Grade metadata]
G --> I[Submitted PDF]
G --> J[Persisted comments]
J --> K{Assigned coach or trainer?}
K -->|Yes| L[Publish comment]
K -->|No| M[Read-only timeline]
Prompt To Fix All With AI
### Issue 1
routes/web.php:8
**Grade parameter is ignored**
The `{grade}` parameter is never resolved or used. As a result, every authenticated request—including nonexistent grade IDs or IDs belonging to another apprentice—shows the same sample PDF and placeholder details instead of the requested record or an access rejection. Resolve the grade and enforce the documented ownership or assignment boundary.
### Issue 2
resources/js/pages/GradeDetails.vue:42-56
**Published comments are lost**
Publishing a comment only appends it to the local Vue array; it does not send a request or persist anything. The comment appears to be published, but disappears when the user reloads or revisits the page. This action should submit through a persistent endpoint or be clearly presented as a non-interactive preview.
### Issue 3
resources/js/pages/GradeDetails.vue:30-31
**Perspective controls comment access**
Comment eligibility comes from a viewer-controlled perspective toggle that defaults to `coach`, not from the authenticated user's role and assignment. Apprentices and other authenticated users therefore see coach-only controls and can add local comments labeled as coach comments, which contradicts the intended role-specific behavior.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat: added grade details page" | Re-trigger Greptile
| Route::middleware(['auth', 'verified'])->group(function () { | ||
| Route::inertia('/', 'Home')->name('home'); | ||
| Route::inertia('/grades/create', 'CreateGrade')->name('grades.create'); | ||
| Route::inertia('/grades/{grade}', 'GradeDetails', [ |
There was a problem hiding this comment.
The {grade} parameter is never resolved or used. As a result, every authenticated request—including nonexistent grade IDs or IDs belonging to another apprentice—shows the same sample PDF and placeholder details instead of the requested record or an access rejection. Resolve the grade and enforce the documented ownership or assignment boundary.
Prompt To Fix With AI
This is a comment left during a code review.
Path: routes/web.php
Line: 8
Comment:
**Grade parameter is ignored**
The `{grade}` parameter is never resolved or used. As a result, every authenticated request—including nonexistent grade IDs or IDs belonging to another apprentice—shows the same sample PDF and placeholder details instead of the requested record or an access rejection. Resolve the grade and enforce the documented ownership or assignment boundary.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| const submitComment = () => { | ||
| if (!newComment.value.trim()) return; | ||
|
|
||
| comments.value.push({ | ||
| author: 'Vous', | ||
| role: perspective.value === 'coach' ? 'Coach' : 'Apprenti', | ||
| date: new Date().toLocaleDateString('fr-CH', { | ||
| day: '2-digit', | ||
| month: 'short', | ||
| year: 'numeric', | ||
| }), | ||
| text: newComment.value.trim(), | ||
| }); | ||
| newComment.value = ''; | ||
| }; |
There was a problem hiding this comment.
Publishing a comment only appends it to the local Vue array; it does not send a request or persist anything. The comment appears to be published, but disappears when the user reloads or revisits the page. This action should submit through a persistent endpoint or be clearly presented as a non-interactive preview.
Prompt To Fix With AI
This is a comment left during a code review.
Path: resources/js/pages/GradeDetails.vue
Line: 42-56
Comment:
**Published comments are lost**
Publishing a comment only appends it to the local Vue array; it does not send a request or persist anything. The comment appears to be published, but disappears when the user reloads or revisits the page. This action should submit through a persistent endpoint or be clearly presented as a non-interactive preview.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| const perspective = ref<'apprentice' | 'coach'>('coach'); | ||
| const canComment = () => perspective.value === 'coach'; |
There was a problem hiding this comment.
Perspective controls comment access
Comment eligibility comes from a viewer-controlled perspective toggle that defaults to coach, not from the authenticated user's role and assignment. Apprentices and other authenticated users therefore see coach-only controls and can add local comments labeled as coach comments, which contradicts the intended role-specific behavior.
Prompt To Fix With AI
This is a comment left during a code review.
Path: resources/js/pages/GradeDetails.vue
Line: 30-31
Comment:
**Perspective controls comment access**
Comment eligibility comes from a viewer-controlled perspective toggle that defaults to `coach`, not from the authenticated user's role and assignment. Apprentices and other authenticated users therefore see coach-only controls and can add local comments labeled as coach comments, which contradicts the intended role-specific behavior.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
we need to configure greptile so it stops saying that this pr is useless since no backend |
closes #144