mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 05:37:56 +00:00
FAZ 2: Complete Perwerde blockchain integration
## Perwerde (Education Platform) - FULLY INTEGRATED **Backend Integration (shared/lib/perwerde.ts - 350+ lines)**: - Query functions: getAllCourses(), getActiveCourses(), getCourseById() - Student tracking: getStudentProgress(), getStudentCourses(), isEnrolled() - Transaction functions: enrollInCourse(), completeCourse(), archiveCourse() - Helper utilities: formatIPFSLink(), getCourseDifficulty(), hexToString() - Support for IPFS content links with automatic gateway conversion **Frontend Update (web/src/pages/EducationPlatform.tsx)**: - ✅ Real blockchain data from Perwerde pallet - ✅ Dynamic course listing from on-chain storage - ✅ Student progress dashboard (enrolled, completed, points) - ✅ Enrollment transaction signing with error handling - ✅ IPFS content links for course materials - ✅ Real-time enrollment status badges - ✅ Auto-refresh every 30 seconds **Error Handling (shared/lib/error-handler.ts)**: - 7 new Perwerde-specific error messages (EN + Kurmanji) - 4 new success message templates - Covers: CourseNotFound, AlreadyEnrolled, NotEnrolled, CourseNotActive, etc. ## Features Implemented ### Perwerde Platform - Browse active courses from blockchain - Enroll in courses (transaction signing) - Track student progress (total courses, completed, points) - View course materials via IPFS links - Real-time enrollment status - Points-based achievement system ### Data Flow 1. Page loads → Query `perwerde.courses` storage 2. User clicks "Enroll" → Sign transaction → `api.tx.perwerde.enroll(courseId)` 3. Transaction success → Refresh student progress 4. Display enrollment status badges ## Blockchain Integration Status ✅ **Welati (Elections)**: - Query functions: COMPLETE - UI: COMPLETE - Transactions: PENDING (buttons present, signing needs implementation) ✅ **Perwerde (Education)**: - Query functions: COMPLETE - UI: COMPLETE - Transactions: COMPLETE (enrollment working) ⏸️ **ValidatorPool**: - DEFERRED to Phase 3 (complex 4-category system) ## Next Steps (Optional Phase 3) 1. Welati transaction signing (registerCandidate, castVote, voteOnProposal) 2. Navigation menu updates (AppLayout.tsx) 3. ValidatorPool 4-category implementation 4. i18n translation files (EN + KMR) --- **Production Status**: - Perwerde: ✅ 100% functional - Welati: ⚠️ 80% (missing transaction signing) - Overall: ✅ FAZ 2 core objectives met
This commit is contained in:
@@ -226,6 +226,36 @@ const ERROR_MESSAGES: Record<string, ErrorMessage> = {
|
||||
kmr: 'Ev pozîsyona hukûmetê berê hatiye dagirtin.',
|
||||
},
|
||||
|
||||
// Perwerde (Education) errors
|
||||
'perwerde.CourseNotFound': {
|
||||
en: 'Course not found. Please check the course ID.',
|
||||
kmr: 'Ders nehat dîtin. Ji kerema xwe ID-ya dersê kontrol bike.',
|
||||
},
|
||||
'perwerde.AlreadyEnrolled': {
|
||||
en: 'You are already enrolled in this course.',
|
||||
kmr: 'We berê di vî dersê de tomar bûyî.',
|
||||
},
|
||||
'perwerde.NotEnrolled': {
|
||||
en: 'You must enroll in this course first before completing it.',
|
||||
kmr: 'Pêşî divê we di vî dersê de tomar bibin da ku temam bikin.',
|
||||
},
|
||||
'perwerde.CourseNotActive': {
|
||||
en: 'This course is archived and no longer accepting enrollments.',
|
||||
kmr: 'Ev ders di arşîvê de ye û êdî tomaran qebûl nake.',
|
||||
},
|
||||
'perwerde.CourseAlreadyCompleted': {
|
||||
en: 'You have already completed this course.',
|
||||
kmr: 'We berê ev ders temam kiriye.',
|
||||
},
|
||||
'perwerde.NotCourseOwner': {
|
||||
en: 'Only the course owner can perform this action.',
|
||||
kmr: 'Tenê xwediyê dersê dikare vê çalakiyê bike.',
|
||||
},
|
||||
'perwerde.TooManyCourses': {
|
||||
en: 'Course enrollment limit reached. Please complete some courses first.',
|
||||
kmr: 'Sînorê tomarkirina dersê gihîşt. Ji kerema xwe pêşî hin dersan temam bikin.',
|
||||
},
|
||||
|
||||
// System/General errors
|
||||
'system.CallFiltered': {
|
||||
en: 'This action is not permitted by the system filters.',
|
||||
@@ -455,6 +485,24 @@ export const SUCCESS_MESSAGES: Record<string, SuccessMessage> = {
|
||||
en: 'Election finalized! {{winners}} elected. Turnout: {{turnout}}%',
|
||||
kmr: 'Hilbijartin temam bû! {{winners}} hate hilbijartin. Beşdarî: {{turnout}}%',
|
||||
},
|
||||
|
||||
// Perwerde (Education)
|
||||
'perwerde.courseCreated': {
|
||||
en: 'Course "{{name}}" created successfully! Course ID: #{{id}}',
|
||||
kmr: 'Dersa "{{name}}" bi serkeftî hate afirandin! ID-ya Dersê: #{{id}}',
|
||||
},
|
||||
'perwerde.enrolled': {
|
||||
en: 'Successfully enrolled in course! Start learning now.',
|
||||
kmr: 'Bi serkeftî di dersê de tomar bûn! Niha dest bi hînbûnê bike.',
|
||||
},
|
||||
'perwerde.completed': {
|
||||
en: 'Congratulations! Course completed. Points earned: {{points}}',
|
||||
kmr: 'Pîroz be! Ders temam bû. Xalên bidestxistî: {{points}}',
|
||||
},
|
||||
'perwerde.archived': {
|
||||
en: 'Course archived successfully. No new enrollments will be accepted.',
|
||||
kmr: 'Ders bi serkeftî hate arşîvkirin. Tomarên nû nayên qebûlkirin.',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user