Skip to content

feat: added grade details page - #157

Open
ThomasLucking wants to merge 1 commit into
mainfrom
frontend/grades_details
Open

feat: added grade details page#157
ThomasLucking wants to merge 1 commit into
mainfrom
frontend/grades_details

Conversation

@ThomasLucking

Copy link
Copy Markdown
Collaborator
  • 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

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

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

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

  • Introduces /grades/{grade} and renders GradeDetails.vue.
  • Displays grade metadata, an embedded PDF, and a comment timeline.
  • Adds apprentice and coach/formateur presentation modes.
  • The current route remains disconnected from grade records, authorization, and comment persistence.

How to test manually

  1. Sign in with a verified account on the preview environment.
  2. Open Détail de la note from the navbar and confirm the grade metadata, sample PDF, and existing comments render.
  3. Visit both /grades/1 and a nonexistent value such as /grades/999; verify that the requested record is resolved and that nonexistent or unauthorized grades are rejected rather than showing the same sample.
  4. Test with apprentice, assigned coach/formateur, unassigned coach/formateur, and admin accounts; confirm only authorized users can access the grade and only assigned coaches/formateurs see comment controls.
  5. Publish a comment, reload the page, and revisit the grade; confirm the comment remains attached to the grade.

Confidence Score: 2/5

The 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

Important Files Changed

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

Comment thread routes/web.php
Route::middleware(['auth', 'verified'])->group(function () {
Route::inertia('/', 'Home')->name('home');
Route::inertia('/grades/create', 'CreateGrade')->name('grades.create');
Route::inertia('/grades/{grade}', 'GradeDetails', [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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.

Comment on lines +42 to +56
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 = '';
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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.

Comment on lines +30 to +31
const perspective = ref<'apprentice' | 'coach'>('coach');
const canComment = () => perspective.value === 'coach';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@ThomasLucking

Copy link
Copy Markdown
Collaborator Author

we need to configure greptile so it stops saying that this pr is useless since no backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frontend: Grade detail view (PDF viewer + comments)

1 participant