3.4 KiB
3.4 KiB
You are a Senior Frontend Engineer.
Project: Training Management System (TMS)
Current task: Fix certificate preview dialog UI based on UAT/management feedback.
Issue: The certificate preview modal close button appears too close to the dialog edge or overflows visually. The certificate image preview also needs better sizing for desktop and mobile.
Important constraints:
- Do NOT change folder structure.
- Do NOT change database schema.
- Do NOT break existing certificate preview/download behavior.
- Reuse existing Dialog / Button / icon components.
- Keep Thai UI.
- Keep responsive/mobile behavior.
- Minimal-impact changes only.
Requirements:
- Fix close button position in certificate preview dialog.
Current issue:
- Close button appears near or outside the top-right edge.
- It looks visually misaligned.
Expected behavior:
- Close button must stay inside the dialog.
- Close button must be easy to click.
- Close button must not overlap the certificate image.
- Close button must work on desktop and mobile.
- Add proper dialog header.
Header text:
- ตัวอย่างเกียรติบัตร
Layout:
- Header title on the left
- Close button on the right
- Divider or spacing before preview content
- Prefer using DialogClose from shadcn/ui.
Example:
- If the current dialog uses absolute positioning:
- Avoid top-0 right-0
- Use top-4 right-4 only if necessary
- Prefer flex justify-between inside header
- Fix image preview sizing.
Image requirements:
- Use object-contain
- Width should not overflow dialog
- Height should not exceed viewport
- Recommended:
- max-h-[70vh]
- w-full
- object-contain
- Fix dialog content sizing.
DialogContent requirements:
- max-w suitable for certificate preview
- max-h-[85vh]
- overflow-y-auto
- padding should not cause overflow
- mobile width should fit screen
Recommended classes:
- w-[calc(100vw-2rem)]
- max-w-3xl
- max-h-[85vh]
- overflow-y-auto
- Keep certificate fallback behavior.
If file is not an image or image fails:
- Show certificate placeholder icon
- Do not show broken image icon
- Apply fix to all certificate preview dialogs/components.
Files likely involved:
- src/features/training-records/components/training-record-certificate-manager.tsx
- src/features/training-records/components/training-record-view-page.tsx
- src/features/training-records/components/training-record-tables/columns.tsx
- src/components/ui/dialog.tsx only if shared dialog styling is causing the issue
- Output Review File
Create: docs/management-change-certificate-dialog-review.md
Include:
- Summary
- Files Changed
- UI Changes
- Dialog Behavior
- Image Sizing
- Mobile/Responsive Notes
- Manual Test Checklist
- Known Limitations
Manual Test Checklist:
- Certificate preview dialog opens correctly.
- Close button stays inside dialog.
- Close button does not overlap image.
- Close button works on desktop.
- Close button works on mobile.
- Large landscape certificate fits inside dialog.
- Portrait certificate fits inside dialog.
- Image does not overflow screen.
- PDF or unsupported file shows certificate placeholder icon.
- Broken image shows certificate placeholder icon.
- Download/open certificate still works.
Return:
- Complete code changes with file paths.
- Content of docs/management-change-certificate-dialog-review.md.