Skip to content

Commit a07d55d

Browse files
committed
fix: correct PDF link identification logic
Corrects the logic for identifying PDF download links in `GuardianPanelCard.tsx` and `StudentPanelCard.tsx`. Previously, the logic relied on `url.includes('/pdf')`, which was incorrect as the actual routes (`ROUTES.MY_GRADES`, `ROUTES.MY_PRESENCE`) do not contain '/pdf'. The updated logic now explicitly checks if `item.url` matches `ROUTES.MY_GRADES` or `ROUTES.MY_PRESENCE`. Also includes minor formatting fixes as identified by `biome check`.
1 parent 1e755d5 commit a07d55d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/components/RolePanelCards/components/GuardianPanelCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function GuardianPanelCard() {
3535
url = url.replace('{id}', String(profile.student))
3636
}
3737

38-
if (url.includes('/pdf')) {
38+
if (item.url === ROUTES.MY_GRADES || item.url === ROUTES.MY_PRESENCE) {
3939
await openPdfInline(
4040
url,
4141
`${item.title}-${profile.student_details?.full_name}.pdf`,

app/src/components/RolePanelCards/components/StudentPanelCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function StudentPanelCard() {
3535
url = url.replace('{id}', String(profile.id))
3636
}
3737

38-
if (url.includes('/pdf')) {
38+
if (item.url === ROUTES.MY_GRADES || item.url === ROUTES.MY_PRESENCE) {
3939
await openPdfInline(url, `${item.title}-${profile.full_name}.pdf`)
4040
} else {
4141
window.location.href = url

0 commit comments

Comments
 (0)