251 frontend build course createedit form page with draft persistence#275
Merged
smattymatty merged 2 commits intomainfrom Feb 13, 2026
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Template CheckAll checks passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build Course Create/Edit Form Page with Draft Persistence
Description
Adds a dedicated course create/edit form page at
/courses/newand/courses/:id/editwith localStorage draft auto-save, unsaved changes protection, and full i18n support.Closes #251
Mandatory Checklist
mainWhat Changed
5 files (3 modified, 2 new)
New Files
src/hooks/useCourseDraft.ts(67 lines)useEditorDraft.tspatternuseCourseDraft(courseId)returning{ loadDraft, saveDraft, clearDraft }CourseFormDataandCourseDrafttypescourse-draft-{id}orcourse-draft-newsrc/pages/CourseFormPage.tsx(623 lines)/courses/new) and edit (/courses/:id/edit) modesid= create, hasid= edit)user_role === "teacher", redirects with error toast if notbeforeunload, React RouteruseBlockerwithUnsavedChangesModal, visual red borders on changed fieldsModified Files
src/App.jsx— Addedcourses/newandcourses/:id/editprotected routes (placed beforecourses/:idto avoid param capture)en.json+ar.json— Added 49course.form.*translation keys each (titles, labels, placeholders, validation messages, toasts, time-ago strings)How to Test
Create Flow
/courses/newEdit Flow
/courses/:id/editfor a course you're a teacher inDraft Persistence
/courses/new— should see "Draft recovered from X ago" toast with your dataUnsaved Changes
Visibility Toggle
Validation
Other
Screenshots (if applicable)