Compare commits

...

1665 Commits

Author SHA1 Message Date
Tiago Ribeiro
2bfb94d01b Merged in develop (pull request #162)
Implemented limit 5 sessions per User
2025-03-05 08:22:28 +00:00
Francisco Lima
df84aaadf4 Merged in limit5SessionsUser (pull request #161)
Implemented limit 5 sessions per User

Approved-by: Tiago Ribeiro
2025-03-05 08:17:05 +00:00
José Lima
2789660e8a Implemented limit 5 sessions per User 2025-03-05 04:42:54 +00:00
Tiago Ribeiro
a78e6eb64f Merged in develop (pull request #160)
Develop
2025-03-04 23:24:59 +00:00
Francisco Lima
6c7d189957 Merged in fixStudentPerformanceFreeze (pull request #159)
FixStudentPerformanceFreeze

Approved-by: Tiago Ribeiro
2025-03-04 23:24:17 +00:00
José Lima
31f2a21a76 reverted unnecessary changes 2025-03-04 23:17:20 +00:00
José Lima
c49b1c8070 Fix student performance freeze and search users in create entities
TODO: pagination in student performance freeze
2025-03-04 23:12:26 +00:00
Tiago Ribeiro
d78654a30f Merged in develop (pull request #158)
Develop
2025-03-04 10:02:57 +00:00
João Correia
655e019bf6 Merged in approval-workflows (pull request #157)
add approved field to exam

Approved-by: Tiago Ribeiro
2025-03-04 01:44:04 +00:00
Tiago Ribeiro
d7a8f496c0 Merged develop into approval-workflows 2025-03-04 01:43:32 +00:00
Joao Correia
5e363e9951 Merge branch 'approval-workflows' of bitbucket.org:ecropdev/ielts-ui into approval-workflows 2025-03-04 00:34:17 +00:00
Joao Correia
3370f3c648 add approved field to exam 2025-03-04 00:33:09 +00:00
João Correia
d77336374d Merged in approval-workflows (pull request #156)
Approval workflows

Approved-by: Tiago Ribeiro
2025-03-03 11:17:40 +00:00
Tiago Ribeiro
e765dea106 Merged develop into approval-workflows 2025-03-03 11:17:17 +00:00
Joao Correia
75fb9490e0 some more slight improvements to exam changes logs 2025-03-02 14:27:17 +00:00
Joao Correia
3ef7998193 order workflows table in descent startDate 2025-03-02 00:21:30 +00:00
Joao Correia
32cd8495d6 add imutable ids to some exam arrays to detect and log changes between two exams. 2025-03-02 00:10:57 +00:00
Joao Correia
4e3cfec9e8 change to a single checkbox filter for all modules 2025-02-27 10:29:35 +00:00
Joao Correia
ba8cc342b1 add filters to show only exams with or without approval 2025-02-26 19:15:20 +00:00
Joao Correia
dd8f821e35 only show workflows where user is assigned to at least one step. 2025-02-26 17:21:37 +00:00
Joao Correia
a4ef2222e2 Keep exam confidential even after approval workflow is completed 2025-02-26 16:51:57 +00:00
Joao Correia
93d9e49358 Merge branch 'develop' into approval-workflows 2025-02-26 16:42:09 +00:00
Francisco Lima
5d0a3acbee Merged in bugfixes-generationdesignchanges (pull request #155)
bugsfixed and design changes for generation 13'' screen

Approved-by: Tiago Ribeiro
2025-02-24 13:38:54 +00:00
José Lima
340ff5a30a bugsfixed and design changes for generation 13'' screen 2025-02-23 18:47:57 +00:00
João Correia
37908423eb Merged in approval-workflows (pull request #154)
Approval Workflows

Approved-by: Tiago Ribeiro
2025-02-20 14:30:24 +00:00
Joao Correia
b388ee399f small refactor 2025-02-20 12:12:00 +00:00
Joao Correia
4ac11df6ae fix examId being cleared when editing approval workflow 2025-02-20 11:27:44 +00:00
Joao Correia
14e2702aca add error message and stop loading if something went wrong while loading exam in approval workflow 2025-02-20 10:40:31 +00:00
Tiago Ribeiro
fec3b51553 Created two new permissions 2025-02-17 10:32:57 +00:00
Tiago Ribeiro
53d6b0dd51 Merged in develop (pull request #153)
Prod Update - 12/02/2025
2025-02-12 09:13:08 +00:00
João Correia
d8386bdd8e Merged in approval-workflows (pull request #152)
Approval workflows

Approved-by: Tiago Ribeiro
2025-02-11 12:09:17 +00:00
Joao Correia
df2f83e496 make access confidential when user submits exam with approval process. make access private upon approval workflow completed. 2025-02-10 13:25:11 +00:00
Joao Correia
e214d8b598 improve edited exam changes again 2025-02-10 11:30:24 +00:00
Joao Correia
c14f16c97a improve edited exam changes printing format 2025-02-09 21:12:29 +00:00
Joao Correia
ca2cf739ee improve edited exam changes printing format 2025-02-09 20:56:55 +00:00
João Correia
d432fb4bc4 Merged in approval-workflows (pull request #151)
Approval workflows

Approved-by: Tiago Ribeiro
2025-02-09 18:44:44 +00:00
Joao Correia
d5bffc9bad Add pagination to approval workflows table and change module styling to match project colors. 2025-02-09 18:10:59 +00:00
Joao Correia
75b4643918 Add button to submit exam without approval process 2025-02-09 17:37:19 +00:00
Joao Correia
9ae6b8e894 make sure admin id is passed to step component if the admin is not assigned to the workflow but approved a step. 2025-02-09 16:55:50 +00:00
Joao Correia
6f6c5a4209 make first step approved by default 2025-02-09 15:44:37 +00:00
Tiago Ribeiro
769b1b39d3 Added the permission 2025-02-09 11:35:52 +00:00
Francisco Lima
4bb12c7f01 Merged in addedAccess-bugfixes (pull request #150)
AddedAccess bugfixes

Approved-by: Tiago Ribeiro
2025-02-09 11:16:24 +00:00
Francisco Lima
a80a342ae2 Merged develop into addedAccess-bugfixes 2025-02-09 04:32:42 +00:00
José Lima
e5e60fcce9 fixed some issues related to build 2025-02-09 04:29:32 +00:00
José Lima
b175d8797e added access variable to exams soo we can distinguish private, public and confidential exams and also bugfixes and improvements 2025-02-09 04:28:34 +00:00
João Correia
f06349e350 Merged in approval-workflows (pull request #149)
filter workflows user can see based on entities

Approved-by: Tiago Ribeiro
2025-02-08 19:35:46 +00:00
Tiago Ribeiro
34caf9986c Merged develop into approval-workflows 2025-02-08 19:35:31 +00:00
Joao Correia
3a3d3d014d filter workflows user can see based on entities 2025-02-08 19:23:42 +00:00
João Correia
c49c303f20 Merged in approval-workflows (pull request #148)
temporary fix for same exam instance being used for all entities and implement approval process skip edge cases

Approved-by: Tiago Ribeiro
2025-02-08 18:03:43 +00:00
Joao Correia
cbe353c2c5 - start only one of the configured workflows (randomly at the moment) for the exam Author.
- skip approval process for admins
2025-02-08 15:26:16 +00:00
Tiago Ribeiro
991adede96 Merged in develop (pull request #147)
Develop
2025-02-07 17:54:57 +00:00
Tiago Ribeiro
f95bce6fa2 Did some fixes related to master corporates 2025-02-07 16:19:47 +00:00
João Correia
1dd6cead9e Merged in workflow-permissions (pull request #146)
Workflow permissions

Approved-by: Tiago Ribeiro
2025-02-07 15:43:34 +00:00
Joao Correia
5a72ebaea1 Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into workflow-permissions 2025-02-07 13:06:59 +00:00
Joao Correia
00d2a7c2ad forgot permissions on [id] view 2025-02-07 12:57:26 +00:00
João Correia
a6e122e82d Merged in approval-workflows (pull request #145)
Fix bug where workflows were being created again after exam edit - and other improvements.

Approved-by: Tiago Ribeiro
2025-02-07 07:41:25 +00:00
Joao Correia
bf2aa29b98 implement workflow permissions 2025-02-06 23:26:21 +00:00
Joao Correia
cf12a4ed4f implement logging of exam edits on workflow's current step 2025-02-06 19:12:18 +00:00
Tiago Ribeiro
8711802b97 Merged develop into approval-workflows 2025-02-06 18:50:07 +00:00
Tiago Ribeiro
36afde8aa4 Created the new permissions as an example 2025-02-06 18:48:31 +00:00
Joao Correia
752881df41 - Fix bug where workflows were being created again after exam update
- Moved createWorkflows function into an helper file instead of a post request.
- Moved the workflow creation logic into the post of exam creation instead of a seperate post in each exam module
2025-02-06 13:16:32 +00:00
Tiago Ribeiro
63604b68e2 Added the permission to update the privacy of an exam 2025-02-06 12:12:34 +00:00
Tiago Ribeiro
d74aa39076 Merge branches 'main' and 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2025-02-06 11:52:16 +00:00
Joao Correia
c3849518fb amend last commit 2025-02-05 19:14:18 +00:00
Joao Correia
7fb5e1a62b fix typo and bug on exam edit. It was throwing an exception if it found an id with the same owners, but should throw when the owners are different. It was also throwing an error if owners was not set in exam. 2025-02-05 18:55:31 +00:00
Joao Correia
4b405297f2 Merge branch 'approval-workflows' into develop 2025-02-05 17:26:58 +00:00
Joao Correia
f0849b9b42 - fix assignees bug after editing active workflow
- only allow corporate+ to configure workflows
- give admins and devs permissions to approve and reject steps even when they are not assigned to them.
- small fixes
2025-02-05 16:50:09 +00:00
Joao Correia
845a5aa9dc fix stale state behaviour 2025-02-05 13:34:47 +00:00
Joao Correia
d48c7b0d03 implement clone in new builder and fix typo 2025-02-05 13:03:42 +00:00
Joao Correia
6692c201e4 instanciate all workflows configured for an exam author based on different entities. 2025-02-05 12:37:53 +00:00
Joao Correia
f4c7961caa implement edit active workflow and do not allow editing on already completed steps 2025-02-05 00:43:49 +00:00
Joao Correia
b215885dc6 - Make isDiagnostic false when all steps of the exam workflow have been approved.
- Implement Load Exam and Edit Exam buttons
2025-02-04 23:22:56 +00:00
Joao Correia
de15eb5ee1 implement initialization of approval workflows on exam creation. 2025-02-04 22:04:58 +00:00
Joao Correia
d3385caaf8 use custom hook to render approval workflows list instead of reloading full page. 2025-02-03 12:52:03 +00:00
Joao Correia
19f2193414 use custom hook to rerender workflow instead of reloading full page. 2025-02-03 12:31:21 +00:00
Joao Correia
d59b654ac2 do not allow empty steps in workflows 2025-02-03 11:34:56 +00:00
Francisco Lima
29b6a02118 Merged in layout-bug-fixes (pull request #144)
Remove unused imports and changed and improved layout design and responsiveness in some components and fixed some bugs.

Approved-by: Tiago Ribeiro
2025-02-03 09:35:25 +00:00
Francisco Lima
b77476dc9a Merged develop into layout-bug-fixes 2025-02-03 00:07:05 +00:00
José Marques Lima
5a685ebe80 Remove unused imports and changed and improved layout design and responsiveness in some components and fixed some bugs. 2025-02-02 23:58:23 +00:00
Joao Correia
835a9bee03 - Filter available form intakers so that no form intaker can be in two workflows at once.
- add getApprovalWorkflowByIntaker to prepare workflow start after exam creation.
- fix builder bug with step keys
- ignore edit view for now because it will only be available for active workflows and not configured workflows.
2025-02-02 22:40:05 +00:00
Joao Correia
16545d2075 refactor workflows api 2025-02-02 11:11:52 +00:00
Joao Correia
b684262759 Fix id handling on update 2025-02-01 23:14:17 +00:00
Joao Correia
ac539332e6 major change on how workflow builder works. It now fetches in edit mode all the currently configured workflows 2025-02-01 22:36:42 +00:00
Francisco Lima
ed87c8b163 Merged in refactor-getserverprops (pull request #143)
Fix Finish page with scores in exams

Approved-by: Tiago Ribeiro
2025-01-31 22:40:29 +00:00
José Marques Lima
e33ab315ad Merge branch 'develop' into refactor-getserverprops 2025-01-31 22:37:36 +00:00
José Marques Lima
1feef5c419 Fix Finish page 2025-01-31 22:34:43 +00:00
Joao Correia
a0229cd971 implement rejection of steps 2025-01-31 20:56:40 +00:00
Joao Correia
662e3b0266 - implement approval of steps
- remove currentStep field from step
- implement save comments on step
- fix _id issue when saving to mongo
2025-01-31 17:01:20 +00:00
Tiago Ribeiro
b9aec7261f Updated the maxPoolSize 2025-01-31 12:26:43 +00:00
Tiago Ribeiro
54a9f6869a Reduced the maxPoolSize 2025-01-31 12:05:39 +00:00
Joao Correia
9de4cba8e8 refactor fetched users into single array and replace Image tag with img 2025-01-31 10:37:14 +00:00
Francisco Lima
7d750dc584 Merged in refactor-getserverprops (pull request #142)
Refactor most getServerProps to make independent requests in parallel and projected the data only to return the necessary fields and changed some functions

Approved-by: Tiago Ribeiro
2025-01-30 20:02:27 +00:00
José Marques Lima
98ba0bfc04 Refactor most getServerProps to fetch independent request in parallel and projected the data only to return the necessary fields and changed some functions 2025-01-30 18:25:42 +00:00
Joao Correia
f89b42c41c remove currentStep from step type 2025-01-30 12:06:13 +00:00
Joao Correia
c968044160 switch to mongo's id handling 2025-01-30 11:50:28 +00:00
Joao Correia
5d727fc528 implement delete workflow 2025-01-30 11:07:13 +00:00
Joao Correia
bdc5ff7797 - edit workflow back-end implementation
- clone workflow back-end implementation
- added loading and redirecting to form submissions
- fixed form intake in progress bug
- fixed rendering bug
2025-01-29 20:49:19 +00:00
Joao Correia
011c6e9e30 Start implementing with back-end. Create workflows completed and fetching workflows on server side as well, to show them in the table. 2025-01-29 17:50:03 +00:00
Joao Correia
42a8ec2f8a small fixes 2025-01-29 15:35:59 +00:00
Francisco Lima
58aebaa66c Merged in ENCOA-316-ENCOA-317 (pull request #141)
Fix login page having a Card

Approved-by: Tiago Ribeiro
2025-01-29 08:59:55 +00:00
José Marques Lima
b69b6e6c77 Fix login page having a Card 2025-01-28 20:31:19 +00:00
Francisco Lima
86af876f01 Merged in ENCOA-316-ENCOA-317 (pull request #140)
Fix entities Page not rendering

Approved-by: Tiago Ribeiro
2025-01-28 09:35:02 +00:00
Tiago Ribeiro
b685259dc7 Merged develop into ENCOA-316-ENCOA-317 2025-01-28 09:30:34 +00:00
José Marques Lima
16b959fb7a Fix entities Page not rendering 2025-01-27 22:06:34 +00:00
Joao Correia
a40ae04aa3 Add workflow table name filter 2025-01-27 12:50:18 +00:00
Francisco Lima
db95fc5681 Merged in ENCOA-316-ENCOA-317 (pull request #139)
ENCOA-316 ENCOA-317

Approved-by: Tiago Ribeiro
2025-01-27 09:27:09 +00:00
Joao Correia
8db47a3962 Filter out empty select inputs on form submission 2025-01-26 14:07:25 +00:00
Joao Correia
ab81a1753d - Implement cloning of workflow
- Entity change will now only clear the assignees instead of the whole workflow
- Fix bug where side panel was showing all workflow assignees instead of just selected step assignees
2025-01-26 04:31:36 +00:00
José Marques Lima
c98af863c3 Merge branch 'develop' of https://bitbucket.org/ecropdev/ielts-ui into ENCOA-316-ENCOA-317 2025-01-25 20:01:52 +00:00
Joao Correia
73610dc273 implement edit workflow 2025-01-25 19:45:39 +00:00
José Marques Lima
37216e2a5a ENCOA-316 ENCOA-317:
Refactor components to remove Layout wrapper and pass it in the App component , implemented a skeleton feedback while loading page and improved API calls related to Dashboard/User Profile
2025-01-25 19:38:29 +00:00
Joao Correia
ac072b0a5a small fixes and animate side panel content 2025-01-25 15:47:33 +00:00
Joao Correia
2c0153e055 Fix animations 2025-01-25 15:10:52 +00:00
Joao Correia
2eff08bf86 Add approval by to step details panel and add text size prop to UserWithProfilePicture component 2025-01-25 04:23:28 +00:00
Joao Correia
f71a7182dd - Refactor of workflow and steps types to differentiate between editView and normalView.
- Added side panel with steps details
2025-01-25 03:44:50 +00:00
Joao Correia
1f7639a30e - initial selected step
- assignees id to name on table view
2025-01-24 17:09:37 +00:00
Joao Correia
41d09eaad8 Make data dynamic in workflow view. Add requester and startDate to workflows. 2025-01-24 14:14:07 +00:00
Joao Correia
f6b0c96b3b Finish Approval Workflow builder for the most part. TODO: implement permissions 2025-01-24 00:33:45 +00:00
Joao Correia
dcd25465fd on workflow builder, only render steps if name and entity are set. reset workflow on entity reset. 2025-01-23 22:56:45 +00:00
Joao Correia
c921d54d50 code refactoring 2025-01-23 22:12:25 +00:00
Joao Correia
a4f60455b5 Render previous select input options when switching between workflows in builder 2025-01-23 17:08:32 +00:00
Joao Correia
a0936cb1a4 Prevent same input on selects from the same step.
Change behaviour of initial step to allow multiple assignees
2025-01-23 15:10:14 +00:00
Joao Correia
aa76c2b54b Work on workflow builder:
- Made number of approvers dynamic with many select inputs as needed
- Tracking approval select input changes with step.assignees
- Fetching teachers and corporates from backend
- Responsive styling when rendering several select inputs
2025-01-23 02:48:25 +00:00
Joao Correia
4e81c08adb fix bug in last commit where all entities would show up on select filter instead of user entities 2025-01-22 18:07:09 +00:00
Joao Correia
4895f00184 Add entityId to workflow. Allow filter workflows based on entityId. Restrict creation of workflows based on user entities. 2025-01-22 16:39:18 +00:00
carlos.mesquita
f727ab4792 Merged in feature/ExamGenRework (pull request #138)
ENCOA-315

Approved-by: Tiago Ribeiro
2025-01-22 08:27:46 +00:00
Carlos-Mesquita
1c75a0e59c ENCOA-315: Small fix and merge 2025-01-22 05:24:49 +00:00
Carlos-Mesquita
e36b24ea3f ENCOA-315 2025-01-22 04:46:24 +00:00
Joao Correia
8f8d5e5640 Work on workflows table 2025-01-22 00:30:14 +00:00
Joao Correia
73e2e95449 work on non editable approval workflow steps view 2025-01-21 20:42:03 +00:00
Joao Correia
48187fc7f2 fix step numbering bug from previous commit and prepare non editable workflow view 2025-01-21 00:10:14 +00:00
Joao Correia
01222b3a13 dynamic list of new workflows in workflow builder and some code refactoring 2025-01-20 23:32:32 +00:00
Francisco Lima
4d788e13b4 Merged in ENCOA-314 (pull request #137)
ENCOA-314

Approved-by: Tiago Ribeiro
2025-01-20 17:15:33 +00:00
Joao Correia
39a397d262 Add progress vertical bars to pipeline steps 2025-01-20 11:44:29 +00:00
José Marques Lima
ae9a49681e ENCOA-314 :
- Implemented Async Select
- Changed Stats Page User fetching to use Async Select and only fetch the User data when it needs
- Changed Record Filter to use Async Select
- Changed useTicketListener to only fetch needed data
- Added Sort/Projection to remove unnecessary data processing.
- Removed some unnecessary data processing.
2025-01-20 02:52:39 +00:00
Joao Correia
50d2841349 Implement reordering of steps 2025-01-19 22:26:02 +00:00
Joao Correia
f485c782f3 Start implementing workflow step form behaviour 2025-01-19 19:23:56 +00:00
Joao Correia
c2c9b3374c Start work on Approval Workflow id page 2025-01-17 20:17:51 +00:00
Joao Correia
66d23b4140 Add local test data, implement [id].tsx for approval workflows 2025-01-17 18:44:52 +00:00
Joao Correia
580e319fb9 start implementation of approval workflows. Add nav, page, empty table, and status filtering 2025-01-17 15:20:46 +00:00
Tiago Ribeiro
205449e1ae Merged in develop (pull request #136)
Develop
2025-01-13 22:44:25 +00:00
carlos.mesquita
4724e98993 Merged in feature/ExamGenRework (pull request #135)
ENCOA-312

Approved-by: Tiago Ribeiro
2025-01-13 22:41:51 +00:00
Carlos-Mesquita
6f9be29cd8 ENCOA-312 2025-01-13 21:02:34 +00:00
carlos.mesquita
d8fafa5cae Merged in feature/ExamGenRework (pull request #134)
ENCOA-311

Approved-by: Tiago Ribeiro
2025-01-13 08:08:19 +00:00
Carlos-Mesquita
ccbbf30058 ENCOA-311 2025-01-13 01:18:19 +00:00
Tiago Ribeiro
387418b9bd Merged in develop (pull request #133)
Develop
2025-01-06 21:32:31 +00:00
carlos.mesquita
715a841483 Merged in feature/ExamGenRework (pull request #132)
Removed a non sense entity ownership classroom name check I added a while back, patched the same entity + same name + same admin query

Approved-by: Tiago Ribeiro
2025-01-06 21:21:05 +00:00
Carlos-Mesquita
f6cd509aa4 Removed a non sense entity ownership classroom name check I added a while back, patched the same entity + same name + same admin query 2025-01-06 20:46:18 +00:00
carlos.mesquita
393b1a6be9 Merged in feature/ExamGenRework (pull request #131)
Feature/ExamGenRework

Approved-by: Tiago Ribeiro
2025-01-06 09:12:01 +00:00
Carlos-Mesquita
bc89f4b9ce ENCOA-310 2025-01-05 22:35:57 +00:00
Carlos-Mesquita
8f77f28aaa ENCOA-309 2025-01-05 21:03:52 +00:00
Carlos-Mesquita
61e07dae95 ENCOA-308 2025-01-05 19:04:08 +00:00
Carlos-Mesquita
0739e044a1 ENCOA-307 2025-01-05 17:46:11 +00:00
Tiago Ribeiro
7f91a92962 Merged in develop (pull request #130)
Develop
2024-12-31 16:44:27 +00:00
Tiago Ribeiro
af9f70880a Bugfix related to the listening audio 2024-12-31 15:47:26 +00:00
Tiago Ribeiro
26fa1691c4 Added the entity name to the classrooms list 2024-12-31 14:04:31 +00:00
Tiago Ribeiro
548163d66c Some improvements in payment record 2024-12-31 11:56:37 +00:00
Tiago Ribeiro
8ff0d16402 Merged in feature/ExamGenRework (pull request #129)
Feature/ExamGenRework
2024-12-30 19:05:18 +00:00
Tiago Ribeiro
4c746b93bc Merged with develop 2024-12-30 19:04:18 +00:00
Tiago Ribeiro
502cc64f99 Updated the exams to work based on entities 2024-12-30 18:48:27 +00:00
Tiago Ribeiro
f64b50df9e Updated part of the payment 2024-12-30 18:39:02 +00:00
Tiago Ribeiro
17154be8bf Updated the expiry date to be based on the expiry date 2024-12-30 15:36:20 +00:00
Tiago Ribeiro
b52259794e ENCOA-298 2024-12-30 11:11:44 +00:00
Carlos-Mesquita
bd9e249704 Unfinished grading attempt at solving it 2024-12-28 03:30:15 +00:00
Carlos-Mesquita
f642e41bfa ENCOA-295 2024-12-26 12:26:17 +00:00
Tiago Ribeiro
7b5d021bf3 Hotfix 2024-12-24 12:40:02 +00:00
Carlos-Mesquita
958f74bd9c Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-12-24 11:53:39 +00:00
Carlos-Mesquita
bac2a08748 ENCOA-289 2024-12-24 11:52:34 +00:00
Tiago Ribeiro
770056e0c4 Improved part of the performance of the dashboards 2024-12-24 10:31:52 +00:00
Tiago Ribeiro
f8e9cfbeff Solved another bug 2024-12-23 16:34:01 +00:00
Tiago Ribeiro
408cfbb500 Bug solved with the Practice Modal 2024-12-23 15:11:20 +00:00
Tiago Ribeiro
2146f57941 Solved a bug 2024-12-23 15:09:35 +00:00
Tiago Ribeiro
e9c961e633 ENCOA-267 2024-12-23 10:18:52 +00:00
Tiago Ribeiro
9cf13e3f26 ENCOA-294 & ENCOA-293 2024-12-23 09:55:03 +00:00
Tiago Ribeiro
f1d97aa6c9 ENCOA-292 2024-12-23 09:38:49 +00:00
carlos.mesquita
d938535d9f Merged in feature/ExamGenRework (pull request #128)
ENCOA-283 or ENCOA-282, I don't know someone deleted the issue

Approved-by: Tiago Ribeiro
2024-12-23 09:37:30 +00:00
Tiago Ribeiro
319da200c6 Merged develop into feature/ExamGenRework 2024-12-23 09:37:16 +00:00
Tiago Ribeiro
345b784daf Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2024-12-23 09:36:19 +00:00
Tiago Ribeiro
1b15a035df ENCOA-286 2024-12-23 09:35:40 +00:00
Carlos-Mesquita
8d7b47312e Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-12-22 21:20:23 +00:00
Carlos-Mesquita
860f1295e5 ENCOA-283 or ENCOA-282, I don't know someone deleted the issue 2024-12-22 21:19:27 +00:00
carlos.mesquita
0cbdba1ab8 Merged in feature/ExamGenRework (pull request #127)
ENCOA-277, ENCOA-276, ENCOA-282, ENCOA-283

Approved-by: Tiago Ribeiro
2024-12-22 11:54:52 +00:00
carlos.mesquita
4ee3724196 Merged develop into feature/ExamGenRework 2024-12-21 19:26:10 +00:00
Carlos-Mesquita
98a1636d0c ENCOA-277, ENCOA-276, ENCOA-282, ENCOA-283 2024-12-21 19:23:53 +00:00
carlos.mesquita
020f65c566 Merged in feature/ExamGenRework (pull request #126)
Removed the exclusion warning when there is only duplicated users as there is already a warning message for that

Approved-by: Tiago Ribeiro
2024-12-16 15:30:10 +00:00
Carlos-Mesquita
f6d387ce2d Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-12-16 14:58:59 +00:00
Carlos-Mesquita
d3d5e59aad Removed the exclusion warning when there is only duplicated users as there is already a warning message for that 2024-12-16 14:56:39 +00:00
Tiago Ribeiro
84f66f0bbb Added possibility for corporates and other to view the entity statistics 2024-12-15 19:01:08 +00:00
carlos.mesquita
8d0f98d186 Merged in feature/ExamGenRework (pull request #125)
ENCOA-274

Approved-by: Tiago Ribeiro
2024-12-14 12:25:32 +00:00
carlos.mesquita
ed9de74f28 Merged develop into feature/ExamGenRework 2024-12-13 21:31:10 +00:00
Carlos-Mesquita
bcf3cf0667 ENCOA-281 2024-12-13 21:29:54 +00:00
Tiago Ribeiro
f3057c675f ENCOA-275 2024-12-13 15:13:27 +00:00
Tiago Ribeiro
61d1bbbe13 ENCOA-268 2024-12-12 16:14:54 +00:00
Tiago Ribeiro
6bb817f9af Stuff with the new corporate 2024-12-12 15:31:24 +00:00
Tiago Ribeiro
3b6836c15a Groups stuff 2024-12-12 15:19:44 +00:00
Tiago Ribeiro
858e29eb93 ENCOA-261 2024-12-12 15:09:56 +00:00
Tiago Ribeiro
240e36f15a ENCOA-279 2024-12-12 15:06:00 +00:00
Tiago Ribeiro
3e74827c47 ENCOA-266 2024-12-12 12:28:57 +00:00
Tiago Ribeiro
578d29066f ENCOA-271 2024-12-12 09:42:21 +00:00
Tiago Ribeiro
1a7d35317b ENCOA-263 2024-12-11 22:00:43 +00:00
Tiago Ribeiro
ce35ba71f4 Improved a bit of the speed of the application 2024-12-11 18:32:29 +00:00
Tiago Ribeiro
76cbf8dc41 ENCOA-269 2024-12-11 17:42:57 +00:00
Tiago Ribeiro
71ed1013b7 ENCOA-270, ENCOA-265, ENCOA-262, ENCOA-258 2024-12-11 16:54:37 +00:00
Carlos-Mesquita
fa0c257040 Fixed a bug from the previous commit, ENCOA-274 2024-12-11 16:09:59 +00:00
carlos.mesquita
cf85b5a822 Merged develop into feature/ExamGenRework 2024-12-11 15:34:09 +00:00
Carlos-Mesquita
efba1939e5 ENCOA-274 2024-12-11 15:28:38 +00:00
Tiago Ribeiro
eabfcd026b ENCOA-273 2024-12-11 14:09:10 +00:00
Tiago Ribeiro
d074ec390c ENCOA-272 2024-12-11 11:58:52 +00:00
carlos.mesquita
6a6c4661c4 Merged in feature/ExamGenRework (pull request #124)
ENCOA-260, ENCOA-259

Approved-by: Tiago Ribeiro
2024-12-11 07:40:52 +00:00
Carlos-Mesquita
7538392e44 ENCOA-260, ENCOA-259 2024-12-09 18:37:51 +00:00
carlos.mesquita
8920eb8441 Merged in feature/ExamGenRework (pull request #123)
ENCOA-257 Fixed FillBlanks MC

Approved-by: Tiago Ribeiro
2024-12-05 21:17:00 +00:00
Carlos-Mesquita
35d28fbff6 Missed a .log 2024-12-05 18:40:59 +00:00
carlos.mesquita
19b6626b71 Merged develop into feature/ExamGenRework 2024-12-05 18:38:01 +00:00
Carlos-Mesquita
8bd8b61041 Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-12-05 18:36:56 +00:00
Carlos-Mesquita
4f32e3cf93 ENCOA-257 Fixed FillBlanks MC 2024-12-05 18:36:04 +00:00
carlos.mesquita
70530b3f6c Merged in feature/ExamGenRework (pull request #122)
ENCOA-224, ENCOA-256: Added the import templates, Speaking didn't have the navbar yet, added multiple choice to reading since they've placed that in the import

Approved-by: Tiago Ribeiro
2024-12-04 09:16:53 +00:00
Tiago Ribeiro
7d08db28aa Merged develop into feature/ExamGenRework 2024-12-04 08:41:01 +00:00
Carlos-Mesquita
3b6fd2bc6b ENCOA-224, ENCOA-256: Added the import templates, Speaking didn't have the navbar yet, added multiple choice to reading since they've placed that in the import 2024-12-04 04:15:31 +00:00
carlos.mesquita
04b2cb3907 Merged in feature/ExamGenRework (pull request #121)
ENCOA-255 Fixed the level import

Approved-by: Tiago Ribeiro
2024-12-03 20:06:49 +00:00
Carlos-Mesquita
ec47d750bf Merge remote-tracking branch 'origin/develop' into feature/ExamGenRework 2024-12-03 12:02:11 +00:00
Carlos-Mesquita
98ed842932 Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-12-03 12:01:10 +00:00
Carlos-Mesquita
5252faafb7 ENCOA-255 Fixed the level import 2024-12-03 12:00:04 +00:00
Tiago Ribeiro
7801a7d05a Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2024-12-03 11:01:03 +00:00
Tiago Ribeiro
a36be67c8b Forgot a permission on the role page 2024-12-03 11:00:20 +00:00
carlos.mesquita
1b97f86a37 Merged in feature/ExamGenRework (pull request #120)
ENCOA-253, ENCOA-248, ENCOA-246

Approved-by: Tiago Ribeiro
2024-12-03 08:36:10 +00:00
carlos.mesquita
444fb15c29 Merged develop into feature/ExamGenRework 2024-12-02 17:23:12 +00:00
Carlos-Mesquita
490c5ad7d3 ENCOA-253, ENCOA-248, ENCOA-246 2024-12-02 17:16:12 +00:00
Tiago Ribeiro
b6f61c6be1 More permissions 2024-12-02 17:12:23 +00:00
Tiago Ribeiro
2e5545f181 Some quick changes to permissions 2024-12-02 17:09:22 +00:00
Tiago Ribeiro
cd14ac537d ENCOA-245 & ENCOA-240 2024-12-02 10:45:12 +00:00
Tiago Ribeiro
24d613e9cd ENCOA-249 2024-12-02 10:00:38 +00:00
Tiago Ribeiro
1f1c2b4aaf ENCOA-251 2024-12-02 09:22:17 +00:00
Tiago Ribeiro
0faa908538 ENCOA-239: Bug: Corporate after viewing assignment the dashboard button forwards the account to the wrong view 2024-11-29 16:20:05 +00:00
Tiago Ribeiro
5cfd2c90b7 ENCOA-242: Bug: Super Admin can't create accounts in the Settings 2024-11-29 16:14:21 +00:00
carlos.mesquita
8efaa67574 Merged in feature/ExamGenRework (pull request #119)
Speaking endpoints and polling fixed

Approved-by: Tiago Ribeiro
2024-11-27 08:25:39 +00:00
Carlos-Mesquita
c90bc271d3 Missed a console.log 2024-11-27 08:12:03 +00:00
Carlos-Mesquita
09e97a28a5 Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-11-27 08:08:50 +00:00
Carlos-Mesquita
a96d4c6e52 Speaking endpoints and polling fixed 2024-11-27 08:04:18 +00:00
carlos.mesquita
432c6ed6fd Merged in feature/ExamGenRework (pull request #118)
Exam Edit on ExamList

Approved-by: Tiago Ribeiro
2024-11-27 07:36:07 +00:00
Tiago Ribeiro
942b2c853c Merged develop into feature/ExamGenRework 2024-11-27 07:35:37 +00:00
Carlos-Mesquita
a2a513077f Exam Edit on ExamList 2024-11-27 02:01:50 +00:00
carlos.mesquita
a0e79f7a5c Merged in feature/ExamGenRework (pull request #117)
Wrong answeredEveryQuestion

Approved-by: Tiago Ribeiro
2024-11-26 23:54:52 +00:00
Carlos-Mesquita
ca5977e78b Wrong answeredEveryQuestion 2024-11-26 23:51:47 +00:00
carlos.mesquita
40d049ad36 Merged in feature/ExamGenRework (pull request #116)
A slash

Approved-by: Tiago Ribeiro
2024-11-26 22:37:30 +00:00
Carlos-Mesquita
dacab73265 Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-11-26 22:35:29 +00:00
Carlos-Mesquita
af5ae2a687 A slash 2024-11-26 22:34:25 +00:00
carlos.mesquita
44da859d30 Merged in feature/ExamGenRework (pull request #115)
More modal patches and a bug in level that I'm still trying to solve

Approved-by: Tiago Ribeiro
2024-11-26 17:25:22 +00:00
Tiago Ribeiro
6a1bc92270 Merged develop into feature/ExamGenRework 2024-11-26 17:25:08 +00:00
Carlos-Mesquita
48d3cfe5f8 Removed the used words check from fillBlanks since allow repetition wasn't implemented and messes up imports 2024-11-26 17:19:01 +00:00
Carlos-Mesquita
4e94773861 More modal patches and a bug in level that I'm still trying to solve 2024-11-26 16:47:26 +00:00
carlos.mesquita
f2941e2ba3 Merged in feature/ExamGenRework (pull request #114)
More navigation bugs and fixed broken modal during transition

Approved-by: Tiago Ribeiro
2024-11-26 15:54:46 +00:00
Carlos-Mesquita
67909c1d7c Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-11-26 15:47:17 +00:00
Carlos-Mesquita
efb153a33d More navigation bugs and fixed broken modal during transition 2024-11-26 15:46:20 +00:00
Tiago Ribeiro
2e96508205 Solved more merge conflicts 2024-11-26 15:42:55 +00:00
Tiago Ribeiro
61b6da749e Updated the packages 2024-11-26 15:37:23 +00:00
Tiago Ribeiro
c6e8d3527d Solved merge conflicts 2024-11-26 15:33:12 +00:00
Tiago Ribeiro
9faf82ee9c Fixed a typo in the records 2024-11-26 15:04:24 +00:00
Carlos-Mesquita
1fc439cb25 Fixed some navigation issues and updated Listening 2024-11-26 14:33:49 +00:00
Carlos-Mesquita
de08164dd8 Merge, do not push to develop yet, Listening.tsx is not updated 2024-11-26 10:33:02 +00:00
Carlos-Mesquita
2ed4e6509e Updated the eval calls to the backend, passed the navigation logic of level to useExamNavigation hook 2024-11-26 09:04:38 +00:00
Tiago Ribeiro
39ff336af5 Rolled back the Speaking avatars 2024-11-25 18:12:36 +00:00
Carlos-Mesquita
bb5326a331 Forgot to stage post merge change 2024-11-25 16:55:24 +00:00
Carlos-Mesquita
a1501d6c23 Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-11-25 16:54:24 +00:00
Carlos-Mesquita
114da173be Navigation rework, added prompt edit to components that were missing 2024-11-25 16:50:46 +00:00
Tiago Ribeiro
bce3a25dc2 Added new permission types 2024-11-25 11:22:58 +00:00
Tiago Ribeiro
47762544fc Fixed a problem where users were being redirected to the dashboard 2024-11-25 10:33:37 +00:00
Tiago Ribeiro
55a03b283f Updated the Finish screen to also show the practice score 2024-11-25 10:32:15 +00:00
Tiago Ribeiro
e5087d4d58 Updated the look of the Entities and Classrooms selectors 2024-11-25 10:15:16 +00:00
Tiago Ribeiro
2160a42964 Corrected a problem related to the permission toggling 2024-11-25 09:47:17 +00:00
Tiago Ribeiro
593d349617 Updated the entities roles to disallow users from updating their own role 2024-11-23 18:57:05 +00:00
Tiago Ribeiro
a6bd3a9f3b Added new columns to the statistical page 2024-11-23 12:18:39 +00:00
Tiago Ribeiro
f6fc701fb7 Added the statistical page as a permission based page 2024-11-22 17:20:09 +00:00
Tiago Ribeiro
50bbb0dacf Updated the grading system to work based on entities 2024-11-22 15:36:21 +00:00
Tiago Ribeiro
f301001ebe Revamped the statistical page to work with the new entity system, along with some other improvements to it 2024-11-21 15:37:53 +00:00
Tiago Ribeiro
0eed8e4612 Corrected the behaviour of the exam after the timer has ended 2024-11-20 10:26:59 +00:00
Tiago Ribeiro
e6d77af53f Updated the score to be reflective of the ungraded questions 2024-11-19 16:21:08 +00:00
Tiago Ribeiro
bb24fe3c6d Quick fix related to the back button of the Listening Exam 2024-11-18 15:28:51 +00:00
Tiago Ribeiro
4f60819dcc Updated the PracticeBadge 2024-11-16 18:19:11 +00:00
Tiago Ribeiro
501606233f Created a simple Practice Badge to showcase when an exercise is a practice exercise 2024-11-16 12:03:08 +00:00
Tiago Ribeiro
d564d86feb Updated the Assignment View to ignore practice questions 2024-11-15 16:02:43 +00:00
carlos.mesquita
c067e26e0c Merged in feature/ExamGenRework (pull request #112)
Added listening import, part divider was showing between questions because it was with exerciseIndex instead of partIndex, fixed a reorder bug when deleting questions

Approved-by: Tiago Ribeiro
2024-11-15 11:21:40 +00:00
carlos.mesquita
e40f880342 Merged develop into feature/ExamGenRework 2024-11-15 10:54:05 +00:00
Carlos-Mesquita
e9b7bd14cc Added listening import, part divider was showing between questions because it was with exerciseIndex instead of partIndex, fixed a reorder bug when deleting questions 2024-11-15 02:51:27 +00:00
carlos.mesquita
2e5c4295dc Merged in feature/ExamGenRework (pull request #111)
Added Speaking to level, fixed a bug where it was causing level to crash if the listening was already created and the section was switched, added true false exercises to listening
2024-11-14 11:12:01 +00:00
Tiago Ribeiro
ba71995ace Redirect to dashboard instead of /exam 2024-11-14 08:41:16 +00:00
Carlos-Mesquita
a18bdfcef6 Merge remote-tracking branch 'origin/develop' into feature/ExamGenRework 2024-11-13 20:38:22 +00:00
Carlos-Mesquita
07e03c8981 Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-11-13 20:34:10 +00:00
Carlos-Mesquita
8cb09e349f Added Speaking to level, fixed a bug where it was causing level to crash if the listening was already created and the section was switched, added true false exercises to listening 2024-11-13 20:32:59 +00:00
Tiago Ribeiro
70a461bc69 Continuation of the bug solving 2024-11-13 09:56:08 +00:00
Tiago Ribeiro
6aa5385939 Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2024-11-13 09:13:04 +00:00
Tiago Ribeiro
49749bfbe9 Solved a bug related to the partial exams 2024-11-13 09:12:30 +00:00
carlos.mesquita
69d0b2bdf4 Merged in feature/ExamGenRework (pull request #110)
isPractice hotfix

Approved-by: Tiago Ribeiro
2024-11-12 18:14:31 +00:00
carlos.mesquita
9000ca9001 Merged develop into feature/ExamGenRework 2024-11-12 17:54:43 +00:00
Carlos-Mesquita
153d7f5448 isPractice hotfix 2024-11-12 17:53:16 +00:00
carlos.mesquita
6f5f53d564 Merged in feature/ExamGenRework (pull request #109)
Feature/ExamGenRework

Approved-by: Tiago Ribeiro
2024-11-12 17:00:12 +00:00
Carlos-Mesquita
311036fe86 Only hooked up the section state had forgot to plugin into Header's isEvaluationEnabled 2024-11-12 15:10:23 +00:00
Carlos-Mesquita
49c63544a1 Wasn't staged :/ 2024-11-12 14:39:30 +00:00
Carlos-Mesquita
36c3bb4392 Commented Speaking from level for the time being 2024-11-12 14:34:40 +00:00
Carlos-Mesquita
1cc068db3e Merge remote-tracking branch 'origin/develop' into feature/ExamGenRework 2024-11-12 14:28:51 +00:00
Carlos-Mesquita
fdf411d133 ENCOA-228 Now when user navigates between modules the generation items persist. Reading, listening and writing added to level module 2024-11-12 14:17:54 +00:00
Tiago Ribeiro
b2dc9b2e31 ENCOA-233: Added the option for certain exercises to not count towards scores 2024-11-12 11:03:19 +00:00
Tiago Ribeiro
1787e3ed53 ENCOA-222 & ENCOA-223
ENCOA-222: Added an option for non-assignment exams to view the
transcript of a Listening audio;

ENCOA-223: Updated the Listening exam to show all of the
exercises/questions of each part on a single page;
2024-11-11 19:14:16 +00:00
Tiago Ribeiro
711a0743c2 ENCOA-234: Changed the login page when a user is going into the /official-exam 2024-11-11 10:26:24 +00:00
carlos.mesquita
0a3a00cd3f Merged in feature/ExamGenRework (pull request #108)
Feature/ExamGenRework

Approved-by: Tiago Ribeiro
2024-11-10 10:47:17 +00:00
Carlos-Mesquita
696c968ebc Merge remote-tracking branch 'origin/develop' into feature/ExamGenRework 2024-11-10 07:09:25 +00:00
Carlos-Mesquita
af21ff2f20 Merge remote-tracking branch 'origin/develop' into feature/ExamGenRework 2024-11-10 06:56:26 +00:00
Carlos-Mesquita
4219341951 Leftovers from the previous commit 2024-11-10 06:19:19 +00:00
Carlos-Mesquita
322d7905c3 Reverted Level to only utas placement test exercises, Speaking, bug fixes, placeholder 2024-11-10 04:24:23 +00:00
Tiago Ribeiro
a010a630ac Removed a console.log 2024-11-10 00:18:47 +00:00
Tiago Ribeiro
7ac15fc767 Removed the autoStartDate and replaced it with the current startDate 2024-11-10 00:13:09 +00:00
Tiago Ribeiro
042b07c267 Removed redirection from the official-exam to records 2024-11-09 18:11:18 +00:00
Carlos-Mesquita
c507eae507 Forgot to stage it 2024-11-09 06:53:17 +00:00
Tiago Ribeiro
f0a97d42a4 Updated the generation page to now work with the entity permission system 2024-11-08 09:44:28 +00:00
Tiago Ribeiro
065497dfa3 Updated the code to return to official-exam if they came from that page 2024-11-07 22:51:45 +00:00
Tiago Ribeiro
7ae91d7bc1 Updated some troubles related to the Level Exam 2024-11-07 14:55:44 +00:00
Tiago Ribeiro
78cf011bf7 Solved a problem with the assignees stuff related to the query 2024-11-07 12:51:14 +00:00
Tiago Ribeiro
fae7b729fe Updated the assignments active filter to work with the startDate 2024-11-07 12:08:28 +00:00
Tiago Ribeiro
0325bb68f5 Added the audio player to the level exam 2024-11-07 11:17:05 +00:00
Carlos-Mesquita
50481a836e Now only when the user submits the listening exam are the mp3 are uploaded onto firebase bucket 2024-11-07 11:06:33 +00:00
Tiago Ribeiro
bead6d98ae Updated the official exam to hide the sidebar during an assignment 2024-11-07 09:53:08 +00:00
Tiago Ribeiro
55737781bc Quick update to the official exam page 2024-11-06 23:33:51 +00:00
carlos.mesquita
4ce208281d Merged in feature/ExamGenRework (pull request #107)
Feature/ExamGenRework

Approved-by: Tiago Ribeiro
2024-11-06 22:40:48 +00:00
Tiago Ribeiro
0741c4c647 Merged develop into feature/ExamGenRework 2024-11-06 22:40:34 +00:00
Carlos-Mesquita
dc8f00c318 When merging forgot to place entities as optional and = [] 2024-11-06 20:22:21 +00:00
Carlos-Mesquita
7045b4e3c7 Ts changes weren't staged, it compiles still doesnt build building 2024-11-06 19:49:02 +00:00
Carlos-Mesquita
a371b171bb Merge branch 'feature/ExamGenRework' of https://bitbucket.org/ecropdev/ielts-ui into feature/ExamGenRework 2024-11-06 19:44:58 +00:00
Carlos-Mesquita
5165b6ae6d Listening Convo Edit and a bunch of ts errors 2024-11-06 19:43:06 +00:00
carlos.mesquita
817100b0e4 Merged in feature/ExamGenRework (pull request #106)
Feature/ExamGenRework

Approved-by: Tiago Ribeiro
2024-11-06 15:48:05 +00:00
Tiago Ribeiro
7de860ad44 Merged develop into feature/ExamGenRework 2024-11-06 14:53:02 +00:00
Tiago Ribeiro
27b72c162b Created a page the client wanted to start and resume assignments as a student 2024-11-06 11:42:35 +00:00
Carlos-Mesquita
b5ac908d09 Merge with develop 2024-11-06 10:59:26 +00:00
Carlos-Mesquita
b50913eda8 Listening preview and some more patches 2024-11-06 09:23:34 +00:00
Carlos-Mesquita
ffa2045a2d Blanks Exercises were removing the blanks on the editor and text but not on solutions, added submit and preview to writing and reading 2024-11-05 17:53:55 +00:00
Tiago Ribeiro
f686985c6e ENCOA-220: Assignment exams were being merged 2024-11-05 11:43:49 +00:00
Tiago Ribeiro
e8b56485ee ENCOA-217: Adapted the invite system to now work based on Entities instead of Users/Groups 2024-11-05 10:40:33 +00:00
Tiago Ribeiro
df41611093 ENCOA-219: Hide System exams from non-admin users 2024-11-05 09:50:13 +00:00
Tiago Ribeiro
54c5b2063b ENCOA-216: Added a button to remove inactive assignees 2024-11-05 09:43:26 +00:00
Tiago Ribeiro
225640ad8a Some more changes I guess 2024-11-04 23:48:49 +00:00
Tiago Ribeiro
7dacc69321 Removed some verification 2024-11-04 23:46:52 +00:00
Tiago Ribeiro
e6f9d9b79a Sidebar generation page 2024-11-04 23:46:18 +00:00
Tiago Ribeiro
b5a40ea220 Tiny improvements 2024-11-04 23:36:29 +00:00
Carlos-Mesquita
15c9c4d4bd Exam generation rework, batch user tables, fastapi endpoint switch 2024-11-04 23:29:14 +00:00
Tiago Ribeiro
774f5e72c0 Quick fix to solve a problem related to timezone regarding the assignments 2024-11-04 16:30:13 +00:00
Tiago Ribeiro
a502b2b863 Added a button to enable complete exams 2024-11-04 10:27:50 +00:00
Tiago Ribeiro
dc4694eb17 Made it so for planned assignments, if the user is allowed to view but not edit, they can view it 2024-11-01 16:44:36 +00:00
Tiago Ribeiro
ce353f34c7 I think I solved a bit of the time ended 2024-11-01 10:38:10 +00:00
Tiago Ribeiro
a2bc997e8f Tiny change because of private exams 2024-10-31 16:01:50 +00:00
Tiago Ribeiro
f29daa0d94 Improved part of the assignments pages 2024-10-31 10:42:35 +00:00
Tiago Ribeiro
28c5d13682 Some quick hotfixes 2024-10-31 10:34:37 +00:00
Tiago Ribeiro
35ca933339 Updated the batch user creation to work without corporate 2024-10-29 11:09:07 +00:00
Tiago Ribeiro
dd94f245eb Updated the assignment creation e-mail to send the URL for the assignment directly 2024-10-29 10:26:18 +00:00
Tiago Ribeiro
ef857fee59 Continued with clearing more of the team's requests 2024-10-28 15:35:57 +00:00
Tiago Ribeiro
fa0c502467 Cleared of the stuff the EnCoach team wanted changed 2024-10-28 14:40:26 +00:00
Tiago Ribeiro
0becd295b0 Fixed the thing with the entity users 2024-10-18 17:49:03 +01:00
Tiago Ribeiro
184a5fd820 Added the entity to the classroom 2024-10-18 14:33:08 +01:00
Tiago Ribeiro
70a027f85b Quick fix 2024-10-18 14:24:47 +01:00
Tiago Ribeiro
87d7d6f12b Added more filters to the classroom 2024-10-17 22:41:20 +01:00
Tiago Ribeiro
4917583c67 Created a system to go directly to an assignment from a URL 2024-10-17 18:24:39 +01:00
Tiago Ribeiro
a0a9402945 Updated entities 2024-10-17 16:18:50 +01:00
Tiago Ribeiro
22b8aed127 Continued with the entities for the batch users 2024-10-17 12:02:35 +01:00
Tiago Ribeiro
532b49165c Fixed a problem with the update of a user 2024-10-17 08:45:18 +01:00
Tiago Ribeiro
1fb7343aa7 Solved some issues with the redirect as well as adding a way to create entities 2024-10-16 10:23:59 +01:00
Tiago Ribeiro
de31f77181 Merge branch 'group-entity-permissions-revamping' into develop 2024-10-11 10:50:04 +01:00
Tiago Ribeiro
a53ee79c0a Continued creating the permission system 2024-10-11 10:47:35 +01:00
Tiago Ribeiro
55204e2ce1 Started implementing the roles permissions 2024-10-10 19:13:18 +01:00
Tiago Ribeiro
c43ab9a911 Continued with the transformation of the Entities 2024-10-08 10:44:57 +01:00
Tiago Ribeiro
1ef4efcacf Continued updating the code to work with entities better 2024-10-07 15:49:58 +01:00
Tiago Ribeiro
b5200c88fc Updated the dashboard to the v2 version 2024-10-03 11:32:43 +01:00
Tiago Ribeiro
3d4a604aa2 Started working on the assignments page 2024-10-02 19:20:05 +01:00
Tiago Ribeiro
9f1f564e25 Merged in develop (pull request #105)
Develop
2024-10-01 16:52:32 +00:00
carlos.mesquita
8adacc51a6 Merged in bugfix/mongo-migration-bugs (pull request #104)
Added back the demographic view

Approved-by: Tiago Ribeiro
2024-10-01 16:52:00 +00:00
Tiago Ribeiro
564e6438cb Continued creating the entity system 2024-10-01 17:39:43 +01:00
Carlos-Mesquita
3c1c4489f8 Updated user had only demographicInformation and was causing the diagnostic view to not show up after submitting the info 2024-10-01 17:11:04 +01:00
Carlos-Mesquita
044ec8d966 Added back the demographic view 2024-10-01 15:34:56 +01:00
Tiago Ribeiro
bae02e5192 Improved the data refresh 2024-09-25 16:23:14 +01:00
Tiago Ribeiro
dd94228672 Created a new system for the Groups that will persist after having entities 2024-09-25 16:18:43 +01:00
carlos.mesquita
8c392f8b49 Merged in bugfix/mongo-migration-bugs (pull request #103)
Bugfix/mongo migration bugs

Approved-by: Tiago Ribeiro
2024-09-23 07:40:57 +00:00
Carlos Mesquita
07c9074d15 More bugs, some updates where not using set 2024-09-23 01:09:34 +01:00
Carlos Mesquita
71bac76c3a More mongodb migration bugs, remove _id from find, and a stat endpoint firebase leftover bug 2024-09-23 00:04:06 +01:00
carlos.mesquita
fb293dc98c Merged main into bugfix/mongo-migration-bugs 2024-09-22 22:47:23 +00:00
Tiago Ribeiro
3ce97b4dcd Removed sorting in exchange for filtering 2024-09-11 16:33:05 +01:00
Tiago Ribeiro
7bfd000213 Solved a problem where it was only getting the first 25 students 2024-09-11 11:29:48 +01:00
Tiago Ribeiro
2a10933206 Solved some problems with the excel of master statistical 2024-09-10 12:00:14 +01:00
Tiago Ribeiro
33a46c227b Solved a bug for the master statistical 2024-09-10 10:55:02 +01:00
Tiago Ribeiro
5153c3d5f1 Merge branch 'main' into develop 2024-09-09 17:52:04 +01:00
Tiago Ribeiro
85c8f622ee Added Student ID to the Master Statistical 2024-09-09 14:43:05 +01:00
Tiago Ribeiro
b9c097d42c Had a bug in pagination 2024-09-09 09:07:30 +01:00
Tiago Ribeiro
192132559b Solved a problem with the download of the excel 2024-09-09 08:19:32 +01:00
Tiago Ribeiro
6d1e8a9788 Had some errors on updating groups 2024-09-09 00:06:51 +01:00
Tiago Ribeiro
1c61d50a5c Improved some of the querying for the assignments 2024-09-09 00:02:34 +01:00
Tiago Ribeiro
9f0ba418e5 Added filtering and pagination for the assignment creator 2024-09-08 23:24:27 +01:00
Tiago Ribeiro
6fd2e64e04 Merge branch 'main' of bitbucket.org:ecropdev/ielts-ui 2024-09-08 23:09:25 +01:00
carlos.mesquita
2c01e6b460 Merged in feature/training-content (pull request #101)
Feature/training content

Approved-by: Tiago Ribeiro
2024-09-08 22:08:32 +00:00
Tiago Ribeiro
6e0c4d4361 Added search per exam 2024-09-08 23:07:47 +01:00
Tiago Ribeiro
745eef981f Added some more pagination 2024-09-08 23:02:48 +01:00
carlos.mesquita
7a33f42bcd Merged main into feature/training-content 2024-09-08 21:49:22 +00:00
Carlos Mesquita
02564c8426 Had the type hardcoded 2024-09-08 22:47:43 +01:00
Tiago Ribeiro
eab6ab03b7 Not shown when not completed 2024-09-08 22:46:09 +01:00
Carlos Mesquita
6f534662e1 Shuffles bugfix 2024-09-08 22:45:24 +01:00
Tiago Ribeiro
fbc7abdabb Solved a bug 2024-09-08 22:35:14 +01:00
Tiago Ribeiro
392eac2ef9 Merge branch 'main' into develop 2024-09-08 19:57:57 +01:00
Tiago Ribeiro
b7349b5df8 Tried to solve some more issues with counts 2024-09-08 19:56:44 +01:00
Tiago Ribeiro
298901a642 Updated the UserList to show the corporates 2024-09-08 19:50:59 +01:00
Tiago Ribeiro
88eafafe12 Stopped sessions from being cached 2024-09-08 19:36:04 +01:00
Tiago Ribeiro
31a01a3157 Allow admins create other admins 2024-09-08 19:27:12 +01:00
Tiago Ribeiro
a5b3a7e94d Solved a problem with the _id 2024-09-08 19:25:14 +01:00
Tiago Ribeiro
49e8237e99 A bit of error handling I guess 2024-09-08 18:54:44 +01:00
Tiago Ribeiro
d5769c2cb9 Updated more of the page 2024-09-08 18:39:52 +01:00
Tiago Ribeiro
e49a325074 Had a small error on the groups 2024-09-08 18:00:47 +01:00
Tiago Ribeiro
e6528392a2 Changed the totals of the admin pretty much 2024-09-08 16:06:54 +01:00
Joao Ramos
a073ca1cce Temporarily disabled Play Again button 2024-09-08 13:56:08 +01:00
Tiago Ribeiro
620e4dd787 Solved some problems, bypassed some stuff 2024-09-08 11:35:09 +01:00
João Ramos
7e30ca5750 Merged in bug-fixing-8-sep-24_2 (pull request #100)
Bug fixing 8 sep 24 2

Approved-by: Tiago Ribeiro
2024-09-08 09:22:05 +00:00
João Ramos
e3847baadb Merged in bug-fixing-8-sep-24 (pull request #99)
Bug fixing 8 sep 24

Approved-by: Tiago Ribeiro
2024-09-08 09:21:53 +00:00
Joao Ramos
2e065eddcb Added an workaround for the broken email system 2024-09-08 10:19:49 +01:00
Joao Ramos
4e91b2f1fb ENCOA-202: Fixed issue updating user 2024-09-08 10:08:24 +01:00
Joao Ramos
5b8631ab6a Readded master statistical to corporate 2024-09-08 01:30:12 +01:00
Joao Ramos
f9f29eabb3 Fixed an issue after merging 2024-09-08 01:23:56 +01:00
Tiago Ribeiro
898edb152f Moved the Dockerfile env 2024-09-07 23:59:58 +01:00
Tiago Ribeiro
bf0d696b2f Some hard coding at least for now 2024-09-07 23:51:04 +01:00
Tiago Ribeiro
d91b1c14e7 Removed an error 2024-09-07 23:41:01 +01:00
Tiago Ribeiro
cdd42b2f07 Merge branch 'main' into migration-mongodb 2024-09-07 23:09:37 +01:00
João Ramos
34bc9df9ea Merged in ENCOA-200_StatisticalCorporate (pull request #97)
ENCOA-200: Added Master Statistical to Corporate

Approved-by: Tiago Ribeiro
2024-09-07 21:57:22 +00:00
Tiago Ribeiro
15cc7c8cc9 Improved a bit of the pagination 2024-09-07 22:48:52 +01:00
Carlos Mesquita
b4ab620c78 lint warnings 2024-09-07 22:42:22 +01:00
Carlos Mesquita
6e4ef249b8 Finished refactoring 2024-09-07 22:39:14 +01:00
Carlos Mesquita
c2b4bb29d6 Refactored /api/users 2024-09-07 21:50:29 +01:00
Carlos Mesquita
cab469007b Refactored /api/tickets /api/training 2024-09-07 21:25:51 +01:00
Carlos Mesquita
d6782bd86e Refactored /api/paypal, /api/permissions, /api/reset /api/sessions, /api/stats 2024-09-07 20:43:55 +01:00
Tiago Ribeiro
6251f8f4db Continued migrating more and more files 2024-09-07 18:29:20 +01:00
Joao Ramos
fb9d11f38d ENCOA-200: Added Master Statistical to Corporate 2024-09-07 18:19:25 +01:00
Carlos Mesquita
bb8dca69cf Merge conflict 2024-09-07 18:09:14 +01:00
Carlos Mesquita
53b31b306d /api/packages refactored, forgot to commit some changes 2024-09-07 18:08:03 +01:00
Tiago Ribeiro
d173cdb02a Updated the Grading System 2024-09-07 18:00:05 +01:00
Tiago Ribeiro
07f0ea25bb Merge branch 'migration-mongodb' of bitbucket.org:ecropdev/ielts-ui into migration-mongodb 2024-09-07 17:55:33 +01:00
Carlos Mesquita
e7ee55d608 Merge branch 'migration-mongodb' of https://bitbucket.org/ecropdev/ielts-ui into migration-mongodb 2024-09-07 17:54:19 +01:00
Carlos Mesquita
7fa4edf37d /api/groups and /api/invites refactored, fixed some inserts/updates in which I didn't include the id 2024-09-07 17:54:10 +01:00
Tiago Ribeiro
49022394b0 Did the same treatment to Corporate and Teacher dashboards 2024-09-07 17:53:16 +01:00
Tiago Ribeiro
3be0d158e3 Improved the performance of the MasterCorporate 2024-09-07 17:34:41 +01:00
Tiago Ribeiro
56f374bbfe Updated the pagination on the useUsers and migrading the grading 2024-09-07 16:53:58 +01:00
Carlos Mesquita
417c9176fe /api/exam refactor 2024-09-07 16:39:07 +01:00
Carlos Mesquita
e3400e8564 /api/evaluate refactor 2024-09-07 16:17:24 +01:00
Carlos Mesquita
d680905a87 Merge branch 'migration-mongodb' of https://bitbucket.org/ecropdev/ielts-ui into migration-mongodb 2024-09-07 16:03:32 +01:00
Carlos Mesquita
c07e3f86fb Refactored discounts and replaced my previous commit id queries to use id not _id 2024-09-07 16:03:26 +01:00
Tiago Ribeiro
238a25aaeb Updated the make_user to use MongoDB 2024-09-07 16:01:03 +01:00
Carlos Mesquita
171231cd21 Refactored codes 2024-09-07 15:41:09 +01:00
Carlos Mesquita
6ed342bb6f Merge branch 'migration-mongodb' of https://bitbucket.org/ecropdev/ielts-ui into migration-mongodb 2024-09-07 15:15:17 +01:00
Carlos Mesquita
6f7ef1abef Refactored pages/api/assignments to mongodb 2024-09-07 15:13:41 +01:00
Tiago Ribeiro
e33fa00fa3 Updated the groups and users 2024-09-07 15:13:13 +01:00
Tiago Ribeiro
c0b814081e Updated the register endpoint to use MongoDB 2024-09-07 13:58:52 +01:00
Tiago Ribeiro
e8b7c5ff80 Started migrating the DB to MongoDB 2024-09-07 13:37:08 +01:00
Tiago Ribeiro
8c94bcac52 Corrected a problem with too many participants 2024-09-07 13:02:47 +01:00
carlos.mesquita
8803a8c166 Merged in feature/training-content (pull request #95)
ENCOA-69: Training update, most of the styles in the old tips were standardized, before all the styles were hardcoded into the tip
2024-09-07 11:42:06 +00:00
João Ramos
2f63fd196b Merged in ENCOA-183_MasterCorporateGrouping (pull request #96)
ENCOA-183 MasterCorporateGrouping

Approved-by: Tiago Ribeiro
2024-09-07 11:41:29 +00:00
Joao Ramos
42471170ce Improved grouping for master statistical 2024-09-07 12:38:28 +01:00
Carlos Mesquita
2bf9afca9c Merge remote-tracking branch 'origin/develop' into feature/training-content 2024-09-07 11:38:18 +01:00
Carlos Mesquita
9c41ddee60 Training update, most of the styles in the old tips were standardized, before all the styles were hardcoded into the tip, the new tips may still have some hardcoded styles but the vast majority only uses standard html or custom ones that are picked up in FormatTip to attribute styles 2024-09-07 11:37:04 +01:00
Joao Ramos
9993c7a8a7 ENCOA-183: Initial test changes for corporates grouped by name 2024-09-07 11:04:00 +01:00
João Ramos
a22c9d102f Merged in ENCOA-131_MasterStatistical (pull request #94)
Added level part display on excel and a pseudo sorting

Approved-by: Tiago Ribeiro
2024-09-07 08:13:29 +00:00
Joao Ramos
2d0cb8eefb Added level part display on excel and a pseudo sorting 2024-09-07 00:14:56 +01:00
Joao Ramos
58448a391f Fixed infinite loop on the dashboards 2024-09-06 23:48:18 +01:00
Tiago Ribeiro
f6550e6a36 Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2024-09-06 17:07:45 +01:00
Tiago Ribeiro
cfe297cc38 Continued improving this 2024-09-06 17:06:49 +01:00
Tiago Ribeiro
4530e4079f Did the same to all of the dashboards 2024-09-06 15:35:26 +01:00
Tiago Ribeiro
de35e1a8b7 Updated the MasterCorporate with the improved queries 2024-09-06 14:57:23 +01:00
Tiago Ribeiro
a6bf53e84c Disabled the review buttons 2024-09-06 14:45:44 +01:00
carlos.mesquita
d7ffdc3031 Merged in feature/level-file-upload (pull request #93)
Small bug fix

Approved-by: Tiago Ribeiro
2024-09-06 10:24:12 +00:00
carlos.mesquita
98f2527fed Merged develop into feature/level-file-upload 2024-09-06 10:23:32 +00:00
Carlos Mesquita
d8bf10eaea Small bug fix 2024-09-06 11:21:35 +01:00
Tiago Ribeiro
f9216637df Extracted the function 2024-09-06 10:39:16 +01:00
Tiago Ribeiro
08945bfbdd Forgot to add this one 2024-09-06 10:13:30 +01:00
Tiago Ribeiro
b92a4285c9 Removed the user itself 2024-09-06 10:12:19 +01:00
Tiago Ribeiro
271ca7069e Updated it so it also appears to teachers 2024-09-06 10:10:50 +01:00
carlos.mesquita
08ed8fcb32 Merged in feature/level-file-upload (pull request #92)
ENCOA-182, ENCOA-185, ENCOA-177, ENCOA-168, ENCOA-186, ENCOA-176, ENCOA-189, ENCOA-167

Approved-by: Tiago Ribeiro
2024-09-06 08:53:29 +00:00
João Ramos
17f678a3ac Merged in ENCOA-131_MasterStatistical (pull request #91)
ENCOA-131 MasterStatistical

Approved-by: Tiago Ribeiro
2024-09-06 08:53:07 +00:00
Carlos Mesquita
6bd9816edd Merge remote-tracking branch 'origin/develop' into feature/level-file-upload 2024-09-06 09:41:01 +01:00
Carlos Mesquita
77ac15c2bb ENCOA-182, ENCOA-185, ENCOA-177, ENCOA-168, ENCOA-186, ENCOA-176, ENCOA-189, ENCOA-167 2024-09-06 09:39:38 +01:00
Tiago Ribeiro
55cc9765e2 Updated the backend so the users list only returns the correct ones 2024-09-06 09:33:30 +01:00
Joao Ramos
e433a150a9 Added level export to excel 2024-09-05 23:30:03 +01:00
Joao Ramos
a61ad2cc7e Added an export feature for the master statisticl screen 2024-09-05 22:42:46 +01:00
Tiago Ribeiro
680f4cfa95 Made it so it will show always the corporate 2024-09-05 19:55:19 +01:00
Tiago Ribeiro
311824e8b7 ENCOA-175: When a Corporate Create another Corporate, the created corporate should have access to the same students and teachers as the creator 2024-09-05 19:24:28 +01:00
Tiago Ribeiro
2fb73cc3a3 ENCOA-166: Increased the probability of this being fixed even more 2024-09-05 18:54:36 +01:00
Joao Ramos
70de97766e Added search to table 2024-09-05 18:25:39 +01:00
Tiago Ribeiro
c7ff11d0fc ENCOA-172: Updated it so if an assignment has already been started, they can't start it again 2024-09-05 17:33:15 +01:00
Tiago Ribeiro
e312af36bb Added the assignment to the Session Card 2024-09-05 17:25:22 +01:00
Tiago Ribeiro
ac980023b5 Negated a simple change 2024-09-05 16:59:39 +01:00
Tiago Ribeiro
3b43803b7e ENCOA-180: Prevented users from checking their results if not released yet 2024-09-05 16:54:45 +01:00
Tiago Ribeiro
c8be2f1255 Prevented sessions from appearing when an assignment is done 2024-09-05 16:52:16 +01:00
Tiago Ribeiro
b6b5f3a9f1 Solved a problem related to not showing corporates if they are not in the correct group 2024-09-05 12:02:46 +01:00
Tiago Ribeiro
6ce81b300a Removed a part of the make_user 2024-09-05 11:35:53 +01:00
Tiago Ribeiro
3d3c4448ae Removed the group for when it's a corporate creating another corporate 2024-09-04 18:50:35 +01:00
Tiago Ribeiro
cb2c1641f5 Made the corporate name being the creator's one 2024-09-04 17:40:26 +01:00
Tiago Ribeiro
7bcd0f863f ENCOA-133: Teachers within a Group should be able to view the Group assignments 2024-09-04 15:26:42 +01:00
Tiago Ribeiro
2d95cbd3dc ENCOA-137: Top right side Next Button on the exams 2024-09-04 15:10:17 +01:00
Tiago Ribeiro
49aac93618 Updated the look of the assignments 2024-09-04 14:50:47 +01:00
Tiago Ribeiro
28ad7944e0 Solved a bug with a page crashing 2024-09-04 14:34:18 +01:00
Tiago Ribeiro
d4553501b8 ENCOA-164: Corporate created by another Corporate Should be linked to the Master Corporate of the Creator Accoubnt 2024-09-04 11:59:14 +01:00
Tiago Ribeiro
4654c21d92 ENCOA-154: Increase the number of questions per page in all modules (Priority in Level Test) 2024-09-04 11:41:48 +01:00
Tiago Ribeiro
becc91d8ea Some general improvements 2024-09-04 11:17:54 +01:00
Tiago Ribeiro
06cb4485f4 ENCOA-163: Groups should only display first 5 names on the table 2024-09-04 09:56:12 +01:00
Tiago Ribeiro
9b22fb259c ENCOA-159: Sidebar should be minimized as default 2024-09-04 09:31:03 +01:00
carlos.mesquita
f2137efaa0 Merged in feature/level-file-upload (pull request #90)
ENCOA-149, ENCOA-150, ENCOA-152, ENCOA-153, ENCOA-155, ENCOA-156, ENCOA-157, ENCOA-158, ENCOA-161

Approved-by: Tiago Ribeiro
2024-09-04 08:10:40 +00:00
João Ramos
00834fec7b Merged in features-03-Sep-24 (pull request #89)
ENCOA-146 + Bug fixing

Approved-by: Tiago Ribeiro
2024-09-04 08:10:12 +00:00
carlos.mesquita
ef84052909 Merged develop into feature/level-file-upload 2024-09-04 01:34:36 +00:00
Carlos Mesquita
6ea80dd0da Merge branch 'feature/level-file-upload' of https://bitbucket.org/ecropdev/ielts-ui into feature/level-file-upload 2024-09-04 02:27:31 +01:00
Carlos Mesquita
5168e70edc ENCOA-149, ENCOA-150, ENCOA-152, ENCOA-153, ENCOA-155, ENCOA-156, ENCOA-157, ENCOA-158, ENCOA-161 -> Updated the mc buttons, no longer shows a context only div on parts that have context, removed line numbers on lines between paragraphs, applied bold and underline to 'not correct' in underline prompts, added another pop up to confirm submission. 2024-09-04 02:26:22 +01:00
João Ramos
a7719dbb55 Merged develop into features-03-Sep-24 2024-09-03 22:25:16 +00:00
Joao Ramos
25e6cb36a9 Improvements on start button 2024-09-03 23:23:18 +01:00
Joao Ramos
a7c1ea0409 Imporvements on started management of assignment 2024-09-03 22:56:43 +01:00
Joao Ramos
8aed075553 Disabled no longer makes sense for an assignment on the student 2024-09-03 22:42:12 +01:00
carlos.mesquita
3fc581aaac Merged in feature/level-file-upload (pull request #88)
ENCOA-147: Uploading a batch of multiple users is now unrestricted by firebase auth request quotas

Approved-by: Tiago Ribeiro
2024-09-03 21:11:33 +00:00
Tiago Ribeiro
020f689af6 Merged develop into feature/level-file-upload 2024-09-03 20:36:55 +00:00
Joao Ramos
04c9ff24ea Changed the criteria for the filter on student assignment 2024-09-03 21:15:59 +01:00
Joao Ramos
105c03fa09 Fied an issue with the future with autostart 2024-09-03 21:15:06 +01:00
Joao Ramos
547e0fc530 Fixed an issue with the default values 2024-09-03 21:14:20 +01:00
Joao Ramos
bf7793e103 Minor fix regarding future assignments 2024-09-03 20:51:11 +01:00
Carlos Mesquita
60554d8e16 ENCOA-147: Uploading a batch of multiple users is now unrestricted by firebase auth request quotas 2024-09-03 20:13:04 +01:00
Joao Ramos
5d26af511c Initial improvements on assets for assignments validation 2024-09-03 20:10:32 +01:00
Joao Ramos
12104e797a Fixed an issue preventing the user from seeing data regarding the assignment 2024-09-03 20:02:30 +01:00
Joao Ramos
d307c61cd7 Added a feature to automatically start an exam 2024-09-03 19:23:45 +01:00
Joao Ramos
6774b2d0b6 Fixed label 2024-09-03 19:12:32 +01:00
Tiago Ribeiro
fa53382c08 Hidden the level score when not released 2024-09-03 17:43:33 +01:00
Tiago Ribeiro
67929655f4 Solved some race conditions related to the previous commit 2024-09-03 17:00:42 +01:00
João Ramos
e8c47941d0 Merged in ENCOA-139_ReleaseBug (pull request #87)
ENCOA-139 Release Improvements
2024-09-03 15:47:17 +00:00
carlos.mesquita
82d0a0556f Merged in feature/level-file-upload (pull request #85)
Feature/level file upload
2024-09-03 15:46:39 +00:00
Tiago Ribeiro
7cd18b07bb ENCOA-130: Add owners to exams 2024-09-03 16:31:29 +01:00
Joao Ramos
aca8ad2d14 Added an option to release automatically 2024-09-02 23:56:51 +01:00
Joao Ramos
4bb80919ad Fixd an error accessing a property that might not be defined, others were already using ? 2024-09-02 23:50:41 +01:00
Joao Ramos
5ed851878a Reenabled information display after Exam 2024-09-02 23:48:56 +01:00
Carlos Mesquita
763452e3cc Merge remote-tracking branch 'origin/develop' into feature/level-file-upload 2024-09-02 22:21:40 +01:00
Carlos Mesquita
063a73691a Exhaustive-deps warning 2024-09-02 22:20:02 +01:00
Carlos Mesquita
caddf87231 Previous Level exams were being broken by the part divider changes, fixed it. 2024-09-02 22:18:33 +01:00
Tiago Ribeiro
0f38e01283 let the users wait 2024-09-02 21:31:26 +01:00
Tiago Ribeiro
640b6f0e4d Updated the user card to allow master corporate to edit without setting a price 2024-09-02 19:56:12 +01:00
Tiago Ribeiro
f43d562405 Solved a problem with the corporate when making user 2024-09-02 18:12:02 +01:00
Tiago Ribeiro
39752cbb1d Wrong number in the corporate amount 2024-09-02 17:48:55 +01:00
Tiago Ribeiro
229d93c03e Fixed a problem 2024-09-02 17:18:53 +01:00
Tiago Ribeiro
b0ab8a8fce Stuff 2024-09-02 16:09:44 +01:00
Tiago Ribeiro
90cb705ad2 Corrected an oopsie related to the amount of level exams shown 2024-09-02 15:38:37 +01:00
Tiago Ribeiro
65fa6e64e6 Removed unnecessary code 2024-09-02 15:32:15 +01:00
Tiago Ribeiro
7c0e7ef53e Solved a bug related to the Batch Create User 2024-09-02 14:28:38 +01:00
Tiago Ribeiro
b6c3754b40 Allow users to edit others 2024-09-02 12:30:23 +01:00
Tiago Ribeiro
4e3c947d2a Solved a bug related to the creation of users 2024-09-02 11:59:12 +01:00
Tiago Ribeiro
abcb1afd48 ENCOA-120: Prevented flicker when leaving page 2024-09-02 11:21:38 +01:00
Tiago Ribeiro
0b88d6bcd1 Improved a tiny bit of the performance with Student Dashboard 2024-08-30 11:56:35 +01:00
Tiago Ribeiro
fef5bf44de Removed some console.logs 2024-08-30 11:25:21 +01:00
carlos.mesquita
2c43d48bbd Merged in feature/training-content (pull request #84)
Patched a bug where the user would be locked out of continuing if he closed the unawnsered modal

Approved-by: Tiago Ribeiro
2024-08-30 10:07:58 +00:00
Carlos Mesquita
4865b47393 ENCOA-138 Changed the 'Confirm Submission' title and the 'Submit' button to red and increased the font size of the modal 2024-08-30 10:17:24 +01:00
Carlos Mesquita
3892fe1a67 Merge remote-tracking branch 'origin/develop' into feature/training-content 2024-08-30 09:25:38 +01:00
Tiago Ribeiro
39710aaea1 Improved the overall stability and speed of the app 2024-08-29 23:21:20 +01:00
Tiago Ribeiro
b57e11bec4 ENCOA-129: When Creating a Single user Corporate OR Master Corporate it should have the field Department to be configured 2024-08-29 15:18:55 +01:00
Tiago Ribeiro
fdc8f98b21 ENCOA-132: Create user is not linking to the Corporate Account 2024-08-29 15:06:32 +01:00
Tiago Ribeiro
2b71f2467c ENCOA-126: Corporate should not be allowed to edit is own name 2024-08-29 13:18:11 +01:00
Tiago Ribeiro
cd1caf0f53 ENCOA-123: Improved the options of users for the Group Creator 2024-08-29 13:00:39 +01:00
Tiago Ribeiro
3b77d3fc0b ENCOA-136: Profile Pictures of all accounts should be by Default Encoach Logo 2024-08-29 12:51:10 +01:00
Tiago Ribeiro
73525f1dc0 ENCOA-127: Change the name of the field Position to Department 2024-08-29 12:47:05 +01:00
Tiago Ribeiro
c256231cfc ENCOA-120: Prevent Assignment Creator from disappearing 2024-08-29 12:43:53 +01:00
Tiago Ribeiro
2fb41f7462 ENCOA-128: Display the position of the Corporate in the topbar 2024-08-29 12:31:34 +01:00
Tiago Ribeiro
aa96b13ec2 ENCOA-121 & ENCOA-122: Fixed a bug where updating the account information of a Corporate or Master Corporate was not working 2024-08-29 12:28:30 +01:00
Tiago Ribeiro
f9429d1056 ENCOA-125: Allow Master Corporate to change the company name of a Corporate 2024-08-29 12:19:44 +01:00
Tiago Ribeiro
af9462398a Increase the size and boldness of the timer 2024-08-28 14:58:07 +01:00
Tiago Ribeiro
6fd0b7aef3 Hotfix for a crash 2024-08-28 14:53:09 +01:00
Tiago Ribeiro
bc47f9c001 Updated the react-icons package 2024-08-28 14:25:29 +01:00
Carlos Mesquita
4ea3a844ed Merge remote-tracking branch 'origin/develop' into feature/training-content 2024-08-28 13:32:21 +01:00
Carlos Mesquita
ea8a3625ef Patched a bug where the user would be locked out of continuing if he closed the unawnsered modal 2024-08-28 13:28:21 +01:00
Tiago Ribeiro
3eb2f432fa Allowed assigners to release and start the assignment 2024-08-28 13:07:04 +01:00
Tiago Ribeiro
5d10e6564d Only shows results for an assignments that has been released 2024-08-28 12:27:26 +01:00
Tiago Ribeiro
e518323d99 Updated the generation to allow for private exams 2024-08-28 10:46:02 +01:00
Tiago Ribeiro
dbf262598f Added the ability to set an exam as private 2024-08-28 10:26:45 +01:00
Tiago Ribeiro
951ca5736e Added the ability for some exams to be private and not chosen randomly 2024-08-28 10:17:01 +01:00
João Ramos
7960e7d8fb Merged in bug-fixing-280824 (pull request #83)
Bug fixing 280824

Approved-by: Tiago Ribeiro
2024-08-28 08:57:52 +00:00
Tiago Ribeiro
99039f8bf3 Corrected a problem related to getting the corporate of a user 2024-08-28 09:57:00 +01:00
Joao Ramos
3c7df4e33c Added default value in case on the user not being found in the DB 2024-08-28 07:39:51 +01:00
Joao Ramos
614a7a2a29 Improved asset download criteria 2024-08-28 07:38:38 +01:00
João Ramos
ec67f91263 Merged in bug-fixing-270824 (pull request #82)
Fixed an use case where the export of Excel failed if no students had answered it

Approved-by: Tiago Ribeiro
2024-08-27 22:20:52 +00:00
Joao Ramos
aa4e13a18d Fixed an use case where the export of Excel failed if no students had answered it 2024-08-27 23:11:40 +01:00
carlos.mesquita
23e26617e2 Merged in feature/training-content (pull request #81)
Feature/training content

Approved-by: Tiago Ribeiro
2024-08-27 21:43:03 +00:00
Carlos Mesquita
ef32226c6c Previous commit solved completion but messed up question modal, patched that and added the condition to show the submission modal when all questions are awnswered 2024-08-27 22:10:31 +01:00
Carlos Mesquita
c9174f37ef Forgot to toggle strict mode again 2024-08-27 17:13:19 +01:00
Carlos Mesquita
c99dbab4b6 Merge remote-tracking branch 'origin/develop' into feature/training-content 2024-08-27 17:10:57 +01:00
Carlos Mesquita
eb985014be Merge branch 'feature/training-content' of https://bitbucket.org/ecropdev/ielts-ui into feature/training-content 2024-08-27 17:09:33 +01:00
Carlos Mesquita
845bccbe2a ENCOA-107, ENCOA-115 Fixed completion percentage, brought back the line numbers, 'Level Exam' was replaced by 'Placement Test', Next/Back instructions with quotes, 'Submit' on last level question 2024-08-27 17:08:33 +01:00
Tiago Ribeiro
3ec886c31d ENCOA-109: Keep the same balance after deleting a user 2024-08-27 16:57:41 +01:00
Tiago Ribeiro
fa3929d5e9 Allow Master Corporate to pay for their subscription 2024-08-27 16:35:34 +01:00
Tiago Ribeiro
b7940087b5 ENCOA-109: Made the modal disappear when a user is created 2024-08-27 11:14:29 +01:00
Tiago Ribeiro
7fb0ed884c Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2024-08-27 11:04:22 +01:00
carlos.mesquita
d93852e230 Merged in feature/training-content (pull request #80)
Feature/training content

Approved-by: Tiago Ribeiro
2024-08-27 10:03:53 +00:00
Tiago Ribeiro
d04ea33616 Merged develop into feature/training-content 2024-08-27 10:03:44 +00:00
Tiago Ribeiro
eb38464aca ENCOA-112: Improve Answer Display 2024-08-27 11:02:39 +01:00
Tiago Ribeiro
cd85c71aec ENCOA-114: In Exam List and Group List provide Fuzzy Search Filter 2024-08-27 10:53:50 +01:00
Carlos Mesquita
c464375414 Merge remote-tracking branch 'origin/develop' into feature/training-content 2024-08-27 09:44:22 +01:00
Tiago Ribeiro
82233c7d53 ENCOA-111: Change Modules Assignment Display 2024-08-27 09:42:14 +01:00
Carlos Mesquita
cc5be99b0f Bug fix on fillblanks calculateScore 2024-08-27 09:40:20 +01:00
Tiago Ribeiro
65dc3e92d0 ENCOA-110: Reorder excel upload columns 2024-08-27 09:38:47 +01:00
Tiago Ribeiro
addd117834 There was a problem with the order of the modals 2024-08-27 09:35:37 +01:00
Carlos Mesquita
72b498eb85 Fixed a bug in fill blanks where the input would be reset by the re-rendering of lines 2024-08-27 09:20:00 +01:00
Tiago Ribeiro
0aba6355ed ENCOA-90: Updated the instances of Level test to use the Grading System 2024-08-27 00:18:01 +01:00
Tiago Ribeiro
a0b8521f0a ENCOA-90: Creating the ability for a corporate/master corporate to edit their grading system 2024-08-26 22:35:00 +01:00
Carlos Mesquita
eb7c539a0e exaustive-deps warning 2024-08-26 18:28:37 +01:00
Carlos Mesquita
22928ce283 ENCOA-94: Fixes the bug, refactored useStats to be useFilterRecordsByUser in order to not duplicate code and also refactored records.tsx and training.tsx to use a component which abstracts the user Selection for both stats and training. 2024-08-26 18:26:29 +01:00
carlos.mesquita
4a1a52bd61 Merged in feature/level-file-upload (pull request #78)
Shuffles fixed

Approved-by: Tiago Ribeiro
2024-08-25 17:36:17 +00:00
João Ramos
af00f49adc Merged in features-21-08-24 (pull request #79)
ENCOA: 86 + 101 + 102

Approved-by: Tiago Ribeiro
2024-08-25 17:35:59 +00:00
Joao Ramos
8d37e60f5d Merge branch 'develop' into features-21-08-24 2024-08-24 18:56:05 +01:00
Joao Ramos
74a53f55fd Added option to start exam which serves as an alternative to start date for the exam 2024-08-24 17:38:57 +01:00
Joao Ramos
101605ad88 Updated Master Statistical with user grade count 2024-08-24 11:06:44 +01:00
Joao Ramos
cf1b47fbd2 Major updates on Master Statistical 2024-08-24 10:53:11 +01:00
Carlos Mesquita
f9174c13c1 Merge branch 'feature/level-file-upload' of https://bitbucket.org/ecropdev/ielts-ui into feature/level-file-upload 2024-08-24 01:03:37 +01:00
Tiago Ribeiro
032d20b4b2 ENCOA-96: License Distribuition system from Master Corporate to Corporate 2024-08-24 01:02:34 +01:00
Carlos Mesquita
2146ef1a92 Found the bug 2024-08-24 00:54:55 +01:00
carlos.mesquita
4928267036 Merged develop into feature/level-file-upload 2024-08-23 20:19:13 +00:00
Carlos Mesquita
f0f38b335f Part and MC question grid jump to, has a bug on next going to refactor the whole thing 2024-08-23 21:17:32 +01:00
Tiago Ribeiro
3e21538d02 ENCOA-98: Change the template on the Excel import Function 2024-08-23 16:59:08 +01:00
Tiago Ribeiro
33fd6ddf8f Removed the ability to change the user from the list 2024-08-23 12:10:44 +01:00
Tiago Ribeiro
1bb5405894 ENCOA-88: Create individual accounts 2024-08-23 12:02:35 +01:00
Joao Ramos
44adc142f6 Updated Master Statistical 2024-08-23 00:56:18 +01:00
Joao Ramos
4379716e9b ENCOA-86: Stats page now filters assignments PDF download based on released 2024-08-22 23:16:16 +01:00
Carlos Mesquita
b4b078c8c9 Missed some console.logs 2024-08-22 22:19:32 +01:00
Carlos Mesquita
6dbc2f5ed2 Merge branch 'develop' of https://bitbucket.org/ecropdev/ielts-ui into feature/level-file-upload 2024-08-22 22:05:53 +01:00
Carlos Mesquita
9a51096a94 Merge branch 'feature/level-file-upload' of https://bitbucket.org/ecropdev/ielts-ui into feature/level-file-upload 2024-08-22 22:04:11 +01:00
Carlos Mesquita
1315e0b280 Shuffles fixed 2024-08-22 22:02:37 +01:00
Tiago Ribeiro
4505ea5ff8 ENCOA-100: Changed the login/register photo 2024-08-22 16:49:27 +01:00
Tiago Ribeiro
192324b891 ENCOA-99: Added a Student ID field to Students 2024-08-22 16:27:03 +01:00
Tiago Ribeiro
326d305a69 ENCOA-97: Now it allows the user to write the name of the country in english 2024-08-22 16:15:25 +01:00
Tiago Ribeiro
cfcff3cf3b ENCOA-93 2024-08-22 15:56:52 +01:00
Tiago Ribeiro
202632ff58 ENCOA-89, ENCOA-91, ENCOA-92, ENCOA-95
All changes related to permissions towards types of users
2024-08-22 12:27:15 +01:00
Joao Ramos
7116892f9a ENCOA-86: Added default value for new assignment 2024-08-21 22:24:46 +01:00
Joao Ramos
c6f40f625b ENCOA-86: Fixed broken labels on release 2024-08-21 22:20:38 +01:00
Joao Ramos
556f642112 ENCOA-86: Added an option to release exam results 2024-08-21 22:19:15 +01:00
João Ramos
22611121c6 Merged in ENCOA-83_MasterStatistical (pull request #76)
ENCOA-83 MasterStatistical

Approved-by: Tiago Ribeiro
2024-08-21 16:23:21 +00:00
Tiago Ribeiro
720597e916 Merged develop into ENCOA-83_MasterStatistical 2024-08-21 16:18:37 +00:00
carlos.mesquita
e74ded676e Merged in feature/level-file-upload (pull request #77)
Forgot to check if exam had shuffled enabled

Approved-by: Tiago Ribeiro
2024-08-21 16:18:23 +00:00
carlos.mesquita
ee60eedd0d Merged develop into feature/level-file-upload 2024-08-21 12:03:57 +00:00
Carlos Mesquita
c37a1becbf Forgot to check if exam had shuffled enabled 2024-08-21 13:02:30 +01:00
João Ramos
b9cca483ec Merged develop into ENCOA-83_MasterStatistical 2024-08-20 23:39:57 +00:00
Joao Ramos
c758bdaf9e Merge branch 'ENCOA-83_MasterStatistical' of https://bitbucket.org/ecropdev/ielts-ui into ENCOA-83_MasterStatistical 2024-08-21 00:39:22 +01:00
Joao Ramos
5ada588b16 Reverted minor change 2024-08-21 00:38:26 +01:00
Joao Ramos
eec1bb0c30 Added final touches 2024-08-21 00:37:33 +01:00
Joao Ramos
65f8368708 Initial draft of level test report 2024-08-20 23:40:54 +01:00
Tiago Ribeiro
806e621c5b Updated the record for students 2024-08-20 22:43:34 +01:00
carlos.mesquita
ce35b23714 Merged in feature/level-file-upload (pull request #75)
Part intro's, modals between parts and some fixes

Approved-by: Tiago Ribeiro
2024-08-20 21:18:22 +00:00
Carlos Mesquita
2cd025b118 Patched part divider, forgot to check if the exam had field intro 2024-08-20 20:14:42 +01:00
Carlos Mesquita
2e699d7e25 Forgot to save TextComponent, and cleanup some warnings 2024-08-20 20:02:59 +01:00
Carlos Mesquita
30da295c60 Merge branch 'develop' of https://bitbucket.org/ecropdev/ielts-ui into feature/level-file-upload 2024-08-20 19:37:06 +01:00
Carlos Mesquita
a82a399d52 Merge branch 'feature/level-file-upload' of https://bitbucket.org/ecropdev/ielts-ui into feature/level-file-upload 2024-08-20 18:53:25 +01:00
Carlos Mesquita
505df31d6b Part intro's, modals between parts and some fixes 2024-08-20 18:52:38 +01:00
Tiago Ribeiro
a4d8ba72af Disallowed the name to be equal to Corporate 2024-08-20 17:41:06 +01:00
Tiago Ribeiro
2bfd0cb502 More stuff related to the groups 2024-08-20 17:38:48 +01:00
Tiago Ribeiro
5ee071028c Removed a WIP page 2024-08-20 17:14:54 +01:00
Tiago Ribeiro
23b9452a3a Another bug solved 2024-08-20 17:12:10 +01:00
Tiago Ribeiro
0ce3a16d3a Resolved another bug related to master corporate groups 2024-08-20 16:29:55 +01:00
Tiago Ribeiro
4315a7b17c Corrected a bug related to groups of a master corporate 2024-08-20 14:37:33 +01:00
Tiago Ribeiro
247f192a0a Added a scroll to the selection 2024-08-20 12:43:34 +01:00
João Ramos
9c944ae3d2 Merged in ENCOA-83_MasterStatistical (pull request #74)
ENCOA-83 MasterStatistical

Approved-by: Tiago Ribeiro
2024-08-20 10:14:19 +00:00
Tiago Ribeiro
a390aa429d Merged develop into ENCOA-83_MasterStatistical 2024-08-20 10:13:42 +00:00
Joao Ramos
3367384791 Merge branch 'ENCOA-83_MasterStatistical' of https://bitbucket.org/ecropdev/ielts-ui into ENCOA-83_MasterStatistical 2024-08-20 11:12:05 +01:00
Joao Ramos
158324a705 Added second excel for master corporate export 2024-08-20 11:10:51 +01:00
Tiago Ribeiro
f9286d1793 Updated the Dockerfile after having upgraded NextJS 2024-08-20 10:47:56 +01:00
João Ramos
2e376c37dd Merged in ENCOA-83_MasterStatistical (pull request #73)
ENCOA-83 MasterStatistical

Approved-by: Tiago Ribeiro
2024-08-20 09:33:42 +00:00
Tiago Ribeiro
5bda9ed227 Merge branch 'develop' into ENCOA-83_MasterStatistical 2024-08-20 10:32:19 +01:00
Tiago Ribeiro
97b533bd3a Took care of some warnings 2024-08-20 10:07:18 +01:00
Tiago Ribeiro
75a45108a2 Upgraded @types/react and @types/react-dom 2024-08-20 09:52:22 +01:00
Tiago Ribeiro
bfc0def20f Updated the exam list to be visible 2024-08-20 09:35:13 +01:00
Joao Ramos
9db33e6a51 Fixed date usage 2024-08-20 09:17:48 +01:00
Joao Ramos
ba5d926659 Merge branch 'develop' into ENCOA-83_MasterStatistical 2024-08-20 01:16:46 +01:00
Joao Ramos
1cd4dfc397 Added download option to master Corporate and teacher 2024-08-20 01:15:43 +01:00
Joao Ramos
bf5dd62b35 Updated Excel document 2024-08-20 01:01:50 +01:00
Tiago Ribeiro
4e583d11b6 Improved the bug on the teachers 2024-08-20 00:10:26 +01:00
Tiago Ribeiro
688505b4eb Updated the permissions access 2024-08-20 00:01:59 +01:00
carlos.mesquita
81b8ceb2b3 Merged in feature/level-file-upload (pull request #72)
Fixed question numbers for fillBlanks exercises, reverted multipleChoice underline prompt, added part label to module title, and changed some styles
2024-08-19 22:48:26 +00:00
carlos.mesquita
d93d36c392 Merged develop into feature/level-file-upload 2024-08-19 22:47:48 +00:00
Carlos Mesquita
3299acee36 Forgot to add a key in Level 2024-08-19 23:46:51 +01:00
Carlos Mesquita
abddead402 Fixed question numbers for fillBlanks exercises, reverted multipleChoice underline prompt, added part label to module title, and changed some styles 2024-08-19 23:43:08 +01:00
Joao Ramos
2d69fdac3c Added missing updated lockfile 2024-08-19 23:39:38 +01:00
Joao Ramos
506ff2503e Merge branch 'develop' into ENCOA-83_MasterStatistical 2024-08-19 23:38:46 +01:00
Tiago Ribeiro
5d191730d2 Added the total of assignments to the Master Corporate 2024-08-19 23:04:13 +01:00
Tiago Ribeiro
346b131388 Improved the sorting and filtering for the Student Performance page 2024-08-19 19:46:43 +01:00
carlos.mesquita
aba49e385f Merged in feature/level-file-upload (pull request #71)
Previously commented a required line
2024-08-19 16:25:52 +00:00
Carlos Mesquita
5789688eab Previously commented a required line 2024-08-19 17:24:10 +01:00
Tiago Ribeiro
f7da11bc69 Updated the way groups work there 2024-08-19 17:03:33 +01:00
carlos.mesquita
10802f6bb5 Merged in feature/level-file-upload (pull request #70)
Feature/level file upload
2024-08-19 15:55:10 +00:00
Carlos Mesquita
37e356572b Merge branch 'develop' of https://bitbucket.org/ecropdev/ielts-ui into feature/level-file-upload 2024-08-19 16:53:39 +01:00
Carlos Mesquita
8669ef462d Commented all related to shuffle 2024-08-19 16:42:14 +01:00
Tiago Ribeiro
df1c0bad4d Created a student performance page 2024-08-19 16:41:35 +01:00
Carlos Mesquita
bcb1a0f914 If someone else wants to join in on the fun be my guest 2024-08-19 01:24:55 +01:00
Joao Ramos
bf1bdd935c Improvements on excel rendering 2024-08-18 21:25:18 +01:00
Carlos Mesquita
edc9d4de2a Fill Blanks changes 2024-08-18 08:07:16 +01:00
Tiago Ribeiro
229275aaee Created a groups page for students and teachers 2024-08-17 20:18:28 +01:00
Tiago Ribeiro
f0ff6ac691 ENCOA-87: Allow MasterCorporate & Corporate to change the type of students and teachers 2024-08-17 19:15:20 +01:00
Tiago Ribeiro
878c7c2ef0 Updated the Groups List to allow teachers to view their corporate's students 2024-08-16 11:50:27 +01:00
Tiago Ribeiro
0a28c2bd41 Added a "last login" to the users 2024-08-15 23:55:08 +01:00
Tiago Ribeiro
38e48c90bb Updated the label for Admin 2024-08-15 23:37:34 +01:00
Tiago Ribeiro
c6f35d7750 Enable the option to not have only full exams 2024-08-15 19:25:39 +01:00
Tiago Ribeiro
85f684dff5 Updated the user balance to be based not only on the amount of codes 2024-08-15 19:24:08 +01:00
Tiago Ribeiro
d94a9bb88a Quick little fix 2024-08-15 18:39:17 +01:00
Joao Ramos
1950d5f15d Added initial Excel changes 2024-08-15 14:56:14 +01:00
Joao Ramos
e84cc8ddd8 Cleaned up some code 2024-08-15 13:39:42 +01:00
Joao Ramos
cf2fd06d39 Added Icon ofr consolidate highest student 2024-08-15 10:38:56 +01:00
Joao Ramos
b6015b6433 Added any to error to prevent an error 2024-08-15 10:35:08 +01:00
Joao Ramos
fea58a7b40 Added initial implementation for master statistical 2024-08-15 10:34:31 +01:00
João Ramos
13284eab75 Merged in ENCOA-82_Permissions (pull request #69)
Updated permissions to have a key to group them
2024-08-14 19:38:30 +00:00
Tiago Ribeiro
dd4e3a4694 Merged develop into ENCOA-82_Permissions 2024-08-14 19:38:16 +00:00
Tiago Ribeiro
eb55e65d91 Solved some issues related to the BatchCreateUser 2024-08-14 20:36:47 +01:00
Joao Ramos
cb75ba6056 Updated permissions to have a key to group them 2024-08-14 18:44:35 +01:00
João Ramos
859d9283a7 Merged in ENCOA-77_GenerationTitle (pull request #64)
Added title to the exam generate

Approved-by: Tiago Ribeiro
2024-08-13 21:40:04 +00:00
Tiago Ribeiro
1a3437b333 Merged develop into ENCOA-77_GenerationTitle 2024-08-13 21:38:56 +00:00
João Ramos
bbbf17daa0 Merged in ENCOA-79_PaymentRecordsFilters (pull request #61)
ENCOA-79 PaymentRecordsFilters

Approved-by: Tiago Ribeiro
2024-08-13 21:38:38 +00:00
Joao Ramos
ae79aef132 Merge branch 'develop' into ENCOA-79_PaymentRecordsFilters 2024-08-13 21:32:33 +01:00
Joao Ramos
c3e71b4389 Merge branch 'develop' into ENCOA-77_GenerationTitle 2024-08-13 21:30:50 +01:00
Tiago Ribeiro
2784117862 Updated the MasterCorporate and Corporate pages to allow to have Assignments 2024-08-13 10:02:40 +01:00
Tiago Ribeiro
8162567e12 Updated the Batch Create User to also have an expiry date 2024-08-12 19:49:18 +01:00
Tiago Ribeiro
58300e32ff Solved an issue where, for developers, because of the amount of permissions, the cookie was too big, so I separated the permissions logic into a hook 2024-08-12 19:35:11 +01:00
carlos.mesquita
cb489bf0ca Merged in feature/training-content (pull request #67)
Tooltips for assessment criteria on Writing and Speaking

Approved-by: Tiago Ribeiro
2024-08-12 14:13:28 +00:00
Tiago Ribeiro
91bc91e725 Merged develop into feature/training-content 2024-08-12 14:12:55 +00:00
João Ramos
ce086a8b22 Merged in ENCOA-81_CodeListPermissions (pull request #68)
ENCOA-81: Fixed issue with the users that each role could create

Approved-by: Tiago Ribeiro
2024-08-12 14:12:25 +00:00
Joao Ramos
6e71ee7cb0 ENCOA-81: Fixed issue with the users that each role could create 2024-08-08 09:17:33 +01:00
Carlos Mesquita
21e58e3b9c Tooltips for assessment criteria on Writing and Speaking 2024-08-07 13:04:42 +01:00
João Ramos
b885dd46b5 Merged in ENCOA-80_Permissions (pull request #66)
ENCOA-80 Permissions

Approved-by: Tiago Ribeiro
2024-08-07 09:30:04 +00:00
Joao Ramos
0fc2df1070 Added permission to codes 2024-08-07 10:03:17 +01:00
Joao Ramos
cf91f1812d Added group permissions 2024-08-07 09:36:08 +01:00
Tiago Ribeiro
3289f27cd5 Merged in settings-import-users (pull request #65)
Settings import users
2024-08-07 06:48:37 +00:00
Tiago Ribeiro
80939d16a5 Merged develop into settings-import-users 2024-08-07 06:47:59 +00:00
carlos.mesquita
11b5490af4 Merged in feature/training-content (pull request #62)
Feature/training content

Approved-by: Tiago Ribeiro
2024-08-06 18:46:43 +00:00
João Ramos
a31070d4a3 Merged in ENCOA-78_ExamList (pull request #63)
Added more columns to exam list

Approved-by: Tiago Ribeiro
2024-08-06 18:46:20 +00:00
Joao Ramos
95c3f89911 Added title to the exam generate 2024-08-06 19:24:43 +01:00
Joao Ramos
2a58e0d33f Added more columns to exam list 2024-08-06 18:40:49 +01:00
mohammedzeglam-pg
afe59f5a3a add group creation. 2024-08-06 18:03:00 +02:00
Carlos Mesquita
7fd56357e0 UI changes to Solutions (Writing, Speaking and Interactive Speaking) as requested 2024-08-06 17:02:17 +01:00
Carlos Mesquita
a4a40b9145 Bug fixes to training, added a spinner to record while it loads, made changes to speaking as requested 2024-08-05 21:44:14 +01:00
Joao Ramos
48faee07f6 Added missing fussy search fileds and support for number 2024-08-05 19:32:53 +01:00
Joao Ramos
f0d7d7644b Added date filter 2024-08-05 19:26:50 +01:00
Carlos Mesquita
309dfba583 Fixed the training content view 2024-08-05 10:41:11 +01:00
carlos.mesquita
cf64a91651 Merged in feature/training-content (pull request #60)
Patched the module badges on the training view
2024-08-03 14:23:05 +00:00
Carlos Mesquita
0f47a8af70 Merge branch 'feature/training-content' of https://bitbucket.org/ecropdev/ielts-ui into feature/training-content 2024-08-03 14:33:55 +01:00
Carlos Mesquita
d0310f7c2b Patched the module badges on the training view 2024-08-03 14:32:54 +01:00
carlos.mesquita
f6a0a391b9 Merged in feature/training-content (pull request #59)
Dropdown on training view
2024-08-03 10:13:44 +00:00
Tiago Ribeiro
8dd4dad096 Merged develop into feature/training-content 2024-08-03 10:13:37 +00:00
Carlos Mesquita
96baa2a6e0 Dropdown on training view 2024-08-03 11:10:01 +01:00
carlos.mesquita
8dd557a29b Merged in feature/training-content (pull request #58)
Feature/training content

Approved-by: Tiago Ribeiro
2024-08-03 09:49:00 +00:00
mzerone
4e30eda06f make user verified by default. 2024-08-03 01:37:41 +02:00
Carlos Mesquita
12bb124d91 Merge branch 'develop' of https://bitbucket.org/ecropdev/ielts-ui into feature/training-content 2024-08-02 15:01:05 +01:00
Carlos Mesquita
a71e6632d6 Hooked training content to backend, did refactors to training components and record.tsx 2024-08-01 20:40:31 +01:00
mzerone
36f518afca add create user in settings. 2024-08-01 00:41:35 +02:00
Carlos Mesquita
a534126c61 training.tsx still a bit messy, all that is left is to retrieve data from firestore /training and /walkthrough and render it 2024-07-31 20:44:46 +01:00
Tiago Ribeiro
752a46b247 Updated the LevelGeneration to be enabled by default 2024-07-31 19:15:36 +01:00
Tiago Ribeiro
663b1aae4f Updated the yarn.lock 2024-07-31 10:42:47 +01:00
Tiago Ribeiro
9b37b60be0 Improved the table 2024-07-30 23:22:30 +01:00
Tiago Ribeiro
4347d0cabb Merge branch 'develop' into feature/update-permission-ui 2024-07-30 23:20:16 +01:00
Tiago Ribeiro
0403773b8e Changed the IDs to now be words and allows the assignment to be like chosen 2024-07-30 23:18:50 +01:00
mzerone
8d99a6b03c ui updates for permissions. 2024-07-29 16:16:14 +02:00
Tiago Ribeiro
02320b9484 Tiny issue 2024-07-28 11:22:46 +01:00
Tiago Ribeiro
fb077fd8cc Updated the multiple choice 2024-07-27 17:43:26 +01:00
Tiago Ribeiro
b5a305485f Finalized the reading generation 2024-07-27 14:55:48 +01:00
Tiago Ribeiro
8f5b27e9ce Updated the FillBlanks to the new format 2024-07-27 14:38:45 +01:00
Tiago Ribeiro
9ef04b822a Updated the design of the feedback 2024-07-27 00:04:52 +01:00
Tiago Ribeiro
a6160c3cf0 Updated and fixed the level generation 2024-07-26 23:43:23 +01:00
Tiago Ribeiro
8f6639b7fc Finalized the Level Generation 2024-07-26 14:09:08 +01:00
Tiago Ribeiro
6a803fe137 Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2024-07-26 11:51:03 +01:00
Carlos Mesquita
d7f6a4dde7 Undefined was causing record page to crash 2024-07-26 11:00:18 +01:00
Tiago Ribeiro
6058e510de Added the ability to generate custom level exams, still WIP in some parts 2024-07-26 10:29:36 +01:00
carlos.mesquita
7208530879 Merged in feature/ai-detection (pull request #57)
Used main branch as base branch in the last time

Approved-by: Tiago Ribeiro
2024-07-25 21:01:56 +00:00
Tiago Ribeiro
9b6c545932 Merged develop into feature/ai-detection 2024-07-25 21:00:40 +00:00
João Ramos
afb9071758 Merged in ENCOA-56_Permissions (pull request #55)
ENCOA-56 Permissions

Approved-by: Tiago Ribeiro
2024-07-25 21:00:28 +00:00
Tiago Ribeiro
d50393930e Merged develop into ENCOA-56_Permissions 2024-07-25 21:00:19 +00:00
João Ramos
03e1f2cfa3 Merged in master-corporate (pull request #54)
Master corporate

Approved-by: Tiago Ribeiro
2024-07-25 21:00:04 +00:00
Carlos Mesquita
877d2f359f Used main branch as base branch in the last time 2024-07-25 16:59:15 +01:00
Joao Ramos
45df9837e7 Added permissions to filter out the user update 2024-07-25 11:23:11 +01:00
Joao Ramos
923319051c Added code role validation 2024-07-25 09:43:11 +01:00
Joao Ramos
f6b4d6ad52 Initial approach where I replaced all the entries for checkAccess 2024-07-25 09:13:13 +01:00
Joao Ramos
19d16c9cef Added new permission system 2024-07-24 18:52:02 +01:00
Joao Ramos
daa27e41b3 Merge branch 'develop' into master-corporate 2024-07-24 09:50:53 +01:00
Joao Ramos
916fa66446 Added linked account 2024-07-24 09:25:29 +01:00
Tiago Ribeiro
10a3243756 Updated it to work with the new canges 2024-07-23 14:43:24 +01:00
Tiago Ribeiro
a1c7f70329 Solved some small issues 2024-07-22 23:35:22 +01:00
Tiago Ribeiro
bd2efb0ef5 Updated the color of the task response 2024-07-22 23:30:22 +01:00
Joao Ramos
34065f1f6e Merge branch 'develop' into master-corporate 2024-07-20 12:38:52 +01:00
Tiago Ribeiro
41873f80d7 ENCOA-66: Payment record not sorting 2024-07-18 15:45:28 +01:00
João Ramos
a1b67c017d Merged in ENCOA-57_EditExamsGenerate (pull request #53)
ENCOA-57 EditExamsGenerate

Approved-by: Tiago Ribeiro
2024-07-18 09:32:05 +00:00
Joao Ramos
13fd7e1ee5 Updated Level Generation 2024-07-17 23:44:53 +01:00
Joao Ramos
4996417218 Fixed sentence header mapping 2024-07-17 23:00:16 +01:00
Joao Ramos
60d436b5b9 Fixed wrong count 2024-07-13 17:25:10 +01:00
Joao Ramos
8d39a20267 Fixed broken list 2024-07-13 17:22:55 +01:00
Joao Ramos
5d46d7e453 Added initial support for "mastercorporate" 2024-07-13 17:19:42 +01:00
Joao Ramos
15f9fb320d Changed approach on available type selection 2024-07-09 23:42:16 +01:00
Joao Ramos
494fc9bab6 Changed approach on available type selection 2024-07-07 16:59:49 +01:00
Joao Ramos
0c5c024098 Added Match Sentences to Reading Generation 2024-07-07 16:43:14 +01:00
Joao Ramos
903a567805 Fixed error with update part 2024-07-04 01:35:10 +01:00
Joao Ramos
df3929d5e6 Added parse for speaking generation 2024-07-04 01:34:07 +01:00
Joao Ramos
6d62500596 Added write the blanks for Listening 2024-07-04 01:23:59 +01:00
Joao Ramos
e5e4e87752 Added Listening Multiple Choice Edit 2024-07-04 01:15:33 +01:00
Joao Ramos
0b3e686f3f Match sentence log 2024-07-04 00:25:04 +01:00
Joao Ramos
3da87cce60 Added write blanks edit 2024-07-04 00:19:07 +01:00
Joao Ramos
c9daba17e1 Added Fill Blanks Edits + True False Edit 2024-07-03 11:13:13 +01:00
João Ramos
5cfd6d56a6 Merged in bug-fixing-19-Jun-24 (pull request #52)
Bug fixing 19 Jun 24

Approved-by: Tiago Ribeiro
2024-06-25 11:47:24 +00:00
Joao Ramos
ec8c06ca94 Filtered out the fields from the UserCard in the list wouldn't have anything to display 2024-06-24 11:12:16 +01:00
Joao Ramos
77a22b3ab3 Added a screen to display the desired levels for the students of a specific corporate 2024-06-22 00:16:30 +01:00
Joao Ramos
e79139174b Added an initial filter for corporate on records 2024-06-21 23:22:49 +01:00
Joao Ramos
61a86394ed Added persistance to the selected user record 2024-06-20 23:20:52 +01:00
Joao Ramos
f6741dd80e Added date filter to code list 2024-06-20 22:57:34 +01:00
Joao Ramos
ce6708be6e Minor fixing on a duplicated key on table 2024-06-20 22:34:02 +01:00
Joao Ramos
b62cae2e3a Filtered done ticket out of the view 2024-06-19 23:14:05 +01:00
Joao Ramos
d73b6d9d12 Added badges for students 2024-06-19 23:00:43 +01:00
Joao Ramos
c11906a395 Standardized the access to the list of users 2024-06-19 21:59:35 +01:00
Joao Ramos
a29b0b56d9 Changed to the correct format for CSV 2024-06-19 21:39:27 +01:00
Tiago Ribeiro
53dbf99fba Fixed some more issues with the Speaking 2024-06-18 22:16:31 +01:00
Tiago Ribeiro
cb49e15cb0 Updated the speaking and interactive speaking to the new format 2024-06-18 10:02:03 +01:00
Tiago Ribeiro
0eddded560 Updated part of the speaking accordingly 2024-06-13 18:17:07 +01:00
Tiago Ribeiro
11c6f70576 Updated a simple bug 2024-06-11 22:44:00 +01:00
Tiago Ribeiro
6712e89c47 Updated the format of the interactive speaking 2024-06-11 11:20:54 +01:00
Tiago Ribeiro
9959cf4294 Removed the persistence for the Speaking exam for now 2024-06-08 10:39:26 +01:00
Tiago Ribeiro
daec246835 Updated the Level Exam to work based on Parts 2024-06-07 13:25:18 +01:00
Tiago Ribeiro
8ea97ee944 Added a new feature to check for and register inactivity during an exam 2024-06-04 22:18:45 +01:00
Tiago Ribeiro
975f4c8285 Updated Firebase to use a service account depending on the environment 2024-05-29 09:06:46 +01:00
Tiago Ribeiro
f0b85409c9 Merge branch 'main' into develop 2024-05-27 16:37:09 +01:00
Tiago Ribeiro
bdd862c633 Updated the state to be active on payment 2024-05-27 13:08:11 +01:00
Tiago Ribeiro
4166781f7e Improved some issues with the payment 2024-05-27 13:05:38 +01:00
Tiago Ribeiro
1f8e9106de Updated the code to set the expiry date to the end of the day 2024-05-27 12:19:25 +01:00
Tiago Ribeiro
9e651358d5 Updated the code to return a 400 when it is not a success 2024-05-27 12:16:08 +01:00
Tiago Ribeiro
5aed336c96 Added a log 2024-05-27 11:02:11 +01:00
Tiago Ribeiro
85b94512e9 Merge branch 'develop' into ENCOA-38/add-validity-date-for-discounts 2024-05-23 19:22:31 +01:00
Tiago Ribeiro
906646ebce Created the validity dates for discounts 2024-05-23 19:21:52 +01:00
Tiago Ribeiro
96108a4958 Reverted to have checks 2024-05-23 17:22:57 +01:00
Tiago Ribeiro
fb449f2054 Updated the status when the transaction is not successful 2024-05-21 15:40:18 +01:00
Tiago Ribeiro
d5ee3d9519 Added a log for debugging 2024-05-21 15:35:57 +01:00
Tiago Ribeiro
4e20ec6575 Removed a check from the webhook 2024-05-21 12:04:31 +01:00
Tiago Ribeiro
836b674076 Added some changes to the propagate corporate changes 2024-05-21 11:21:14 +01:00
Tiago Ribeiro
5086c6fb09 Solved a visual bug 2024-05-21 11:09:36 +01:00
Tiago Ribeiro
489c9c3b7e Possibly solved part of the issue with speaking 2024-05-20 21:28:45 +01:00
Tiago Ribeiro
e3ded29e77 Merge branch 'develop' 2024-05-20 21:09:43 +01:00
Tiago Ribeiro
16419a5584 Fixed a bug introduced on the last one 2024-05-20 11:23:52 +01:00
Tiago Ribeiro
3e3b24cc30 Solved a bug for level test 2024-05-20 11:18:46 +01:00
Tiago Ribeiro
841698ba10 Updated the profile to also have the focus in it 2024-05-20 11:13:09 +01:00
Tiago Ribeiro
d50904611c Added a missing space 2024-05-16 15:42:13 +01:00
Tiago Ribeiro
e77fd16d26 Added a space to it 2024-05-16 15:03:31 +01:00
Tiago Ribeiro
649f24e4ae Updated the showcase 2024-05-16 14:51:19 +01:00
Tiago Ribeiro
2f0cbfe74e Removed the billing details modal 2024-05-16 14:30:44 +01:00
Tiago Ribeiro
d022bd078a Updated the currencies to have OMR as well 2024-05-16 13:44:27 +01:00
Tiago Ribeiro
c18afee9ad Updated the packages 2024-05-16 13:34:18 +01:00
Tiago Ribeiro
a65b72adad Updated the payment integration to be dynamic 2024-05-16 13:30:38 +01:00
Tiago Ribeiro
e13aea9f7d Updated the table 2024-05-15 23:41:45 +01:00
Tiago Ribeiro
2920fa7f3a Updated the payment to work with Paymob 2024-05-15 22:59:51 +01:00
Tiago Ribeiro
7af96ecccc Created a webhook to allow the transaction to be completed 2024-05-15 00:25:44 +01:00
Tiago Ribeiro
70716b3483 Merge branch 'develop' into feature/ENCOA-42/update-payment-system-paymob 2024-05-13 11:02:35 +01:00
Tiago Ribeiro
d7bb64e7e0 Merge branch 'main' into develop 2024-05-13 11:02:16 +01:00
Tiago Ribeiro
dd19b5746c Updated the times listened to not be global 2024-05-13 11:01:37 +01:00
Tiago Ribeiro
f967282f71 Started implementing the Paymob integration 2024-05-13 10:38:05 +01:00
Tiago Ribeiro
8b2459c304 ENCOA-37: Added the ability for users to download a list of the shown users 2024-05-08 15:46:24 +01:00
Tiago Ribeiro
72fb934d4f Updated the propagated changes to also affect expiry date changes for corporates 2024-05-07 23:53:15 +01:00
Tiago Ribeiro
ed0b8bcb99 ENCOA-36: Allow Corporate Users to select invitation expiry date lower than theirs 2024-05-07 11:42:05 +01:00
Tiago Ribeiro
6f211d8435 Added the corporate user balance to the User Card 2024-05-07 09:48:49 +01:00
Tiago Ribeiro
b59589b855 ENCOA-26: Student profile count stats was invalid 2024-05-07 09:07:17 +01:00
Tiago Ribeiro
db20feaa00 Added the ID of the multiple choice question 2024-05-07 08:48:16 +01:00
Tiago Ribeiro
8fc2cf571e Disabled the Play Again for admins 2024-05-07 08:37:09 +01:00
Tiago Ribeiro
3128fea8c9 Merge branch 'develop' 2024-05-05 12:03:36 +01:00
Tiago Ribeiro
0e53b4a454 Added the ability to view archived assignments and unarchive them 2024-05-05 12:02:53 +01:00
Tiago Ribeiro
cbb61d18fe Made sure to only send the e-mail for previously invited users instead of also creating a new code 2024-04-30 14:59:55 +01:00
Tiago Ribeiro
dff51cf6ea Merged from develop 2024-04-28 20:20:25 +01:00
Tiago Ribeiro
15dbadcc53 Solved a small bug 2024-04-28 20:19:21 +01:00
Tiago Ribeiro
624a3fb88e Created a discount system related to the user's e-mail address and applied to the packages 2024-04-26 20:41:46 +01:00
Tiago Ribeiro
00feee2179 Disabled the short length exams 2024-04-24 08:53:53 +01:00
Tiago Ribeiro
0f8f9bc05b Added a button to review the exam from the selected module forward 2024-04-21 21:29:43 +01:00
Tiago Ribeiro
f76b7578a6 Disabled the editing of the country manager of a corporate from the payment record 2024-04-21 12:22:02 +01:00
Tiago Ribeiro
1a17689cd2 Updated the code to name the field companyArabName and made it so it returns it when arabic 2024-04-21 00:37:08 +01:00
Tiago Ribeiro
a958e2ff0d Added a field for the agent where they can put their arab name 2024-04-20 16:01:35 +01:00
Tiago Ribeiro
36b861266f ENCOA-18: Improve the loading of the company names on the Group and Users lists 2024-04-18 16:03:09 +01:00
Tiago Ribeiro
771262fc18 ENCOA-16: Added a creation date to the Code List 2024-04-18 14:18:29 +01:00
Tiago Ribeiro
0f03ce95e7 Remove a console.log 2024-04-18 11:27:40 +01:00
Tiago Ribeiro
6a6e010daa ENCOA-13: Add filter for "In Use" and "Unused" for the Code List
ENCOA-15: Checkbox to select/unselect all for the Code List
2024-04-18 09:40:47 +01:00
Tiago Ribeiro
13496387c4 ENCOA-6: Updated the Linked Corporate column in the Group List 2024-04-11 11:29:08 +01:00
Tiago Ribeiro
4ecb21e0ae ENCOA-4: Added the ability to filter by Creator on the Code List 2024-04-11 11:23:13 +01:00
Tiago Ribeiro
8663fe13bd Prevented users from deleted in use codes 2024-04-11 10:56:40 +01:00
Tiago Ribeiro
de4638bc46 - ENCOA-3: Added the ability to delete multiple codes at once;
- ENCOA-5 Added a column for the Creator on the code list;
2024-04-11 10:22:02 +01:00
Tiago Ribeiro
c9740fe8ee ENCOA-1: Added expired teachers on the Admin dashboard 2024-04-11 09:53:34 +01:00
Tiago Ribeiro
9b9b67c6cd Added a "Linked Corporate" column to the Groups list 2024-04-05 09:04:40 +01:00
Tiago Ribeiro
fe2abaacae Added a list for codes, for users to delete unused ones 2024-04-04 23:05:12 +01:00
João Ramos
11e2ea3249 Merged in bug-fixing-2-Abril (pull request #51)
Minor change regarding user id on the pdf footer

Approved-by: Tiago Ribeiro
2024-04-04 08:25:39 +00:00
Tiago Ribeiro
2de4b7c715 Show the Company Name of the Teachers and students that are linked in the User List View 2024-04-03 22:46:31 +01:00
Joao Ramos
a8ffebe944 Minor change regarding user id on the pdf footer 2024-04-02 22:19:32 +01:00
Tiago Ribeiro
9ab7c3ed59 Merge branch 'develop' 2024-04-02 14:53:48 +01:00
Tiago Ribeiro
f374d91ef8 Solved an issue where the company name of country managers wasn't able to be updated 2024-04-02 10:53:34 +01:00
Tiago Ribeiro
62ecc4e395 Added the ability to edit the options of a Level Exam 2024-04-02 10:32:59 +01:00
Tiago Ribeiro
46764cacfa Updated the stats 2024-04-02 00:25:49 +01:00
Tiago Ribeiro
0b9e1bd734 Merged in develop (pull request #50)
Update 31/02/2024
2024-03-31 22:33:55 +00:00
João Ramos
bddb2ed18e Merged in bug-fixing-30-MAR (pull request #49)
Added missing cards

Approved-by: Tiago Ribeiro
2024-03-31 22:33:15 +00:00
Joao Ramos
e8fbeff77a Added missing cards 2024-03-30 14:43:08 +00:00
Tiago Ribeiro
b64593df90 Solved a problem with the record page not being able to reload 2024-03-28 12:28:24 +00:00
Tiago Ribeiro
2657cb409c Solved a bug where it would not send the correct link to the e-mail 2024-03-28 08:21:45 +00:00
Tiago Ribeiro
329ed573b3 Improved a bit more the error prevention 2024-03-26 21:48:55 +00:00
Tiago Ribeiro
bb7558afb8 Updated the writing evaluation to use the different endpoints 2024-03-26 21:46:53 +00:00
Tiago Ribeiro
259ed03ee4 Solved a bug where users could change their e-mail to another user's email 2024-03-26 16:13:39 +00:00
Tiago Ribeiro
bf6c805487 Updated the Group List to show the name of the corporate 2024-03-26 14:03:58 +00:00
Tiago Ribeiro
1086e78936 Updated the MatchSentences exercise to work better now 2024-03-26 00:42:39 +00:00
Tiago Ribeiro
7d0d930140 Updated the Listening partial to not show the introductory audio 2024-03-25 01:34:58 +00:00
Tiago Ribeiro
f02fff55e7 Solved the exercise counter bug 2024-03-25 01:16:56 +00:00
Tiago Ribeiro
08e71c4dd8 Updated the ID of the matchSentences when generating 2024-03-25 00:47:03 +00:00
João Ramos
6f5a74844c Merged in pdf-bullet-points (pull request #48)
Added support for PDF bulletpoints

Approved-by: Tiago Ribeiro
2024-03-24 23:51:53 +00:00
João Ramos
c4011cd456 Merged develop into pdf-bullet-points 2024-03-24 23:43:42 +00:00
Joao Ramos
5ef2568aa5 Added support for PDF bulletpoints 2024-03-24 23:42:02 +00:00
Tiago Ribeiro
6d817e6d27 Added Match Sentences as a possible exercise type for Reading 2024-03-24 23:32:14 +00:00
Tiago Ribeiro
5decfb098d Removed the "Correct" and stuff from the Finish for the Writing and Speaking 2024-03-24 12:28:42 +00:00
Tiago Ribeiro
c2b6be4425 Solved the solution duplication bug 2024-03-24 12:22:52 +00:00
Tiago Ribeiro
f320fee416 This is better 2024-03-24 03:24:12 +00:00
Tiago Ribeiro
445e486cd2 Added a filter that should not exist but whatever 2024-03-24 03:23:01 +00:00
Tiago Ribeiro
ee26b50cf6 Helped solve a bug where it would get stuck 2024-03-24 03:18:00 +00:00
Tiago Ribeiro
22f2b43692 Prevented the bug where the application is crashing 2024-03-24 02:32:12 +00:00
Tiago Ribeiro
29b2c8b3b8 Updated the code to solve the double stats creation 2024-03-24 00:46:42 +00:00
Tiago Ribeiro
51cc1e3f36 Oops 2024-03-23 18:40:37 +00:00
Tiago Ribeiro
d9fce10538 Updated the level to be out of its total and not 9.0 2024-03-23 18:30:43 +00:00
Tiago Ribeiro
bd74313bd5 Updated the radial result accordingly 2024-03-23 18:28:12 +00:00
Tiago Ribeiro
18df890ef9 Updated the PDF report to show the level instead of the score 2024-03-23 17:16:52 +00:00
Tiago Ribeiro
13ebb9bbd8 Solved a bug where the speaking and interactive speaking were not being correctly evaluated 2024-03-23 15:43:25 +00:00
João Ramos
38c0c823e1 Merged in bug-fixing-19-MAR (pull request #47)
Bug fixing 19 MAR

Approved-by: Tiago Ribeiro
2024-03-22 11:17:43 +00:00
Tiago Ribeiro
b50e15d1d9 Merge branch 'develop' into bug-fixing-19-MAR 2024-03-22 11:15:30 +00:00
Tiago Ribeiro
969698d8b8 Updated the PDF report to give the value out of 9.0 2024-03-22 09:07:36 +00:00
Tiago Ribeiro
7d83ebc5c5 Maybe this helps I guess 2024-03-21 16:30:01 +00:00
Tiago Ribeiro
e99650ecd8 Removed unused console.logs 2024-03-21 11:28:09 +00:00
João Ramos
7287a9ce9a Merged develop into bug-fixing-19-MAR 2024-03-21 11:21:28 +00:00
Joao Ramos
8cc7e6a57d Removed change setup for debug 2024-03-21 10:57:55 +00:00
Joao Ramos
0a24cb9978 Added PDF Manuals 2024-03-21 10:56:56 +00:00
Joao Ramos
a5c1286748 Removed decimals from export pdf 2024-03-21 10:48:46 +00:00
Tiago Ribeiro
06684a4900 Added the exam information to the ticket submission 2024-03-20 21:24:09 +00:00
Tiago Ribeiro
1823538058 Added a link for admins to go to the CMS 2024-03-20 12:46:55 +00:00
Joao Ramos
60ccc822b5 Fixed missing threshold 2024-03-19 19:22:28 +00:00
Joao Ramos
9abd69c5e5 Stats and Records are now hidden for country managers 2024-03-19 19:01:37 +00:00
Joao Ramos
2667891bdd If the subscrition is unlimited, do not provide the link 2024-03-19 18:57:10 +00:00
Tiago Ribeiro
65485a0d1f Solved a problem with the API call 2024-03-13 23:31:11 +00:00
Tiago Ribeiro
74dd96d000 Applied the same fix for other pages 2024-03-13 09:21:16 +00:00
Tiago Ribeiro
49ee3c45e5 Merge branch 'develop' 2024-03-13 09:19:26 +00:00
Tiago Ribeiro
49d2680a07 Solved a bug with the redirection 2024-03-13 09:18:14 +00:00
Tiago Ribeiro
9dac7fd19e Merge branch 'develop' 2024-03-12 19:06:18 +00:00
Tiago Ribeiro
528299571c Fixed a small bug 2024-03-12 19:05:44 +00:00
Tiago Ribeiro
dcc630b8e5 Merge branch 'develop' 2024-03-12 17:56:57 +00:00
João Ramos
be5125e5b0 Merged in bug-fixing-11-MAR (pull request #46)
Bug fixing 11 MAR

Approved-by: Tiago Ribeiro
2024-03-12 17:51:36 +00:00
Joao Ramos
0adf45c6ad Added propagate status changes 2024-03-12 15:52:10 +00:00
Joao Ramos
d9b93a3470 Added default value for postal_code 2024-03-11 17:13:48 +00:00
Joao Ramos
83e4173750 removed broken debugger 2024-03-11 17:05:20 +00:00
Joao Ramos
e2d5f6ac9d Removed debugger; 2024-03-11 17:04:10 +00:00
Joao Ramos
37c3c6f7f4 Updated redirect implementation 2024-03-11 17:00:38 +00:00
Joao Ramos
3b4dfb9648 Merge branch 'develop' 2024-03-11 15:45:49 +00:00
Joao Ramos
330c177ff9 Paypal integration improvements 2024-03-07 11:18:48 +00:00
Tiago Ribeiro
0cff310354 Turned the e-mails to be dependent on the environment 2024-03-07 10:21:13 +00:00
Joao Ramos
87a1d7c288 Minor imporvements and logs 2024-03-06 18:59:11 +00:00
Joao Ramos
8e1fe15a24 Fixed loading blocking the paypal box 2024-03-06 11:38:08 +00:00
Joao Ramos
c95c0eff9b Removed vault: true from paypal as requested 2024-03-06 11:03:31 +00:00
Joao Ramos
eaf94f458a Added console.error on RAAS 2024-03-05 18:18:26 +00:00
Tiago Ribeiro
ba85596e79 Merged in develop (pull request #45)
Update - 05/03/2024
2024-03-05 17:29:33 +00:00
João Ramos
c6a478c406 Merged in feature-paypal-simple (pull request #44)
Improvements on the Paypal Integration

Approved-by: Tiago Ribeiro
2024-03-05 16:04:28 +00:00
Joao Ramos
2a27fbd02f Merge branch 'develop' into feature-paypal-simple 2024-03-05 14:45:51 +00:00
Joao Ramos
a86ed9f76c Added RAAS api and tracking
Improvements on paypal UI
2024-03-05 14:37:02 +00:00
Tiago Ribeiro
20b52d049d Updated the default to be 100 2024-03-04 00:14:04 +00:00
Tiago Ribeiro
165e33b188 Updated an error with the session 2024-03-03 12:01:05 +00:00
João Ramos
04cbcbc4cb Merged in feature-homepage-contacts-languages (pull request #43)
Feature homepage contacts languages

Approved-by: Tiago Ribeiro
2024-02-29 23:54:04 +00:00
Tiago Ribeiro
2feb9223c1 Merged develop into feature-homepage-contacts-languages 2024-02-29 23:53:42 +00:00
Joao Ramos
02d2d07f6c Paypal tab is now only displayed to admin or devs 2024-02-29 21:33:47 +00:00
Joao Ramos
ecd66d61f2 Updated exam abandon message 2024-02-29 21:33:07 +00:00
Joao Ramos
424b72efaf Uppercased the country code to prevent API errors 2024-02-29 18:35:30 +00:00
Joao Ramos
79e51d6294 Added support for the homepage languages 2024-02-29 18:26:41 +00:00
Tiago Ribeiro
773480875f Extremely wrong approach, but want to test 2024-02-28 22:44:18 +00:00
Joao Ramos
96d1b85f56 Removed HeaderGroup types on CSV export 2024-02-28 22:34:58 +00:00
Joao Ramos
cf20920fd8 Updated possible HeaderGroup types on CSV export 2024-02-28 22:29:07 +00:00
Joao Ramos
4114971244 Prevented date from wrapping 2024-02-28 20:01:43 +00:00
João Ramos
bee20388d9 Merged in feature-paypal-payments (pull request #40)
Added integration for paypal payments
2024-02-27 14:20:35 +00:00
João Ramos
bd97529658 Merged in feature-tickets-with-admin (pull request #42)
Added corporate display to Tickets table

Approved-by: Tiago Ribeiro
2024-02-27 14:17:43 +00:00
Tiago Ribeiro
d3c24d738c Merged develop into feature-tickets-with-admin 2024-02-27 14:17:28 +00:00
João Ramos
eac43a160d Merged in tickets-source (pull request #41)
Added Approach to accept ticket source

Approved-by: Tiago Ribeiro
2024-02-27 14:17:06 +00:00
Joao Ramos
24c3f506c6 Added corporate display to Tickets table 2024-02-26 23:27:10 +00:00
Joao Ramos
3e13ed5830 Added Approach to accept ticket source 2024-02-26 19:09:42 +00:00
Joao Ramos
9b5ff70037 Added search text to Paypal payments
Updated CSV Downlaod
Reordered the UI of the page
2024-02-26 18:46:21 +00:00
Joao Ramos
d7f1a4f6b2 Added integration for paypal payments 2024-02-25 16:59:21 +00:00
Tiago Ribeiro
b663e5c706 Updated the labels for the level 2024-02-24 22:35:13 +00:00
Tiago Ribeiro
efb99b31f2 Merge branch 'develop' 2024-02-23 15:20:10 +00:00
Tiago Ribeiro
03882d2a7e Improved some visual things requested by the client 2024-02-23 15:18:45 +00:00
Tiago Ribeiro
a3087567ea Merge branch 'develop' 2024-02-23 15:07:42 +00:00
João Ramos
e37afd5bbc Merged in feature-homepage-users (pull request #39)
Added API endpoints for agents load for the homepage

Approved-by: Alvaro Doria
2024-02-19 14:35:29 +00:00
João Ramos
cf5e827ca7 Merged in feature-archive-assignments (pull request #38)
Added approach to archive past assignments

Approved-by: Alvaro Doria
2024-02-19 14:35:20 +00:00
João Ramos
bfa9d039e2 Merged in bug-user-level-progress (pull request #37)
Bug user level progress

Approved-by: Alvaro Doria
2024-02-19 14:35:08 +00:00
Joao Ramos
62b915fbc1 Added API endpoints for agents load for the homepage 2024-02-18 18:04:54 +00:00
Joao Ramos
cdfafb3eea Added approach to archive past assignments 2024-02-18 11:46:08 +00:00
Joao Ramos
29cae5c3d2 Stats for Level exam are now being properly calculated 2024-02-18 11:09:25 +00:00
Joao Ramos
04f97b62c3 Filtered out level from students history display 2024-02-17 14:22:46 +00:00
Joao Ramos
52d309e7f4 Fixed NaN display on level progress 2024-02-17 10:43:55 +00:00
Tiago Ribeiro
dbf5b17f64 Merge branch 'develop' 2024-02-15 16:10:06 +00:00
Tiago Ribeiro
703fb0df5f Updated the generic Listening intro 2024-02-15 14:07:30 +00:00
Tiago Ribeiro
be4d2de76f Updated the module title to keep in mind the previous time spent 2024-02-14 11:31:35 +00:00
Tiago Ribeiro
44c61c2e5d Fixed a bug with the module evaluation, no idea why it was happening 2024-02-14 11:19:55 +00:00
João Ramos
764064bc28 Merged in feature-ticket-badge (pull request #36)
Added a badge with the amount of pending tickets assigned to the user

Approved-by: Tiago Ribeiro
2024-02-14 00:06:27 +00:00
Tiago Ribeiro
d87de9fea9 Updated the styling a little bit 2024-02-14 00:05:08 +00:00
Joao Ramos
b63ba3f316 Added a badge with the amount of pending tickets assigned to the user 2024-02-13 17:29:55 +00:00
Tiago Ribeiro
64b1d9266e Updated the Speaking Generation to save the topic as well 2024-02-13 16:26:56 +00:00
Tiago Ribeiro
b7cd1fb141 Merge branch 'feature/user-choose-topics' into develop 2024-02-13 16:07:12 +00:00
Tiago Ribeiro
30cb2f460c Changed the label on the Save button 2024-02-13 16:05:13 +00:00
Tiago Ribeiro
6a38b7a32e Updated the exam selection to get exams related to the user's topic preference 2024-02-13 16:04:46 +00:00
Joao Ramos
2a1b5236ee Revert "Updated the label for the Tickets button"
This reverts commit a99f6fd20e.
2024-02-13 15:43:24 +00:00
Joao Ramos
a99f6fd20e Updated the label for the Tickets button 2024-02-13 15:37:37 +00:00
Tiago Ribeiro
c0c9d22864 Added the ability for a user to select their preferred topics 2024-02-13 11:39:19 +00:00
Tiago Ribeiro
718782cfd5 Merged in develop (pull request #35)
Updated the main branch - 13/02/24
2024-02-13 00:52:45 +00:00
Tiago Ribeiro
f643430068 Merge branch 'develop' into feature/user-choose-topics 2024-02-13 00:45:56 +00:00
João Ramos
2823af7ef8 Merged in privacy-policy (pull request #33)
Added checkbox for accepted terms

Approved-by: Tiago Ribeiro
2024-02-13 00:44:55 +00:00
Tiago Ribeiro
57116f50e8 Hard coded the website link because there are some problems with ENV variables in the frontend 2024-02-13 00:44:16 +00:00
Tiago Ribeiro
e382a09ae8 Added the key "topic" to Writing, Speaking and Interactive Speaking exercises 2024-02-13 00:42:09 +00:00
João Ramos
b4c7c9a911 Merged in contact-us-form (pull request #32)
Contact Us support

Approved-by: Tiago Ribeiro
2024-02-13 00:40:23 +00:00
Tiago Ribeiro
86e920f102 Merged develop into contact-us-form 2024-02-13 00:39:59 +00:00
João Ramos
6f12a4a1db Merged in email-notification-ticket-close (pull request #34)
Added an email notification when the ticket is submitted
2024-02-13 00:39:39 +00:00
Tiago Ribeiro
a27a3c1fb0 Merged develop into contact-us-form 2024-02-13 00:38:56 +00:00
Joao Ramos
63618405bc Added an email notification when the ticket is submitted 2024-02-12 22:37:16 +00:00
João Ramos
7ab67fdf15 Merged develop into privacy-policy 2024-02-12 21:49:11 +00:00
Joao Ramos
17ec004a59 Added checkbox for accepted terms 2024-02-12 21:45:37 +00:00
Tiago Ribeiro
417bd7fecb Added tooltips to the student dashboard 2024-02-12 19:26:55 +00:00
Joao Ramos
e82895351d Published the tickets POST route 2024-02-12 18:18:25 +00:00
Tiago Ribeiro
4802310474 Added the ability to delete already finished assignments 2024-02-12 11:15:04 +00:00
Tiago Ribeiro
dc3373be6a Added the ability to choose a difficulty when generating an exam 2024-02-10 13:26:08 +00:00
Tiago Ribeiro
2e894622d0 Updated users to get exams related to their level 2024-02-10 09:10:52 +00:00
Tiago Ribeiro
1895b9e183 Disabled the navigation on the mobile menu 2024-02-09 16:48:25 +00:00
Tiago Ribeiro
03f78ceb46 Added the same functionality to the Assignments 2024-02-09 13:23:35 +00:00
Tiago Ribeiro
872cc62fe4 - Added the ability for a student/developer to choose a gender for a speaking instructor;
- Made it so, if chosen, the user will only get speaking exams with their chosen gender;
- Added the ability for speaking exams to select a gender when generating;
2024-02-09 12:14:47 +00:00
Joao Ramos
ce7032c8a7 Added agent as a possible idsplay on the list for ticket 2024-02-08 19:49:53 +00:00
Tiago Ribeiro
71f07af2eb Added "instructorGender" key to Speaking exams 2024-02-08 14:04:52 +00:00
Tiago Ribeiro
89250fb98e Merge branch 'develop' into feature/exam-session-persistence 2024-02-08 11:55:16 +00:00
Tiago Ribeiro
b09fe79cb7 Updated the InteractiveSpeaking to also work with the session persistence 2024-02-08 11:43:01 +00:00
Joao Ramos
870ed57166 Swapped the grade for the level on the level display for an exam 2024-02-07 20:35:30 +00:00
Tiago Ribeiro
2a9e204041 Updated the Speaking to also work the with exam session persistence 2024-02-07 17:15:41 +00:00
João Ramos
00f6aaf058 Merged in feature-pdf-version (pull request #31)
PDF Versioning

Approved-by: Tiago Ribeiro
2024-02-06 20:45:13 +00:00
Joao Ramos
044a4f91aa Added PDF version to footer 2024-02-06 19:19:03 +00:00
Tiago Ribeiro
65fe1ec8ed Made it so it currently is possible to save the progress on the Writing exercise as well 2024-02-06 15:51:55 +00:00
Tiago Ribeiro
779fb76b8b Solved some issues related to the listening loading 2024-02-06 15:24:51 +00:00
Tiago Ribeiro
4ec439492e Added the capability for users to resume their previously stopped sessions 2024-02-06 14:44:22 +00:00
Tiago Ribeiro
c4b61c4787 - Adapted the exam to store all of its information to Zustand;
- Made it so, every time there is a change or every X seconds, it saves the session;
2024-02-06 12:34:45 +00:00
Joao Ramos
934394b17f Added approach to allow versioning of PDFs (Requires env var!) 2024-02-05 20:01:50 +00:00
Tiago Ribeiro
8baa25c445 Added a Scroll To Top function 2024-02-05 17:59:46 +00:00
Tiago Ribeiro
f6166ca9e1 Added an "instructions" panel to the Listening before it actually starts 2024-02-05 14:52:35 +00:00
Tiago Ribeiro
e6017854fd From now on, when a student accepts an invite from a corporate, they are removed from previous corporate groups 2024-02-05 10:40:39 +00:00
Tiago Ribeiro
0bd8b0ab24 Solved a small display issue 2024-02-05 10:07:04 +00:00
Tiago Ribeiro
401d212d85 Added a better way to distinguish the options 2024-02-04 00:32:34 +00:00
Tiago Ribeiro
9383929ebb Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2024-02-04 00:23:59 +00:00
Tiago Ribeiro
5dcab23fdb Extracted the PayPalScriptProvider 2024-02-03 23:40:31 +00:00
Joao Ramos
d111be2f70 Fixed the assignments export based on unique exams. 2024-02-03 22:51:21 +00:00
Tiago Ribeiro
00c171b161 Merge branch 'develop' 2024-02-03 15:15:24 +00:00
João Ramos
53d3f843da Merged in stats-tooltip (pull request #30)
Added tooltip to stats screen
2024-02-03 15:14:49 +00:00
Tiago Ribeiro
8d7f312a83 Merged develop into stats-tooltip 2024-02-03 15:14:25 +00:00
Joao Ramos
6f11818876 Added tooltip to stats screen 2024-02-03 15:11:19 +00:00
Tiago Ribeiro
81bc4e7a0c Merge branch 'develop' 2024-02-03 15:02:49 +00:00
Tiago Ribeiro
48265a8e54 Reverted the name 2024-02-03 15:01:54 +00:00
Tiago Ribeiro
0053105dd3 Updated the use of the Desired Levels to be configurable 2024-02-03 14:46:35 +00:00
Tiago Ribeiro
846d829d10 Had left some code behind? 2024-02-03 12:40:27 +00:00
Tiago Ribeiro
c0c3e37568 Aligned the selection text to the left;\nUpdated the service account for the Firebase. 2024-02-01 14:00:34 +00:00
Tiago Ribeiro
a872190e1b Turned it bold 2024-01-31 23:45:36 +00:00
Tiago Ribeiro
147a450be2 Changed the Level test finish screen to only show the grade 2024-01-31 23:45:09 +00:00
Tiago Ribeiro
908ce5b5b9 Added an Invite list to the payment due page as well 2024-01-31 23:42:46 +00:00
Tiago Ribeiro
0ec62c107c Corrected a bug where a corporate with unlimited subscription could not generate multiple codes 2024-01-31 23:00:43 +00:00
Tiago Ribeiro
626655d0d0 Merge branch 'develop' 2024-01-31 11:46:07 +00:00
Tiago Ribeiro
16eeba76fd Added the tickets link to the mobile menu 2024-01-31 11:45:23 +00:00
Tiago Ribeiro
85729116e7 Updated the tickets to allow agents to also view theirs 2024-01-31 10:47:14 +00:00
Tiago Ribeiro
2de9636c8b Merged in feature/ticket-system (pull request #29)
Features: Ticket and Invite systems
2024-01-30 18:27:49 +00:00
Tiago Ribeiro
bcad5b5646 Added date sorting to the ticket list 2024-01-30 18:02:21 +00:00
Tiago Ribeiro
4e40dc9c8c Prevented the creation of multiple equal invites 2024-01-30 17:50:48 +00:00
Tiago Ribeiro
e3bcaf6b30 Merge branch 'develop' into feature/ticket-system 2024-01-29 21:03:47 +00:00
Tiago Ribeiro
a35c85545e Updated the code to set the participant's expiration date to use the corporate's one if it is better 2024-01-29 21:02:52 +00:00
Tiago Ribeiro
c4707d6426 Merge branch 'develop' into feature/ticket-system 2024-01-29 15:41:20 +00:00
Tiago Ribeiro
3564d0af6b Solved the same bug but for the e-mail 2024-01-29 15:40:50 +00:00
Tiago Ribeiro
e7acdb5858 Merge branch 'develop' into feature/ticket-system 2024-01-29 15:33:55 +00:00
Tiago Ribeiro
8bff64dd13 Solved a bug on the assignments because of the multiple exams 2024-01-29 15:31:41 +00:00
Tiago Ribeiro
2c4168a014 Created an e-mail type to be sent to the ticket reporter with the ticket's information 2024-01-29 13:19:12 +00:00
Tiago Ribeiro
800d04da37 Updated the login and register to transform the e-mail to lowercase 2024-01-29 09:53:47 +00:00
Tiago Ribeiro
b7b2718387 Merge branch 'develop' into feature/ticket-system 2024-01-29 09:51:50 +00:00
Tiago Ribeiro
a862e59574 Updated the login and register to transform the e-mail to lowercase 2024-01-29 09:51:11 +00:00
Tiago Ribeiro
688d8ba0b2 Created a simple invite system that notifies users via e-mail when a corporate uploads an Excel file with already registered students 2024-01-29 09:36:59 +00:00
Tiago Ribeiro
8b7e550a70 Created a new page for ticket handling as well as submission 2024-01-28 21:05:17 +00:00
João Ramos
cf1cb6f270 Merged in bug-fixing-27-jan-24 (pull request #28)
Bug fixing 27 jan 24
2024-01-28 18:47:10 +00:00
Tiago Ribeiro
476a6b0188 Merged develop into bug-fixing-27-jan-24 2024-01-28 18:46:54 +00:00
Tiago Ribeiro
01e55f970d Solved a bug where if two evaluations where too fast, they would overwrite each other 2024-01-28 18:10:56 +00:00
Joao Ramos
bca73dff2e Fixed userid 2024-01-27 20:10:15 +00:00
Joao Ramos
aef3800c08 Fixed issue with serialization on forgot password locally 2024-01-27 20:08:44 +00:00
Joao Ramos
a40c21ca53 Fixed table columns headers 2024-01-27 20:08:10 +00:00
Joao Ramos
34b1c7f25b Fixed footer paddings 2024-01-27 20:07:40 +00:00
Joao Ramos
7c641508ce Added user id to the footer of the report 2024-01-27 19:34:15 +00:00
Joao Ramos
4163076524 Added passportid to the table ; removed gender column from table 2024-01-27 19:27:28 +00:00
Joao Ramos
009c610033 Removed some candidate information 2024-01-27 19:26:48 +00:00
Joao Ramos
c05df7d6b7 Removed condition that blocked admins/devs from exporting a pdf for assignment 2024-01-27 19:12:05 +00:00
Joao Ramos
b881969bd4 Exporting a report from an user now allows access to the user data of the user that did the exam instead of the current session 2024-01-27 19:10:41 +00:00
Tiago Ribeiro
5e6af11156 Update the Group List to always allow editing for developers and admins 2024-01-26 19:13:44 +00:00
Tiago Ribeiro
c1162c5e88 Merge branch 'develop' 2024-01-26 16:33:55 +00:00
Tiago Ribeiro
213bdd0c8f Added the ability for developers to choose what screen they wanna see 2024-01-26 16:21:34 +00:00
Tiago Ribeiro
13401562fb Added the ability for assignments to use partial exams as well 2024-01-26 16:16:28 +00:00
Tiago Ribeiro
4e199931aa Solved another weird bug 2024-01-26 11:49:03 +00:00
Tiago Ribeiro
3eafc799ab Solved a quick bug 2024-01-26 11:41:31 +00:00
Tiago Ribeiro
9b87764afb Updated the code generator to only generate after the e-mails are sent 2024-01-25 12:14:12 +00:00
Tiago Ribeiro
a969e90c98 Added a confirmation when generating codes 2024-01-25 11:32:29 +00:00
Tiago Ribeiro
c38c1d9ff6 Removed the need for it to alway use Passport ID 2024-01-25 10:28:45 +00:00
Tiago Ribeiro
bcacbbdd15 Made the phone row optional 2024-01-25 10:19:06 +00:00
Tiago Ribeiro
fa481dc50e Merge branch 'develop' 2024-01-24 15:58:35 +00:00
Tiago Ribeiro
710c7931aa Updated the permissions to disallow corporate and teachers from editing other users 2024-01-24 15:40:05 +00:00
Tiago Ribeiro
d3f80603c4 Improved the Speaking Generation 2024-01-24 15:37:51 +00:00
Tiago Ribeiro
fea2d311ae Updated it so an agent can't edit the commission on a corporate 2024-01-24 15:24:45 +00:00
Tiago Ribeiro
5f475fb7a7 Finalized the Speaking exam generation 2024-01-24 00:37:54 +00:00
Tiago Ribeiro
bd0fab4c8f Updated and fixed part of the partial test generation 2024-01-23 11:45:32 +00:00
Tiago Ribeiro
74d3f30c93 Added the ability to choose between partial and full exams 2024-01-23 10:11:04 +00:00
Tiago Ribeiro
67c2e06575 Improved the Generation frontend 2024-01-22 23:34:42 +00:00
Tiago Ribeiro
506ee1e0e4 Updated the zIndex of the Select 2024-01-22 22:56:08 +00:00
Tiago Ribeiro
81943dbf42 Updated the module generation to allow for only certain parts to be made 2024-01-22 18:50:12 +00:00
Tiago Ribeiro
c868ea8795 Turned the nav to Gray when it is disabled 2024-01-22 14:18:08 +00:00
Tiago Ribeiro
cfde8ac9f0 Updated it so the Corporate is updated into Active when its payment is accepted 2024-01-21 20:35:35 +00:00
Tiago Ribeiro
8c1da3a84a Updated the UserCard to only show buttons to adequate users 2024-01-21 20:28:42 +00:00
Tiago Ribeiro
52143d2472 Solved a bug that caused some user's profile page to crash 2024-01-21 20:23:48 +00:00
Tiago Ribeiro
c7f303e410 Solved a bug 2024-01-21 20:20:08 +00:00
Tiago Ribeiro
da93b79c78 Solved an issue with sorting 2024-01-21 13:34:48 +00:00
Tiago Ribeiro
83b8ab7774 Allowed admins and others to download reports related to other users 2024-01-21 12:48:29 +00:00
Tiago Ribeiro
f6bb69f994 Updated the condition to close assignment: to be end date or when all students finish the assignment 2024-01-21 00:30:44 +00:00
Tiago Ribeiro
a97c40dc47 Merge branch 'develop' 2024-01-20 15:24:38 +00:00
Tiago Ribeiro
3de0357369 Oops, left an ID accidentally 2024-01-20 15:24:02 +00:00
Tiago Ribeiro
8eb8a7af46 Added a new card for the Corporate to show their user balance 2024-01-20 15:09:42 +00:00
Tiago Ribeiro
9773f1da72 Updated the user deletion to allow corporate to remove users from their groups, instead of deleting them 2024-01-20 13:33:22 +00:00
Tiago Ribeiro
2ef86344cd Updated the Assignment default start date to be the current time 2024-01-20 01:17:22 +00:00
Tiago Ribeiro
5e8b6f96bb Added a timezone selector to the Demographic Input 2024-01-20 01:15:12 +00:00
Tiago Ribeiro
b757cbbed7 Solved a date sorting bug 2024-01-20 01:09:03 +00:00
Tiago Ribeiro
4e08afb259 Merge branch 'develop' 2024-01-18 00:27:31 +00:00
Tiago Ribeiro
68069d118f Added correction visualizers for the Speaking transcript correction 2024-01-17 23:40:46 +00:00
Tiago Ribeiro
74dcccf089 Added a new type of e-mail to send to students when a new assignment is created 2024-01-17 15:55:33 +00:00
Tiago Ribeiro
b7ae9fb837 Merge branch 'develop' 2024-01-17 14:29:33 +00:00
Tiago Ribeiro
63d2baf35f Improved the overall redirection of the login page 2024-01-17 14:25:37 +00:00
Tiago Ribeiro
c02a6a01f4 Merge branch 'develop' into feature/writing-diff-viewer 2024-01-17 12:58:44 +00:00
Tiago Ribeiro
a646955493 Solved a bug with calculations of the stats page 2024-01-17 11:59:40 +00:00
Tiago Ribeiro
7a577a7ca2 Solved another stupid bug 2024-01-17 11:50:50 +00:00
Tiago Ribeiro
c26ff48b60 Solved some issues with the Student Dashboard 2024-01-17 11:32:20 +00:00
Tiago Ribeiro
9ee09c8fda Added a diff viewer for the writing correction 2024-01-17 11:22:23 +00:00
João Ramos
d4867fd9a2 Merged in bug-fixing-16-jan-24 (pull request #26)
Report PDF improvements / bugs

Approved-by: Tiago Ribeiro
2024-01-16 23:20:00 +00:00
Tiago Ribeiro
13e52bfce6 Merge branch 'develop' into bug-fixing-16-jan-24 2024-01-16 23:14:05 +00:00
Tiago Ribeiro
5540e4a3e6 Updated the profile page a bit to accommodate recent changes 2024-01-16 23:11:16 +00:00
João Ramos
a18ee93909 Merged in feature-user-timezone-pdf (pull request #25)
Added Date export based on user timezone

Approved-by: Tiago Ribeiro
2024-01-16 23:07:07 +00:00
Tiago Ribeiro
0641d4250c Merged develop into feature-user-timezone-pdf 2024-01-16 23:03:46 +00:00
Tiago Ribeiro
f85a1f5601 Updated part of the correction display for Writing 2024-01-16 23:00:58 +00:00
Joao Ramos
6bcc303b74 Fixed institution print 2024-01-16 22:24:08 +00:00
Joao Ramos
8002c71b91 Fixed issue with 100% being hyphenized 2024-01-16 22:22:55 +00:00
Joao Ramos
31d3232f19 Added passport id to PDF 2024-01-16 19:24:19 +00:00
Joao Ramos
4448c2019e Added some bold text to PDF footer 2024-01-16 18:48:01 +00:00
Joao Ramos
01a9da3a5b Added Date export based on user timezone 2024-01-16 18:42:12 +00:00
Tiago Ribeiro
d0b0dfb16f Solved a bug with the UserCard 2024-01-16 16:30:38 +00:00
Tiago Ribeiro
c5007a316f Updated the profile of the Corporate user according to the client's instructions 2024-01-16 16:26:59 +00:00
Tiago Ribeiro
c68e206aae Updated the Group creation modal to use Excel 2024-01-15 21:32:54 +00:00
Tiago Ribeiro
2bad3ad09f Solved: A second “Next” button appears on Listening part transitions 2024-01-15 21:21:08 +00:00
Tiago Ribeiro
f9e037bd7b Updated to "Linked to:" 2024-01-15 21:01:38 +00:00
Tiago Ribeiro
ccde1c84b7 Added a log for the exam for developers 2024-01-15 20:35:11 +00:00
Tiago Ribeiro
367553eb44 Added associated corporate’s name to Students and Teachers 2024-01-15 20:27:20 +00:00
Tiago Ribeiro
576d2ac29d Merge branch 'develop' of bitbucket.org:ecropdev/ielts-ui into develop 2024-01-15 20:19:21 +00:00
João Ramos
e13af65d88 Merged in bug-missing-radial-performance-sumary (pull request #24)
Fixed Missing radial performance sumary

Approved-by: Tiago Ribeiro
2024-01-15 20:13:29 +00:00
Joao Ramos
294d319ab3 Removed debuggers 2024-01-15 19:47:53 +00:00
Joao Ramos
7572909b13 Removed unnecessary margin ruining percentage centered 2024-01-15 19:33:31 +00:00
Joao Ramos
46b9fe50ef Added the missing radial progress 2024-01-15 19:32:11 +00:00
Tiago Ribeiro
1335c14acc Removed the ability for a Teacher to upload a file for the Group creation 2024-01-15 16:34:06 +00:00
Tiago Ribeiro
e47607597c Solved some bugs related to the payment page 2024-01-15 14:52:17 +00:00
Tiago Ribeiro
b7b2dca2dd Updated the user deletion to work in the backend 2024-01-15 11:02:40 +00:00
Tiago Ribeiro
a14c9f8b3c Updated the label of the cancel button on FillBlanks 2024-01-15 10:20:23 +00:00
Tiago Ribeiro
e59d36e892 Updated the UserCard to not show the Commission for corporate users 2024-01-15 10:11:18 +00:00
Tiago Ribeiro
f5bdedee2f Updated the message of the failed delete payment 2024-01-14 23:35:48 +00:00
Tiago Ribeiro
3f0821eb33 Added the corporate name to the user's top-right profile link 2024-01-14 23:31:50 +00:00
Tiago Ribeiro
31e09c94c7 Added an explanation for the Excel file format requested 2024-01-14 23:29:22 +00:00
Tiago Ribeiro
404e5a8a0c Added a * to required fields 2024-01-14 23:20:12 +00:00
Tiago Ribeiro
b7a3778f01 Solved another bug with the TrueFalse 2024-01-14 23:18:51 +00:00
Tiago Ribeiro
24ec336dca Updated the Record to start with the overall screen 2024-01-14 23:13:12 +00:00
Tiago Ribeiro
e324b37942 Prepared for partial exams 2024-01-14 22:36:39 +00:00
Tiago Ribeiro
066baa9492 Solved a bug with the WriteBlanks warning 2024-01-14 22:27:48 +00:00
Tiago Ribeiro
08aec9b54c Solved some bugs with reading the Excel file 2024-01-14 22:18:15 +00:00
Tiago Ribeiro
10a480aa81 Updated the Code generators select to depend on the type of user 2024-01-14 22:08:17 +00:00
Tiago Ribeiro
9baf3109c9 Merge branch 'develop' 2024-01-14 07:44:23 +00:00
João Ramos
360e6f8f60 Merged in bug-fixing-13-jan-24 (pull request #23)
Editing country manager is now only available for admins/dev
2024-01-14 00:10:25 +00:00
Tiago Ribeiro
eadddbf505 Merged develop into bug-fixing-13-jan-24 2024-01-14 00:09:32 +00:00
Joao Ramos
be03760cb9 Editing country amanger is now only available for admins/dev 2024-01-13 23:58:03 +00:00
Tiago Ribeiro
99758d860d BatchCodeGenerator.tsx edited online with Bitbucket 2024-01-13 18:54:21 +00:00
Tiago Ribeiro
8aca34e8b5 Merged in Tiago-Ribeiro/batchcodegeneratortsx-edited-online-with-1705170801981 (pull request #22)
BatchCodeGenerator.tsx edited online with Bitbucket
2024-01-13 18:34:01 +00:00
Tiago Ribeiro
aaaf7f646d BatchCodeGenerator.tsx edited online with Bitbucket 2024-01-13 18:33:26 +00:00
João Ramos
51dcb69b81 Merged in bug-fixing-12-jan-24 (pull request #21)
Bug fixing 12 jan 24

Approved-by: Tiago Ribeiro
2024-01-12 21:30:28 +00:00
Joao Ramos
580ddfd9e6 Fixed Pending payment page key 2024-01-12 21:27:46 +00:00
Joao Ramos
9e6dc4b4c2 Reviewed all IconCard for non-matching icons 2024-01-12 20:00:31 +00:00
Joao Ramos
72b9e1f11d Added payment done and pending visible to Admin and Developers without filters 2024-01-12 19:55:46 +00:00
Tiago Ribeiro
ad1dbaef27 Formatted the code to accept .xlsx 2024-01-12 13:49:27 +00:00
Tiago Ribeiro
6cdee9b268 Merge branch 'develop' into feature/62/upload-users-with-excel 2024-01-12 13:42:25 +00:00
João Ramos
7f4d82072f Merged in feature-payment-done-pending (pull request #20)
Added payment done and pending

Approved-by: Tiago Ribeiro
2024-01-12 10:15:12 +00:00
João Ramos
e365640620 Merged in bug-fixing-11-jan-24 (pull request #19)
Bug fixing 11 jan 24

Approved-by: Tiago Ribeiro
2024-01-12 07:55:42 +00:00
Joao Ramos
27a4014f63 Added payment done and pending 2024-01-12 01:38:34 +00:00
Joao Ramos
cb91acdded Removed some horizontal margins on PDFs 2024-01-12 00:32:02 +00:00
Joao Ramos
7714854338 Changed all corporate icons 2024-01-12 00:25:14 +00:00
Joao Ramos
5379cdb0d2 Blocked corporate user edit for corporate 2024-01-12 00:23:18 +00:00
Joao Ramos
39ea11bc9b Fixed naming of the table 2024-01-12 00:20:03 +00:00
Joao Ramos
bb1a2e477a Revert "Removed references to Referred corporated"
This reverts commit 21b612eaa4.
2024-01-12 00:19:35 +00:00
Tiago Ribeiro
34c1041182 Hard coded the CORS for the EnCoach website 2024-01-11 23:10:51 +00:00
Tiago Ribeiro
b2690f748b Merge branch 'develop' into feature/62/upload-users-with-excel 2024-01-11 21:55:57 +00:00
João Ramos
edbf405c30 Merged in bug-fixing-10-Jan-24 (pull request #17)
Exported Route for CORS usage

Approved-by: Tiago Ribeiro
2024-01-11 21:35:56 +00:00
Tiago Ribeiro
84c42ccf3e Adapted the BatchCodeGenerator to use an Excel file 2024-01-11 21:35:26 +00:00
Joao Ramos
5e283e358b Added CORS as .env var 2024-01-11 19:32:39 +00:00
Tiago Ribeiro
c9ed3b5a72 Merge branch 'develop' into feature/62/upload-users-with-excel 2024-01-11 14:39:40 +00:00
Tiago Ribeiro
3dfd65e161 Merged develop into bug-fixing-10-Jan-24 2024-01-11 14:31:56 +00:00
João Ramos
040102c835 Merged in feature-export-csv-roles (pull request #18)
Feature export csv roles

Approved-by: Tiago Ribeiro
2024-01-11 14:22:42 +00:00
Joao Ramos
c781c10fe9 Prevented an error that should only happen if the user had the type changed directly on the DB for testing purposes 2024-01-11 14:18:57 +00:00
Joao Ramos
a91539ec61 Download CSV is now also allowed for Agent and Corporates 2024-01-11 14:18:04 +00:00
Tiago Ribeiro
f79857fabe Started trying out reading Excel files 2024-01-11 13:55:37 +00:00
João Ramos
14d8c1e294 Merged in feature-report-export (pull request #16)
Feature report export

Approved-by: Tiago Ribeiro
2024-01-11 12:50:35 +00:00
Tiago Ribeiro
fd1af3efee Updated a bit of the conditions to show the Demographic input 2024-01-11 11:10:08 +00:00
Tiago Ribeiro
0c9f0b3dbd Added a National ID/Passport field to the demographic information of a student 2024-01-11 11:05:14 +00:00
Joao Ramos
93d5015c99 Exported Route for CORS usage 2024-01-11 00:06:09 +00:00
Joao Ramos
356d7e6a9d Merge branch 'feature-report-export' of https://bitbucket.org/ecropdev/ielts-ui into feature-report-export 2024-01-10 21:59:43 +00:00
João Ramos
2a4b7ed82d Merged develop into feature-report-export 2024-01-10 21:58:03 +00:00
Joao Ramos
2ec7e85ace Added page break + Improvement footer behaviour 2024-01-10 21:57:21 +00:00
Tiago Ribeiro
174398b4f7 Updated the text color of the unanswered WriteBlanks solutions 2024-01-10 09:43:16 +00:00
Joao Ramos
b00bf19620 Merge branch 'develop' into feature-report-export 2024-01-09 23:33:57 +00:00
Joao Ramos
744aa1e788 Added missing % on percentage
Removed unnecessary prop
2024-01-09 23:16:39 +00:00
Joao Ramos
cc0f9712d6 Added download option for assignment cards
Export PDF Download to hook
Prevented some NaN's
2024-01-09 23:15:13 +00:00
Joao Ramos
418221427a Added pdf download to record page
Reenabled reuse of PDF
2024-01-09 22:42:42 +00:00
Joao Ramos
6c741f944d Minor improvements on labels 2024-01-09 21:32:07 +00:00
Joao Ramos
1aadc4647c Final improvements for Groups PDF's 2024-01-09 20:17:21 +00:00
Joao Ramos
4e378f0c71 Added level to table 2024-01-09 18:47:32 +00:00
Joao Ramos
f8bf58e57c Removed ID and improved unknown user handling 2024-01-09 18:25:00 +00:00
Tiago Ribeiro
271364a939 Updated the payment records screen for the corporate to make sure they can't see agent related stuff 2024-01-09 17:26:37 +00:00
Tiago Ribeiro
f8f8ee5e13 Hid the country manager from the corporate on the payment records 2024-01-09 14:00:01 +00:00
Tiago Ribeiro
3b35a899e0 Removed an unused console.log 2024-01-09 13:56:31 +00:00
Tiago Ribeiro
59d1a12439 Added a simple spellchecker for the correction of the Writing 2024-01-09 13:55:04 +00:00
Tiago Ribeiro
e100c401e9 Updated the color of the unanswered questions to gray 2024-01-09 13:08:02 +00:00
Tiago Ribeiro
7b0f8c1c20 - It is no longer possible to upload/edit/delete a transfer after it is considered paid
- When deleting a row, the transfers are also deleted from the storage
2024-01-09 12:12:20 +00:00
Tiago Ribeiro
db2f5f2c0b Removed an unused console.log 2024-01-09 11:32:46 +00:00
Tiago Ribeiro
0ed843125a Made it so the isPaid property is controlled with the file uploads/deletes 2024-01-09 11:32:17 +00:00
Tiago Ribeiro
14d19257df Merged in feature/68/update-evaluation-to-background (pull request #15)
Feature/68/update evaluation to background
2024-01-09 10:16:37 +00:00
Joao Ramos
bdf65a7215 Added initial group report pdf 2024-01-09 02:22:54 +00:00
Joao Ramos
2540398ab0 Renamed to setup for group testing 2024-01-08 22:19:48 +00:00
Joao Ramos
cd8860f6ac PDF Report titles are now dynamic 2024-01-08 22:15:54 +00:00
Tiago Ribeiro
2cd18376f2 Merge branch 'develop' into feature/68/update-evaluation-to-background 2024-01-08 20:59:55 +00:00
Tiago Ribeiro
0694950bba Solved a bug where the "Perfect answer" would not show for speaking 2024-01-08 20:59:20 +00:00
Tiago Ribeiro
c6b15eaca1 Solved a small bug 2024-01-08 20:57:03 +00:00
Joao Ramos
647807a07c Separated suggestion from evaluation 2024-01-08 19:27:05 +00:00
Joao Ramos
094fd05df7 Removed unnecessary code 2024-01-08 19:18:10 +00:00
Joao Ramos
1ea9d8e60f Added custom stylesheet 2024-01-08 19:17:22 +00:00
Joao Ramos
63998b50d6 Added more comment 2024-01-08 19:04:44 +00:00
Joao Ramos
0f029a21f7 Added todo notification 2024-01-08 19:00:23 +00:00
Joao Ramos
7328f5c57f Temporarily disabled hasPDF validation 2024-01-08 18:59:51 +00:00
Joao Ramos
12d608879d Added some code comments 2024-01-08 18:58:54 +00:00
Tiago Ribeiro
9ceb71ae2f Refactored evaluation process for improved efficiency:
- Initial response set to null; Frontend now generates a list of anticipated stats;
- Background evaluation dynamically updates DB upon completion;
- Frontend actively monitors and finalizes upon stat evaluation completion.
2024-01-08 17:02:46 +00:00
Joao Ramos
e6c82412bf Added integration with backend to fetch skills feedback 2024-01-08 01:01:17 +00:00
Joao Ramos
5e8e46ff09 Added PNGs with partial radial progress 2024-01-07 23:51:05 +00:00
Tiago Ribeiro
957400cb82 Payment Record: Created Filters for Corporate and Country Manager that has submitted file in payment records 2024-01-07 15:22:46 +00:00
Tiago Ribeiro
e687a2b3e5 Payment Record: Prevent the tick without all files submitted 2024-01-07 15:06:59 +00:00
Joao Ramos
7a297a6f6c Added level report 2024-01-04 22:20:00 +00:00
Joao Ramos
432f4a735f Added QRCode for PDF 2024-01-04 19:49:15 +00:00
Joao Ramos
a4f79d236d Fixed Logo
Modules results display
2024-01-04 19:19:21 +00:00
Joao Ramos
a4771d5d29 Updated export to now work based on session 2024-01-04 15:48:30 +00:00
Joao Ramos
227de4ffc4 Fixed Date String for PDF 2024-01-04 12:18:34 +00:00
Joao Ramos
42fe650ae6 PDF Styling improvements 2024-01-04 12:18:11 +00:00
Tiago Ribeiro
026730c077 Updated the evaluation to work recursively when failing 2024-01-03 15:32:51 +00:00
Tiago Ribeiro
35d1157b0c Added the ability for a corporate account to check the payment record 2024-01-03 10:41:00 +00:00
Tiago Ribeiro
06dc92fdaa Added a confirmation for the payment record 2024-01-03 10:33:37 +00:00
Tiago Ribeiro
c9cac3539c Made sure it only happens for corporate students 2024-01-02 11:48:15 +00:00
Tiago Ribeiro
d2276eba1d Made it so that students, connected to a corporate, if they change their e-mail, they get unassigned 2024-01-02 11:07:18 +00:00
Tiago Ribeiro
1c2c3fe402 Lock the e-mail on input if the code has an e-mail associated 2023-12-31 15:22:42 +00:00
João Ramos
d4b90b5fa4 Merged in feature-payment-corporate-id (pull request #10)
Replaced display of payment id with corporate's id

Approved-by: Tiago Ribeiro
2023-12-29 10:47:55 +00:00
Tiago Ribeiro
383ddde7b5 Merged develop into feature-payment-corporate-id 2023-12-29 10:42:20 +00:00
João Ramos
e56636ca1f Merged in bug-fixing-271223 (pull request #14)
Bug fixing 271223

Approved-by: Tiago Ribeiro
2023-12-29 10:41:53 +00:00
Joao Ramos
0b6a66b12d Initial version of PDF export 2023-12-28 23:41:21 +00:00
João Ramos
e0be2fd222 Merged develop into feature-payment-corporate-id 2023-12-28 18:29:12 +00:00
Joao Ramos
9e23e3e608 Added support for currency in the CSV 2023-12-28 18:28:18 +00:00
João Ramos
47ecc2be27 Merged develop into bug-fixing-271223 2023-12-28 18:13:01 +00:00
Joao Ramos
3ca0ad353e Removed unnecessary code 2023-12-28 18:11:30 +00:00
Tiago Ribeiro
5447c89da4 Updated the permissions to be admin instead of owner 2023-12-28 11:44:21 +00:00
Joao Ramos
c88757c869 Profile is now auto filled with the user data 2023-12-27 22:33:11 +00:00
Joao Ramos
8831729470 Changed behaviour for new payment values 2023-12-27 22:14:11 +00:00
Joao Ramos
b3bb5a2337 Added search area for table users 2023-12-27 21:44:13 +00:00
Joao Ramos
b7ddee1db2 Company Name is now displayed on the Settings table, if available 2023-12-27 21:06:06 +00:00
João Ramos
d85b9db535 Merged develop into feature-payment-corporate-id 2023-12-27 19:27:04 +00:00
Joao Ramos
d03d790327 Merge branch 'develop' into feature-payment-corporate-id
CSV Improvements after merge issues
2023-12-27 19:21:02 +00:00
Tiago Ribeiro
79b159f948 Merged in improvement/stats-page-updaes (pull request #13)
Updates to the Stats page according to the client's requests
2023-12-27 15:03:03 +00:00
Tiago Ribeiro
3a0a9e1e99 Merge branch 'develop' into improvement/stats-page-updaes 2023-12-27 15:02:12 +00:00
João Ramos
cc2d0bf1b0 Merged in feature-paymentFilters (pull request #8)
Added payment and date filter

Approved-by: Tiago Ribeiro
2023-12-27 14:54:08 +00:00
João Ramos
03a199983b Merged develop into feature-paymentFilters 2023-12-27 14:52:53 +00:00
Tiago Ribeiro
a07e5a7312 Merge branch 'develop' into improvement/stats-page-updaes 2023-12-27 14:50:10 +00:00
Joao Ramos
fe5833b061 Fixed Date range picker label 2023-12-27 14:50:10 +00:00
Joao Ramos
0c2200f49f Removed debugger 2023-12-27 14:48:55 +00:00
Tiago Ribeiro
cb73196503 Limited the chevron to only work if it does not go after today 2023-12-27 14:47:42 +00:00
Tiago Ribeiro
c5fe405389 Updated the scale to be between 0 and 9 2023-12-27 09:53:45 +00:00
Tiago Ribeiro
fddc3ff2f3 Finished updating the stats page according to the client's requests 2023-12-27 09:14:13 +00:00
João Ramos
9dbe876d65 Merged in feature-payment-block-corporate-update (pull request #9)
Blocked Corporate user update through payment records screen

Approved-by: Tiago Ribeiro
2023-12-26 20:25:46 +00:00
Tiago Ribeiro
fd402bbd32 Merged develop into feature-payment-block-corporate-update 2023-12-26 20:24:39 +00:00
João Ramos
f2aa377cfe Merged in feature-country-manager-flag (pull request #11)
Feature country manager flag

Approved-by: Tiago Ribeiro
2023-12-26 20:23:56 +00:00
Tiago Ribeiro
0f0223725e Merged develop into feature-paymentFilters 2023-12-26 20:23:40 +00:00
Tiago Ribeiro
3ef29e43f5 Merged develop into feature-country-manager-flag 2023-12-26 20:22:06 +00:00
João Ramos
60a7835040 Merged in feature-payment-export-csv (pull request #12)
Feature payment export csv

Approved-by: Tiago Ribeiro
2023-12-26 20:21:13 +00:00
Tiago Ribeiro
1c645fcba2 Added an ID to every payment record column 2023-12-23 20:44:04 +00:00
Joao Ramos
938a5e9c7c Removed debugger 2023-12-23 14:52:56 +00:00
Joao Ramos
cc655fed6c Added flag display for agents 2023-12-23 14:51:28 +00:00
Joao Ramos
7f9692a3d9 Replaced display of payment id with corporate's id 2023-12-23 14:38:18 +00:00
Joao Ramos
cf90cae4eb Blocked Corporate user update through payment records screen 2023-12-23 14:29:24 +00:00
Joao Ramos
fea8e0672e Added Export CSV 2023-12-23 00:01:24 +00:00
Joao Ramos
359748841f Added payment and date filter 2023-12-22 23:22:25 +00:00
Tiago Ribeiro
438778a03c Added more control over the stats appearing in the stats page 2023-12-18 22:42:14 +00:00
Tiago Ribeiro
c37bb2691b Added the ability to view the stats in a specific time interval 2023-12-18 17:57:27 +00:00
João Ramos
6c49409de8 Merged in bug-fixing-140223 (pull request #7)
Bug fixing 140223
2023-12-15 15:52:07 +00:00
Tiago Ribeiro
2a335026de Used a already set constant instead of creating a new function 2023-12-15 10:53:25 +00:00
Tiago Ribeiro
7712e5c71d Made it so it also reloads the users 2023-12-15 10:51:31 +00:00
Tiago Ribeiro
861d97222a Updated from companyName to name 2023-12-15 10:40:32 +00:00
Tiago Ribeiro
de862f635c Merge branch 'develop' into bug-fixing-140223 2023-12-15 10:37:38 +00:00
João Ramos
ae058422aa Merged in feature-paymentAssetManagement (pull request #5)
Added file storage handling for Corporate and Commission transfer

Approved-by: Tiago Ribeiro
2023-12-15 10:09:02 +00:00
Joao Ramos
44454d1e05 Changed corporate from user.name to user.companyName
Company name is now updateable
2023-12-14 17:57:39 +00:00
Joao Ramos
a2b9ba17a7 Replaced 'Agent' with 'Country Manager' on role display 2023-12-14 17:38:24 +00:00
Joao Ramos
6f61fe1564 Comission is now hidden from everyone apart from admins 2023-12-14 17:34:52 +00:00
Joao Ramos
73d7ddc4af Profile screen was crashing 2023-12-14 17:34:12 +00:00
João Ramos
263f4afa82 Merged develop into feature-paymentAssetManagement 2023-12-14 17:21:24 +00:00
Joao Ramos
45cf2dc279 Added a number asset to limit to a specific number of decimal cases if needed 2023-12-14 17:20:36 +00:00
João Ramos
786a425d85 Merged in feature-displayRole (pull request #6)
Show User type in the navbar

Approved-by: Tiago Ribeiro
2023-12-14 09:58:06 +00:00
Tiago Ribeiro
d57223bd01 Added a Fixed decimal point for the payment records 2023-12-14 09:52:47 +00:00
Joao Ramos
fbc2cff3f1 Minor identation changes 2023-12-13 23:58:48 +00:00
Joao Ramos
9ad4f077d1 Added user type to navbar 2023-12-13 23:57:32 +00:00
Joao Ramos
e2b6061310 Merge branch 'develop' into feature-paymentAssetManagement 2023-12-13 23:43:52 +00:00
Joao Ramos
b77e97a9d2 Changed icon used for replacing files 2023-12-13 23:39:22 +00:00
João Ramos
67925c8a9e Merged in feature-newPaymentOnUserUpdate (pull request #3)
Feature newPaymentOnUserUpdate

Approved-by: Tiago Ribeiro
2023-12-13 23:33:30 +00:00
Joao Ramos
020ecff29c Implemented file storage handling for Corporate Transfer and Comission Transfer 2023-12-13 23:29:14 +00:00
Tiago Ribeiro
964660ed5d Merged develop into feature-newPaymentOnUserUpdate 2023-12-13 22:01:43 +00:00
João Ramos
1390af62ab Merged in feature-levelScoringTiers (pull request #4)
Changed approach to display level for Level Testing

Approved-by: Tiago Ribeiro
2023-12-13 22:01:07 +00:00
Joao Ramos
15947f942c Fixed issue with payment records on update 2023-12-13 17:08:26 +00:00
Joao Ramos
7b3c3d15db Changed approach to display level for Level Testing 2023-12-13 00:14:34 +00:00
Joao Ramos
1cff6fe242 Temporary fix on date/data payment 2023-12-12 22:48:38 +00:00
Joao Ramos
4cbd045502 Added comission to user card and updated user update to insert a new payment entry 2023-12-12 22:44:33 +00:00
Joao Ramos
21b612eaa4 Removed references to Referred corporated 2023-12-11 22:34:42 +00:00
Tiago Ribeiro
ef18e304a1 - Created a package list for student packages;
- Updated the group creation wizard to work as a modal;
2023-12-11 13:43:23 +00:00
Tiago Ribeiro
8e4223a9e7 Slight tweak on the sidebar logout 2023-12-09 15:44:02 +00:00
Tiago Ribeiro
7d696735ba Improved a bit of the UI for the admin dashboard 2023-12-09 15:35:56 +00:00
Tiago Ribeiro
e0ecc5be05 Merge branch 'develop' into improvement-37/writing-evaluation-perfect-answer 2023-12-09 14:47:06 +00:00
João Ramos
77af0b3495 Merged in feature-multiplerandomexams (pull request #1)
Dynamic tests generation of assignment + Minor changes

Approved-by: Tiago Ribeiro
2023-12-09 14:43:48 +00:00
Tiago Ribeiro
e2e38284a7 Uncommented a section 2023-12-09 14:39:03 +00:00
Tiago Ribeiro
ccd2560451 Merged develop into feature-multiplerandomexams 2023-12-09 14:37:34 +00:00
João Ramos
390658f2b0 Merged in feature-removeCompanyReferences (pull request #2)
Changed Comercial labels to Corporate

Approved-by: Tiago Ribeiro
2023-12-09 14:28:30 +00:00
Joao Ramos
450a4e9fe3 Changed Comercial labels to Corporate 2023-12-08 15:43:19 +00:00
Joao Ramos
dfbbf0456d Revert "Changed Comercial labels to Corporate"
This reverts commit 9c8d7988c5.
2023-12-08 14:55:16 +00:00
Joao Ramos
d46f92edb2 Added Referenced corporate expiring in 1 month 2023-12-07 23:42:04 +00:00
Joao Ramos
26c4368f31 Minor improvement on reusability of filter function 2023-12-07 23:34:31 +00:00
Joao Ramos
ec56a5426b Added Inactive Referred corporate 2023-12-07 23:31:16 +00:00
Joao Ramos
fe32584ff9 Add Inactive Country manager 2023-12-07 23:23:39 +00:00
Joao Ramos
db7762c6e2 Replaced Teacher labels 2023-12-07 23:20:19 +00:00
Joao Ramos
e70e26f84c Updated checkbox string 2023-12-07 23:17:23 +00:00
Joao Ramos
7dc9d568d1 Replaced Teachers Icon 2023-12-07 23:13:42 +00:00
Joao Ramos
0049ab272b Added dynamic generation of exams as an option 2023-12-07 23:07:35 +00:00
Joao Ramos
f48885bba6 Updatd UI to display the unique tests for each user in an assignment 2023-12-07 18:23:44 +00:00
Joao Ramos
5eaa0ac269 Assignments now generate unique list of exams for each user 2023-12-07 18:23:00 +00:00
Joao Ramos
f7af21878e Separate get exam bussiness logic into a backend asset 2023-12-07 18:20:11 +00:00
Joao Ramos
9d4071d4cd Added debug settings for vscoe 2023-12-07 18:19:01 +00:00
Tiago Ribeiro
6f5dd86cd1 Updated so the new payment prefills with all of the corporate's payment information 2023-12-07 16:36:57 +00:00
Tiago Ribeiro
8b9537b272 Merge branch 'develop' into improvement-37/writing-evaluation-perfect-answer 2023-12-06 16:43:14 +00:00
Tiago Ribeiro
a526e76c70 Added a feature to allow a user to filter the payment record 2023-12-06 16:41:11 +00:00
Joao Ramos
62b2f477f4 Replaced Corporate Icon on Agent Dashboard 2023-12-06 15:54:49 +00:00
Joao Ramos
f36384fdb4 Replaced Corporate Icon on Admin dashboard 2023-12-06 15:43:44 +00:00
Joao Ramos
9c8d7988c5 Changed Comercial labels to Corporate 2023-12-06 15:16:48 +00:00
Tiago Ribeiro
18f163768c Made it so, when a user registers with an eCrop e-mail, they get the role of a developer 2023-12-06 15:15:50 +00:00
Tiago Ribeiro
72083439af Updated Writing and Speaking to have a tab system for the evaluation vs the "perfect answer" 2023-12-06 14:48:54 +00:00
Tiago Ribeiro
523149327b Turned the name into a fallback when there is no corporate name 2023-12-06 11:31:56 +00:00
Tiago Ribeiro
58c18133ec Finished up the modal to create a payment and added the page to the sidebar 2023-12-05 23:41:55 +00:00
Tiago Ribeiro
03520b650b Merge branch 'develop' into faeture/payment-history 2023-12-05 16:36:16 +00:00
Tiago Ribeiro
556884058b Fixed a bug where the user was not being saved when the expiry date is disabled 2023-12-05 16:35:40 +00:00
Tiago Ribeiro
73b0d5d41d Continued creating the payment page 2023-12-05 16:27:18 +00:00
Tiago Ribeiro
7c589327f7 Merge branch 'develop' into faeture/payment-history 2023-12-04 16:01:30 +00:00
Tiago Ribeiro
5c8867555d Added the option to view both the teachers and students of a corporate as well as the corporate of a student 2023-12-03 00:13:50 +00:00
Tiago Ribeiro
36be5267a2 Set the Part 4 as undefined as well 2023-11-30 16:52:45 +00:00
Tiago Ribeiro
4ebfd49cb9 Merge branch 'develop' into faeture/payment-history 2023-11-30 15:52:16 +00:00
Tiago Ribeiro
96fe83de14 Added the Speaking generation to the project, still WIP 2023-11-30 15:50:24 +00:00
Tiago Ribeiro
1746db3752 Disabled Diagnostics test for all users except students 2023-11-30 10:36:15 +00:00
Tiago Ribeiro
58b4883236 Updated the types of exercises for the Listening Generation 2023-11-29 20:52:08 +00:00
Tiago Ribeiro
a3864eb7d3 Added sound effects to the exam generation 2023-11-29 20:26:48 +00:00
Tiago Ribeiro
1f0e5f4a08 Added the ability to generate Listening exams as well 2023-11-29 17:19:47 +00:00
Tiago Ribeiro
c90234cefc Changed from employment to position for Corporate accounts 2023-11-28 08:21:00 +00:00
Tiago Ribeiro
f354a4f4fe Solved an oopsie 2023-11-27 23:09:37 +00:00
Tiago Ribeiro
7e0c071eee Changed to Number of users 2023-11-27 23:07:40 +00:00
Tiago Ribeiro
9bed726062 Created a list of payments 2023-11-27 22:27:51 +00:00
Tiago Ribeiro
3878d4761e Made it so the listing of a corporate account shows the name of the corporate instead of the person 2023-11-27 13:07:33 +00:00
Tiago Ribeiro
81f5af5629 Added more information for the Agent User 2023-11-27 13:02:19 +00:00
Tiago Ribeiro
5f76e430af Extracted the user types 2023-11-27 11:35:04 +00:00
Tiago Ribeiro
facac33a89 More housekeeping 2023-11-27 11:22:41 +00:00
Tiago Ribeiro
f36c63f1b2 Added a trim 2023-11-27 11:06:05 +00:00
Tiago Ribeiro
b1f07b877c Added the type to the profile page 2023-11-27 10:39:43 +00:00
Tiago Ribeiro
70611305a7 Changed the defaultAvatar 2023-11-27 10:32:54 +00:00
Tiago Ribeiro
fdedc2c5d3 Changed the way the settings is viewable 2023-11-27 10:32:02 +00:00
Tiago Ribeiro
75875b49e6 Removed access to upload/add users from the teachers 2023-11-27 10:23:42 +00:00
Tiago Ribeiro
37e52886b5 Merge branch 'main' into develop 2023-11-27 08:48:52 +00:00
Tiago Ribeiro
a5dfe69220 Removed an unused firebase config variable 2023-11-27 08:48:15 +00:00
Tiago Ribeiro
1c36c7f1e1 Improved a slight detail 2023-11-26 23:21:45 +00:00
Tiago Ribeiro
9de39485de Improved the way the PayPal integration works 2023-11-26 23:16:26 +00:00
Tiago Ribeiro
0fe2e0d393 Merge branch 'develop' into feature/paypal-integration 2023-11-26 23:00:17 +00:00
Tiago Ribeiro
dbb5e131fc Removed the previous stuff 2023-11-26 22:34:59 +00:00
Tiago Ribeiro
ebda1e1717 And another test 2023-11-26 22:34:35 +00:00
Tiago Ribeiro
8cbec131fe Adding it to the build as well 2023-11-26 22:13:02 +00:00
Tiago Ribeiro
472d4a3331 Let's try this one out now 2023-11-26 21:49:39 +00:00
Tiago Ribeiro
c2f83d996a Testing something out 2023-11-26 21:15:09 +00:00
Tiago Ribeiro
43bd6b24c5 Reverted a change 2023-11-26 15:47:37 +00:00
Tiago Ribeiro
ca89261e10 Made it so the admin and agent should also be able to edit the amount each corporate should pay 2023-11-26 15:15:58 +00:00
Tiago Ribeiro
a9bbbe8b52 Turned the code in the register optional 2023-11-26 13:59:14 +00:00
Tiago Ribeiro
fa544bf4e8 Enabled payment for Corporate along with increasing every single one of their students/teachers expiry date as well 2023-11-26 11:01:27 +00:00
Tiago Ribeiro
7e91a989b3 Added packages for students to be able to purchase 2023-11-26 10:08:57 +00:00
Tiago Ribeiro
c312260721 Started working with PayPal 2023-11-24 16:02:55 +00:00
Tiago Ribeiro
23f2bace5d Added the ability to generate Level exams 2023-11-24 00:57:25 +00:00
Tiago Ribeiro
7e2f1fcf9d Merge branch 'develop' into feature/exam-generation 2023-11-21 19:45:30 +00:00
Tiago Ribeiro
6e420a8a82 Created a dashboard for the Agent 2023-11-21 18:01:45 +00:00
Tiago Ribeiro
cd81547022 Created a dashboard of the Agent 2023-11-21 13:59:36 +00:00
Tiago Ribeiro
a2baedb80c Improvement the creation of Agents 2023-11-21 13:37:29 +00:00
Tiago Ribeiro
8072cefbe6 Added the ability to create an agent using the CodeGenerator 2023-11-21 13:24:07 +00:00
Tiago Ribeiro
6bf666d01c It is now possible to generate and save both Reading and Writing exams 2023-11-21 12:17:57 +00:00
Tiago Ribeiro
7672e29063 Merge branch 'develop' into feature/exam-generation 2023-11-21 11:22:02 +00:00
Tiago Ribeiro
51e7c535df Updated the Exercise count for the Interactive Speaking as well 2023-11-21 09:35:54 +00:00
Tiago Ribeiro
d0f89cfe01 Fixed issues related to the exercise/question index in the ModuleTitle 2023-11-21 09:22:32 +00:00
Tiago Ribeiro
8de60aeb32 Merge branch 'develop' into feature/exam-generation 2023-11-21 00:31:51 +00:00
Tiago Ribeiro
0e28473c31 Changed the mobile menu to the correct one 2023-11-21 00:29:58 +00:00
Tiago Ribeiro
52d4b831ae Renamed the Owner to Admin 2023-11-20 23:46:43 +00:00
Tiago Ribeiro
cdc8cfe46e Updated more of the exam generation 2023-11-20 23:30:47 +00:00
Tiago Ribeiro
4c7e8f56d8 Made it so it is currently possible to generate reading passages 2023-11-20 21:03:24 +00:00
Tiago Ribeiro
4753b85ab5 Started creating the page to generate exams 2023-11-20 16:19:05 +00:00
Tiago Ribeiro
13c8459d4b Updated the assignments to work with the level exams 2023-11-18 00:19:26 +00:00
Tiago Ribeiro
19b3bbe139 Added it to the exam list 2023-11-17 15:45:59 +00:00
Tiago Ribeiro
44a89c6645 Added a new module called Level for level testing 2023-11-17 15:32:45 +00:00
Tiago Ribeiro
4a51bd7dfa Turned off the ExamGenerator for everyone except me 2023-11-16 13:56:37 +00:00
Tiago Ribeiro
dc759a368e Added more lists related to the expired accounts 2023-11-16 13:55:43 +00:00
Tiago Ribeiro
c28f7bb024 Added the ability to change the status and type of a user 2023-11-15 19:54:16 +00:00
Tiago Ribeiro
d412c1616f Updated the expiry date to show as red 2023-11-15 11:17:44 +00:00
Tiago Ribeiro
c2a807efc7 Improved the email verification a tiny bit 2023-11-14 15:57:30 +00:00
Tiago Ribeiro
6056735c72 Added more fields to the corporate and showcased them in the UserCard 2023-11-13 19:27:11 +00:00
Tiago Ribeiro
261ba74105 Removed the exercises and exams tab from the sidebar for owners and corporate 2023-11-13 14:43:11 +00:00
Tiago Ribeiro
4328a1d72d Made it so a corporate user is not able to generate more code than they are allowed to 2023-11-10 15:41:26 +00:00
Tiago Ribeiro
82643b51d3 Updated the user card to have the corporate information 2023-11-10 15:27:03 +00:00
Tiago Ribeiro
a38e5e2f0a Removed the console.log 2023-11-09 14:56:40 +00:00
Tiago Ribeiro
19624e97bd Improved the way a teacher views the assignments 2023-11-09 12:34:56 +00:00
Tiago Ribeiro
536c1dfab3 Enabled a way for students to do assigned tasks 2023-11-09 11:44:58 +00:00
Tiago Ribeiro
c2acb39859 Improved the responsiveness of the assignment creator 2023-11-07 22:44:26 +00:00
Tiago Ribeiro
dd2ddc0e5b Finished up a wizard to create Assignments 2023-11-07 22:30:46 +00:00
Tiago Ribeiro
40f095191a Created a simple "assignment" dashboard for teachers 2023-11-05 14:53:54 +00:00
Tiago Ribeiro
37baa11987 Merge branch 'main' into feature/corporate-model-implementation 2023-10-30 15:35:27 +00:00
Tiago Ribeiro
3ecc2b7982 Removed the port from the mailer 2023-10-30 15:34:45 +00:00
Tiago Ribeiro
ba3588e97d Updated the groups section for the teachers and admins 2023-10-30 15:27:48 +00:00
Tiago Ribeiro
bd6892dcf1 Created a dashboard for teachers 2023-10-30 15:01:58 +00:00
Tiago Ribeiro
dc13a4a7b7 Updated the Dashboard for Corporate accounts 2023-10-30 14:29:41 +00:00
Tiago Ribeiro
37c889a39a Merge branch 'main' into feature/corporate-model-implementation 2023-10-29 14:39:58 +00:00
Tiago Ribeiro
c5ece3a5f8 Updated the SMTP port 2023-10-29 14:39:16 +00:00
Tiago Ribeiro
a20b980adb Added the ability for Corporate accounts to register without codes 2023-10-29 14:38:46 +00:00
Tiago Ribeiro
6e31a05f21 Updated the register to allow the difference between a individual and corporate 2023-10-27 15:50:02 +01:00
Tiago Ribeiro
0aefbb85ec Renamed the admin type to corporate 2023-10-27 00:43:05 +01:00
Tiago Ribeiro
15f8d25bc9 Improved the overall code itself 2023-10-27 00:35:56 +01:00
Tiago Ribeiro
c0269fca45 Added the ability to view how many students and teachers an admin has 2023-10-27 00:28:29 +01:00
Tiago Ribeiro
bdb0ffde95 - Added more panels and lists;
- Added the ability to view more information on the user;
- Added the ability to update the user's expiry date
2023-10-26 22:41:24 +01:00
Tiago Ribeiro
8515eaf4ee Merge branch 'develop' into feature/updated-user-type-dashboard 2023-10-24 16:59:40 +01:00
Tiago Ribeiro
3bb27a692f Removed the console.log calls 2023-10-24 16:58:44 +01:00
Tiago Ribeiro
3528eb227e Merge branch 'develop' into feature/updated-user-type-dashboard 2023-10-24 14:47:46 +01:00
Tiago Ribeiro
729204a095 May have solved a bug made in the writing and speaking evaluation 2023-10-24 14:47:01 +01:00
Tiago Ribeiro
cf5a9c9780 Resolved a small bug 2023-10-23 23:27:35 +01:00
Tiago Ribeiro
8b872020c6 Continued with the same updates 2023-10-23 23:17:47 +01:00
Tiago Ribeiro
e16a9873be Merge branch 'develop' into feature/updated-user-type-dashboard 2023-10-22 09:42:45 +01:00
Tiago Ribeiro
faced0b20c Replaced the previous e-mail verification process for our own 2023-10-22 09:38:29 +01:00
Tiago Ribeiro
7e576738ce Started creating a user type specific dashboard 2023-10-22 09:15:11 +01:00
Tiago Ribeiro
e10aebf4c0 Improved a bit of the evaluation system 2023-10-22 09:13:25 +01:00
Tiago Ribeiro
9f9e36f0cd Added a Husky pre-commit to always build before a commit 2023-10-21 16:51:55 +01:00
Tiago Ribeiro
913ed54cf9 Keep calm and commit 2023-10-21 16:51:25 +01:00
Tiago Ribeiro
960c5b8c6f Added the possibility to have multiple dashboards 2023-10-21 16:49:41 +01:00
Tiago Ribeiro
57f2135848 Improved the responsiveness of the application for tablet as well 2023-10-19 10:19:33 +01:00
Tiago Ribeiro
171f328278 Added the ability to sort by every column 2023-10-19 09:40:52 +01:00
Tiago Ribeiro
ffe534edd9 Solved a problem with the build process 2023-10-17 23:25:16 +01:00
Tiago Ribeiro
fb15668288 Updated the mobile responsiveness for Diagnostic and Demographic 2023-10-17 23:22:28 +01:00
Tiago Ribeiro
b00d155aa1 Updated the responsiveness of the profile page for mobile 2023-10-17 22:51:12 +01:00
Tiago Ribeiro
9b852bd6be - Did a bit of refactor related to the exam/exercises page;
- Improved the responsiveness of the page for mobile;
2023-10-17 08:52:41 +01:00
Tiago Ribeiro
550cdba5a7 Started improving the responsiveness of the application 2023-10-16 23:52:41 +01:00
Tiago Ribeiro
aaa7d6deb3 Changed to platform 2023-10-16 18:56:42 +01:00
Tiago Ribeiro
e2567e128e Changed from encoach.com to app.encoach.com 2023-10-16 18:55:55 +01:00
Tiago Ribeiro
5c11087cec Oops 2023-10-16 00:34:27 +01:00
Tiago Ribeiro
635c92791c Added the timeSpent to the stats 2023-10-16 00:18:45 +01:00
Tiago Ribeiro
e8b44ee10e Updated the CountrySelect 2023-10-15 23:40:25 +01:00
Tiago Ribeiro
932a2e4081 Updated the look of the stats page 2023-10-15 23:23:46 +01:00
Tiago Ribeiro
11777b1bea Solved a bug on the stats page 2023-10-15 23:05:02 +01:00
Tiago Ribeiro
69425d0b93 Updated the ExamList to only appear to developers 2023-10-15 23:03:54 +01:00
Tiago Ribeiro
1895ffb5c3 Updated the text of the about exams/exercises 2023-10-15 22:57:23 +01:00
Tiago Ribeiro
f51dc450b9 Updated the counter of exercises 2023-10-15 22:54:40 +01:00
Tiago Ribeiro
18e12db7c5 Made it possible to add time to a specific account as well 2023-10-14 09:49:10 +01:00
Tiago Ribeiro
ebb6bb2a1a Updated the Stripe webhook to work better 2023-10-13 15:22:01 +01:00
Tiago Ribeiro
348a020e7f Solved issues related to the build 2023-10-13 13:53:18 +01:00
Tiago Ribeiro
ca96b37303 Created a route for the Stripe webhook 2023-10-13 13:33:58 +01:00
Tiago Ribeiro
1a255b5a4d Updated the User list to also show their demographic information 2023-10-12 23:13:37 +01:00
Tiago Ribeiro
320aedefb1 Improved the screen for when a user's subscription has expired, or their account was disabled 2023-10-12 20:51:09 +01:00
Tiago Ribeiro
da135d3e6f Added the ability to view the expiry date on the profile page (as well as some warnings on the dashboard) 2023-10-12 10:17:22 +01:00
Tiago Ribeiro
4c95d85cf9 Made sure the user can’t navigate to another page when they shouldn’t via the URL 2023-10-12 10:00:44 +01:00
Tiago Ribeiro
1d27da71ec Updated the user list to only show users belonging to an admin's groups 2023-10-11 12:02:20 +01:00
Tiago Ribeiro
a84edcd237 - Added the option to select an expiry date when an owner or dev creates a code
- Made it so the student's expiry date is the same as the admin when created by one
2023-10-11 11:20:28 +01:00
Tiago Ribeiro
25ce3bdf8f Removed the MTI's name from the headers 2023-10-11 08:06:49 +01:00
Tiago Ribeiro
634a396434 New feature on the account creation:
It automatically stores who created the code and adds the registered user to a group administrated by that creator
2023-10-10 23:00:36 +01:00
Tiago Ribeiro
1aa4f0ddfd Updated a bit more of the way the codes work 2023-10-10 21:17:46 +01:00
Tiago Ribeiro
0c9a49a9c3 Solved an oopsie 2023-10-09 22:38:09 +01:00
Tiago Ribeiro
cb3790dc1d Removed the DatePicker from the stats 2023-10-09 11:06:26 +01:00
Tiago Ribeiro
d4c4546c88 Updated some bugs 2023-10-09 08:53:41 +01:00
Tiago Ribeiro
ebe4c41f76 Updated a bit more of the evaluation 2023-10-07 10:18:51 +01:00
Tiago Ribeiro
5e1b9ce2c7 Updated the Speaking exam to work with always having video 2023-10-07 10:17:09 +01:00
Tiago Ribeiro
2d095316a7 Fixed a bug in the Listening exam 2023-10-05 18:07:39 +01:00
Tiago Ribeiro
73d3922f18 Merge branch 'main' into update-listening-format 2023-10-04 14:05:04 +01:00
Tiago Ribeiro
925250d2c5 Added the ability to enable/disable a user as well as deleting an exam 2023-10-04 13:39:31 +01:00
Tiago Ribeiro
29914d3e89 Updated the register to only allow to create users if they have a code available 2023-10-03 23:53:54 +01:00
Tiago Ribeiro
1ccb9555b6 Made it so, when using the batch code generator, it sends e-mails to everyone 2023-10-03 20:24:34 +01:00
Tiago Ribeiro
07e73b0d88 Added the possibility to upload a file containing users to a group 2023-10-03 16:48:52 +01:00
Tiago Ribeiro
9239068cde Updated the stats page a bit more 2023-10-02 14:16:34 +01:00
Tiago Ribeiro
0f0b7748d7 Updated the stats and record page 2023-10-02 10:23:33 +01:00
Tiago Ribeiro
551faadd28 Merge branch 'main' into update-listening-format 2023-10-01 22:09:59 +01:00
Tiago Ribeiro
b58957e38e Added the ability to edit a group 2023-10-01 21:15:15 +01:00
Tiago Ribeiro
782976c14f Updated the Listening format to work 2023-09-29 13:56:11 +01:00
Tiago Ribeiro
2a68d37de8 Updated the way this is calculated 2023-09-28 14:51:24 +01:00
Tiago Ribeiro
a47ee28ca5 Updated the backend to work 2023-09-28 14:45:42 +01:00
Tiago Ribeiro
169ae2c959 Updated the reading to a new format 2023-09-28 14:43:43 +01:00
Tiago Ribeiro
a568950aa9 Solved a problem with the build 2023-09-28 12:00:36 +01:00
Tiago Ribeiro
f9cd477114 Removed unused reports 2023-09-28 11:46:41 +01:00
Tiago Ribeiro
75fb6ab197 Added the ability to create groups 2023-09-28 11:40:01 +01:00
Tiago Ribeiro
7af607d476 Prevented the stats page from crashing when there are no stats 2023-09-28 00:16:43 +01:00
Tiago Ribeiro
41040f92c3 Updated the layout leave to a reload 2023-09-27 11:05:23 +01:00
Tiago Ribeiro
9dbf43cf22 Added the admin panel to other users apart from developer 2023-09-27 10:03:28 +01:00
Tiago Ribeiro
4873832437 Solved a bug on repeated questions 2023-09-27 09:58:53 +01:00
Tiago Ribeiro
a362dc5a11 Made it so when a user is deleted, all of their stats are also deleted 2023-09-26 18:13:27 +01:00
Tiago Ribeiro
f3fea7fc66 Updated the sizing of the select 2023-09-26 16:35:13 +01:00
Tiago Ribeiro
64e7fcbcc7 Added the ability to delete a user 2023-09-26 13:51:41 +01:00
Tiago Ribeiro
733138f2be Added more options to the User List 2023-09-26 13:23:53 +01:00
Tiago Ribeiro
b0a11a5f8d Reduced the side of the sidebar a little bit 2023-09-26 12:15:17 +01:00
Tiago Ribeiro
8fb1d8e886 Continued updating the e-mail verification and I think I managed to get it working 2023-09-26 11:28:10 +01:00
Tiago Ribeiro
3491efb494 Created the possibility to delete a user 2023-09-26 07:26:01 +01:00
Tiago Ribeiro
5564b4c181 Added console.log 2023-09-25 23:39:38 +01:00
Tiago Ribeiro
7d4d228f0d Removed a forgotten alert 2023-09-25 14:57:39 +01:00
Tiago Ribeiro
8b7e7cf0ad Improved an error we had before 2023-09-25 14:57:14 +01:00
Tiago Ribeiro
cb5434d166 Added a "trim" to the verification 2023-09-25 11:37:50 +01:00
Tiago Ribeiro
8b51e50f15 Solving a Listening bug 2023-09-25 10:46:04 +01:00
Tiago Ribeiro
6dda49a917 Added the ability to view all exams 2023-09-23 13:34:14 +01:00
Tiago Ribeiro
7a957e4d78 Extracted the Admin Panel items 2023-09-22 14:13:57 +01:00
Tiago Ribeiro
a9ceecdc84 Added the ability to generate a user code on the admin panel 2023-09-22 13:39:26 +01:00
Tiago Ribeiro
d46d0ab42f Added the ability for a user to select to avoid repeated exams 2023-09-21 23:43:48 +01:00
Tiago Ribeiro
1bac6eb110 Updated the nomenclature of the ModuleTitle 2023-09-21 23:25:17 +01:00
Tiago Ribeiro
1e4316a57e Updated the verification 2023-09-21 23:17:50 +01:00
Tiago Ribeiro
9a45f53062 Made it so, in the FillBlanks, it automatically goes to the next one 2023-09-20 09:57:28 +01:00
Tiago Ribeiro
0ca2649040 Improved the Country selector 2023-09-19 21:58:03 +01:00
Tiago Ribeiro
395afbb4ee Testing things out 2023-09-19 20:37:40 +01:00
Tiago Ribeiro
7cdff84d5e Created the InteractiveSpeaking exercise 2023-09-19 00:57:36 +01:00
Tiago Ribeiro
f5de8f5e10 Made it so the side bar is minimized after refresh if it was before 2023-09-18 19:55:37 +01:00
Tiago Ribeiro
4d364bd597 Updated the speaking evaluation to use the new endpoint 2023-09-18 13:17:33 +01:00
Tiago Ribeiro
3e010572f6 Made it so the component reloads 2023-09-18 08:19:08 +01:00
Tiago Ribeiro
68fb5e5bc7 Updated a problem with the rendering of the Solutions 2023-09-18 08:16:56 +01:00
Tiago Ribeiro
efb341355d Prepared the code to later handle the evaluation of the Interactive Speaking exercise 2023-09-17 08:56:00 +01:00
Tiago Ribeiro
161d5236b4 Oops 2023-09-17 08:48:24 +01:00
Tiago Ribeiro
91495d6a34 Created an Admin panel for developers 2023-09-16 15:00:48 +01:00
Tiago Ribeiro
05ca96e476 Updated the demographic input to work more as expected 2023-09-16 10:27:17 +01:00
Tiago Ribeiro
dc8682e1c3 Updated the problems with the marking - related to the DB not having the correct type 2023-09-13 23:46:50 +01:00
Tiago Ribeiro
3a51185942 The country was not working 2023-09-13 11:31:21 +01:00
Tiago Ribeiro
39a2813bde Stopped the isLoading after updating the profile 2023-09-13 11:29:38 +01:00
Tiago Ribeiro
27c6eff590 Added demographic information to the user 2023-09-13 11:28:13 +01:00
Tiago Ribeiro
8dcfb8a670 Removed the ability to pause the listening 2023-09-13 07:40:20 +01:00
Tiago Ribeiro
8cbf56b81a Updated the console.logs 2023-09-12 09:25:03 +01:00
Tiago Ribeiro
27ff2bd158 Removed console.logs used for testing 2023-09-11 09:06:20 +01:00
Tiago Ribeiro
dadaa831ba Improved the duration display on Listening 2023-09-11 09:06:01 +01:00
Tiago Ribeiro
27956d311c Solved the WriteBlanks problem 2023-09-11 08:50:38 +01:00
Tiago Ribeiro
cca94db9bf Added a word counter to the Writing exercise 2023-09-10 10:33:07 +01:00
Tiago Ribeiro
42a0821677 Removed unused console.log 2023-09-10 10:05:29 +01:00
Tiago Ribeiro
9de62cc55f Update the mode of the action page 2023-09-08 09:33:53 +01:00
Tiago Ribeiro
af70d36b7c Increased the size of the Timer 2023-09-07 21:26:02 +01:00
Tiago Ribeiro
b1461d1c04 Removed unused console.log 2023-09-07 13:06:39 +01:00
Tiago Ribeiro
f91cd0ca63 Made it so users have to verify their e-mail starting to use the application 2023-09-07 12:45:31 +01:00
Tiago Ribeiro
5211e92c65 Added a few more stats to the stats page 2023-09-05 16:31:32 +01:00
Tiago Ribeiro
af994cfadb Made it so the when it is showing the solutions, it automatically starts 2023-09-05 14:21:55 +01:00
Tiago Ribeiro
caddc57ef8 Took care of an oopsie 2023-09-03 20:50:24 +01:00
Tiago Ribeiro
578f42d9b1 Improved the overall sizing of the Reading exam 2023-09-03 20:47:24 +01:00
Tiago Ribeiro
1a0ec780b9 Disabled the right click, paste and spell check on the Writing 2023-09-03 20:34:09 +01:00
Tiago Ribeiro
10b2f09c7f Solved a few bugs on the WriteBlanks module 2023-09-03 15:06:56 +01:00
Tiago Ribeiro
5263cc260d Added a capability to minimize the sidebar 2023-09-03 14:41:10 +01:00
Tiago Ribeiro
0013d86ef8 Added margin bottom to the Finish 2023-09-03 13:20:29 +01:00
Tiago Ribeiro
41d6303403 Implemented the reset password mechanism 2023-08-31 21:48:02 +01:00
Tiago Ribeiro
f2323b35b8 Turned the reading into split screen 2023-08-31 20:53:08 +01:00
Tiago Ribeiro
b3b804fc11 - Prevent the CTRL+F on Reading;
- Made the Listening audio appear on exercises;
2023-08-31 20:39:38 +01:00
Tiago Ribeiro
7dd96bf259 Solved the bug where the user solutions were not loading 2023-08-31 12:19:09 +01:00
Tiago Ribeiro
c2fb398707 Removed an alert that was not supposed to be there 2023-08-31 11:16:31 +01:00
Tiago Ribeiro
f4b0d6822d Bug fixing:
- Prevented the viewing of the exam solutions to generate another record;
- Made it so the solution is the same after viewing the results;
2023-08-31 10:47:43 +01:00
Tiago Ribeiro
511c30d635 Reverted previous commit 2023-08-31 09:56:06 +01:00
Tiago Ribeiro
084d19600a Updated the Dockerfile 2023-08-31 09:12:58 +01:00
Tiago Ribeiro
b75a0be52c Added a log for when there is an error 2023-08-31 09:05:15 +01:00
Tiago Ribeiro
c23c07ae38 Removed the uploadDir 2023-08-31 08:35:21 +01:00
Tiago Ribeiro
17ff85b62b Reverted the previous commit 2023-08-30 19:51:06 +01:00
Tiago Ribeiro
84a42d0e14 Removed the uploadDir from the speaking evaluation API 2023-08-30 12:16:37 +01:00
Tiago Ribeiro
437c405c74 Removed the abandon popup when not in exam mode 2023-08-28 22:38:38 +01:00
Tiago Ribeiro
b4d856d32f Improved a bit more of the responsiveness and solved a bug 2023-08-28 16:25:01 +01:00
Tiago Ribeiro
3c711e0279 Improved the responsiveness of the login and register pages on mobile 2023-08-28 15:47:04 +01:00
Tiago Ribeiro
c879d5d8de Made it a tiny bit more responsive 2023-08-24 15:21:35 +01:00
Tiago Ribeiro
82d2c548ef Updated the icon on the register 2023-08-24 10:18:01 +01:00
Tiago Ribeiro
cdb4f329cf Updated the page icon 2023-08-24 10:15:58 +01:00
Tiago Ribeiro
c91264e455 Removed the build problem 2023-08-22 23:25:17 +01:00
Tiago Ribeiro
14a719b8b5 - Solved the bug on Diagnostic where the exams weren't loading;
- Removed the Layout appearance and made it so the abandon popup appears on click and not on enter
2023-08-22 23:13:26 +01:00
Joao Ramos
78c5b7027e Added abandon exam/exercise handler 2023-08-16 19:32:39 +01:00
Joao Ramos
cd71cf4833 Added abandon popup 2023-08-16 00:38:54 +01:00
Joao Ramos
93a5bcf40f Added initial focus trap during exercises/exams 2023-08-16 00:08:20 +01:00
Tiago Ribeiro
dd0acbea61 Added more onClicks 2023-08-13 21:50:12 +01:00
Tiago Ribeiro
ef736bc63e Resolved the Questions Blank bug 2023-08-12 00:03:35 +01:00
Tiago Ribeiro
d9ca0e84a6 Some light bug solving 2023-08-11 23:54:09 +01:00
Tiago Ribeiro
db54d58bab - Added a new type of exercise
- Updated all solutions to solve a huge bug where after reviewing, it would reset the score
2023-08-11 14:23:09 +01:00
Tiago Ribeiro
5099721b9b Finished up the Diagnostic page 2023-08-08 00:06:01 +01:00
Tiago Ribeiro
2c2fbffd8c Well, removed unused thingy 2023-08-07 23:48:48 +01:00
Tiago Ribeiro
3fee4292f1 Updated the Writing to work with another format 2023-08-07 23:39:29 +01:00
Tiago Ribeiro
7e9e28f134 Updated the styling of the Diagnostic page 2023-08-07 22:52:10 +01:00
Tiago Ribeiro
d879f4afab Made it so the timer is more dynamic 2023-07-27 20:25:57 +01:00
Tiago Ribeiro
d38ca76182 Seems to have solved some other issues 2023-07-27 15:41:34 +01:00
Tiago Ribeiro
77692d270e Made it so when the timer ends, the module ends 2023-07-27 13:59:00 +01:00
Tiago Ribeiro
f5c3abb310 Fully implemented the register flow 2023-07-25 19:53:48 +01:00
Tiago Ribeiro
02260d496c Solved some more bugs and styling 2023-07-25 00:09:25 +01:00
Tiago Ribeiro
581adbb56e - Updated the colors of the application;
- Added the ability for a user to partially update their profile
2023-07-22 10:11:10 +01:00
Tiago Ribeiro
6ade34d243 Updated the platform colors to the new ones 2023-07-22 07:18:28 +01:00
Tiago Ribeiro
16ea0b497e Ooopsy 2023-07-21 13:42:07 +01:00
Tiago Ribeiro
ea41875e36 Updated the Formidable to work with serverless (supposedly) 2023-07-21 13:37:41 +01:00
Tiago Ribeiro
eae0a4ae4e Updated the clock of the Speaking timer 2023-07-21 12:41:44 +01:00
Tiago Ribeiro
fea788bdc4 Updated the next.config.js 2023-07-21 10:43:15 +01:00
Tiago Ribeiro
86c69e5993 Removed the --link flag 2023-07-21 10:30:14 +01:00
Tiago Ribeiro
f01794fed8 Updated the Dockerfile 2023-07-21 10:29:06 +01:00
Tiago Ribeiro
cc4b38fbbd Added Docker support to the application 2023-07-21 10:17:38 +01:00
Tiago Ribeiro
121ac8ba4d Finallyyyyyy finished the whole Speaking flow along with the solution page 2023-07-14 14:15:07 +01:00
Tiago Ribeiro
2c10a203a5 Finalized the Speaking module exercise 2023-07-14 12:08:25 +01:00
Tiago Ribeiro
6a2fab4f88 Commented a bit of code that is not yet ready 2023-07-11 00:30:05 +01:00
Tiago Ribeiro
9637cb6477 Made it so the Speaking is sent to the backend and saved to Firebase 2023-07-11 00:29:32 +01:00
Tiago Ribeiro
ce90de1b74 Updated the code so the user levels update depending on their performance 2023-07-04 21:03:36 +01:00
Tiago Ribeiro
49e24865a3 Created a profile editing page 2023-07-04 13:21:36 +01:00
Tiago Ribeiro
dceff807e9 Added the ability to read the text on Reading exercises 2023-06-30 21:18:13 +01:00
Tiago Ribeiro
3c4dba69db Added a confirmation dialog for when the user leaves questions unanswered 2023-06-29 15:28:50 +01:00
Tiago Ribeiro
3fac92b54d Added the exercises page which will work as the current exam page, while the exam page will mandatorily be the full exam 2023-06-29 00:18:39 +01:00
Tiago Ribeiro
139f527fdd Added the ability to filter by month, week and day on the record 2023-06-29 00:08:48 +01:00
Tiago Ribeiro
93cef3d58f Moved the Logout button to be sticky 2023-06-23 14:17:24 +01:00
Tiago Ribeiro
60b23ce1b5 Removed unused console.log calls 2023-06-23 14:15:57 +01:00
Tiago Ribeiro
d3a37eed3e Redesigned the Record page along with solving some bugs on the FillBlanks 2023-06-23 14:14:12 +01:00
Tiago Ribeiro
447cecbf3f Removed an unneeded console.log 2023-06-23 10:29:10 +01:00
Tiago Ribeiro
b2cc706a5e Updated the Writing exercise to have the evaluation in the user solutions instead of the exercise itself 2023-06-23 10:28:33 +01:00
Tiago Ribeiro
9cbb5b93c8 Added a subtitle of the colors 2023-06-22 23:16:07 +01:00
Tiago Ribeiro
747c07f84e Updated the sidebar 2023-06-22 22:39:25 +01:00
Tiago Ribeiro
79ed521703 Redesigned the MatchSentences exercise 2023-06-22 22:28:29 +01:00
Tiago Ribeiro
fe4a97ec85 Implemented the Writing exercise's solution display 2023-06-22 16:59:13 +01:00
Tiago Ribeiro
b194a9183e Updated the text related to the finish screen depending on the level 2023-06-21 16:43:06 +01:00
Tiago Ribeiro
f369234e8a Updated the stats to have missing 2023-06-21 15:02:42 +01:00
Tiago Ribeiro
808ec6315b Updated the Finish screen along with other tweaks 2023-06-21 14:54:22 +01:00
Tiago Ribeiro
d2cf50be68 Updated the ModuleTitle 2023-06-21 11:00:14 +01:00
Tiago Ribeiro
294f00952e Updated the design of the WriteBlanks exercise 2023-06-20 22:43:28 +01:00
Tiago Ribeiro
7beb1c84e7 Solved a bug in WriteBlanks where it wasn't saving the user's answer 2023-06-20 22:21:50 +01:00
Tiago Ribeiro
3a7c29de56 Made it so the code remembers the user's previous answers to current exercises 2023-06-20 17:07:54 +01:00
Tiago Ribeiro
dd357d991c Started updating the stats page 2023-06-20 09:32:33 +01:00
Tiago Ribeiro
47b1784615 Reverted the yarn version 2023-06-18 23:46:07 +01:00
Tiago Ribeiro
d4156c83f4 Transitioned to yarn classic 2023-06-18 23:31:57 +01:00
Tiago Ribeiro
572bc25eed Removed a trailing comma 2023-06-18 23:20:34 +01:00
Tiago Ribeiro
e80b163b4a Let's try this 2023-06-18 23:11:43 +01:00
Tiago Ribeiro
87e0610c79 Also updated the MultipleChoice exercise to the new design 2023-06-18 22:57:53 +01:00
Tiago Ribeiro
52218ff8b8 Updated the FillBlanks exercise and solution to the new design 2023-06-18 22:02:48 +01:00
Tiago Ribeiro
84b0b8ac42 Removed placeholders 2023-06-15 16:53:11 +01:00
Tiago Ribeiro
989a7449bf Turned on the normalize 2023-06-15 16:35:30 +01:00
Tiago Ribeiro
bc7eaea911 Implemented the speaking exercise;
Cleaned up a bit of the code;
2023-06-15 15:39:40 +01:00
Tiago Ribeiro
f5ec910010 Did the new designs for the Writing 2023-06-15 15:27:04 +01:00
Tiago Ribeiro
2d46bad40f Implemented the Reading and Listening initial screens according to the new designs, creating new components as needed 2023-06-15 14:43:29 +01:00
Tiago Ribeiro
65ebdd7dde Extracted the Input into its own component 2023-06-15 10:10:33 +01:00
Tiago Ribeiro
60217e9a66 - Updated the icons;
- Extracted the Layout into its own component;
2023-06-15 09:12:13 +01:00
Tiago Ribeiro
ec3157870e Updated the selection page 2023-06-14 22:22:18 +01:00
Tiago Ribeiro
9cf4bf7184 Improved the appearance of the Waveform 2023-06-14 17:18:22 +01:00
Tiago Ribeiro
f5fc85e1a7 Created a waveform component to display the recording's waveform 2023-06-14 16:22:48 +01:00
Tiago Ribeiro
31f2eb510e Created a simple test page where I'll implement the recorder for the speaking module 2023-06-14 14:37:12 +01:00
Tiago Ribeiro
31e2e56833 Updated the yarn version and recorder 2023-06-14 13:28:28 +01:00
Tiago Ribeiro
efaa32cd68 Completed the rest of the Selection screen to the new design 2023-06-13 16:24:01 +01:00
Tiago Ribeiro
b41ee8e2ad Updated part of the Selection screen to the new design 2023-06-13 15:43:26 +01:00
Tiago Ribeiro
e055b84688 Moved the exam page to the root pages 2023-06-13 15:25:45 +01:00
Tiago Ribeiro
1e286bb65b Added the ability for the user to show the password they're typing 2023-06-13 15:24:27 +01:00
Tiago Ribeiro
abe986313f Updated the <a> to <Link> 2023-06-12 15:58:17 +01:00
Tiago Ribeiro
088b77a66b Created a placeholder of the register page 2023-06-12 15:47:42 +01:00
Tiago Ribeiro
72fc98fccd Completed the Login page and updated the overall colors and font 2023-06-12 15:21:30 +01:00
Tiago Ribeiro
9ce45dfc30 Recreated most of the login screen with the new designs 2023-06-12 14:57:30 +01:00
Tiago Ribeiro
e864e16064 Updated the code to use the new desired levels 2023-06-12 14:05:48 +01:00
Tiago Ribeiro
6fe8a678ea Completed more of the home page of the new designs 2023-06-12 09:31:20 +01:00
Tiago Ribeiro
b2232df0c7 Created part of the homepage of the new Figma designs 2023-06-11 17:58:06 +01:00
Tiago Ribeiro
9a7853bd05 Created a score calculator 2023-06-05 14:04:58 +01:00
Tiago Ribeiro
1e8e95da34 Continued implementing the new design;
Added an average level calculator;
2023-05-31 14:01:12 +01:00
Tiago Ribeiro
4d37bf536a Merge branch 'main' into task/design/dashboard-redesign 2023-05-29 11:57:37 +01:00
Tiago Ribeiro
d0704e573b Removed unused Navbar calls 2023-05-27 11:17:43 +01:00
Tiago Ribeiro
31dc29b812 Removed the Navbar calls 2023-05-26 20:26:11 +01:00
Tiago Ribeiro
9ed3672cb6 Started the redesign of the dashboard 2023-05-26 19:46:50 +01:00
633 changed files with 77058 additions and 14812 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git

9
.gitignore vendored
View File

@@ -1,3 +1,5 @@
src/constants/test_firebase.json
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
@@ -35,4 +37,9 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
.env
.env
.yarn/*
.history*
__ENV.js
settings.json

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
yarn build

5
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
}

28
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"serverReadyAction": {
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
}
]
}

59
Dockerfile Normal file
View File

@@ -0,0 +1,59 @@
#syntax=docker/dockerfile:1.4
FROM node:18-alpine AS base
# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* ./
RUN yarn --frozen-lockfile
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1
ENV MONGODB_URI "mongodb+srv://user:JKpFBymv0WLv3STj@encoach.lz18a.mongodb.net/?retryWrites=true&w=majority&appName=EnCoach"
RUN yarn build
# If using npm comment out above and use below instead
# RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1
RUN \
addgroup --system --gid 1001 nodejs; \
adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=1001:1001 /app/.next/standalone ./
COPY --from=builder --chown=1001:1001 /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME localhost
CMD HOSTNAME="0.0.0.0" node server.js

17
components.json Normal file
View File

@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/styles/globals.css",
"baseColor": "neutral",
"cssVariables": false,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}

View File

@@ -1,6 +1,57 @@
/** @type {import('next').NextConfig} */
const websiteUrl = process.env.NODE_ENV === 'production' ? "https://encoach.com" : "http://localhost:3000";
const nextConfig = {
reactStrictMode: true,
}
reactStrictMode: false,
output: "standalone",
async headers() {
return [
{
source: "/api/packages",
headers: [
{key: "Access-Control-Allow-Credentials", value: "false"},
{key: "Access-Control-Allow-Origin", value: websiteUrl},
{
key: "Access-Control-Allow-Methods",
value: "GET",
},
{
key: "Access-Control-Allow-Headers",
value: "Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date",
},
],
},
{
source: "/api/tickets",
headers: [
{key: "Access-Control-Allow-Credentials", value: "false"},
{key: "Access-Control-Allow-Origin", value: websiteUrl},
{
key: "Access-Control-Allow-Methods",
value: "POST,OPTIONS",
},
{
key: "Access-Control-Allow-Headers",
value: "Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date",
},
],
},
{
source: "/api/users/agents",
headers: [
{key: "Access-Control-Allow-Credentials", value: "false"},
{key: "Access-Control-Allow-Origin", value: websiteUrl},
{
key: "Access-Control-Allow-Methods",
value: "POST,OPTIONS",
},
{
key: "Access-Control-Allow-Headers",
value: "Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date",
},
],
},
];
},
};
module.exports = nextConfig
module.exports = nextConfig;

10089
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,55 +1,119 @@
{
"name": "next-wind",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@headlessui/react": "^1.7.13",
"@mdi/js": "^7.1.96",
"@mdi/react": "^1.6.1",
"@next/font": "13.1.6",
"@types/node": "18.13.0",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"axios": "^1.3.5",
"chart.js": "^4.2.1",
"clsx": "^1.2.1",
"daisyui": "^2.50.0",
"eslint": "8.33.0",
"eslint-config-next": "13.1.6",
"firebase": "9.19.1",
"framer-motion": "^9.0.2",
"iron-session": "^6.3.1",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"next": "13.1.6",
"primeicons": "^6.0.1",
"primereact": "^9.2.3",
"react": "18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "18.2.0",
"react-firebase-hooks": "^5.1.1",
"react-lineto": "^3.3.0",
"react-media-recorder": "^1.6.6",
"react-player": "^2.12.0",
"react-string-replace": "^1.1.0",
"react-toastify": "^9.1.2",
"swr": "^2.1.3",
"typescript": "4.9.5",
"uuid": "^9.0.0",
"zustand": "^4.3.6"
},
"devDependencies": {
"@types/lodash": "^4.14.191",
"@types/uuid": "^9.0.1",
"@wixc3/react-board": "^2.2.0",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.4"
}
"name": "next-wind",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"prepare": "husky install"
},
"dependencies": {
"@beam-australia/react-env": "^3.1.1",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",
"@firebase/util": "^1.9.7",
"@headlessui/react": "^2.1.2",
"@mdi/js": "^7.1.96",
"@mdi/react": "^1.6.1",
"@paypal/paypal-js": "^7.1.0",
"@paypal/react-paypal-js": "^8.1.3",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-popover": "^1.1.1",
"@react-pdf/renderer": "^3.1.14",
"@react-spring/web": "^9.7.4",
"@tanstack/react-table": "^8.10.1",
"@types/node": "18.13.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@use-gesture/react": "^10.3.1",
"axios": "^1",
"axios-cache-interceptor": "^1",
"bcrypt": "^5.1.1",
"chart.js": "^4.2.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"countries-list": "^3.0.1",
"country-codes-list": "^1.6.11",
"currency-symbol-map": "^5.1.0",
"daisyui": "^3.1.5",
"deep-diff": "^1.0.2",
"eslint": "8.33.0",
"eslint-config-next": "13.1.6",
"exceljs": "^4.4.0",
"express-handlebars": "^7.1.2",
"firebase": "9.19.1",
"firebase-admin": "^11.10.1",
"firebase-scrypt": "^2.2.0",
"formidable": "^3.5.0",
"formidable-serverless": "^1.1.1",
"framer-motion": "^9.0.2",
"howler": "^2.2.4",
"immer": "^10.1.1",
"iron-session": "^6.3.1",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"moment-timezone": "^0.5.44",
"mongodb": "^6.8.1",
"next": "^14.2.5",
"nodemailer": "^6.9.5",
"nodemailer-express-handlebars": "^6.1.0",
"primeicons": "^6.0.1",
"primereact": "^9.2.3",
"qrcode": "^1.5.3",
"random-words": "^2.0.0",
"react": "18.2.0",
"react-chartjs-2": "^5.2.0",
"react-csv": "^2.2.2",
"react-currency-input-field": "^3.6.12",
"react-datepicker": "^4.18.0",
"react-diff-viewer": "^3.1.1",
"react-dom": "18.2.0",
"react-firebase-hooks": "^5.1.1",
"react-icons": "^5.3.0",
"react-lineto": "^3.3.0",
"react-media-recorder": "1.6.5",
"react-phone-number-input": "^3.3.6",
"react-player": "^2.12.0",
"react-select": "^5.7.5",
"react-string-replace": "^1.1.0",
"react-toastify": "^9.1.2",
"react-tooltip": "^5.27.1",
"react-xarrows": "^2.0.2",
"read-excel-file": "^5.7.1",
"short-unique-id": "5.0.2",
"stripe": "^13.10.0",
"swr": "^2.2.5",
"tailwind-merge": "^2.5.2",
"tailwind-scrollbar-hide": "^1.1.7",
"tailwindcss-animate": "^1.0.7",
"typescript": "4.9.5",
"use-file-picker": "^2.1.0",
"uuid": "^9.0.0",
"wavesurfer.js": "^6.6.4",
"zustand": "^4.3.6"
},
"devDependencies": {
"@simbathesailor/use-what-changed": "^2.0.0",
"@types/blob-stream": "^0.1.33",
"@types/deep-diff": "^1.0.5",
"@types/formidable": "^3.4.0",
"@types/howler": "^2.2.11",
"@types/lodash": "^4.14.191",
"@types/nodemailer": "^6.4.11",
"@types/nodemailer-express-handlebars": "^4.0.3",
"@types/qrcode": "^1.5.5",
"@types/react-csv": "^1.1.10",
"@types/react-datepicker": "^4.15.1",
"@types/uuid": "^9.0.1",
"@types/wavesurfer.js": "^6.0.6",
"@wixc3/react-board": "^2.2.0",
"autoprefixer": "^10.4.13",
"husky": "^8.0.3",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.4"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

BIN
public/audio/check.mp3 Normal file

Binary file not shown.

BIN
public/audio/error.mp3 Normal file

Binary file not shown.

BIN
public/audio/sent.mp3 Normal file

Binary file not shown.

BIN
public/blue-stock-photo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 KiB

BIN
public/defaultAvatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
public/logo_title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

BIN
public/manuals/student.pdf Normal file

Binary file not shown.

BIN
public/manuals/teacher.pdf Normal file

Binary file not shown.

1
public/mat-icon-info.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
public/red-stock-photo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 MiB

View File

@@ -0,0 +1,51 @@
import dotenv from "dotenv";
dotenv.config();
import { MongoClient } from "mongodb";
const uri = process.env.MONGODB_URI || "";
const options = {
maxPoolSize: 10,
};
const dbName = process.env.MONGODB_DB; // change this to prod db when needed
async function migrateData() {
const MODULE_ARRAY = ["reading", "listening", "writing", "speaking", "level"];
const client = new MongoClient(uri, options);
try {
await client.connect();
console.log("Connected to MongoDB");
if (!process.env.MONGODB_DB) {
throw new Error("Missing env var: MONGODB_DB");
}
const db = client.db(dbName);
for (const string of MODULE_ARRAY) {
const collection = db.collection(string);
const result = await collection.updateMany(
{ private: { $exists: false } },
{ $set: { access: "public" } }
);
const result2 = await collection.updateMany(
{ private: true },
{ $set: { access: "private" }, $unset: { private: "" } }
);
const result1 = await collection.updateMany(
{ private: { $exists: true } },
{ $set: { access: "public" } }
);
console.log(
`Updated ${
result.modifiedCount + result1.modifiedCount
} documents to "access: public" in ${string}`
);
console.log(
`Updated ${result2.modifiedCount} documents to "access: private" and removed private var in ${string}`
);
}
console.log("Migration completed successfully!");
} catch (error) {
console.error("Migration failed:", error);
} finally {
await client.close();
console.log("MongoDB connection closed.");
}
}
//migrateData(); // uncomment to run the migration

View File

@@ -0,0 +1,193 @@
import Image from "next/image";
import clsx from "clsx";
import RadialProgressBar from "./RadialProgressBar";
import { AIDetectionAttributes } from "@/interfaces/exam";
import { Tooltip } from 'react-tooltip';
import SegmentedProgressBar from "./SegmentedProgressBar";
// Colors and texts scrapped from gpt's zero react bundle
const AIDetection: React.FC<AIDetectionAttributes> = ({ predicted_class, confidence_category, class_probabilities, sentences }) => {
const probabilityTooltipContent = `
Encoach's deep learning model predicts the <br/>
probability this text has been entirely <br/>
generated by AI. For instance, a 40% AI <br/>
probability does not indicate that the text<br/>
contains 40% AI-written content. Rather, it<br/>
indicates the text is more likely to be partially<br/>
human written than be entirely AI-written.
`;
const confidenceTooltipContent = `
Confidence scores are a safeguard to better<br/>
understand AI identification results. Encoach<br/>
trained it's deep learning model on a diverse<br/>
dataset of millions of human and AI-written<br/>
documents. Green scores indicate that you can scan<br/>
with confidence that the model has classified<br/>
many similar documents with high accuracy.<br/>
Red scores indicate that this text is dissimilar<br/>
to the ones in their training set, which can impact<br/>
the model's accuracy, and to proceed with caution.
`;
const confidenceKeywords = ["moderately", "highly", "confident", "uncertain"];
var confidence = {
low: {
ai: "Encoach is uncertain about this text. If Encoach had to classify it, it would be considered",
human: "Encoach is uncertain about this text. If Encoach had to classify it, it would likely be considered",
mixed: "Encoach is uncertain about this text. If Encoach had to classify it, it would likely be a"
},
medium: {
ai: "Encoach is moderately confident this text was",
human: "Encoach is moderately confident this text is entirely",
mixed: "Encoach is moderately confident this text is a"
},
high: {
ai: "Encoach is highly confident this text was",
human: "Encoach is highly confident this text is entirely",
mixed: "Encoach is highly confident this text is a"
}
}
var classPrediction = {
ai: {
background: "bg-ai-detection-result-ai-bg",
color: "text-ai-detection-result-ai",
text: "ai generated"
},
mixed: {
background: "bg-ai-detection-result-mixed-bg",
color: "text-ai-detection-result-mixed",
text: "mix of ai and human"
},
human: {
background: "bg-ai-detection-result-human-bg",
color: "text-ai-detection-result-human",
text: "human"
}
}
const segments = [
{ percentage: Math.round(class_probabilities["human"] * 100), subtitle: 'human', color: "ai-detection-result-human" },
{ percentage: Math.round(class_probabilities["mixed"] * 100), subtitle: 'mixed', color: "ai-detection-result-mixed" },
{ percentage: Math.round(class_probabilities["ai"] * 100), subtitle: 'ai', color: "ai-detection-result-ai" }
];
const styleConfidenceText = (text: string): [string, string[]] => {
const keywords: string[] = [];
const styledText = text.split(" ").map(word => {
if (confidenceKeywords.includes(word)) {
keywords.push(word);
return `<span style="font-weight: 500; text-decoration: underline;">${word}</span>`;
}
return word
}).join(" ");
return [styledText, keywords];
};
const confidenceText = confidence[confidence_category][predicted_class];
const [styledText, keywords] = styleConfidenceText(confidenceText);
const tooltipStyle = {
"backgroundColor": "rgb(255, 255, 255)",
"color": "#8992B1",
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
borderRadius: '0.125rem'
}
const highestProbability = Math.max(class_probabilities["ai"], class_probabilities["human"], class_probabilities["mixed"]);
const spanTextColor = highestProbability === class_probabilities["ai"]
? "#f4bf4f"
: highestProbability === class_probabilities["human"]
? "#50c08a"
: "#93aafb";
let spanClassName = highestProbability === class_probabilities["ai"]
? "text-ai-detection-result-ai"
: highestProbability === class_probabilities["human"]
? "text-ai-detection-result-human"
: "text-ai-detection-result-mixed";
spanClassName = `${spanClassName} font-bold text-lg`
const percentage = Math.round(highestProbability * 100)
const hasHighlightedForAI = sentences.some(item => item.highlight_sentence_for_ai);
return (
<>
<Tooltip id="probability-tooltip" className="z-50 bg-white shadow-md rounded-sm" style={tooltipStyle} />
<Tooltip id="confidence-tooltip" className="z-50 bg-white shadow-md rounded-sm" style={tooltipStyle} />
<div className="flex flex-col bg-white p-6 rounded-lg shadow-lg gap-16">
<h1 className="text-lg font-semibold">Encoach Detection Results</h1>
<div className="flex flex-row -md:flex-col -lg:gap-0 -xl:gap-10 gap-20 items-stretch -md:items-center">
<div className="flex -md:w-5/6 w-1/2 justify-center">
<div className="flex flex-col border rounded-xl">
<h1 className="border-b p-6 font-medium">Text Classification</h1>
<div className="flex flex-row gap-8 items-center p-6">
<RadialProgressBar
percentage={percentage}
text={predicted_class}
color={spanTextColor}
spanClassName={spanClassName}
/>
<div className="flex flex-col gap-1 text-sm">
<div className="flex flex-row items-center">
<span className="mr-2 text-ai-detection-result-ai-text font-semibold text-xl">
{`${Math.round(class_probabilities["ai"] * 100)}%`}
</span>
<span className="text-sm -md:text-xs text-ai-detection-text">Probability AI generated</span>
<a data-tooltip-id="probability-tooltip" data-tooltip-html={probabilityTooltipContent} className='ml-1 flex items-center justify-center'>
<Image src="/mat-icon-info.svg" width={24} height={24} alt="Probability Tooltip" />
</a>
</div>
<div className="flex flex-row items-center gap-1">
<div className={clsx(
"rounded-full w-3 h-3",
confidence_category == 'low' ?
"bg-ai-detection-confidence-low border border-ai-detection-confidence-border" : "bg-ai-detection-confidence-low-transparent"
)}></div>
<div className={clsx(
"rounded-full w-3 h-3",
confidence_category == 'medium' ?
"bg-ai-detection-confidence-medium border border-ai-detection-confidence-border" : "bg-ai-detection-confidence-medium-transparent"
)}></div>
<div className={clsx(
"rounded-full w-3 h-3 mr-2",
confidence_category == 'high' ?
"bg-ai-detection-confidence-high border border-ai-detection-confidence-border" : "bg-ai-detection-confidence-high-transparent"
)}></div>
<span className="text-sm -md:text-xs text-ai-detection-text">{keywords.join(' ')}</span>
<a data-tooltip-id="confidence-tooltip" data-tooltip-html={confidenceTooltipContent} className='ml-1 flex items-center justify-center'>
<Image src="/mat-icon-info.svg" width={24} height={24} alt="Probability Tooltip" />
</a>
</div>
</div>
</div>
</div>
</div>
<div className="flex flex-col border rounded-xl -md:w-5/6 w-2/6">
<h1 className="border-b p-6 font-medium">Probability Breakdown</h1>
<div className="flex items-center w-full h-full">
<SegmentedProgressBar segments={segments} className="w-full px-8 -md:py-8 text-ai-detection-text" />
</div>
</div>
</div>
<div className="flex flex-col gap-2">
<div className="flex flex-row items-center">
<div dangerouslySetInnerHTML={{ __html: styledText }} className="mr-2"></div>
<div className={clsx(
"flex items-center justify-center p-2 rounded",
classPrediction[predicted_class]['color'],
classPrediction[predicted_class]['background']
)}>
<span className="text-sm">{classPrediction[predicted_class]['text']}</span>
</div>
</div>
{(hasHighlightedForAI && <div>
Sentences that are likely written by AI are <span className="font-semibold bg-ai-detection-highlight">highlighted</span>.
</div>)}
</div>
</div >
<div>
{sentences.map((item, index) => (
<span
key={index}
className={item.highlight_sentence_for_ai ? 'bg-ai-detection-highlight' : ''}
>
{item.sentence}{' '}
</span>
))}
</div>
</>
)
}
export default AIDetection;

View File

@@ -0,0 +1,99 @@
import { Dialog, Transition } from "@headlessui/react";
import { Fragment, useCallback, useEffect, useState } from "react";
import Button from "./Low/Button";
interface Props {
isOpen: boolean;
abandonPopupTitle: string;
abandonPopupDescription: string;
abandonConfirmButtonText: string;
onAbandon: () => void;
onCancel: () => void;
}
export default function AbandonPopup({ isOpen, abandonPopupTitle, abandonPopupDescription, abandonConfirmButtonText, onAbandon, onCancel }: Props) {
const [isClosing, setIsClosing] = useState(false);
const [mounted, setMounted] = useState(false);
useEffect(() => {
if (isOpen) {
setMounted(true);
}
}, [isOpen]);
useEffect(() => {
if (!isOpen && mounted) {
const timer = setTimeout(() => {
setMounted(false);
setIsClosing(false);
}, 300);
return () => clearTimeout(timer);
}
}, [isOpen, mounted]);
const blockMultipleClicksClose = useCallback((cancel: boolean) => {
if (isClosing) return;
setIsClosing(true);
const func = cancel ? onCancel : onAbandon;
func();
const timer = setTimeout(() => {
setIsClosing(false);
}, 300);
return () => clearTimeout(timer);
}, [isClosing, onCancel, onAbandon]);
if (!mounted && !isOpen) return null;
return (
<Transition
show={isOpen}
as={Fragment}
beforeEnter={() => setIsClosing(false)}
beforeLeave={() => setIsClosing(true)}
afterLeave={() => {
setIsClosing(false);
setMounted(false);
}}
>
<Dialog onClose={() => blockMultipleClicksClose(true)} className="relative z-50">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0">
<div className="fixed inset-0 bg-black/30" />
</Transition.Child>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95">
<div className="fixed inset-0 flex items-center justify-center p-4">
<Dialog.Panel className="w-full max-w-2xl h-fit p-8 rounded-xl bg-white flex flex-col gap-4">
<Dialog.Title className="font-bold text-xl">{abandonPopupTitle}</Dialog.Title>
<span>{abandonPopupDescription}</span>
<div className="w-full flex justify-between mt-8">
<Button color="purple" onClick={() => blockMultipleClicksClose(true)} variant="outline" className="max-w-[200px] self-end w-full">
Cancel
</Button>
<Button color="purple" onClick={() => blockMultipleClicksClose(false)} className="max-w-[200px] self-end w-full">
{abandonConfirmButtonText}
</Button>
</div>
</Dialog.Panel>
</div>
</Transition.Child>
</Dialog>
</Transition>
);
}

View File

@@ -0,0 +1,32 @@
import Image from "next/image";
import React from "react";
import { FaRegUser } from "react-icons/fa";
interface Props {
prefix: string;
name: string;
profileImage: string;
}
export default function RequestedBy({ prefix, name, profileImage }: Props) {
return (
<div className="flex items-center space-x-3">
<div className="flex items-center justify-center w-12 h-12 bg-gray-100 rounded-lg border border-gray-300">
<FaRegUser className="text-mti-purple-dark size-5"/>
</div>
<div>
<p className="text-sm font-medium text-gray-800">Requested by</p>
<div className="flex items-center space-x-2">
<p className="text-xs font-medium text-gray-800">{prefix} {name}</p>
<img
src={profileImage ? profileImage : "/defaultAvatar.png"}
alt={name}
width={24}
height={24}
className="w-6 h-6 rounded-full border-[1px] border-gray-400 border-opacity-50"
/>
</div>
</div>
</div>
);
};

View File

@@ -0,0 +1,41 @@
import React from "react";
import { PiCalendarDots } from "react-icons/pi";
interface Props {
date: number;
}
export default function StartedOn({ date }: Props) {
const formattedDate = new Date(date);
const yearMonthDay = formattedDate.toISOString().split("T")[0];
const fullDateTime = formattedDate.toLocaleString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: false,
});
return (
<div className="flex items-center space-x-3">
<div className="flex items-center justify-center w-12 h-12 bg-gray-100 rounded-lg border border-gray-300">
<PiCalendarDots className="text-mti-purple-dark size-7" />
</div>
<div>
<p className="pb-1 text-sm font-medium text-gray-800">Started on</p>
<div className="flex items-center">
<p
className="text-xs font-medium text-gray-800"
title={fullDateTime}
>
{yearMonthDay}
</p>
</div>
</div>
</div>
);
};

View File

@@ -0,0 +1,23 @@
import { ApprovalWorkflowStatus, ApprovalWorkflowStatusLabel } from "@/interfaces/approval.workflow";
import React from "react";
import { RiProgress5Line } from "react-icons/ri";
interface Props {
status: ApprovalWorkflowStatus;
}
export default function Status({ status }: Props) {
return (
<div className="flex items-center space-x-3">
<div className="flex items-center justify-center w-12 h-12 bg-gray-100 rounded-lg border border-gray-300">
<RiProgress5Line className="text-mti-purple-dark size-7"/>
</div>
<div>
<p className="pb-1 text-sm font-medium text-gray-800">Status</p>
<div className="flex items-center">
<p className="text-xs font-medium text-gray-800">{ApprovalWorkflowStatusLabel[status]}</p>
</div>
</div>
</div>
);
};

View File

@@ -0,0 +1,14 @@
import { MdTipsAndUpdates } from "react-icons/md";
interface Props {
text: string;
}
export default function Tip({ text }: Props) {
return (
<div className="flex flex-row gap-3 text-gray-500 font-medium">
<MdTipsAndUpdates size={25} />
<p>{text}</p>
</div>
);
};

View File

@@ -0,0 +1,24 @@
import Image from "next/image";
interface Props {
prefix: string;
name: string;
profileImage: string;
textSize?: string;
}
export default function UserWithProfilePic({ prefix, name, profileImage, textSize }: Props) {
const textClassName = `${textSize ? textSize : "text-xs"} font-medium`
return (
<div className="flex items-center space-x-2">
<p className={textClassName}>{prefix} {name}</p>
<img
src={profileImage ? profileImage : "/defaultAvatar.png"}
alt={name}
width={24}
height={24}
className="rounded-full h-auto border-[1px] border-gray-400 border-opacity-50"
/>
</div>
);
};

View File

@@ -0,0 +1,136 @@
import { EditableWorkflowStep } from "@/interfaces/approval.workflow";
import Option from "@/interfaces/option";
import { CorporateUser, DeveloperUser, MasterCorporateUser, TeacherUser } from "@/interfaces/user";
import Image from "next/image";
import { useEffect, useMemo, useState } from "react";
import { AiOutlineUserAdd } from "react-icons/ai";
import { BsTrash } from "react-icons/bs";
import { LuGripHorizontal } from "react-icons/lu";
import WorkflowStepNumber from "./WorkflowStepNumber";
import WorkflowStepSelects from "./WorkflowStepSelects";
interface Props extends Pick<EditableWorkflowStep, 'stepNumber' | 'assignees' | 'finalStep' | 'onDelete'> {
entityApprovers: (TeacherUser | CorporateUser | MasterCorporateUser | DeveloperUser)[];
onSelectChange: (numberOfSelects: number, index: number, value: Option | null) => void;
isCompleted: boolean,
}
export default function WorkflowEditableStepComponent({
stepNumber,
assignees = [null],
finalStep,
onDelete,
onSelectChange,
entityApprovers,
isCompleted,
}: Props) {
const [selects, setSelects] = useState<(Option | null | undefined)[]>([null]);
const [isAdding, setIsAdding] = useState(false);
const approverOptions: Option[] = useMemo(() =>
entityApprovers
.map((approver) => ({
value: approver.id,
label: approver.name,
icon: () => <img src={approver.profilePicture} alt={approver.name} />
}))
.sort((a, b) => a.label.localeCompare(b.label)),
[entityApprovers]
);
useEffect(() => {
if (assignees && assignees.length > 0) {
const initialSelects = assignees.map((assignee) =>
typeof assignee === 'string' ? approverOptions.find(option => option.value === assignee) || null : null
);
setSelects((prevSelects) => {
// This is needed to avoid unnecessary re-renders which can cause warning of a child component being re-rendered while parent is in the midle of also re-rendering.
const areEqual = initialSelects.length === prevSelects.length && initialSelects.every((option, idx) => option?.value === prevSelects[idx]?.value);
if (!areEqual) {
return initialSelects;
}
return prevSelects;
});
}
}, [assignees, approverOptions]);
const selectedValues = useMemo(() =>
selects.filter((opt): opt is Option => !!opt).map(opt => opt.value),
[selects]
);
const availableApproverOptions = useMemo(() =>
approverOptions.filter(opt => !selectedValues.includes(opt.value)),
[approverOptions, selectedValues]
);
const handleAddSelectComponent = () => {
setIsAdding(true); // I hate to use flags... but it was the only way i was able to prevent onSelectChange to cause parent component from re-rendering in the midle of EditableWorkflowStep rerender.
setSelects(prev => [...prev, null]);
};
useEffect(() => {
if (isAdding) {
onSelectChange(selects.length, selects.length - 1, null);
setIsAdding(false);
}
}, [selects.length, isAdding, onSelectChange]);
const handleSelectChangeAt = (numberOfSelects: number, index: number, option: Option | null) => {
const updated = [...selects];
updated[index] = option;
setSelects(updated);
onSelectChange(numberOfSelects, index, option);
};
return (
<div className="flex w-full">
<div className="flex flex-col items-center">
<WorkflowStepNumber stepNumber={stepNumber} completed={false} selected={false} />
{/* Vertical Bar connecting steps */}
{!finalStep && (
<div className="w-1 h-full min-h-10 bg-mti-purple-dark"></div>
)}
</div>
{stepNumber !== 1 && !finalStep && !isCompleted
? <LuGripHorizontal className="ml-3 mt-2 cursor-grab active:cursor-grabbing min-w-[25px] min-h-[25px]" />
: <div className="ml-3 mt-2" style={{ width: 25, height: 25 }}></div>
}
<div className="ml-10 mb-12">
<WorkflowStepSelects
approvers={availableApproverOptions}
selects={selects}
placeholder={stepNumber === 1 ? "Form Intake By:" : "Approval By:"}
onSelectChange={handleSelectChangeAt}
isCompleted={isCompleted}
/>
</div>
<div className="flex flex-row items-start mt-1.5 ml-3">
<button
type="button"
onClick={handleAddSelectComponent}
className="cursor-pointer"
>
<AiOutlineUserAdd className="size-7 hover:text-mti-purple-light transition ease-in-out duration-300" />
</button>
{stepNumber !== 1 && !finalStep && (
<button
className="cursor-pointer"
onClick={onDelete}
type="button"
>
<BsTrash className="size-6 mt-0.5 ml-3 hover:text-mti-purple-light transition ease-in-out duration-300" />
</button>
)}
</div>
</div>
);
};

View File

@@ -0,0 +1,203 @@
import { EditableApprovalWorkflow, EditableWorkflowStep } from "@/interfaces/approval.workflow";
import Option from "@/interfaces/option";
import { CorporateUser, DeveloperUser, MasterCorporateUser, TeacherUser } from "@/interfaces/user";
import { AnimatePresence, Reorder, motion } from "framer-motion";
import { FaRegCheckCircle, FaSpinner } from "react-icons/fa";
import { IoIosAddCircleOutline } from "react-icons/io";
import Button from "../Low/Button";
import Tip from "./Tip";
import WorkflowEditableStepComponent from "./WorkflowEditableStepComponent";
interface Props {
workflow: EditableApprovalWorkflow;
onWorkflowChange: (workflow: EditableApprovalWorkflow) => void;
entityApprovers: (TeacherUser | CorporateUser | MasterCorporateUser | DeveloperUser)[];
entityAvailableFormIntakers?: (TeacherUser | CorporateUser | MasterCorporateUser | DeveloperUser)[];
isLoading: boolean;
isRedirecting?: boolean;
}
export default function WorkflowForm({ workflow, onWorkflowChange, entityApprovers, entityAvailableFormIntakers, isLoading, isRedirecting }: Props) {
const lastStep = workflow.steps[workflow.steps.length - 1];
const renumberSteps = (steps: EditableWorkflowStep[]): EditableWorkflowStep[] => {
return steps.map((step, index) => ({
...step,
stepNumber: index + 1,
}));
};
const addStep = () => {
const newStep: EditableWorkflowStep = {
key: Date.now(),
stepType: "approval-by",
stepNumber: workflow.steps.length,
completed: false,
assignees: [null],
firstStep: false,
finalStep: false,
};
const updatedSteps = [
...workflow.steps.slice(0, -1),
newStep,
lastStep
];
onWorkflowChange({ ...workflow, steps: renumberSteps(updatedSteps) });
};
const handleDelete = (key: number | undefined) => {
if (!key) return;
const updatedSteps = workflow.steps.filter((step) => step.key !== key);
onWorkflowChange({ ...workflow, steps: renumberSteps(updatedSteps) });
};
const handleSelectChange = (key: number | undefined, numberOfSelects: number, index: number, selectedOption: Option | null) => {
if (!key) return;
const updatedSteps = workflow.steps.map((step) => {
if (step.key !== key) return step;
const assignees = step.assignees ?? [];
let newAssignees = [...assignees];
if (numberOfSelects === assignees.length) { // means no new select was added and instead one was changed
newAssignees[index] = selectedOption?.value;
} else if (numberOfSelects === assignees.length + 1) { // means a new select was added
newAssignees.push(selectedOption?.value || null);
}
return { ...step, assignees: newAssignees };
});
onWorkflowChange({ ...workflow, steps: updatedSteps });
};
const handleReorder = (newOrder: EditableWorkflowStep[]) => {
let draggableIndex = 0;
const updatedSteps = workflow.steps.map((step) => {
if (!step.firstStep && !step.finalStep && !step.completed) {
return newOrder[draggableIndex++];
}
// Keep static steps as-is
return step;
});
onWorkflowChange({ ...workflow, steps: renumberSteps(updatedSteps) });
};
return (
<>
{workflow.entityId && workflow.name &&
<div>
<div
className="flex flex-col gap-6"
>
<Tip text="Introduce here all the steps associated with this instance." />
<Button
color="purple"
variant="solid"
onClick={addStep}
type="button"
className="max-w-fit text-lg font-medium flex items-center gap-2 text-left mb-7"
>
<IoIosAddCircleOutline className="size-6" />
Add Step
</Button>
</div>
<Reorder.Group
axis="y"
values={workflow.steps}
onReorder={handleReorder}
className="flex flex-col gap-0"
>
<AnimatePresence>
{workflow.steps.map((step, index) =>
step.completed || step.firstStep || step.finalStep ? (
<motion.div
key={step.key}
layout
initial={{ opacity: 0, y: -30 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, x: 30 }}
transition={{ duration: 0.20 }}
>
<WorkflowEditableStepComponent
stepNumber={index + 1}
assignees={step.assignees}
finalStep={step.finalStep}
onDelete={() => handleDelete(step.key)}
onSelectChange={(numberOfSelects, idx, option) =>
handleSelectChange(step.key, numberOfSelects, idx, option)
}
entityApprovers={
step.stepNumber === 1 && entityAvailableFormIntakers
? entityAvailableFormIntakers
: entityApprovers
}
isCompleted={step.completed}
/>
</motion.div>
) : (
// Render non-completed steps as draggable items
<Reorder.Item
key={step.key}
value={step}
initial={{ opacity: 0, y: -30 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, x: 30 }}
transition={{ duration: 0.20 }}
layout
drag={!step.firstStep && !step.finalStep}
dragListener={!step.firstStep && !step.finalStep}
>
<WorkflowEditableStepComponent
stepNumber={index + 1}
assignees={step.assignees}
finalStep={step.finalStep}
onDelete={() => handleDelete(step.key)}
onSelectChange={(numberOfSelects, idx, option) =>
handleSelectChange(step.key, numberOfSelects, idx, option)
}
entityApprovers={
step.stepNumber === 1 && entityAvailableFormIntakers
? entityAvailableFormIntakers
: entityApprovers
}
isCompleted={step.completed}
/>
</Reorder.Item>
)
)}
<Button
type="submit"
color="purple"
variant="solid"
disabled={isLoading}
className="max-w-fit text-lg font-medium flex items-center gap-2 text-left -mt-4"
>
{isRedirecting ? (
<>
<FaSpinner className="animate-spin size-5" />
Redirecting...
</>
) : isLoading ? (
<>
<FaSpinner className="animate-spin size-5" />
Loading...
</>
) : (
<>
<FaRegCheckCircle className="size-5" />
Confirm Exam Workflow Pipeline
</>
)}
</Button>
</AnimatePresence>
</Reorder.Group>
</div>
}
</>
);
};

View File

@@ -0,0 +1,101 @@
import { getUserTypeLabel, getUserTypeLabelShort, WorkflowStep } from "@/interfaces/approval.workflow";
import WorkflowStepNumber from "./WorkflowStepNumber";
import clsx from "clsx";
import { RiThumbUpLine } from "react-icons/ri";
import { FaWpforms } from "react-icons/fa6";
import { User } from "@/interfaces/user";
import UserWithProfilePic from "./UserWithProfilePic";
interface Props extends WorkflowStep {
workflowAssignees: User[],
currentStep: boolean,
}
export default function WorkflowStepComponent({
workflowAssignees,
currentStep,
stepType,
stepNumber,
completed,
rejected = false,
completedBy,
assignees,
finalStep,
selected = false,
onClick,
}: Props) {
const completedByUser = workflowAssignees.find((assignee) => assignee.id === completedBy);
const assigneesUsers = workflowAssignees.filter(user => assignees.includes(user.id));
return (
<div
onClick={onClick}
className={clsx("flex flex-row gap-5 w-[600px] p-6 mb-5 rounded-2xl transition ease-in-out duration-300 cursor-pointer", {
"bg-mti-red-ultralight": rejected && selected,
"bg-mti-purple-ultralight": selected,
})}
>
<div className="relative flex flex-col items-center">
<WorkflowStepNumber stepNumber={stepNumber} selected={selected} completed={completed} finalStep={finalStep} rejected={rejected} />
{/* Vertical Bar connecting steps */}
{!finalStep && (
<div className="absolute w-1 bg-mti-purple-dark -bottom-20 top-11"></div>
)}
</div>
<div className="mt-1.5">
{stepType === "approval-by" ? (
<RiThumbUpLine size={25} />
) : (
<FaWpforms size={25} />
)
}
</div>
<div className="mt-1 flex flex-col gap-0">
{completed && completedBy && rejected ? (
<div className={clsx("text-xs font-medium", { "text-mti-purple-ultradark": selected, "text-gray-800": !selected })}>
<p className="text-sm font-medium text-gray-800">{stepType === "approval-by" ? `Approval: ${getUserTypeLabel(completedByUser!.type)} Approval` : `Form Intake: ${getUserTypeLabel(completedByUser!.type)} Intake`} </p>
<UserWithProfilePic
prefix={`Rejected by: ${getUserTypeLabelShort(completedByUser!.type)}`}
name={completedByUser!.name}
profileImage={completedByUser!.profilePicture}
/>
</div>
) : completed && completedBy && !rejected ? (
<div className={clsx("text-xs font-medium", { "text-mti-purple-ultradark": selected, "text-gray-800": !selected })}>
<p className="text-sm font-medium text-gray-800">{stepType === "approval-by" ? `Approval: ${getUserTypeLabel(completedByUser!.type)} Approval` : `Form Intake: ${getUserTypeLabel(completedByUser!.type)} Intake`} </p>
<UserWithProfilePic
prefix={`Completed by: ${getUserTypeLabelShort(completedByUser!.type)}`}
name={completedByUser!.name}
profileImage={completedByUser!.profilePicture}
/>
</div>
) : !completed && currentStep ? (
<div className={clsx("text-xs font-medium", { "text-mti-purple-ultradark": selected, "text-gray-800": !selected })}>
<p className="text-sm font-medium text-gray-800">{stepType === "approval-by" ? `Approval:` : `Form Intake:`} </p>
In Progress... Assignees:
<div className="flex flex-row flex-wrap gap-3 items-center">
{assigneesUsers.map(user => (
<span key={user.id}>
<UserWithProfilePic
prefix={getUserTypeLabelShort(user.type)}
name={user.name}
profileImage={user.profilePicture}
/>
</span>
))}
</div>
</div>
) : (
<div className={clsx("text-xs font-medium", { "text-mti-purple-ultradark": selected, "text-gray-800": !selected })}>
<p className="text-sm font-medium text-gray-800">{stepType === "approval-by" ? `Approval:` : `Form Intake:`} </p>
Waiting for previous steps...
</div>
)}
</div>
</div>
);
};

View File

@@ -0,0 +1,31 @@
import { WorkflowStep } from "@/interfaces/approval.workflow";
import clsx from "clsx";
import { IoCheckmarkDoneSharp, IoCheckmarkSharp } from "react-icons/io5";
import { RxCross2 } from "react-icons/rx";
type Props = Pick<WorkflowStep, 'stepNumber' | 'completed' | 'finalStep' | 'selected' | 'rejected'>
export default function WorkflowStepNumber({ stepNumber, selected = false, completed, rejected, finalStep }: Props) {
return (
<div
className={clsx(
'flex items-center justify-center min-w-11 min-h-11 rounded-full',
{
'bg-mti-red-dark text-mti-red-ultralight': rejected,
'bg-mti-purple-dark text-mti-purple-ultralight': selected,
'bg-mti-purple-ultralight text-gray-500': !selected,
}
)}
>
{rejected ? (
<RxCross2 className="text-xl font-bold" size={25}/>
) : completed && finalStep ? (
<IoCheckmarkDoneSharp className="text-xl font-bold" size={25} />
) : completed && !finalStep ? (
<IoCheckmarkSharp className="text-xl font-bold" size={25} />
) : (
<span className="text-lg font-semibold">{stepNumber}</span>
)}
</div>
);
};

View File

@@ -0,0 +1,51 @@
import Option from "@/interfaces/option";
import Select from "../Low/Select";
interface Props {
approvers: Option[];
selects: (Option | null | undefined)[];
placeholder: string;
onSelectChange: (numberOfSelects: number, index: number, value: Option | null) => void;
isCompleted: boolean;
}
export default function WorkflowStepSelects({
approvers,
selects,
placeholder,
onSelectChange,
isCompleted,
}: Props) {
return (
<div
className={"flex flex-wrap gap-0"}
>
{selects.map((option, index) => {
let classes = "px-2 rounded-none";
if (index === 0 && selects.length === 1) {
classes += " rounded-l-2xl rounded-r-2xl";
} else if (index === 0) {
classes += " rounded-l-2xl";
} else if (index === selects.length - 1) {
classes += " rounded-r-2xl";
}
return (
<div key={index} className="w-[275px]">
<Select
options={approvers}
value={option}
onChange={(option) => onSelectChange(selects.length, index, option)}
placeholder={placeholder}
flat
isClearable
className={classes}
disabled={isCompleted}
/>
</div>
);
})}
</div>
);
}

View File

@@ -0,0 +1,148 @@
import ProgressBar from "@/components/Low/ProgressBar";
import useUsers from "@/hooks/useUsers";
import { Module } from "@/interfaces";
import { Assignment } from "@/interfaces/results";
import { calculateBandScore } from "@/utils/score";
import clsx from "clsx";
import moment from "moment";
import { BsBook, BsClipboard, BsHeadphones, BsMegaphone, BsPen } from "react-icons/bs";
import { usePDFDownload } from "@/hooks/usePDFDownload";
import { useAssignmentArchive } from "@/hooks/useAssignmentArchive";
import { uniqBy } from "lodash";
import { useAssignmentUnarchive } from "@/hooks/useAssignmentUnarchive";
import { useAssignmentRelease } from "@/hooks/useAssignmentRelease";
import { getUserName } from "@/utils/users";
import { User } from "@/interfaces/user";
import { EntityWithRoles } from "@/interfaces/entity";
interface Props {
users: User[];
onClick?: () => void;
allowDownload?: boolean;
reload?: Function;
allowArchive?: boolean;
allowUnarchive?: boolean;
allowExcelDownload?: boolean;
entityObj?: EntityWithRoles
}
export default function AssignmentCard({
id,
name,
assigner,
startDate,
endDate,
entityObj,
assignees,
results,
exams,
archived,
onClick,
allowDownload,
reload,
allowArchive,
allowUnarchive,
allowExcelDownload,
users,
released,
}: Assignment & Props) {
const renderPdfIcon = usePDFDownload("assignments");
const renderExcelIcon = usePDFDownload("assignments", "excel");
const renderArchiveIcon = useAssignmentArchive(id, reload);
const renderUnarchiveIcon = useAssignmentUnarchive(id, reload);
const renderReleaseIcon = useAssignmentRelease(id, reload);
const calculateAverageModuleScore = (module: Module) => {
const resultModuleBandScores = results.map((r) => {
const moduleStats = r.stats.filter((s) => s.module === module);
const correct = moduleStats.reduce((acc, curr) => acc + curr.score.correct, 0);
const total = moduleStats.reduce((acc, curr) => acc + curr.score.total, 0);
return calculateBandScore(correct, total, module, r.type);
});
return resultModuleBandScores.length === 0 ? -1 : resultModuleBandScores.reduce((acc, curr) => acc + curr, 0) / results.length;
};
const uniqModules = uniqBy(exams, (x) => x.module);
const shouldRenderPDF = () => {
if (released && allowDownload) {
// in order to be downloadable, the assignment has to be released
// the component should have the allowDownload prop
// and the assignment should not have the level module
return uniqModules.every(({ module }) => module !== "level");
}
return false;
};
const shouldRenderExcel = () => {
if (released && allowExcelDownload) {
// in order to be downloadable, the assignment has to be released
// the component should have the allowExcelDownload prop
// and the assignment should have the level module
return uniqModules.some(({ module }) => module === "level");
}
return false;
};
return (
<div
onClick={onClick}
className="border-mti-gray-platinum flex h-fit w-[350px] cursor-pointer flex-col gap-6 rounded-xl border bg-white p-4 transition duration-300 ease-in-out hover:drop-shadow">
<div className="flex flex-col gap-3">
<div className="flex flex-row justify-between">
<h3 className="text-xl font-semibold">{name}</h3>
<div className="flex gap-2">
{shouldRenderPDF() && renderPdfIcon(id, "text-mti-gray-dim", "text-mti-gray-dim")}
{shouldRenderExcel() && renderExcelIcon(id, "text-mti-gray-dim", "text-mti-gray-dim")}
{allowArchive && !archived && renderArchiveIcon("text-mti-gray-dim", "text-mti-gray-dim")}
{allowUnarchive && archived && renderUnarchiveIcon("text-mti-gray-dim", "text-mti-gray-dim")}
{!released && renderReleaseIcon("text-mti-gray-dim", "text-mti-gray-dim")}
</div>
</div>
<ProgressBar
color={results.length / assignees.length < 0.5 ? "red" : "purple"}
percentage={(results.length / assignees.length) * 100}
label={`${results.length}/${assignees.length}`}
className="h-5"
textClassName={results.length / assignees.length < 0.5 ? "!text-mti-gray-dim font-light" : "text-white"}
/>
</div>
<div className="flex flex-col gap-1">
<span className="flex justify-between gap-1">
<span>{moment(startDate).format("DD/MM/YY, HH:mm")}</span>
<span>-</span>
<span>{moment(endDate).format("DD/MM/YY, HH:mm")}</span>
</span>
<span>Assigner: {getUserName(users.find((x) => x.id === assigner))}</span>
{entityObj && <span>Entity: {entityObj.label}</span>}
</div>
<div className="-md:mt-2 grid w-full grid-cols-4 place-items-start gap-2">
{uniqModules.map(({ module }) => (
<div
key={module}
className={clsx(
"-md:px-4 flex w-fit items-center gap-2 rounded-xl py-2 text-white md:px-2 xl:px-4",
module === "reading" && "bg-ielts-reading",
module === "listening" && "bg-ielts-listening",
module === "writing" && "bg-ielts-writing",
module === "speaking" && "bg-ielts-speaking",
module === "level" && "bg-ielts-level",
)}>
{module === "reading" && <BsBook className="h-4 w-4" />}
{module === "listening" && <BsHeadphones className="h-4 w-4" />}
{module === "writing" && <BsPen className="h-4 w-4" />}
{module === "speaking" && <BsMegaphone className="h-4 w-4" />}
{module === "level" && <BsClipboard className="h-4 w-4" />}
{calculateAverageModuleScore(module) > -1 && (
<span className="text-sm">{calculateAverageModuleScore(module).toFixed(1)}</span>
)}
</div>
))}
</div>
</div>
);
}

View File

@@ -0,0 +1,339 @@
import Button from "@/components/Low/Button";
import ProgressBar from "@/components/Low/ProgressBar";
import Modal from "@/components/Modal";
import useUsers from "@/hooks/useUsers";
import { Module } from "@/interfaces";
import { Assignment } from "@/interfaces/results";
import { Stat, User } from "@/interfaces/user";
import useExamStore from "@/stores/exam";
import { getExamById } from "@/utils/exams";
import { sortByModule } from "@/utils/moduleUtils";
import { calculateBandScore } from "@/utils/score";
import { getUserName } from "@/utils/users";
import axios from "axios";
import clsx from "clsx";
import { capitalize, uniqBy } from "lodash";
import moment from "moment";
import { useRouter } from "next/router";
import { BsBook, BsClipboard, BsHeadphones, BsMegaphone, BsPen } from "react-icons/bs";
import { toast } from "react-toastify";
import { futureAssignmentFilter } from "@/utils/assignments";
interface Props {
isOpen: boolean;
users: User[];
assignment?: Assignment;
onClose: () => void;
}
export default function AssignmentView({ isOpen, users, assignment, onClose }: Props) {
const router = useRouter();
const dispatch = useExamStore((s) => s.dispatch);
const deleteAssignment = async () => {
if (!confirm("Are you sure you want to delete this assignment?")) return;
axios
.delete(`/api/assignments/${assignment?.id}`)
.then(() => toast.success(`Successfully deleted the assignment "${assignment?.name}".`))
.catch(() => toast.error("Something went wrong, please try again later."))
.finally(onClose);
};
const startAssignment = () => {
if (assignment) {
axios
.post(`/api/assignments/${assignment.id}/start`)
.then(() => {
toast.success(`The assignment "${assignment.name}" has been started successfully!`);
})
.catch((e) => {
console.log(e);
toast.error("Something went wrong, please try again later!");
});
}
};
const formatTimestamp = (timestamp: string) => {
const date = moment(parseInt(timestamp));
const formatter = "YYYY/MM/DD - HH:mm";
return date.format(formatter);
};
const calculateAverageModuleScore = (module: Module) => {
if (!assignment) return -1;
const resultModuleBandScores = assignment.results.map((r) => {
const moduleStats = r.stats.filter((s) => s.module === module);
const correct = moduleStats.reduce((acc, curr) => acc + curr.score.correct, 0);
const total = moduleStats.reduce((acc, curr) => acc + curr.score.total, 0);
return calculateBandScore(correct, total, module, r.type);
});
return resultModuleBandScores.length === 0 ? -1 : resultModuleBandScores.reduce((acc, curr) => acc + curr, 0) / assignment.results.length;
};
const aggregateScoresByModule = (stats: Stat[]): { module: Module; total: number; missing: number; correct: number }[] => {
const scores: {
[key in Module]: { total: number; missing: number; correct: number };
} = {
reading: {
total: 0,
correct: 0,
missing: 0,
},
listening: {
total: 0,
correct: 0,
missing: 0,
},
writing: {
total: 0,
correct: 0,
missing: 0,
},
speaking: {
total: 0,
correct: 0,
missing: 0,
},
level: {
total: 0,
correct: 0,
missing: 0,
},
};
stats.filter(x => !x.isPractice).forEach((x) => {
scores[x.module!] = {
total: scores[x.module!].total + x.score.total,
correct: scores[x.module!].correct + x.score.correct,
missing: scores[x.module!].missing + x.score.missing,
};
});
return Object.keys(scores)
.filter((x) => scores[x as Module].total > 0)
.map((x) => ({ module: x as Module, ...scores[x as Module] }));
};
const customContent = (stats: Stat[], user: string, focus: "academic" | "general") => {
const correct = stats.reduce((accumulator, current) => accumulator + current.score.correct, 0);
const total = stats.reduce((accumulator, current) => accumulator + current.score.total, 0);
const aggregatedScores = aggregateScoresByModule(stats).filter((x) => x.total > 0);
const aggregatedLevels = aggregatedScores.map((x) => ({
module: x.module,
level: calculateBandScore(x.correct, x.total, x.module, focus),
}));
const timeSpent = stats[0].timeSpent;
const selectExam = () => {
const examPromises = uniqBy(stats, "exam").map((stat) => getExamById(stat.module, stat.exam));
Promise.all(examPromises).then((exams) => {
if (exams.every((x) => !!x)) {
dispatch({
type: 'INIT_SOLUTIONS', payload: {
exams: exams.map((x) => x!).sort(sortByModule),
modules: exams
.map((x) => x!)
.sort(sortByModule)
.map((x) => x!.module),
stats
}
});
router.push("/exam");
}
});
};
const content = (
<>
<div className="-md:items-center flex w-full justify-between 2xl:items-center">
<div className="-md:gap-2 -md:items-center flex md:flex-col md:gap-1 2xl:flex-row 2xl:items-center 2xl:gap-2">
<span className="font-medium">{formatTimestamp(stats[0].date.toString())}</span>
{timeSpent && (
<>
<span className="md:hidden 2xl:flex">⢠</span>
<span className="text-sm">{Math.floor(timeSpent / 60)} minutes</span>
</>
)}
</div>
<span
className={clsx(
correct / total >= 0.7 && "text-mti-purple",
correct / total >= 0.3 && correct / total < 0.7 && "text-mti-red",
correct / total < 0.3 && "text-mti-rose",
)}>
Level{" "}
{(aggregatedLevels.reduce((accumulator, current) => accumulator + current.level, 0) / aggregatedLevels.length).toFixed(1)}
</span>
</div>
<div className="flex w-full flex-col gap-1">
<div className="-md:mt-2 grid w-full grid-cols-4 place-items-start gap-2">
{aggregatedLevels.map(({ module, level }) => (
<div
key={module}
className={clsx(
"-md:px-4 flex w-fit items-center gap-2 rounded-xl py-2 text-white md:px-2 xl:px-4",
module === "reading" && "bg-ielts-reading",
module === "listening" && "bg-ielts-listening",
module === "writing" && "bg-ielts-writing",
module === "speaking" && "bg-ielts-speaking",
module === "level" && "bg-ielts-level",
)}>
{module === "reading" && <BsBook className="h-4 w-4" />}
{module === "listening" && <BsHeadphones className="h-4 w-4" />}
{module === "writing" && <BsPen className="h-4 w-4" />}
{module === "speaking" && <BsMegaphone className="h-4 w-4" />}
{module === "level" && <BsClipboard className="h-4 w-4" />}
<span className="text-sm">{level.toFixed(1)}</span>
</div>
))}
</div>
</div>
</>
);
return (
<div className="flex flex-col gap-2">
<span>
{(() => {
const student = users.find((u) => u.id === user);
return `${student?.name} (${student?.email})`;
})()}
</span>
<div
key={user}
className={clsx(
"border-mti-gray-platinum -md:hidden flex cursor-pointer flex-col gap-4 rounded-xl border p-4 transition duration-300 ease-in-out",
correct / total >= 0.7 && "hover:border-mti-purple",
correct / total >= 0.3 && correct / total < 0.7 && "hover:border-mti-red",
correct / total < 0.3 && "hover:border-mti-rose",
)}
onClick={selectExam}
role="button">
{content}
</div>
<div
key={user}
className={clsx(
"border-mti-gray-platinum -md:tooltip flex cursor-pointer flex-col gap-4 rounded-xl border p-4 transition duration-300 ease-in-out md:hidden",
correct / total >= 0.7 && "hover:border-mti-purple",
correct / total >= 0.3 && correct / total < 0.7 && "hover:border-mti-red",
correct / total < 0.3 && "hover:border-mti-rose",
)}
data-tip="Your screen size is too small to view previous exams."
role="button">
{content}
</div>
</div>
);
};
const shouldRenderStart = () => {
if (assignment) {
if (futureAssignmentFilter(assignment)) {
return true;
}
}
return false;
};
return (
<Modal isOpen={isOpen} onClose={onClose} title={assignment?.name}>
<div className="mt-4 flex w-full flex-col gap-4">
<ProgressBar
color="purple"
label={`${assignment?.results.length}/${assignment?.assignees.length} assignees completed`}
className="h-6"
textClassName={
(assignment?.results.length || 0) / (assignment?.assignees.length || 1) < 0.5 ? "!text-mti-gray-dim font-light" : "text-white"
}
percentage={((assignment?.results.length || 0) / (assignment?.assignees.length || 1)) * 100}
/>
<div className="flex items-start gap-8">
<div className="flex flex-col gap-2">
<span>Start Date: {moment(assignment?.startDate).format("DD/MM/YY, HH:mm")}</span>
<span>End Date: {moment(assignment?.endDate).format("DD/MM/YY, HH:mm")}</span>
</div>
<div className="flex flex-col gap-2">
<span>
Assignees:{" "}
{users
.filter((u) => assignment?.assignees.includes(u.id))
.map((u) => `${u.name} (${u.email})`)
.join(", ")}
</span>
<span>Assigner: {getUserName(users.find((x) => x.id === assignment?.assigner))}</span>
</div>
</div>
<div className="flex flex-col gap-2">
<span className="text-xl font-bold">Average Scores</span>
<div className="-md:mt-2 flex w-full items-center gap-4">
{assignment &&
uniqBy(assignment.exams, (x) => x.module).map(({ module }) => (
<div
data-tip={capitalize(module)}
key={module}
className={clsx(
"-md:px-4 tooltip flex w-fit items-center gap-2 rounded-xl py-2 text-white md:px-2 xl:px-4",
module === "reading" && "bg-ielts-reading",
module === "listening" && "bg-ielts-listening",
module === "writing" && "bg-ielts-writing",
module === "speaking" && "bg-ielts-speaking",
module === "level" && "bg-ielts-level",
)}>
{module === "reading" && <BsBook className="h-4 w-4" />}
{module === "listening" && <BsHeadphones className="h-4 w-4" />}
{module === "writing" && <BsPen className="h-4 w-4" />}
{module === "speaking" && <BsMegaphone className="h-4 w-4" />}
{module === "level" && <BsClipboard className="h-4 w-4" />}
{calculateAverageModuleScore(module) > -1 && (
<span className="text-sm">{calculateAverageModuleScore(module).toFixed(1)}</span>
)}
</div>
))}
</div>
</div>
<div className="flex flex-col gap-2">
<span className="text-xl font-bold">
Results ({assignment?.results.length}/{assignment?.assignees.length})
</span>
<div>
{assignment && assignment?.results.length > 0 && (
<div className="grid w-full grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3 xl:gap-6">
{assignment.results.map((r) => customContent(r.stats, r.user, r.type))}
</div>
)}
{assignment && assignment?.results.length === 0 && <span className="ml-1 font-semibold">No results yet...</span>}
</div>
</div>
<div className="flex gap-4 w-full items-center justify-end">
{assignment && (assignment.results.length === assignment.assignees.length || moment().isAfter(moment(assignment.endDate))) && (
<Button variant="outline" color="red" className="w-full max-w-[200px]" onClick={deleteAssignment}>
Delete
</Button>
)}
{/** if the assignment is not deemed as active yet, display start */}
{shouldRenderStart() && (
<Button variant="outline" color="green" className="w-full max-w-[200px]" onClick={startAssignment}>
Start
</Button>
)}
<Button onClick={onClose} className="w-full max-w-[200px]">
Close
</Button>
</div>
</div>
</Modal>
);
}

View File

@@ -0,0 +1,63 @@
import clsx from "clsx";
import {IconType} from "react-icons";
import {MdSpaceDashboard} from "react-icons/md";
import {BsFileEarmarkText, BsClockHistory, BsPencil, BsGraphUp} from "react-icons/bs";
import {RiLogoutBoxFill} from "react-icons/ri";
import {SlPencil} from "react-icons/sl";
import {FaAward} from "react-icons/fa";
import Link from "next/link";
import {useRouter} from "next/router";
import axios from "axios";
import FocusLayer from "@/components/FocusLayer";
import {preventNavigation} from "@/utils/navigation.disabled";
interface Props {
path: string;
navDisabled?: boolean;
focusMode?: boolean;
onFocusLayerMouseEnter?: () => void;
className?: string;
}
interface NavProps {
Icon: IconType;
label: string;
path: string;
keyPath: string;
disabled?: boolean;
}
const Nav = ({Icon, label, path, keyPath, disabled = false}: NavProps) => (
<Link
href={!disabled ? keyPath : ""}
className={clsx(
"p-4 rounded-full flex gap-4 items-center cursor-pointer text-gray-500 hover:bg-mti-purple-light hover:text-white transition duration-300 ease-in-out",
path === keyPath && "bg-mti-purple-light text-white",
)}>
<Icon size={20} />
</Link>
);
export default function BottomBar({path, navDisabled = false, focusMode = false, onFocusLayerMouseEnter, className}: Props) {
const router = useRouter();
const logout = async () => {
axios.post("/api/logout").finally(() => {
setTimeout(() => router.reload(), 500);
});
};
const disableNavigation = preventNavigation(navDisabled, focusMode);
return (
<section className={clsx("w-full bg-white py-2 drop-shadow-2xl shadow-2xl rounded-t-2xl", className)}>
<div className="flex justify-around gap-3">
<Nav disabled={disableNavigation} Icon={MdSpaceDashboard} label="Dashboard" path={path} keyPath="/" />
<Nav disabled={disableNavigation} Icon={BsFileEarmarkText} label="Exams" path={path} keyPath="/exam" />
<Nav disabled={disableNavigation} Icon={BsPencil} label="Exercises" path={path} keyPath="/exercises" />
<Nav disabled={disableNavigation} Icon={BsGraphUp} label="Stats" path={path} keyPath="/stats" />
<Nav disabled={disableNavigation} Icon={BsClockHistory} label="Record" path={path} keyPath="/record" />
</div>
{focusMode && <FocusLayer onFocusLayerMouseEnter={onFocusLayerMouseEnter} />}
</section>
);
}

View File

@@ -0,0 +1,149 @@
import {EmploymentStatus, EMPLOYMENT_STATUS, Gender, User} from "@/interfaces/user";
import {FormEvent, useEffect, useState} from "react";
import countryCodes from "country-codes-list";
import {RadioGroup} from "@headlessui/react";
import Input from "./Low/Input";
import clsx from "clsx";
import Button from "./Low/Button";
import {BsArrowRepeat} from "react-icons/bs";
import axios from "axios";
import {toast} from "react-toastify";
import {KeyedMutator} from "swr";
import CountrySelect from "./Low/CountrySelect";
import GenderInput from "@/components/High/GenderInput";
import EmploymentStatusInput from "@/components/High/EmploymentStatusInput";
import TimezoneSelect from "./Low/TImezoneSelect";
import moment from "moment";
interface Props {
user: User;
mutateUser: (user: User) => void;
}
export default function DemographicInformationInput({user, mutateUser}: Props) {
const [country, setCountry] = useState(user.demographicInformation?.country);
const [phone, setPhone] = useState(user.demographicInformation?.phone);
const [passport_id, setPassportID] = useState<string | undefined>(user.type === "student" ? user.demographicInformation?.passport_id : undefined);
const [gender, setGender] = useState<Gender>();
const [employment, setEmployment] = useState<EmploymentStatus>();
const [timezone, setTimezone] = useState<string>(moment.tz.guess());
const [isLoading, setIsLoading] = useState(false);
const [position, setPosition] = useState(
user.type === "corporate" || user.type === "mastercorporate"
? user.demographicInformation?.position
: user.demographicInformation?.employment,
);
const [companyName, setCompanyName] = useState<string>();
const [commercialRegistration, setCommercialRegistration] = useState<string>();
const save = (e?: FormEvent) => {
if (e) e.preventDefault();
setIsLoading(true);
axios
.patch<{user: User}>("/api/users/update", {
demographicInformation: {
country,
phone: `+${countryCodes.findOne("countryCode" as any, country!).countryCallingCode}${phone}`,
gender,
employment: user.type === "corporate" ? undefined : employment,
position: user.type === "corporate" ? position : undefined,
passport_id,
timezone,
},
agentInformation: user.type === "agent" ? {companyName, commercialRegistration} : undefined,
})
.then((response) => mutateUser(response.data.user))
.catch(() => {
toast.error("Something went wrong, please try again later!", {toastId: "user-update-error"});
})
.finally(() => setIsLoading(false));
};
return (
<div className="flex flex-col items-center justify-center gap-12 w-full">
<h2 className="font-semibold text-center text-xl max-w-[800px]">
Welcome to EnCoach, the ultimate platform dedicated to helping you master the IELTS ! We are thrilled that you have chosen us as your
learning companion on this journey towards achieving your desired IELTS score.
<br />
<br />
To make the most of your learning experience, we kindly request you to complete your profile. By providing some essential information
about yourself.
</h2>
<form className="flex flex-col items-center justify-items-center gap-6 w-full h-full -md:px-4 lg:w-1/2 mb-32" onSubmit={save}>
{user.type === "agent" && (
<div className="w-full flex gap-8">
<Input type="text" onChange={setCompanyName} name="companyName" label="Corporate Name" required />
<Input
type="text"
onChange={setCommercialRegistration}
name="commercialRegistration"
label="Commercial Registration"
required
/>
</div>
)}
<div className="w-full grid grid-cols-2 gap-6">
<div className="relative flex flex-col gap-3 w-full">
<label className="font-normal text-base text-mti-gray-dim">Country *</label>
<CountrySelect value={country} onChange={setCountry} />
</div>
<Input
type="tel"
name="phone"
label="Phone number"
onChange={(e) => setPhone(e)}
value={phone}
placeholder="Enter phone number"
required
/>
</div>
{user.type === "student" && (
<Input
type="text"
name="passport_id"
label="Passport/National ID"
onChange={(e) => setPassportID(e)}
value={passport_id}
placeholder="Enter National ID or Passport number"
required
/>
)}
<div className="flex flex-col gap-3 w-full">
<label className="font-normal text-base text-mti-gray-dim">Timezone</label>
<TimezoneSelect value={timezone} onChange={setTimezone} />
</div>
<GenderInput value={gender} onChange={setGender} />
{user.type === "corporate" && (
<Input name="position" onChange={setPosition} type="text" label="Department" placeholder="CEO, Head of Marketing..." required />
)}
{user.type !== "corporate" && <EmploymentStatusInput value={employment} onChange={setEmployment} />}
</form>
<div className="self-end flex justify-end w-full gap-8 absolute bottom-8 left-0 px-8">
<Button
className="lg:mt-8 max-w-[400px] w-full self-end"
color="purple"
onClick={save}
disabled={
isLoading ||
!country ||
!phone ||
!gender ||
(user.type === "corporate" ? !position : !employment) ||
(user.type === "agent" ? !companyName || !commercialRegistration : false)
}>
{!isLoading && "Save information"}
{isLoading && (
<div className="flex items-center justify-center">
<BsArrowRepeat className="text-white animate-spin" size={25} />
</div>
)}
</Button>
</div>
</div>
);
}

View File

@@ -1,45 +1,41 @@
import {infoButtonStyle} from "@/constants/buttonStyles";
import {BAND_SCORES} from "@/constants/ielts";
import {Module} from "@/interfaces";
import {User} from "@/interfaces/user";
import useExamStore from "@/stores/examStore";
import {getExamById} from "@/utils/exams";
import useExamStore from "@/stores/exam";
import {getExam} from "@/utils/exams";
import {MODULE_ARRAY} from "@/utils/moduleUtils";
import axios from "axios";
import clsx from "clsx";
import {capitalize} from "lodash";
import {useRouter} from "next/router";
import {useState} from "react";
import { useState} from "react";
import { BsQuestionSquare} from "react-icons/bs";
import {toast} from "react-toastify";
import Button from "./Low/Button";
import ModuleLevelSelector from "./Medium/ModuleLevelSelector";
interface Props {
user: User;
onFinish: () => void;
}
const DIAGNOSTIC_EXAMS = [
["reading", "CurQtQoxWmHaJHeN0JW2"],
["listening", "Y6cMao8kUcVnPQOo6teV"],
["writing", "hbueuDaEZXV37EW7I12A"],
["speaking", "QVFm4pdcziJQZN2iUTDo"],
];
export default function Diagnostic({onFinish}: Props) {
const [focus, setFocus] = useState<"academic" | "general">();
const [isInsert, setIsInsert] = useState(false);
const [levels, setLevels] = useState({reading: 0, listening: 0, writing: 0, speaking: 0});
const [levels, setLevels] = useState({reading: -1, listening: -1, writing: -1, speaking: -1, level: 0});
const [desiredLevels, setDesiredLevels] = useState({reading: 9, listening: 9, writing: 9, speaking: 9, level: 9});
const router = useRouter();
const setExams = useExamStore((state) => state.setExams);
const setSelectedModules = useExamStore((state) => state.setSelectedModules);
const dispatch = useExamStore((state) => state.dispatch);
const isNextDisabled = () => {
if (!focus) return true;
return Object.values(levels).includes(-1);
};
const selectExam = () => {
const examPromises = DIAGNOSTIC_EXAMS.map((exam) => getExamById(exam[0] as Module, exam[1]));
const examPromises = MODULE_ARRAY.map((module) => getExam(module, true, "partial"));
Promise.all(examPromises).then((exams) => {
if (exams.every((x) => !!x)) {
setExams(exams.map((x) => x!));
setSelectedModules(exams.map((x) => x!.module));
dispatch({type: 'INIT_EXAM', payload: {exams: exams.map((x) => x!), modules: exams.map((x) => x!.module)}})
router.push("/exam");
}
});
@@ -47,72 +43,85 @@ export default function Diagnostic({onFinish}: Props) {
const updateUser = (callback: () => void) => {
axios
.patch("/api/users/update", {focus, levels, isFirstLogin: false})
.patch("/api/users/update", {
focus,
levels: Object.values(levels).includes(-1) ? {reading: 0, listening: 0, writing: 0, speaking: 0, level: 0} : levels,
desiredLevels,
isFirstLogin: false,
})
.then(callback)
.catch(() => {
toast.error("Something went wrong, please try again later!", {toastId: "user-update-error"});
});
};
if (!focus) {
return (
<div className="bg-white p-16 rounded-2xl flex flex-col items-center justify-center gap-8 h-96 relative shadow-md">
<h2 className="absolute top-8 font-semibold text-xl">What is your focus?</h2>
<div className="flex flex-col gap-4 justify-self-stretch">
<button onClick={() => setFocus("academic")} className={clsx("btn btn-wide gap-4 relative text-white", infoButtonStyle)}>
Academic
</button>
<button onClick={() => setFocus("general")} className={clsx("btn btn-wide gap-4 relative text-white", infoButtonStyle)}>
General
</button>
</div>
</div>
);
}
if (isInsert) {
return (
<div className="bg-white p-16 rounded-2xl flex flex-col items-center justify-center gap-8 shadow-md">
<h2 className="font-semibold text-xl">What is your level?</h2>
<div className="flex w-full flex-col gap-4 justify-self-stretch">
{Object.keys(levels).map((module) => (
<div key={module} className="flex items-center gap-4 justify-between">
<span className="font-medium text-lg">{capitalize(module)}</span>
<input
type="number"
className={clsx(
"input input-bordered bg-white w-24",
!BAND_SCORES[module as Module].includes(levels[module as keyof typeof levels]) && "input-error",
)}
value={levels[module as keyof typeof levels]}
min={0}
max={9}
step={0.5}
onChange={(e) => setLevels((prev) => ({...prev, [module]: parseFloat(e.target.value)}))}
/>
</div>
))}
</div>
<button
onClick={() => updateUser(onFinish)}
className={clsx("btn btn-wide gap-4 relative text-white", infoButtonStyle)}
disabled={!Object.keys(levels).every((module) => BAND_SCORES[module as Module].includes(levels[module as keyof typeof levels]))}>
Next
</button>
</div>
);
}
return (
<div className="bg-white p-16 rounded-2xl flex flex-col items-center justify-center gap-8 h-96 relative shadow-md">
<h2 className="absolute top-8 font-semibold text-xl">What is your current IELTS level?</h2>
<div className="flex flex-col gap-4">
<button onClick={() => setIsInsert(true)} className={clsx("btn btn-wide gap-4 relative text-white", infoButtonStyle)}>
Insert my IELTS level
</button>
<button onClick={() => updateUser(selectExam)} className={clsx("btn btn-wide gap-4 relative text-white", infoButtonStyle)}>
Perform a Diagnosis Test
</button>
<div className="flex flex-col items-center justify-center gap-12 w-full">
<div className="flex flex-col items-center justify-center gap-8 w-full">
<h2 className="font-semibold text-xl">What is your current focus?</h2>
<div className="flex flex-col gap-16 w-full">
<div className="grid grid-cols-1 md:grid-cols-2 gap-y-4 gap-x-16">
<button
onClick={() => setFocus("academic")}
className={clsx(
"w-full border border-mti-gray-platinum rounded-full px-6 py-4 flex justify-center items-center gap-12 bg-white",
"hover:bg-mti-purple-light hover:text-white",
focus === "academic" && "!bg-mti-purple-light !text-white",
"transition duration-300 ease-in-out",
)}>
Academic
</button>
<button
onClick={() => setFocus("general")}
className={clsx(
"w-full border border-mti-gray-platinum rounded-full px-6 py-4 flex justify-center items-center gap-12 bg-white",
"hover:bg-mti-purple-light hover:text-white",
focus === "general" && "!bg-mti-purple-light !text-white",
"transition duration-300 ease-in-out",
)}>
General
</button>
</div>
</div>
</div>
<div className="flex flex-col items-center justify-center gap-8 w-full">
<h2 className="font-semibold text-xl">What is your current IELTS level?</h2>
<ModuleLevelSelector levels={levels} setLevels={setLevels} />
</div>
<div className="flex flex-col items-center justify-center gap-8 w-full mb-44">
<h2 className="font-semibold text-xl">What is your desired IELTS level?</h2>
<ModuleLevelSelector levels={desiredLevels} setLevels={setDesiredLevels} />
</div>
<div className="md:self-end flex -md:flex-col justify-between w-full gap-8 absolute bottom-8 left-0 px-4 md:px-8">
<div className="w-full tooltip" data-tip="Your screen size is too small to perform a diagnostic test">
<Button
color="purple"
variant="outline"
className="group flex items-center justify-center gap-6 relative md:max-w-[400px] w-full md:hidden"
disabled>
<BsQuestionSquare className="text-mti-purple-light transition duration-300 ease-in-out" size={20} />
<span>Perform diagnostic test instead</span>
</Button>
</div>
<Button
onClick={() => updateUser(selectExam)}
color="purple"
variant="outline"
className="group flex items-center justify-center gap-6 relative md:max-w-[400px] w-full -md:hidden"
disabled={!focus}>
<BsQuestionSquare
className="text-mti-purple-light group-hover:text-white transition duration-300 ease-in-out"
size={20}
onClick={() => updateUser(selectExam)}
/>
<span onClick={() => updateUser(selectExam)}>Perform diagnostic test instead</span>
</Button>
<Button color="purple" className="md:max-w-[400px] w-full" onClick={() => updateUser(onFinish)} disabled={isNextDisabled()}>
Next Step
</Button>
</div>
</div>
);

104
src/components/Dropdown.tsx Normal file
View File

@@ -0,0 +1,104 @@
import React, { useState, ReactNode, useRef, useEffect } from 'react';
import { animated, useSpring } from '@react-spring/web';
interface DropdownProps {
title?: ReactNode;
open?: boolean;
setIsOpen?: React.Dispatch<React.SetStateAction<boolean>> | ((isOpen: boolean) => void);
className?: string;
contentWrapperClassName?: string;
titleClassName?: string;
bottomPadding?: number;
disabled?: boolean,
wrapperClassName?: string;
customTitle?: ReactNode;
children: ReactNode;
}
const Dropdown: React.FC<DropdownProps> = ({
title,
open = false,
titleClassName = "",
setIsOpen: externalSetIsOpen,
className = "w-full text-left font-semibold flex justify-between items-center p-4",
contentWrapperClassName = "px-6",
bottomPadding = 12,
disabled = false,
customTitle = undefined,
wrapperClassName,
children
}) => {
const [internalIsOpen, setInternalIsOpen] = useState<boolean>(open);
const isOpen = externalSetIsOpen !== undefined ? open : internalIsOpen;
const toggleOpen = externalSetIsOpen !== undefined ? externalSetIsOpen : setInternalIsOpen;
const contentRef = useRef<HTMLDivElement>(null);
const [contentHeight, setContentHeight] = useState<number>(0);
useEffect(() => {
let resizeObserver: ResizeObserver | null = null;
if (contentRef.current) {
resizeObserver = new ResizeObserver(entries => {
for (let entry of entries) {
if (entry.borderBoxSize && entry.borderBoxSize.length > 0) {
const height = entry.borderBoxSize[0].blockSize;
setContentHeight(height + bottomPadding);
} else {
// Fallback for browsers that don't support borderBoxSize
const height = entry.contentRect.height;
setContentHeight(height + bottomPadding);
}
}
});
resizeObserver.observe(contentRef.current);
}
return () => {
if (resizeObserver) {
resizeObserver.disconnect();
}
};
}, [bottomPadding]);
const springProps = useSpring({
height: isOpen ? contentHeight : 0,
opacity: isOpen ? 1 : 0,
config: { tension: 300, friction: 30 }
});
return (
<div className={wrapperClassName}>
<button
onClick={() => toggleOpen(!isOpen)}
className={className}
disabled={disabled}
>
<div className='flex flex-row w-full justify-between items-center'>
{customTitle ? (
customTitle
) : (
<p className={titleClassName}>{title}</p>
)}
<svg
className={`w-4 h-4 transform transition-transform ${isOpen ? 'rotate-180' : ''}`}
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
</svg>
</div>
</button>
<animated.div style={springProps} className="overflow-hidden">
<div ref={contentRef} className={contentWrapperClassName} style={{ paddingBottom: bottomPadding }}>
{children}
</div>
</animated.div>
</div>
);
};
export default Dropdown;

View File

@@ -0,0 +1,307 @@
import React, { useEffect, useState } from 'react';
import { Tooltip } from 'react-tooltip';
import { ExerciseGen } from './generatedExercises';
import Image from 'next/image';
import clsx from 'clsx';
import { GiBrain } from 'react-icons/gi';
import { IoTextOutline } from 'react-icons/io5';
import { Switch } from '@headlessui/react';
import useExamEditorStore from '@/stores/examEditor';
import { Module } from '@/interfaces';
import { capitalize } from 'lodash';
import Select from '@/components/Low/Select';
import { Difficulty } from '@/interfaces/exam';
interface Props {
module: Module;
sectionId: number;
exercises: ExerciseGen[];
extraArgs?: Record<string, any>;
onSubmit: (configurations: ExerciseConfig[]) => void;
onDiscard: () => void;
selectedExercises: string[];
}
export interface ExerciseConfig {
type: string;
params: {
[key: string]: string | number | boolean;
};
}
const ExerciseWizard: React.FC<Props> = ({
module,
exercises,
extraArgs,
sectionId,
selectedExercises,
onSubmit,
onDiscard,
}) => {
const [configurations, setConfigurations] = useState<ExerciseConfig[]>([]);
const { currentModule } = useExamEditorStore();
const { difficulty } = useExamEditorStore(state => state.modules[currentModule]);
const randomDiff = difficulty.length === 1
? capitalize(difficulty[0])
: difficulty.length == 0 ?
"Random" :
`Selected (${difficulty.sort().map(dif => capitalize(dif)).join(", ")})` as Difficulty;
const DIFFICULTIES = difficulty.length === 1
? ["A1", "A2", "B1", "B2", "C1", "C2", "Random"]
: ["A1", "A2", "B1", "B2", "C1", "C2", randomDiff, "Random"];
useEffect(() => {
const initialConfigs = selectedExercises.map(exerciseType => {
const exercise = exercises.find(ex => {
const fullType = ex.extra?.find(e => e.param === 'name')?.value
? `${ex.type}/?name=${ex.extra.find(e => e.param === 'name')?.value}`
: ex.type;
return fullType === exerciseType;
});
const params: { [key: string]: string | number | boolean } = {};
exercise?.extra?.forEach(param => {
if (param.param !== 'name') {
if (exerciseType.includes('paragraphMatch') && param.param === 'quantity') {
params[param.param] = extraArgs?.text.split("\n\n").length || 1;
} else {
params[param.param || ''] = param.value ?? '';
}
}
});
return {
type: exerciseType,
params
};
});
setConfigurations(initialConfigs);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedExercises, exercises]);
const handleParameterChange = (
exerciseIndex: number,
paramName: string,
value: string | number | boolean
) => {
setConfigurations(prev => {
const newConfigs = [...prev];
newConfigs[exerciseIndex] = {
...newConfigs[exerciseIndex],
params: {
...newConfigs[exerciseIndex].params,
[paramName]: value
}
};
return newConfigs;
});
};
const renderParameterInput = (
param: NonNullable<ExerciseGen['extra']>[0],
exerciseIndex: number,
config: ExerciseConfig
) => {
if (typeof param.value === 'boolean') {
const currentValue = Boolean(config.params[param.param || '']);
return (
<div className="flex flex-row items-center ml-auto">
<GiBrain
className="mx-4"
size={28}
color={currentValue ? `#F3F4F6` : `#1F2937`}
/>
<Switch
checked={currentValue}
onChange={(value) => handleParameterChange(
exerciseIndex,
param.param || '',
value
)}
className={clsx(
"relative inline-flex h-[30px] w-[58px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75",
currentValue ? `bg-[#F3F4F6]` : `bg-[#1F2937]`
)}
>
<span
aria-hidden="true"
className={clsx(
"pointer-events-none inline-block h-[26px] w-[26px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",
currentValue ? 'translate-x-7' : 'translate-x-0'
)}
/>
</Switch>
<IoTextOutline
className="mx-4"
size={28}
color={!currentValue ? `#F3F4F6` : `#1F2937`}
/>
<Tooltip id={`${exerciseIndex}`} className="z-50 bg-white shadow-md rounded-sm" />
<a data-tooltip-id={`${exerciseIndex}`} data-tooltip-html="Generate or use placeholder?" className='ml-1 flex items-center justify-center'>
<Image src="/mat-icon-info.svg" width={24} height={24} alt={"AI Generated?"} />
</a>
</div>
);
}
if ('type' in param && param.type === 'text') {
return (
<div className="space-y-2">
<div className="flex items-center gap-2">
<label className="text-sm font-medium text-white">
{param.label}
</label>
{param.tooltip && (
<>
<Tooltip id={config.type} className="z-50 bg-white shadow-md rounded-sm" />
<a data-tooltip-id={config.type} data-tooltip-html={param.tooltip} className='ml-1 flex items-center justify-center'>
<Image src="/mat-icon-info.svg" width={24} height={24} alt={param.tooltip} />
</a>
</>
)}
</div>
<input
type="text"
value={config.params[param.param || ''] as string}
onChange={(e) => handleParameterChange(
exerciseIndex,
param.param || '',
e.target.value
)}
className="px-3 py-2 shadow-lg rounded-md text-mti-gray-dim w-full"
placeholder="Enter here..."
/>
</div>
);
}
const inputValue = Number(config.params[param.param || '1'].toString()) || config.params[param.param!];
const isParagraphMatch = config.type.split("?name=")[1] === "paragraphMatch";
const maxParagraphs = isParagraphMatch ? extraArgs!.text.split("\n\n").length : 50;
return (
<div className="space-y-2">
<div className="flex items-center gap-2">
<label className="text-sm font-medium text-white">
{`${param.label}${isParagraphMatch ? ` (out of ${extraArgs!.text.split("\n\n").length} paragraphs)` : ""}`}
</label>
{param.tooltip && (
<>
<Tooltip id={config.type} className="z-50 bg-white shadow-md rounded-sm" />
<a data-tooltip-id={config.type} data-tooltip-html={param.tooltip} className='ml-1 flex items-center justify-center'>
<Image src="/mat-icon-info.svg" width={24} height={24} alt={param.tooltip} />
</a>
</>
)}
</div>
{param.param === "difficulty" ?
<Select
options={DIFFICULTIES.map((x) => ({ value: x, label: x }))}
onChange={(value) => {
handleParameterChange(
exerciseIndex,
param.param || '',
value?.value || ''
);
}}
value={{ value: config.params[param.param] !== "" ? config.params[param.param] as string : randomDiff , label: config.params[param.param] !== "" ? config.params[param.param] as string : randomDiff }}
flat
/>
:
<input
type="number"
value={inputValue as number}
onChange={(e) => handleParameterChange(
exerciseIndex,
param.param || '',
e.target.value ? Number(e.target.value) : ''
)}
className="px-3 py-2 shadow-lg rounded-md text-mti-gray-dim w-full"
min={1}
max={maxParagraphs}
/>
}
</div>
);
};
const renderExerciseHeader = (
exercise: ExerciseGen,
exerciseIndex: number,
config: ExerciseConfig,
extraParams: boolean,
) => {
const generateParam = exercise.extra?.find(param => param.param === 'generate');
return (
<div className={clsx("flex items-center w-full", extraParams ? "mb-4" : "py-4")}>
<div className="flex items-center gap-2">
<exercise.icon className="h-5 w-5" />
<h3 className="font-medium text-lg">{exercise.label}</h3>
</div>
{/* when placeholders are done uncomment this*/}
{/*generateParam && renderParameterInput(generateParam, exerciseIndex, config)*/}
</div>
);
};
return (
<div className="space-y-6 px-4 py-6">
{configurations.map((config, exerciseIndex) => {
const exercise = exercises.find(ex => {
const fullType = ex.extra?.find(e => e.param === 'name')?.value
? `${ex.type}/?name=${ex.extra.find(e => e.param === 'name')?.value}`
: ex.type;
return fullType === config.type;
});
if (!exercise) return null;
const nonGenerateParams = exercise.extra?.filter(
param => param.param !== 'name' && param.param !== 'generate'
);
return (
<div
key={config.type}
className={`bg-ielts-${module}/70 text-white rounded-lg p-4 shadow-xl`}
>
{renderExerciseHeader(exercise, exerciseIndex, config, (exercise.extra || []).length > 2)}
{nonGenerateParams && nonGenerateParams.length > 0 && (
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{nonGenerateParams.map(param => (
<div key={param.param}>
{renderParameterInput(param, exerciseIndex, config)}
</div>
))}
</div>
)}
</div>
);
})}
<div className="flex justify-between">
<button
onClick={onDiscard}
className={`px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-400 transition-colors`}
>
Cancel
</button>
<button
onClick={() => onSubmit(configurations)}
className={`px-4 py-2 bg-ielts-${module} text-white rounded-md hover:bg-ielts-${module}/80 transition-colors`}
>
Add Exercises
</button>
</div>
</div>
);
};
export default ExerciseWizard;

View File

@@ -0,0 +1,471 @@
import {
FaListUl,
FaUnderline,
FaPen,
FaBookOpen,
FaEnvelope,
FaComments,
FaHandshake,
FaParagraph,
FaLightbulb,
FaHeadphones,
FaWpforms,
} from 'react-icons/fa6';
import {
FaEdit,
FaFileAlt,
FaUserFriends,
FaCheckSquare,
FaQuestionCircle,
} from 'react-icons/fa';
import { ExerciseGen } from './generatedExercises';
import { BsListCheck } from 'react-icons/bs';
const quantity = (quantity: number, tooltip?: string) => {
return {
param: "quantity",
label: "Quantity",
tooltip: tooltip ? tooltip : "Exercise Quantity",
value: quantity
}
}
const difficulty = () => {
return {
param: "difficulty",
label: "Difficulty",
tooltip: "Exercise difficulty",
}
}
const generate = () => {
return {
param: "generate",
value: true
}
}
const reading = (passage: number) => {
const readingExercises = [
{
label: `Passage ${passage} - Multiple Choice`,
type: `reading_${passage}`,
icon: BsListCheck,
sectionId: passage,
extra: [
{
param: "name",
value: "multipleChoice"
},
quantity(5, "Quantity of Multiple Choice Questions"),
difficulty(),
generate()
],
module: "reading"
},
{
label: `Passage ${passage} - Fill Blanks`,
type: `reading_${passage}`,
icon: FaEdit,
sectionId: passage,
extra: [
{
param: "name",
value: "fillBlanks"
},
{
param: "num_random_words",
label: "Random Words",
tooltip: "Words that are not the solution",
value: 1
},
quantity(4, "Quantity of Blanks"),
difficulty(),
generate()
],
module: "reading"
},
{
label: `Passage ${passage} - Write Blanks`,
type: `reading_${passage}`,
icon: FaPen,
sectionId: passage,
extra: [
{
param: "name",
value: "writeBlanks"
},
{
param: "max_words",
label: "Word Limit",
tooltip: "How many words a solution can have",
value: 3
},
quantity(4, "Quantity of Blanks"),
difficulty(),
generate()
],
module: "reading"
},
{
label: `Passage ${passage} - True False`,
type: `reading_${passage}`,
icon: FaCheckSquare,
sectionId: passage,
extra: [
{
param: "name",
value: "trueFalse"
},
quantity(4, "Quantity of Statements"),
difficulty(),
generate()
],
module: "reading"
},
{
label: `Passage ${passage} - Paragraph Match`,
type: `reading_${passage}`,
icon: FaParagraph,
sectionId: passage,
extra: [
{
param: "name",
value: "paragraphMatch"
},
quantity(5, "Quantity of Matches"),
difficulty(),
generate()
],
module: "reading"
},
];
if (passage === 3) {
readingExercises.push(
{
label: `Passage 3 - Idea Match`,
type: `reading_3`,
icon: FaLightbulb,
sectionId: passage,
extra: [
{
param: "name",
value: "ideaMatch"
},
quantity(5, "Quantity of Ideas"),
difficulty(),
generate()
],
module: "reading"
},
);
}
return readingExercises;
}
const listening = (section: number) => {
const listeningExercises = [
{
label: `Section ${section} - Multiple Choice`,
type: `listening_${section}`,
icon: FaHeadphones,
sectionId: section,
extra: [
{
param: "name",
value: section == 3 ? "multipleChoice3Options" : "multipleChoice"
},
quantity(5, "Quantity of Multiple Choice Questions"),
difficulty(),
generate()
],
module: "listening"
},
{
label: `Section ${section} - Write Blanks: Questions`,
type: `listening_${section}`,
icon: FaQuestionCircle,
sectionId: section,
extra: [
{
param: "name",
value: "writeBlanksQuestions"
},
quantity(5, "Quantity of Blanks"),
difficulty(),
generate()
],
module: "listening"
},
{
label: `Section ${section} - True False`,
type: `listening_${section}`,
icon: FaCheckSquare,
sectionId: section,
extra: [
{
param: "name",
value: "trueFalse"
},
quantity(4, "Quantity of Statements"),
difficulty(),
generate()
],
module: "listening"
},
];
if (section === 1 || section === 4) {
listeningExercises.push(
{
label: `Section ${section} - Write Blanks: Fill`,
type: `listening_${section}`,
icon: FaEdit,
sectionId: section,
extra: [
{
param: "name",
value: "writeBlanksFill"
},
quantity(5, "Quantity of Blanks"),
difficulty(),
generate()
],
module: "listening"
}
);
listeningExercises.push(
{
label: `Section ${section} - Write Blanks: Form`,
type: `listening_${section}`,
sectionId: section,
icon: FaWpforms,
extra: [
{
param: "name",
value: "writeBlanksForm"
},
quantity(5, "Quantity of Blanks"),
difficulty(),
generate()
],
module: "listening"
}
);
}
return listeningExercises;
}
const EXERCISES: ExerciseGen[] = [
/*{
label: "Multiple Choice",
type: "multipleChoice",
icon: FaListUl,
extra: [
{
param: "name",
value: "multipleChoice"
},
quantity(10, "Amount"),
difficulty(),
generate()
],
module: "level"
},*/
{
label: "Multiple Choice: Blank Space",
type: "mcBlank",
icon: FaEdit,
extra: [
{
param: "name",
value: "mcBlank"
},
quantity(10, "Amount"),
difficulty(),
generate()
],
module: "level"
},
{
label: "Multiple Choice: Underlined",
type: "mcUnderline",
icon: FaUnderline,
extra: [
{
param: "name",
value: "mcUnderline"
},
quantity(10, "Amount"),
difficulty(),
generate()
],
module: "level"
},
/*{
label: "Blank Space", <- Assuming this is FillBlanks aswell
type: "blankSpaceText",
icon: FaPen,
extra: [
quantity(10, "Nº of Blanks"),
{
label: "Passage Word Size",
param: "text_size",
value: "250"
},
difficulty(),
generate()
],
module: "level"
},*/
{
label: "Fill Blanks: Multiple Choice",
type: "fillBlanksMC",
icon: FaPen,
extra: [
{
param: "name",
value: "fillBlanksMC"
},
quantity(10, "Nº of Blanks"),
{
label: "Passage Word Size",
param: "text_size",
value: "250"
},
difficulty(),
generate()
],
module: "level"
},
// Removing this since level supports reading aswell
/*{
label: "Reading Passage: Multiple Choice",
type: "passageUtas",
icon: FaBookOpen,
extra: [
{
param: "name",
value: "passageUtas"
},
// in the utas exam there was only mc so I'm assuming short answers are deprecated
//{
// label: "Short Answers",
// param: "sa_qty",
// value: "10"
//},
quantity(10, "Multiple Choice Quantity"),
{
label: "Reading Passage Topic",
param: "topic",
value: "",
type: "text"
},
{
label: "Passage Word Size",
param: "text_size",
value: "700"
},
difficulty(),
generate()
],
module: "level"
},*/
{
label: "Task 1 - Letter",
type: "writing_letter",
icon: FaEnvelope,
extra: [
{
label: "Letter Topic",
param: "topic",
value: "",
type: "text"
},
difficulty(),
generate()
],
module: "writing"
},
{
label: "Task 2 - Essay",
type: "writing_2",
icon: FaFileAlt,
extra: [
{
label: "Essay Topic",
param: "topic",
value: "",
type: "text"
},
difficulty(),
generate()
],
module: "writing"
},
{
label: "Exercise 1",
type: "speaking_1",
icon: FaComments,
extra: [
difficulty(),
generate(),
{
label: "First Topic",
param: "first_topic",
value: "",
type: "text"
},
{
label: "Second Topic",
param: "second_topic",
value: "",
type: "text"
},
],
module: "speaking"
},
{
label: "Exercise 2",
type: "speaking_2",
icon: FaUserFriends,
extra: [
difficulty(),
generate(),
{
label: "Topic",
param: "topic",
value: "",
type: "text"
},
],
module: "speaking"
},
{
label: "Interactive",
type: "speaking_3",
icon: FaHandshake,
extra: [
difficulty(),
generate(),
{
label: "Topic",
param: "topic",
value: "",
type: "text"
},
],
module: "speaking"
},
...reading(1),
...reading(2),
...reading(3),
...listening(1),
...listening(2),
...listening(3),
...listening(4),
]
export default EXERCISES;

View File

@@ -0,0 +1,22 @@
import { IconType } from "react-icons";
export interface GeneratedExercises {
exercises: Record<string, string>[];
sectionId: number;
module: string;
}
export interface GeneratorState {
loading: boolean;
sectionId: number;
}
export interface ExerciseGen {
label: string;
type: string;
icon: IconType;
sectionId?: number;
extra?: { param: string; value?: string | number | boolean; label?: string; tooltip?: string, type?: string}[];
module: string
}

View File

@@ -0,0 +1,275 @@
import EXERCISES from "./exercises";
import clsx from "clsx";
import { ExerciseGen, GeneratedExercises, GeneratorState } from "./generatedExercises";
import Modal from "@/components/Modal";
import { useCallback, useState } from "react";
import ExerciseWizard, { ExerciseConfig } from "./ExerciseWizard";
import { generate } from "../SettingsEditor/Shared/Generate";
import { Module } from "@/interfaces";
import useExamEditorStore from "@/stores/examEditor";
import { LevelPart, ListeningPart, Message, ReadingPart } from "@/interfaces/exam";
import { BsArrowRepeat } from "react-icons/bs";
interface ExercisePickerProps {
module: string;
sectionId: number;
extraArgs?: Record<string, any>;
levelSectionId?: number;
level?: boolean;
}
const DIFFICULTIES: string[] = ["A1", "A2", "B1", "B2", "C1", "C2"];
const ExercisePicker: React.FC<ExercisePickerProps> = ({
module,
sectionId,
extraArgs = undefined,
levelSectionId,
level = false
}) => {
const { currentModule } = useExamEditorStore();
const { difficulty, sections } = useExamEditorStore((store) => store.modules[level ? "level" : currentModule]);
const section = sections.find((s) => s.sectionId === (level ? levelSectionId : sectionId));
const [pickerOpen, setPickerOpen] = useState(false);
const [localSelectedExercises, setLocalSelectedExercises] = useState<string[]>([]);
const state = section?.state;
const getFullExerciseType = (exercise: ExerciseGen): string => {
if (exercise.extra && exercise.extra.length > 0) {
const extraValue = exercise.extra.find(e => e.param === 'name')?.value;
return extraValue ? `${exercise.type}/?name=${extraValue}` : exercise.type;
}
return exercise.type;
};
const handleChange = (exercise: ExerciseGen) => {
const fullType = getFullExerciseType(exercise);
setLocalSelectedExercises(prev => {
const newSelected = prev.includes(fullType)
? prev.filter(type => type !== fullType)
: [...prev, fullType];
return newSelected;
});
};
const moduleExercises = (sectionId && !["level", "writing", "speaking"].includes(module) ? EXERCISES.filter((ex) => ex.module === module && ex.sectionId == sectionId) : EXERCISES.filter((ex) => ex.module === module));
const onModuleSpecific = useCallback((configurations: ExerciseConfig[]) => {
const exercises = configurations.map(config => {
const exerciseType = config.type.split('name=')[1];
return {
type: exerciseType,
quantity: Number(config.params.quantity || 1),
...(config.params.num_random_words !== undefined && {
num_random_words: Number(config.params.num_random_words)
}),
...(config.params.max_words !== undefined && {
max_words: Number(config.params.max_words)
}),
...((DIFFICULTIES.includes(config.params.difficulty as string) || config.params.difficulty === "Random") && {
difficulty: config.params.difficulty
})
};
});
let context = {};
if (module === 'reading') {
const readingState = state as ReadingPart | LevelPart;
context = {
text: readingState.text!.content
};
} else if (module === 'listening') {
const listeningState = state as ListeningPart | LevelPart;
const script = listeningState.script;
if (sectionId === 1 || sectionId === 3) {
const dialog = script as Message[];
context = {
text: dialog.map((d) => `${d.name}: ${d.text}`).join("\n")
};
} else if (sectionId === 2 || sectionId === 4) {
context = {
text: script as string
};
}
}
if (!["speaking", "writing"].includes(module)) {
generate(
sectionId,
module as Module,
level ? `exercises-${module}` : "exercises",
{
method: 'POST',
body: {
...context,
exercises,
difficulty
}
},
(data: any) => [{
exercises: data.exercises
}],
levelSectionId,
level
);
} else if (module === "writing") {
configurations.forEach((config) => {
let queryParams = {
difficulty: config.params.difficulty ? config.params.difficulty as string: difficulty,
...(config.params.topic !== '' && { topic: config.params.topic as string })
};
generate(
config.type === 'writing_letter' ? 1 : 2,
"writing",
config.type,
{
method: 'GET',
queryParams
},
(data: any) => [{
prompt: data.question,
difficulty: data.difficulty
}],
levelSectionId,
level
);
});
} else {
configurations.forEach((config) => {
let queryParams = Object.fromEntries(
Object.entries({
topic: config.params.topic as string,
first_topic: config.params.first_topic as string,
second_topic: config.params.second_topic as string,
difficulty: config.params.difficulty ? config.params.difficulty as string: difficulty,
}).filter(([_, value]) => value && value !== '')
);
let query = Object.keys(queryParams).length === 0 ? undefined : queryParams;
generate(
Number(config.type.split('_')[1]),
"speaking",
config.type,
{
method: 'GET',
queryParams: query
},
(data: any) => {
switch (Number(config.type.split('_')[1])) {
case 1:
return [{
prompts: data.questions,
first_topic: data.first_topic,
second_topic: data.second_topic,
difficulty: data.difficulty
}];
case 2:
return [{
topic: data.topic,
question: data.question,
prompts: data.prompts,
suffix: data.suffix,
difficulty: data.difficulty
}];
case 3:
return [{
topic: data.topic,
questions: data.questions,
difficulty: data.difficulty
}];
default:
return [data];
}
},
levelSectionId,
level
);
});
}
setLocalSelectedExercises([]);
setPickerOpen(false);
}, [
sectionId,
levelSectionId,
level,
module,
state,
difficulty,
setPickerOpen
]);
if (section === undefined) return <></>;
return (
<>
<Modal isOpen={pickerOpen} onClose={() => setPickerOpen(false)} title="Exercise Wizard"
titleClassName={clsx(
"text-2xl font-semibold text-center py-4",
`bg-ielts-${module} text-white`,
"shadow-sm",
"-mx-6 -mt-6",
"mb-6"
)}
>
<ExerciseWizard
module={module as Module}
selectedExercises={localSelectedExercises}
sectionId={sectionId}
exercises={moduleExercises}
onSubmit={onModuleSpecific}
onDiscard={() => setPickerOpen(false)}
extraArgs={extraArgs}
/>
</Modal>
<div className="flex flex-col gap-4 px-4" key={sectionId}>
<div className="space-y-2">
{moduleExercises.map((exercise) => {
const fullType = getFullExerciseType(exercise);
return (
<label
key={fullType}
className={`flex items-center space-x-3 text-white font-semibold cursor-pointer p-2 hover:bg-ielts-${exercise.module}/70 rounded bg-ielts-${exercise.module}/90`}
>
<input
type="checkbox"
name="exercise"
value={fullType}
checked={localSelectedExercises.includes(fullType)}
onChange={() => handleChange(exercise)}
className="h-5 w-5"
/>
<div className="flex items-center space-x-2">
<exercise.icon className="h-5 w-5 text-white" />
<span>{exercise.label}</span>
</div>
</label>
);
})}
</div>
<div className="flex flex-row justify-center">
<button
className={
clsx("flex items-center justify-center px-4 py-2 text-white rounded-xl transition-colors duration-300 disabled:cursor-not-allowed",
`bg-ielts-${module}/70 border border-ielts-${module} hover:bg-ielts-${module} disabled:bg-ielts-${module}/40 `,
)
}
onClick={() => setPickerOpen(true)}
disabled={localSelectedExercises.length === 0}
>
{section.generating === "exercises" ? (
<div key={`section-${sectionId}`} className="flex items-center justify-center">
<BsArrowRepeat className="text-white animate-spin" size={25} />
</div>
) : (
<>{["speaking", "writing"].includes(module) ? "Add Exercises" : "Set Up Exercises"} ({localSelectedExercises.length}) </>
)}
</button>
</div>
</div>
</>
);
};
export default ExercisePicker;

View File

@@ -0,0 +1,247 @@
import { toast } from "react-toastify";
export type TextToken = {
type: 'text';
content: string;
isWhitespace: boolean;
isLineBreak?: boolean;
};
export type BlankToken = {
type: 'blank';
id: number;
};
type Token = TextToken | BlankToken;
export type BlankState = {
id: number;
position: number;
};
export const getTextSegments = (text: string): Token[] => {
const tokens: Token[] = [];
let lastIndex = 0;
const regex = /{{(\d+)}}/g;
let match;
const addTextTokens = (text: string) => {
// Split by newlines first
const lines = text.replaceAll("\\n",'\n').split(/(\n)/);
lines.forEach((line, i) => {
if (line === '\n') {
tokens.push({
type: 'text',
content: '<br>',
isWhitespace: false,
isLineBreak: true
});
return;
}
const normalizedText = line.replace(/\s+/g, ' ');
if (normalizedText) {
const parts = normalizedText.split(/(\s)/);
parts.forEach(part => {
if (part) {
tokens.push({
type: 'text',
content: part,
isWhitespace: /^\s+$/.test(part)
});
}
});
}
});
};
while ((match = regex.exec(text)) !== null) {
if (match.index > lastIndex) {
addTextTokens(text.slice(lastIndex, match.index));
}
tokens.push({
type: 'blank',
id: parseInt(match[1])
});
lastIndex = regex.lastIndex;
}
if (lastIndex < text.length) {
addTextTokens(text.slice(lastIndex));
}
return tokens;
}
export const reconstructTextFromTokens = (tokens: Token[]): string => {
return tokens.map(token => {
if (token.type === 'blank') {
return `{{${token.id}}}`;
}
if (token.type === 'text' && token.isLineBreak) {
return '\n';
}
return token.content;
}).join('');
}
export type BlanksState = {
text: string;
blanks: BlankState[];
selectedBlankId: number | null;
draggedItemId: string | null;
textMode: boolean;
setEditing: React.Dispatch<React.SetStateAction<boolean>>;
};
export type BlanksAction =
| { type: "SET_TEXT"; payload: string }
| { type: "SET_BLANKS"; payload: BlankState[] }
| { type: "ADD_BLANK" }
| { type: "REMOVE_BLANK"; payload: number }
| { type: "SELECT_BLANK"; payload: number | null }
| { type: "SET_DRAGGED_ITEM"; payload: string | null }
| { type: "MOVE_BLANK"; payload: { blankId: number; newPosition: number } }
| { type: "TOGGLE_EDIT_MODE" }
| { type: "RESET", payload: { text: string } };
export const blanksReducer = (state: BlanksState, action: BlanksAction): BlanksState => {
switch (action.type) {
case "SET_TEXT": {
return {
...state,
text: action.payload,
};
}
case "SET_BLANKS": {
return {
...state,
blanks: action.payload,
};
}
case "ADD_BLANK":
state.setEditing(true);
const newBlankId = Math.max(...state.blanks.map(b => b.id), 0) + 1;
const newBlanks = [
...state.blanks,
{ id: newBlankId, position: state.blanks.length }
];
const newText = state.text + ` {{${newBlankId}}}`;
return {
...state,
blanks: newBlanks,
text: newText
};
case "REMOVE_BLANK": {
if (state.blanks.length === 1) {
toast.error("There needs to be at least 1 blank!");
break;
}
state.setEditing(true);
const blanksToKeep = state.blanks.filter(b => b.id !== action.payload);
const updatedBlanks = blanksToKeep.map((blank, index) => ({
...blank,
position: index
}));
const tokens = getTextSegments(state.text).filter(
token => !(token.type === 'blank' && token.id === action.payload)
);
const newText = reconstructTextFromTokens(tokens);
return {
...state,
blanks: updatedBlanks,
text: newText,
selectedBlankId: state.selectedBlankId === action.payload ? null : state.selectedBlankId
};
}
case "MOVE_BLANK": {
state.setEditing(true);
const { blankId, newPosition } = action.payload;
const tokens = getTextSegments(state.text);
// Find the current position of the blank
const currentPosition = tokens.findIndex(
token => token.type === 'blank' && token.id === blankId
);
if (currentPosition === -1) return state;
// Remove the blank and its surrounding whitespace
const blankToken = tokens[currentPosition];
tokens.splice(currentPosition, 1);
// When inserting at new position, ensure there's whitespace around the blank
let insertPosition = newPosition;
const prevToken = tokens[insertPosition - 1];
const nextToken = tokens[insertPosition];
// Insert space before if needed
if (!prevToken || (prevToken.type === 'text' && !prevToken.isWhitespace)) {
tokens.splice(insertPosition, 0, {
type: 'text',
content: ' ',
isWhitespace: true
});
insertPosition++;
}
// Insert the blank
tokens.splice(insertPosition, 0, blankToken);
insertPosition++;
// Insert space after if needed
if (!nextToken || (nextToken.type === 'text' && !nextToken.isWhitespace)) {
tokens.splice(insertPosition, 0, {
type: 'text',
content: ' ',
isWhitespace: true
});
}
// Reconstruct the text
const newText = reconstructTextFromTokens(tokens);
// Update blank positions
const updatedBlanks = tokens.reduce((acc, token, idx) => {
if (token.type === 'blank') {
acc.push({ id: token.id, position: idx });
}
return acc;
}, [] as BlankState[]);
return {
...state,
text: newText,
blanks: updatedBlanks
};
}
case "SELECT_BLANK":
return { ...state, selectedBlankId: action.payload };
case "SET_DRAGGED_ITEM":
state.setEditing(true);
return { ...state, draggedItemId: action.payload };
case "TOGGLE_EDIT_MODE":
return { ...state, textMode: !state.textMode };
case "RESET":
return {
text: action.payload.text || "",
blanks: [],
selectedBlankId: null,
draggedItemId: null,
textMode: false,
setEditing: state.setEditing
};
}
return state;
};

View File

@@ -0,0 +1,129 @@
import { useDraggable, useDroppable } from "@dnd-kit/core";
import clsx from "clsx";
import { MdClose, MdDelete, MdDragIndicator } from "react-icons/md";
import { CSS } from "@dnd-kit/utilities";
import { useEffect, useState } from "react";
import ConfirmDeleteBtn from "../../Shared/ConfirmDeleteBtn";
interface BlankProps {
id: number;
module: string;
variant: "text" | "bank";
isSelected?: boolean;
isDragging?: boolean;
onSelect?: (id: number) => void;
onRemove?: (id: number) => void;
disabled?: boolean;
}
export const Blank: React.FC<BlankProps> = ({
id,
module,
variant,
isSelected,
isDragging,
onSelect,
onRemove,
disabled,
}) => {
const { attributes, listeners, setNodeRef, transform } = useDraggable({
id: `${variant}-blank-${id}`,
disabled: disabled || variant !== "text",
});
const style = transform ? {
transform: CSS.Translate.toString(transform),
transition: 'none',
zIndex: 999,
position: 'relative' as const,
touchAction: 'none',
} : {
transition: 'transform 0.2s cubic-bezier(0.25, 1, 0.5, 1)',
touchAction: 'none',
position: 'relative' as const,
};
const handleClick = (e: React.MouseEvent) => {
if (variant === "bank" && !disabled && onSelect) {
onSelect(id);
}
};
const dragProps = variant === "text" ? {
...attributes,
...listeners,
} : {};
return (
<div
ref={setNodeRef}
style={style}
className={clsx(
"group relative inline-flex items-center gap-2 px-2 py-1.5 rounded-lg select-none",
"transform-gpu transition-colors duration-150",
"hover:ring-2 hover:ring-offset-1 shadow-sm",
(
isSelected ? (
isDragging ?
`bg-ielts-${module}/20 bg-ielts-${module} hover:ring-ielts-${module}/50` :
`bg-ielts-${module}/20 bg-ielts-${module}/80 hover:ring-ielts-${module}/40`
)
: `bg-ielts-${module}/20 bg-ielts-${module} hover:ring-ielts-${module}/50`
),
!disabled && (variant === "text" ? "cursor-grab active:cursor-grabbing" : "cursor-pointer"),
disabled && "cursor-default",
variant === "bank" && "w-12"
)}
onClick={variant === "bank" ? handleClick : undefined}
{...dragProps}
role="button"
>
{variant === "text" && (
<span
className={clsx(
"text-xl p-1.5 -ml-1 rounded-md",
"transition-colors duration-150"
)}
title="Drag to reorder"
>
{isSelected ?
<MdDragIndicator className="transform scale-125" color="white" /> :
<MdDragIndicator className="transform scale-125" color="#898492" />
}
</span>
)}
<span className={clsx(
"font-semibold px-1 text-mti-gray-taupe",
isSelected && !isDragging && "text-white"
)}>
{id}
</span>
{onRemove && !isDragging && (
<ConfirmDeleteBtn
onDelete={() => onRemove(id)}
size="md"
position="top-right"
className="-translate-y-2 translate-x-1.5"
/>
)}
</div>
);
};
export const DropZone: React.FC<{ index: number, module: string; }> = ({ index, module }) => {
const { setNodeRef, isOver } = useDroppable({
id: `drop-${index}`,
});
return (
<span
ref={setNodeRef}
className={clsx(
"inline-block h-6 w-4 mx-px transition-all duration-200 select-none",
isOver ? `bg-ielts-${module}/20 w-4.5` : `bg-transparent hover:bg-ielts-${module}/20`
)}
role="presentation"
/>
);
};

View File

@@ -0,0 +1,58 @@
import { MdDelete } from "react-icons/md";
interface Props {
letter: string;
word: string;
isSelected: boolean;
onClick: () => void;
onRemove?: () => void;
onEdit?: (newWord: string) => void;
isEditMode?: boolean;
}
const FillBlanksWord: React.FC<Props> = ({
letter,
word,
isSelected,
onClick,
onRemove,
onEdit,
isEditMode
}) => {
return (
<div className="w-full flex items-center gap-2">
{isEditMode ? (
<div className="min-w-0 flex-1 flex items-center gap-2 p-2 rounded-md border border-gray-200">
<span className="font-medium min-w-[24px] text-center shrink-0">{letter}</span>
<input
type="text"
value={word}
onChange={(e) => onEdit?.(e.target.value)}
className="w-full min-w-0 focus:outline-none"
/>
</div>
) : (
<button
onClick={onClick}
className={`
min-w-0 flex-1 flex items-center gap-2 p-2 rounded-md border text-left transition-colors
${isSelected ? 'border-blue-500 bg-blue-100' : 'border-gray-200'}
`}
>
<span className="font-medium min-w-[24px] text-center shrink-0">{letter}</span>
<span className="truncate">{word}</span>
</button>
)}
{isEditMode && onRemove && (
<button
onClick={onRemove}
className="p-1 rounded text-red-500 hover:bg-gray-100 shrink-0"
aria-label="Remove word"
>
<MdDelete className="h-4 w-4" />
</button>
)}
</div>
);
};
export default FillBlanksWord;

View File

@@ -0,0 +1,353 @@
import { Difficulty, FillBlanksExercise, ReadingPart } from "@/interfaces/exam";
import { useCallback, useEffect, useReducer, useState } from "react";
import BlanksEditor from "..";
import { Card, CardContent } from "@/components/ui/card";
import { MdEdit, MdEditOff } from "react-icons/md";
import FillBlanksWord from "./FillBlanksWord";
import { FaPlus } from "react-icons/fa";
import useExamEditorStore from "@/stores/examEditor";
import { blanksReducer, BlankState, getTextSegments } from "../BlanksReducer";
import useSectionEdit from "@/components/ExamEditor/Hooks/useSectionEdit";
import { AlertItem } from "../../Shared/Alert";
import validateBlanks from "../validateBlanks";
import { toast } from "react-toastify";
import setEditingAlert from "../../Shared/setEditingAlert";
import PromptEdit from "../../Shared/PromptEdit";
import { uuidv4 } from "@firebase/util";
interface Word {
letter: string;
word: string;
}
const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: number }> = ({ exercise, sectionId }) => {
const { currentModule, dispatch } = useExamEditorStore();
const difficulty = useExamEditorStore((state) => state.modules[currentModule].difficulty);
const { state } = useExamEditorStore(
(state) => state.modules[currentModule].sections.find((section) => section.sectionId === sectionId)!
);
const section = state as ReadingPart;
const [alerts, setAlerts] = useState<AlertItem[]>([]);
const [local, setLocal] = useState(exercise);
const [selectedBlankId, setSelectedBlankId] = useState<string | null>(null);
const [answers, setAnswers] = useState<Map<string, string>>(
new Map(exercise.solutions.map(({ id, solution }) => [id, solution]))
);
const [isEditMode, setIsEditMode] = useState(false);
const [newWord, setNewWord] = useState('');
const [editing, setEditing] = useState(false);
const updateLocal = (exercise: FillBlanksExercise) => {
setLocal(exercise);
setEditingAlert(true, setAlerts);
setEditing(true);
};
const [blanksState, blanksDispatcher] = useReducer(blanksReducer, {
text: exercise.text || "",
blanks: [],
selectedBlankId: null,
draggedItemId: null,
textMode: false,
setEditing,
});
const { handleSave, handleDiscard, handleDelete, handlePractice } = useSectionEdit({
sectionId,
editing,
setEditing,
onSave: () => {
if (!validateBlanks(blanksState.blanks, answers, alerts, setAlerts)) {
toast.error("Please fix the errors before saving!");
return;
}
setEditing(false);
setAlerts([]);
const updatedExercise = {
...local,
text: blanksState.text,
solutions: Array.from(answers.entries()).map(([id, solution]) => ({
uuid: local.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
},
onDiscard: () => {
setSelectedBlankId(null);
setAnswers(new Map(exercise.solutions.map(({ id, solution }) => [id, solution])));
setIsEditMode(false);
setNewWord('');
setLocal(exercise);
blanksDispatcher({ type: "RESET", payload: { text: exercise.text } });
blanksDispatcher({ type: "SET_TEXT", payload: exercise.text || "" });
const tokens = getTextSegments(exercise.text || "");
const initialBlanks = tokens.reduce((acc, token, idx) => {
if (token.type === 'blank') {
acc.push({ id: token.id, position: idx });
}
return acc;
}, [] as BlankState[]);
blanksDispatcher({ type: "SET_BLANKS", payload: initialBlanks });
},
onDelete: () => {
const newSection = {
...section,
exercises: section.exercises.filter((ex) => ex.id !== local.id)
};
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: newSection, module: currentModule } });
},
onPractice: () => {
const updatedExercise = {
...local,
isPractice: !local.isPractice,
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
setLocal((prev) => ({...prev, isPractice: !local.isPractice}))
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}
});
useEffect(() => {
if (!editing) {
setLocal(exercise);
setAnswers(new Map(exercise.solutions.map(({ id, solution }) => [id, solution])));
}
}, [exercise, editing]);
const handleWordSelect = (word: string) => {
if (!selectedBlankId) return;
if (!editing) setEditing(true);
const newAnswers = new Map(answers);
newAnswers.set(selectedBlankId, word);
setAnswers(newAnswers);
setLocal(prev => ({
...prev,
solutions: Array.from(newAnswers.entries()).map(([id, solution]) => ({
uuid: prev.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
}));
};
const handleAddWord = () => {
const word = newWord.trim();
if (!word) return;
setLocal(prev => {
const nextLetter = String.fromCharCode(65 + prev.words.length);
return {
...prev,
words: [...prev.words, { letter: nextLetter, word }]
};
});
setNewWord('');
};
const handleRemoveWord = (index: number) => {
if (!editing) setEditing(true);
if (answers.size === 1) {
toast.error("There needs to be at least 1 word!");
return;
}
setLocal(prev => {
const newWords = prev.words.filter((_, i) => i !== index) as Word[];
const removedWord = prev.words[index] as Word;
const newAnswers = new Map(answers);
for (const [blankId, answer] of newAnswers.entries()) {
if (answer === removedWord.word) {
newAnswers.delete(blankId);
}
}
setAnswers(newAnswers);
return {
...prev,
words: newWords,
solutions: Array.from(newAnswers.entries()).map(([id, solution]) => ({
uuid: prev.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
};
});
};
const handleEditWord = (index: number, newWord: string) => {
if (!editing) setEditing(true);
setLocal(prev => {
const newWords = [...prev.words] as Word[];
const oldWord = newWords[index].word;
newWords[index] = { ...newWords[index], word: newWord };
const newAnswers = new Map(answers);
for (const [blankId, answer] of newAnswers.entries()) {
if (answer === oldWord) {
newAnswers.set(blankId, newWord);
}
}
setAnswers(newAnswers);
return {
...prev,
words: newWords,
solutions: Array.from(newAnswers.entries()).map(([id, solution]) => ({
uuid: prev.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
};
});
};
const handleBlankRemove = (blankId: number) => {
if (!editing) setEditing(true);
const newAnswers = new Map(answers);
newAnswers.delete(blankId.toString());
setAnswers(newAnswers);
setLocal(prev => ({
...prev,
solutions: Array.from(newAnswers.entries()).map(([id, solution]) => ({
uuid: prev.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
}));
blanksDispatcher({ type: "REMOVE_BLANK", payload: blankId });
};
useEffect(() => {
validateBlanks(blanksState.blanks, answers, alerts, setAlerts);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [answers, blanksState.blanks, blanksState.textMode])
useEffect(()=> {
setEditingAlert(editing, setAlerts);
}, [editing])
const saveDifficulty = useCallback((diff: Difficulty) => {
if (!difficulty.includes(diff)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, diff]} } });
}
const updatedExercise = { ...exercise, difficulty: diff };
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) => ex.id === exercise.id ? updatedExercise : ex );
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}, [currentModule, difficulty, dispatch, exercise, section, sectionId]);
return (
<div className="space-y-4">
<BlanksEditor
alerts={alerts}
editing={editing}
state={blanksState}
difficulty={exercise.difficulty}
saveDifficulty={saveDifficulty}
blanksDispatcher={blanksDispatcher}
description="Place blanks and assign words from the word bank"
initialText={local.text}
module={currentModule}
showBlankBank={true}
onBlankSelect={(blankId) => setSelectedBlankId(blankId?.toString() || null)}
onBlankRemove={handleBlankRemove}
onSave={handleSave}
onDiscard={handleDiscard}
onDelete={handleDelete}
setEditing={setEditing}
onPractice={handlePractice}
isEvaluationEnabled={!local.isPractice}
prompt={local.prompt}
updatePrompt={(prompt: string) => updateLocal({...local, prompt})}
>
<>
{!blanksState.textMode && <Card className="p-4">
<CardContent>
<div className="flex justify-between items-center mb-4">
<div className="text-lg font-semibold">Word Bank</div>
<button
onClick={() => setIsEditMode(!isEditMode)}
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
>
{isEditMode ?
<MdEditOff size={20} className="text-gray-500" /> :
<MdEdit size={20} className="text-gray-500" />
}
</button>
</div>
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2">
{(local.words as Word[]).map((wordItem, index) => (
<FillBlanksWord
key={wordItem.letter}
letter={wordItem.letter}
word={wordItem.word}
isSelected={answers.get(selectedBlankId || '') === wordItem.word}
onClick={() => handleWordSelect(wordItem.word)}
onRemove={isEditMode ? () => handleRemoveWord(index) : undefined}
onEdit={isEditMode ? (newWord) => handleEditWord(index, newWord) : undefined}
isEditMode={isEditMode}
/>
))}
</div>
{isEditMode && (
<div className="flex flex-row mt-8">
<input
type="text"
value={newWord}
onChange={(e) => setNewWord(e.target.value)}
placeholder="Enter new word"
className="flex-1 px-3 py-2 border border-r-0 rounded-l-md focus:outline-none"
name=""
/>
<button
onClick={handleAddWord}
disabled={!isEditMode || newWord === ""}
className="px-4 bg-blue-500 text-white rounded-r-md border border-blue-500 hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed"
>
<FaPlus className="h-4 w-4" />
</button>
</div>
)}
</CardContent>
</Card>
}
</>
</BlanksEditor>
</div>
);
};
export default FillBlanksLetters;

View File

@@ -0,0 +1,67 @@
import clsx from "clsx";
interface MCOptionProps {
id: string;
options: {
A: string;
B: string;
C: string;
D: string;
};
selectedOption?: string;
onSelect: (option: string) => void;
isEditMode?: boolean;
onEdit?: (key: 'A' | 'B' | 'C' | 'D', value: string) => void;
onRemove?: () => void;
}
const MCOption: React.FC<MCOptionProps> = ({
id,
options,
selectedOption,
onSelect,
isEditMode,
onEdit,
}) => {
const optionKeys = ['A', 'B', 'C', 'D'] as const;
return (
<div className="w-full">
<div className="flex items-center justify-between mb-2">
<span className="font-medium">Question {id}</span>
</div>
<div className="grid grid-cols-2 gap-2">
{optionKeys.map((key) => (
<div key={key} className="flex gap-2">
{isEditMode ? (
<div className="flex-1 flex items-center gap-2 p-2 rounded-md border border-gray-200">
<span className="font-medium min-w-[24px] text-center">{key}</span>
<input
type="text"
value={options[key]}
onChange={(e) => onEdit?.(key, e.target.value)}
className="w-full focus:outline-none"
/>
</div>
) : (
<button
onClick={() => onSelect(key)}
className={clsx(
"flex-1 flex items-center gap-2 p-2 rounded-md border transition-colors text-left",
selectedOption === key
? "border-blue-500 bg-blue-100"
: "border-gray-200 hover:bg-blue-50"
)}
>
<span className="font-medium min-w-[24px] text-center">{key}</span>
<span>{options[key]}</span>
</button>
)}
</div>
))}
</div>
</div>
);
};
export default MCOption;

View File

@@ -0,0 +1,345 @@
import { Difficulty, FillBlanksExercise, FillBlanksMCOption, ReadingPart } from "@/interfaces/exam";
import { useCallback, useEffect, useReducer, useState } from "react";
import BlanksEditor from "..";
import { Card, CardContent } from "@/components/ui/card";
import useExamEditorStore from "@/stores/examEditor";
import { blanksReducer, BlankState, getTextSegments } from "../BlanksReducer";
import useSectionEdit from "@/components/ExamEditor/Hooks/useSectionEdit";
import { AlertItem } from "../../Shared/Alert";
import validateBlanks from "../validateBlanks";
import { toast } from "react-toastify";
import setEditingAlert from "../../Shared/setEditingAlert";
import { MdEdit, MdEditOff } from "react-icons/md";
import MCOption from "./MCOption";
import { uuidv4 } from "@firebase/util";
const FillBlanksMC: React.FC<{ exercise: FillBlanksExercise; sectionId: number }> = ({ exercise, sectionId }) => {
const { currentModule, dispatch } = useExamEditorStore();
const difficulty = useExamEditorStore((state) => state.modules[currentModule].difficulty);
const { state } = useExamEditorStore(
(state) => state.modules[currentModule].sections.find((section) => section.sectionId === sectionId)!
);
const section = state as ReadingPart;
const [alerts, setAlerts] = useState<AlertItem[]>([]);
const [local, setLocal] = useState(exercise);
const [selectedBlankId, setSelectedBlankId] = useState<string | null>(null);
const [answers, setAnswers] = useState<Map<string, string>>(() => {
return new Map(
exercise.solutions.map(({ id, solution }) => [
id.toString(),
solution
])
);
});
const [isEditMode, setIsEditMode] = useState(false);
const [editing, setEditing] = useState(false);
const updateLocal = (exercise: FillBlanksExercise) => {
setLocal(exercise);
setEditingAlert(true, setAlerts);
setEditing(true);
};
const [blanksState, blanksDispatcher] = useReducer(blanksReducer, {
text: exercise.text || "",
blanks: [],
selectedBlankId: null,
draggedItemId: null,
textMode: false,
setEditing,
});
const { handleSave, handleDiscard, handleDelete, handlePractice } = useSectionEdit({
sectionId,
editing,
setEditing,
onSave: () => {
if (!validateBlanks(blanksState.blanks, answers, alerts, setAlerts)) {
toast.error("Please fix the errors before saving!");
return;
}
setEditing(false);
setAlerts([]);
const updatedExercise = {
...local,
text: blanksState.text,
solutions: Array.from(answers.entries()).map(([id, solution]) => ({
uuid: local.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
},
onDiscard: () => {
setSelectedBlankId(null);
setAnswers(new Map(exercise.solutions.map(({ id, solution }) => [id, solution])));
setIsEditMode(false);
setLocal(exercise);
blanksDispatcher({ type: "RESET", payload: { text: exercise.text } });
blanksDispatcher({ type: "SET_TEXT", payload: exercise.text || "" });
const tokens = getTextSegments(exercise.text || "");
const initialBlanks = tokens.reduce((acc, token, idx) => {
if (token.type === 'blank') {
acc.push({ id: token.id, position: idx });
}
return acc;
}, [] as BlankState[]);
blanksDispatcher({ type: "SET_BLANKS", payload: initialBlanks });
},
onDelete: () => {
const newSection = {
...section,
exercises: section.exercises.filter((ex) => ex.id !== local.id)
};
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: newSection, module: currentModule } });
},
onPractice: () => {
const updatedExercise = {
...local,
isPractice: !local.isPractice
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
setLocal((prev) => ({ ...prev, isPractice: !local.isPractice }))
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}
});
useEffect(() => {
if (!editing) {
setLocal(exercise);
setAnswers(new Map(exercise.solutions.map(({ id, solution }) => [id, solution])));
}
}, [exercise, editing]);
const handleOptionSelect = (option: string) => {
if (!selectedBlankId) return;
if (!editing) setEditing(true);
const newAnswers = new Map(answers);
newAnswers.set(selectedBlankId, option);
setAnswers(newAnswers);
setLocal(prev => ({
...prev,
solutions: Array.from(newAnswers.entries()).map(([id, solution]) => ({
uuid: prev.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
}));
};
const handleEditOption = (mcOptionIndex: number, key: keyof FillBlanksMCOption['options'], value: string) => {
if (!editing) setEditing(true);
setLocal(prev => {
const newWords = [...prev.words] as FillBlanksMCOption[];
const mcOption = newWords[mcOptionIndex] as FillBlanksMCOption;
const newOptions = { ...mcOption.options, [key]: value };
newWords[mcOptionIndex] = { ...mcOption, options: newOptions };
const oldValue = (mcOption.options as any)[key];
const newAnswers = new Map(answers);
for (const [blankId, answer] of newAnswers.entries()) {
if (answer === oldValue) {
newAnswers.set(blankId, value);
}
}
setAnswers(newAnswers);
return {
...prev,
words: newWords,
solutions: Array.from(newAnswers.entries()).map(([id, solution]) => ({
uuid: prev.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
};
});
};
useEffect(() => {
validateBlanks(blanksState.blanks, answers, alerts, setAlerts);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [answers, blanksState.blanks, blanksState.textMode]);
useEffect(() => {
setEditingAlert(editing, setAlerts);
}, [editing]);
useEffect(() => {
if (!editing) {
setLocal(exercise);
setAnswers(new Map(
exercise.solutions.map(({ id, solution }) => [
id.toString(),
solution
])
));
}
}, [exercise, editing]);
useEffect(() => {
setAnswers(new Map(
exercise.solutions.map(({ id, solution }) => [
id.toString(),
solution
])
));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const handleBlankRemove = (blankId: number) => {
if (!editing) setEditing(true);
const newAnswers = new Map(answers);
newAnswers.delete(blankId.toString());
setAnswers(newAnswers);
setLocal(prev => ({
...prev,
words: (prev.words as FillBlanksMCOption[]).filter(w => w.id !== blankId.toString()),
solutions: Array.from(newAnswers.entries()).map(([id, solution]) => ({
uuid: prev.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
}));
blanksDispatcher({ type: "REMOVE_BLANK", payload: blankId });
};
useEffect(() => {
const existingWordIds = new Set((local.words as FillBlanksMCOption[]).map(word => word.id));
const blanksMissingWords = blanksState.blanks.filter(blank => !existingWordIds.has(blank.id.toString()));
if (blanksMissingWords.length > 0) {
setLocal(prev => {
const newWords = [...prev.words] as FillBlanksMCOption[];
blanksMissingWords.forEach(blank => {
const newMCOption: FillBlanksMCOption = {
uuid: uuidv4(),
id: blank.id.toString(),
options: {
A: 'Option A',
B: 'Option B',
C: 'Option C',
D: 'Option D'
}
};
newWords.push(newMCOption);
});
return {
...prev,
words: newWords,
solutions: Array.from(answers.entries()).map(([id, solution]) => ({
uuid: prev.solutions.find(sol => sol.id === id)?.uuid || uuidv4(),
id,
solution
}))
};
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [blanksState.blanks]);
const saveDifficulty = useCallback((diff: Difficulty) => {
if (!difficulty.includes(diff)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, diff]} } });
}
const updatedExercise = { ...exercise, difficulty: diff };
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) => ex.id === exercise.id ? updatedExercise : ex );
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}, [currentModule, difficulty, dispatch, exercise, section, sectionId]);
return (
<div className="space-y-4">
<BlanksEditor
alerts={alerts}
editing={editing}
state={blanksState}
difficulty={exercise.difficulty}
saveDifficulty={saveDifficulty}
blanksDispatcher={blanksDispatcher}
description="Place blanks and select the correct answer from multiple choice options"
initialText={local.text}
module={currentModule}
showBlankBank={true}
onBlankSelect={(blankId) => setSelectedBlankId(blankId?.toString() || null)}
onSave={handleSave}
onDiscard={handleDiscard}
onDelete={handleDelete}
onPractice={handlePractice}
setEditing={setEditing}
onBlankRemove={handleBlankRemove}
isEvaluationEnabled={!local.isPractice}
prompt={local.prompt}
updatePrompt={(prompt: string) => updateLocal({ ...local, prompt })}
>
{!blanksState.textMode && selectedBlankId && (
<Card className="p-4">
<CardContent>
<div className="flex justify-between items-center mb-4">
<div className="text-lg font-semibold">Multiple Choice Options</div>
<button
onClick={() => setIsEditMode(!isEditMode)}
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
>
{isEditMode ?
<MdEditOff size={20} className="text-gray-500" /> :
<MdEdit size={20} className="text-gray-500" />
}
</button>
</div>
{(local.words as FillBlanksMCOption[]).map((mcOption) => {
if (mcOption.id.toString() !== selectedBlankId) return null;
return (
<MCOption
key={mcOption.id}
id={mcOption.id}
options={mcOption.options}
selectedOption={answers.get(selectedBlankId)}
onSelect={(option) => handleOptionSelect(option)}
isEditMode={isEditMode}
onEdit={(key, value) => handleEditOption(
(local.words as FillBlanksMCOption[]).findIndex(w => w.id === mcOption.id),
key as "A" | "B" | "C" | "D",
value
)}
/>
);
})}
</CardContent>
</Card>
)}
</BlanksEditor>
</div>
);
};
export default FillBlanksMC;

View File

@@ -0,0 +1,47 @@
import { MdDelete, MdAdd } from "react-icons/md";
interface AlternativeSolutionProps {
solutions: string[];
onAdd: () => void;
onRemove: (index: number) => void;
onEdit: (index: number, value: string) => void;
}
const AlternativeSolutions: React.FC<AlternativeSolutionProps> = ({
solutions,
onAdd,
onRemove,
onEdit,
}) => {
return (
<div className="space-y-2 mt-4">
{solutions.map((solution, index) => (
<div key={index} className="flex items-center gap-2">
<input
type="text"
value={solution}
onChange={(e) => onEdit(index, e.target.value)}
className="flex-1 p-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
placeholder={`Solution ${index + 1}`}
/>
<button
onClick={() => onRemove(index)}
className="p-2 text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors"
title="Delete solution"
>
<MdDelete size={20} />
</button>
</div>
))}
<button
onClick={onAdd}
className="w-full mt-2 p-2 border-2 border-dashed border-gray-300 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition-colors flex items-center justify-center gap-2 text-gray-600 hover:text-blue-600"
>
<MdAdd size={18} />
Add Alternative Solution
</button>
</div>
);
};
export default AlternativeSolutions;

View File

@@ -0,0 +1,234 @@
import useSectionEdit from "@/components/ExamEditor/Hooks/useSectionEdit";
import { Card, CardContent } from "@/components/ui/card";
import { WriteBlanksExercise, ReadingPart, Difficulty } from "@/interfaces/exam";
import useExamEditorStore from "@/stores/examEditor";
import { useState, useReducer, useEffect, useCallback } from "react";
import { toast } from "react-toastify";
import BlanksEditor from "..";
import { AlertItem } from "../../Shared/Alert";
import setEditingAlert from "../../Shared/setEditingAlert";
import { blanksReducer } from "../BlanksReducer";
import { validateWriteBlanks } from "./validation";
import AlternativeSolutions from "./AlternativeSolutions";
const WriteBlanksFill: React.FC<{ exercise: WriteBlanksExercise; sectionId: number }> = ({ exercise, sectionId }) => {
const { currentModule, dispatch } = useExamEditorStore();
const difficulty = useExamEditorStore((state) => state.modules[currentModule].difficulty);
const { state } = useExamEditorStore(
(state) => state.modules[currentModule].sections.find((section) => section.sectionId === sectionId)!
);
const section = state as ReadingPart;
const [alerts, setAlerts] = useState<AlertItem[]>([]);
const [local, setLocal] = useState(exercise);
const [selectedBlankId, setSelectedBlankId] = useState<string | null>(null);
const [editing, setEditing] = useState(false);
const updateLocal = (exercise: WriteBlanksExercise) => {
setLocal(exercise);
setEditingAlert(true, setAlerts);
setEditing(true);
};
const [blanksState, blanksDispatcher] = useReducer(blanksReducer, {
text: exercise.text || "",
blanks: [],
selectedBlankId: null,
draggedItemId: null,
textMode: false,
setEditing,
});
const { handleSave, handleDiscard, handleDelete, handlePractice } = useSectionEdit({
sectionId,
editing,
setEditing,
onSave: () => {
if (!validateWriteBlanks(local.solutions, local.maxWords, setAlerts)) {
toast.error("Please fix the errors before saving!");
return;
}
setEditing(false);
setAlerts([]);
const updatedExercise = {
...local,
text: blanksState.text,
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
},
onDiscard: () => {
setSelectedBlankId(null);
setLocal(exercise);
blanksDispatcher({ type: "RESET", payload: { text: exercise.text } });
},
onDelete: () => {
const newSection = {
...section,
exercises: section.exercises.filter((ex) => ex.id !== local.id)
};
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: newSection, module: currentModule } });
},
onPractice: () => {
const updatedExercise = {
...local,
isPractice: !local.isPractice
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
setLocal((prev) => ({ ...prev, isPractice: !local.isPractice }))
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}
});
useEffect(() => {
if (!editing) {
setLocal(exercise);
}
}, [exercise, editing]);
const handleAddSolution = (blankId: string) => {
if (!editing) setEditing(true);
setLocal(prev => ({
...prev,
solutions: prev.solutions.map(s =>
s.id === blankId
? { ...s, solution: [...s.solution, ""] }
: s
)
}));
};
const handleRemoveSolution = (blankId: string, index: number) => {
if (!editing) setEditing(true);
const solutions = local.solutions.find(s => s.id === blankId);
if (solutions && solutions.solution.length <= 1) {
toast.error("Each blank must have at least one solution!");
return;
}
setLocal(prev => ({
...prev,
solutions: prev.solutions.map(s =>
s.id === blankId
? { ...s, solution: s.solution.filter((_, i) => i !== index) }
: s
)
}));
};
const handleEditSolution = (blankId: string, index: number, value: string) => {
if (!editing) setEditing(true);
setLocal(prev => ({
...prev,
solutions: prev.solutions.map(s =>
s.id === blankId
? {
...s,
solution: s.solution.map((sol, i) => i === index ? value : sol)
}
: s
)
}));
};
const handleBlankRemove = (blankId: number) => {
if (!editing) setEditing(true);
setLocal(prev => ({
...prev,
solutions: prev.solutions.filter(s => s.id !== blankId.toString())
}));
blanksDispatcher({ type: "REMOVE_BLANK", payload: blankId });
};
useEffect(() => {
validateWriteBlanks(local.solutions, local.maxWords, setAlerts);
}, [local.solutions, local.maxWords]);
useEffect(() => {
setEditingAlert(editing, setAlerts);
}, [editing]);
const saveDifficulty = useCallback((diff: Difficulty) => {
if (!difficulty.includes(diff)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, diff]} } });
}
const updatedExercise = { ...exercise, difficulty: diff };
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) => ex.id === exercise.id ? updatedExercise : ex );
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}, [currentModule, difficulty, dispatch, exercise, section, sectionId]);
return (
<div className="space-y-4">
<BlanksEditor
title="Write Blanks: Fill"
alerts={alerts}
editing={editing}
state={blanksState}
blanksDispatcher={blanksDispatcher}
description={local.prompt}
initialText={local.text}
difficulty={exercise.difficulty}
saveDifficulty={saveDifficulty}
module={currentModule}
showBlankBank={true}
onBlankSelect={(blankId) => setSelectedBlankId(blankId?.toString() || null)}
onBlankRemove={handleBlankRemove}
onSave={handleSave}
onDiscard={handleDiscard}
onDelete={handleDelete}
onPractice={handlePractice}
setEditing={setEditing}
isEvaluationEnabled={!local.isPractice}
prompt={local.prompt}
updatePrompt={(prompt: string) => updateLocal({ ...local, prompt })}
>
{!blanksState.textMode && (
<Card>
<CardContent className="p-4">
<div className="flex items-center justify-between mb-4">
<span className="text-lg font-semibold">
{selectedBlankId
? `Solutions for Blank ${selectedBlankId}`
: "Click a blank to edit its solutions"}
</span>
{selectedBlankId && (
<span className="text-sm text-gray-500">
Max words per solution: {local.maxWords}
</span>
)}
</div>
<div className="grid grid-cols-1 gap-4">
{selectedBlankId && (
<AlternativeSolutions
solutions={local.solutions.find(s => s.id === selectedBlankId)?.solution || []}
onAdd={() => handleAddSolution(selectedBlankId)}
onRemove={(index: number) => handleRemoveSolution(selectedBlankId, index)}
onEdit={(index: number, value: string) => handleEditSolution(selectedBlankId, index, value)}
/>
)}
</div>
</CardContent>
</Card>
)}
</BlanksEditor>
</div>
);
};
export default WriteBlanksFill;

View File

@@ -0,0 +1,58 @@
import { AlertItem } from "../../Shared/Alert";
export const validateWriteBlanks = (
solutions: { id: string; solution: string[] }[],
maxWords: number,
setAlerts: React.Dispatch<React.SetStateAction<AlertItem[]>>
): boolean => {
let isValid = true;
const emptySolutions = solutions.flatMap(s =>
s.solution.map((sol, index) => ({
blankId: s.id,
solutionIndex: index,
isEmpty: !sol.trim()
}))
).filter(({ isEmpty }) => isEmpty);
if (emptySolutions.length > 0) {
isValid = false;
setAlerts(prev => {
const filtered = prev.filter(a => !a.tag?.startsWith('empty-solution'));
return [...filtered, ...emptySolutions.map(({ blankId, solutionIndex }) => ({
variant: "error" as const,
tag: `empty-solution-${blankId}-${solutionIndex}`,
description: `Solution ${solutionIndex + 1} for blank ${blankId} cannot be empty`
}))];
});
} else {
setAlerts(prev => prev.filter(a => !a.tag?.startsWith('empty-solution')));
}
if (maxWords > 0) {
const invalidWordCount = solutions.flatMap(s =>
s.solution.map((sol, index) => ({
blankId: s.id,
solutionIndex: index,
wordCount: sol.trim().split(/\s+/).length
}))
).filter(({ wordCount }) => wordCount > maxWords);
if (invalidWordCount.length > 0) {
isValid = false;
setAlerts(prev => {
const filtered = prev.filter(a => !a.tag?.startsWith('word-count'));
return [...filtered, ...invalidWordCount.map(({ blankId, solutionIndex, wordCount }) => ({
variant: "error" as const,
tag: `word-count-${blankId}-${solutionIndex}`,
description: `Solution ${solutionIndex + 1} for blank ${blankId} exceeds maximum of ${maxWords} words (current: ${wordCount} words)`
}))];
});
} else {
setAlerts(prev => prev.filter(a => !a.tag?.startsWith('word-count')));
}
}
return isValid;
};

View File

@@ -0,0 +1,283 @@
import React, { useCallback, useMemo, useReducer, useEffect, ReactNode } from "react";
import {
DndContext,
DragEndEvent,
DragStartEvent,
MeasuringStrategy,
PointerSensor,
useSensor,
useSensors,
} from "@dnd-kit/core";
import {
restrictToWindowEdges,
snapCenterToCursor,
} from "@dnd-kit/modifiers";
import AutoExpandingTextArea from "@/components/Low/AutoExpandingTextarea";
import Header from "../../Shared/Header";
import Alert, { AlertItem } from "../Shared/Alert";
import clsx from "clsx";
import { Card, CardContent } from "@/components/ui/card";
import { Blank, DropZone } from "./DragNDrop";
import { getTextSegments, BlankState, BlanksState, BlanksAction, BlankToken } from "./BlanksReducer";
import PromptEdit from "../Shared/PromptEdit";
import { Difficulty } from "@/interfaces/exam";
interface Props {
title?: string;
initialText: string;
description: string;
difficulty?: Difficulty;
saveDifficulty: (difficulty: Difficulty) => void;
state: BlanksState;
module: string;
editing: boolean;
showBlankBank: boolean;
alerts: AlertItem[];
prompt: string;
updatePrompt: (prompt: string) => void;
setEditing: React.Dispatch<React.SetStateAction<boolean>>;
blanksDispatcher: React.Dispatch<BlanksAction>
onBlankSelect?: (blankId: number | null) => void;
onBlankRemove: (blankId: number) => void;
onSave: () => void;
onDiscard: () => void;
onDelete: () => void;
onPractice: () => void;
isEvaluationEnabled?: boolean;
children: ReactNode;
}
const BlanksEditor: React.FC<Props> = ({
title = "Fill Blanks",
initialText,
description,
difficulty,
saveDifficulty,
state,
editing,
module,
children,
showBlankBank = true,
alerts,
blanksDispatcher,
onBlankSelect,
onBlankRemove,
onSave,
onDiscard,
onDelete,
onPractice,
isEvaluationEnabled,
setEditing,
prompt,
updatePrompt
}) => {
useEffect(() => {
const tokens = getTextSegments(initialText);
const initialBlanks = tokens.reduce((acc, token, idx) => {
if (token.type === 'blank') {
acc.push({ id: token.id, position: idx });
}
return acc;
}, [] as BlankState[]);
blanksDispatcher({ type: "SET_TEXT", payload: initialText });
blanksDispatcher({ type: "SET_BLANKS", payload: initialBlanks });
}, [initialText, blanksDispatcher]);
const tokens = useMemo(() => {
return getTextSegments(state.text || "");
}, [state.text]);
const handleDragStart = useCallback((event: DragStartEvent) => {
blanksDispatcher({ type: "SET_DRAGGED_ITEM", payload: event.active.id.toString() });
}, [blanksDispatcher]);
const handleDragEnd = useCallback(
(event: DragEndEvent) => {
const { active, over } = event;
if (!over) return;
const blankId = parseInt(active.id.toString().split("-").pop() || "");
const dropIndex = parseInt(over.id.toString().split("-")[1]);
blanksDispatcher({
type: "MOVE_BLANK",
payload: { blankId, newPosition: dropIndex },
});
blanksDispatcher({ type: "SET_DRAGGED_ITEM", payload: null });
},
[blanksDispatcher]
);
const handleTextChange = useCallback(
(newText: string) => {
const processedText = newText.replace(/\[(\d+)\]/g, "{{$1}}");
const existingBlankIds = getTextSegments(state.text)
.filter(token => token.type === 'blank')
.map(token => (token as BlankToken).id);
const newBlankIds = getTextSegments(processedText)
.filter(token => token.type === 'blank')
.map(token => (token as BlankToken).id);
const removedBlankIds = existingBlankIds.filter(id => !newBlankIds.includes(id));
removedBlankIds.forEach(id => {
onBlankRemove(id);
});
blanksDispatcher({ type: "SET_TEXT", payload: processedText });
},
[blanksDispatcher, state.text, onBlankRemove]
);
useEffect(() => {
if (onBlankSelect !== undefined) onBlankSelect(state.selectedBlankId);
}, [state.selectedBlankId, onBlankSelect]);
const handleBlankSelect = (blankId: number) => {
blanksDispatcher({
type: "SELECT_BLANK",
payload: blankId === state.selectedBlankId ? null : blankId,
});
};
const handleBlankRemove = useCallback((blankId: number) => {
onBlankRemove(blankId);
blanksDispatcher({ type: "REMOVE_BLANK", payload: blankId });
}, [blanksDispatcher, onBlankRemove]);
const sensors = useSensors(
useSensor(PointerSensor, {
activationConstraint: {
distance: 4,
tolerance: 5,
},
})
);
const modifiers = [snapCenterToCursor, restrictToWindowEdges];
const measuring = {
droppable: {
strategy: MeasuringStrategy.Always,
},
};
return (
<div className="space-y-4 p-4">
<Header
title={title}
description={description}
editing={editing}
difficulty={difficulty}
saveDifficulty={saveDifficulty}
handleSave={onSave}
handleDelete={onDelete}
handleDiscard={onDiscard}
handlePractice={onPractice}
isEvaluationEnabled={isEvaluationEnabled}
/>
{alerts.length > 0 && <Alert alerts={alerts} />}
<PromptEdit value={prompt} onChange={(text: string) => updatePrompt(text)} />
<Card>
<CardContent className="p-4 text-white font-semibold flex gap-2">
<button
onClick={() => blanksDispatcher({ type: "ADD_BLANK" })}
className={`px-3 py-1.5 bg-ielts-${module} rounded-md hover:bg-ielts-${module}/50 transition-colors`}
>
Add Blank
</button>
<button
onClick={() => blanksDispatcher({ type: "TOGGLE_EDIT_MODE" })}
className={clsx(
"px-3 py-1.5 rounded-md transition-colors",
`bg-ielts-${module} text-white hover:bg-ielts-${module}/50`
)}
>
{state.textMode ? "Drag Mode" : "Text Mode"}
</button>
</CardContent>
</Card>
<DndContext
sensors={sensors}
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
modifiers={modifiers}
measuring={measuring}
>
<Card>
<CardContent className="p-4">
{state.textMode ? (
<AutoExpandingTextArea
value={state.text.replace(/{{(\d+)}}/g, "[$1]")}
onChange={(text) => { handleTextChange(text); if (!editing) setEditing(true) }}
className="w-full h-full min-h-[200px] p-2 bg-white border rounded-md"
placeholder="Enter text here. Use [1], [2], etc. for blanks..."
/>
) : (
<div className="leading-relaxed p-4">
{tokens.map((token, index) => {
const isWordToken = token.type === 'text' && !token.isWhitespace;
const showDropZone = isWordToken || token.type === 'blank';
return (
<React.Fragment key={index}>
{showDropZone && <DropZone index={index} module={module} />}
{token.type === 'blank' ? (
<Blank
id={token.id}
module={module}
variant="text"
isSelected={token.id === state.selectedBlankId}
isDragging={state.draggedItemId === `text-blank-${token.id}`}
/>
) : token.isLineBreak ? (
<br />
) : (
<span className="select-none">{token.content}</span>
)}
</React.Fragment>
);
})}
{tokens.length > 0 &&
tokens[tokens.length - 1].type === 'text' && (
<DropZone index={tokens.length} module={module} />
)}
</div>
)}
</CardContent>
</Card>
{(!state.textMode && showBlankBank) && (
<Card>
<CardContent className="flex flex-wrap gap-2 p-4">
{state.blanks.map(blank => (
<Blank
key={blank.id}
id={blank.id}
module={module}
variant="bank"
isSelected={blank.id === state.selectedBlankId}
isDragging={state.draggedItemId === `bank-blank-${blank.id}`}
onSelect={handleBlankSelect}
onRemove={handleBlankRemove}
disabled={state.textMode}
/>
))}
</CardContent>
</Card>
)}
{children}
</DndContext>
</div>
);
}
export default BlanksEditor;

View File

@@ -0,0 +1,38 @@
import { AlertItem } from "../Shared/Alert";
import { BlankState } from "./BlanksReducer";
const validateBlanks = (
blanks: BlankState[],
answers: Map<string, string>,
alerts: AlertItem[],
setAlerts: React.Dispatch<React.SetStateAction<AlertItem[]>>,
save: boolean = false,
): boolean => {
const unfilledBlanks = blanks.filter(blank => !answers.has(blank.id.toString()));
const filteredAlerts = alerts.filter(alert => alert.tag !== "unfilled-blanks");
if (unfilledBlanks.length > 0) {
if (!save && !filteredAlerts.some(alert => alert.tag === "editing")) {
filteredAlerts.push({
variant: "info",
description: "You have unsaved changes. Don't forget to save your work!",
tag: "editing"
});
}
setAlerts([
...filteredAlerts,
{
variant: "error",
tag: "unfilled-blanks",
description: `${unfilledBlanks.length} blank${unfilledBlanks.length > 1 ? 's' : ''} ${unfilledBlanks.length > 1 ? 'are' : 'is'} missing a word (blanks: ${unfilledBlanks.map(blank => blank.id).join(", ")})`
}
]);
return false;
} else if (filteredAlerts.length !== alerts.length) {
setAlerts(filteredAlerts);
}
return true;
};
export default validateBlanks;

View File

@@ -0,0 +1,45 @@
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { MatchSentenceExerciseOption } from "@/interfaces/exam";
import { MdVisibilityOff } from "react-icons/md";
interface Props {
showReference: boolean;
selectedReference: string | null;
options: MatchSentenceExerciseOption[];
headings: boolean;
setShowReference: React.Dispatch<React.SetStateAction<boolean>>;
}
const ReferenceViewer: React.FC<Props> = ({ showReference, selectedReference, options, setShowReference, headings = true}) => (
<div
className={`fixed inset-y-0 right-0 w-96 bg-white shadow-lg transform transition-transform duration-300 z-50 ease-in-out ${showReference ? 'translate-x-0' : 'translate-x-full'}`}
>
<div className="h-full flex flex-col">
<div className="p-4 border-b bg-gray-50 flex justify-between items-center">
<h3 className="font-semibold text-gray-800">{headings ? "Reference Paragraphs" : "Authors"}</h3>
<button
onClick={() => setShowReference(false)}
className="p-2 hover:bg-gray-200 rounded-full"
>
<MdVisibilityOff size={20} />
</button>
</div>
<div className="flex-1 overflow-y-auto p-4">
<div className="space-y-4">
{options.map((option) => (
<Card key={option.id} className={`bg-gray-50 transition-all duration-200 ${selectedReference === option.id ? 'ring-2 ring-blue-500' : ''}`}>
<CardHeader className="pb-2">
<CardTitle className="text-md text-black">{headings ? "Paragraph" : "Author" } {option.id}</CardTitle>
</CardHeader>
<CardContent>
<p className="text-sm text-gray-600">{option.sentence}</p>
</CardContent>
</Card>
))}
</div>
</div>
</div>
</div>
);
export default ReferenceViewer;

View File

@@ -0,0 +1,263 @@
import React, { useState, useMemo, useEffect, useCallback } from 'react';
import {
MdAdd,
MdVisibility,
MdVisibilityOff
} from 'react-icons/md';
import { Difficulty, MatchSentencesExercise, ReadingPart } from '@/interfaces/exam';
import Alert, { AlertItem } from '../Shared/Alert';
import ReferenceViewer from './ParagraphViewer';
import Header from '../../Shared/Header';
import SortableQuestion from '../Shared/SortableQuestion';
import QuestionsList from '../Shared/QuestionsList';
import useExamEditorStore from '@/stores/examEditor';
import useSectionEdit from '../../Hooks/useSectionEdit';
import validateMatchSentences from './validation';
import setEditingAlert from '../Shared/setEditingAlert';
import { toast } from 'react-toastify';
import { DragEndEvent } from '@dnd-kit/core';
import { handleMatchSentencesReorder } from '@/stores/examEditor/reorder/local';
import PromptEdit from '../Shared/PromptEdit';
import { uuidv4 } from '@firebase/util';
const MatchSentences: React.FC<{ exercise: MatchSentencesExercise, sectionId: number }> = ({ exercise, sectionId }) => {
const { currentModule, dispatch } = useExamEditorStore();
const difficulty = useExamEditorStore((state) => state.modules[currentModule].difficulty);
const { state } = useExamEditorStore(
(state) => state.modules[currentModule].sections.find((section) => section.sectionId === sectionId)!
);
const section = state as ReadingPart;
const [local, setLocal] = useState(exercise);
const [selectedParagraph, setSelectedParagraph] = useState<string | null>(null);
const [showReference, setShowReference] = useState(false);
const [alerts, setAlerts] = useState<AlertItem[]>([]);
const updateLocal = (exercise: MatchSentencesExercise) => {
setLocal(exercise);
setEditing(true);
};
const { editing, setEditing, handleSave, handleDiscard, handleDelete, handlePractice } = useSectionEdit({
sectionId,
onSave: () => {
const isValid = validateMatchSentences(local.sentences, setAlerts);
if (!isValid) {
toast.error("Please fix the errors before saving!");
return;
}
setEditing(false);
setAlerts([]);
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) => ex.id === exercise.id ? local : ex);
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
},
onDiscard: () => {
setLocal(exercise);
setSelectedParagraph(null);
setShowReference(false);
},
onDelete: () => {
const newSection = {
...section,
exercises: section.exercises.filter((ex) => ex.id !== local.id)
};
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: newSection, module: currentModule } });
},
onPractice: () => {
const updatedExercise = {
...local,
isPractice: !local.isPractice
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
setLocal((prev) => ({...prev, isPractice: !local.isPractice}))
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}
});
const usedOptions = useMemo(() => {
return local.sentences.reduce((acc, sentence) => {
if (sentence.solution) {
acc.add(sentence.solution);
}
return acc;
}, new Set<string>());
}, [local.sentences]);
const addHeading = () => {
const newId = (parseInt(local.sentences[local.sentences.length - 1].id) + 1).toString();
updateLocal({
...local,
sentences: [
...local.sentences,
{
uuid: uuidv4(),
id: newId,
sentence: "",
solution: ""
}
]
});
};
const updateHeading = (index: number, field: string, value: string) => {
const newSentences = [...local.sentences];
if (field === 'solution') {
const oldSolution = newSentences[index].solution;
if (oldSolution) {
usedOptions.delete(oldSolution);
}
}
newSentences[index] = { ...newSentences[index], [field]: value };
updateLocal({ ...local, sentences: newSentences });
};
const deleteHeading = (index: number) => {
if (local.sentences.length <= 1) {
toast.error(`There needs to be at least one ${exercise.variant && exercise.variant == "ideaMatch" ? "idea/opinion" : "heading"}!`);
return;
}
const deletedSolution = local.sentences[index].solution;
if (deletedSolution) {
usedOptions.delete(deletedSolution);
}
const newSentences = local.sentences.filter((_, i) => i !== index);
updateLocal({ ...local, sentences: newSentences });
};
useEffect(() => {
validateMatchSentences(local.sentences, setAlerts);
}, [local.sentences]);
useEffect(() => {
setEditingAlert(editing, setAlerts);
}, [editing]);
const handleDragEnd = (event: DragEndEvent) => {
updateLocal(handleMatchSentencesReorder(event, local));
}
const saveDifficulty = useCallback((diff: Difficulty) => {
if (!difficulty.includes(diff)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, diff]} } });
}
const updatedExercise = { ...exercise, difficulty: diff };
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) => ex.id === exercise.id ? updatedExercise : ex );
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}, [currentModule, difficulty, dispatch, exercise, section, sectionId]);
return (
<div className="flex flex-col mx-auto p-2">
<Header
title={exercise.variant && exercise.variant == "ideaMatch" ? "Idea Match" : "Paragraph Match"}
description={`Edit ${exercise.variant && exercise.variant == "ideaMatch" ? "ideas/opinions" : "headings"} and their matches`}
editing={editing}
difficulty={exercise.difficulty}
saveDifficulty={saveDifficulty}
handleSave={handleSave}
handleDelete={handleDelete}
handleDiscard={handleDiscard}
handlePractice={handlePractice}
isEvaluationEnabled={!local.isPractice}
>
<button
onClick={() => setShowReference(!showReference)}
className="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg transition-colors flex items-center gap-2"
>
{showReference ? <MdVisibilityOff size={18} /> : <MdVisibility size={18} />}
{showReference ? 'Hide Reference' : 'Show Reference'}
</button>
</Header>
<div className="space-y-4">
{alerts.length > 0 && <Alert alerts={alerts} />}
<PromptEdit
value={local.prompt}
onChange={(text) => updateLocal({ ...local, prompt: text })}
/>
<QuestionsList
ids={local.sentences.map(s => s.id)}
handleDragEnd={handleDragEnd}
>
{local.sentences.map((sentence, index) => (
<SortableQuestion
key={sentence.id}
id={sentence.id}
index={index}
deleteQuestion={() => deleteHeading(index)}
onFocus={() => setSelectedParagraph(sentence.solution)}
>
<>
<input
type="text"
value={sentence.sentence}
onChange={(e) => updateHeading(index, 'sentence', e.target.value)}
className="w-full p-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none text-mti-gray-dim"
placeholder={`Enter ${exercise.variant && exercise.variant == "ideaMatch" ? "idea/opinion" : "heading"} ...`}
/>
<div className="flex items-center gap-3">
<select
value={sentence.solution}
onChange={(e) => {
updateHeading(index, 'solution', e.target.value);
setSelectedParagraph(e.target.value);
}}
className="w-full p-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none bg-white text-mti-gray-dim"
>
<option value="">Select matching {exercise.variant == "ideaMatch" ? "author" : "paragraph"}...</option>
{local.options.map((option) => {
const isUsed = usedOptions.has(option.id);
const isCurrentSelection = sentence.solution === option.id;
return (
<option
key={option.id}
value={option.id}
disabled={isUsed && !isCurrentSelection}
>
{exercise.variant == "ideaMatch" ? "Author" : "Paragraph"} {option.id}
</option>
);
})}
</select>
</div>
</>
</SortableQuestion>
))}
</QuestionsList>
{(section.text !== undefined && section.text.content.split("\n\n").length - 1) === local.sentences.length && (
<button
onClick={addHeading}
className="w-full p-4 border-2 border-dashed border-gray-300 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition-colors flex items-center justify-center gap-2 text-gray-600 hover:text-blue-600"
>
<MdAdd size={18} />
Add New Match
</button>
)}
</div>
<ReferenceViewer
headings={exercise.variant !== "ideaMatch"}
showReference={showReference}
selectedReference={selectedParagraph}
options={local.options}
setShowReference={setShowReference}
/>
</div>
);
};
export default MatchSentences;

View File

@@ -0,0 +1,42 @@
import { AlertItem } from "../Shared/Alert";
const validateMatchSentences = (
sentences: {id: string; sentence: string; solution: string;}[],
setAlerts: React.Dispatch<React.SetStateAction<AlertItem[]>>
): boolean => {
let hasErrors = false;
const emptySentences = sentences.filter(s => !s.sentence.trim());
if (emptySentences.length > 0) {
hasErrors = true;
setAlerts(prev => {
const filteredAlerts = prev.filter(alert => !alert.tag?.startsWith('empty-sentence'));
return [...filteredAlerts, ...emptySentences.map(s => ({
variant: "error" as const,
tag: `empty-sentence-${s.id}`,
description: `Heading ${s.id} is empty`
}))];
});
} else {
setAlerts(prev => prev.filter(alert => !alert.tag?.startsWith('empty-sentence')));
}
const unmatchedSentences = sentences.filter(s => !s.solution);
if (unmatchedSentences.length > 0) {
hasErrors = true;
setAlerts(prev => {
const filteredAlerts = prev.filter(alert => !alert.tag?.startsWith('unmatched-sentence'));
return [...filteredAlerts, ...unmatchedSentences.map(s => ({
variant: "error" as const,
tag: `unmatched-sentence-${s.id}`,
description: `Heading ${s.id} has no paragraph selected`
}))];
});
} else {
setAlerts(prev => prev.filter(alert => !alert.tag?.startsWith('unmatched-sentence')));
}
return !hasErrors;
};
export default validateMatchSentences;

View File

@@ -0,0 +1,191 @@
import { MultipleChoiceQuestion } from "@/interfaces/exam";
import clsx from "clsx";
import { useEffect, useState } from "react";
import { MdEdit, MdEditOff } from "react-icons/md";
interface UnderlineQuestionProps {
question: MultipleChoiceQuestion;
onQuestionChange: (updatedQuestion: MultipleChoiceQuestion) => void;
onValidationChange?: (isValid: boolean) => void;
}
interface Option {
id: string;
text?: string;
src?: string;
}
export const UnderlineQuestion: React.FC<UnderlineQuestionProps> = ({
question,
onQuestionChange,
onValidationChange,
}) => {
const [isEditing, setIsEditing] = useState(false);
const [validationErrors, setValidationErrors] = useState<string[]>([]);
const stripUnderlineTags = (text: string = '') => text.replace(/<\/?u>/g, '');
const addUnderlineTags = (text: string, options: Option[]) => {
let result = text;
// Sort options by length (longest first) to handle overlapping matches
const sortedOptions = [...options]
.filter(opt => opt.text?.trim() && opt.text.trim().length > 1)
.sort((a, b) => ((b.text?.length || 0) - (a.text?.length || 0)));
for (const option of sortedOptions) {
if (!option.text?.trim()) continue;
const optionText = stripUnderlineTags(option.text).trim();
const textLower = result.toLowerCase();
const optionLower = optionText.toLowerCase();
let startIndex = textLower.indexOf(optionLower);
while (startIndex !== -1) {
// Check if this portion is already underlined
const beforeTag = result.slice(Math.max(0, startIndex - 3), startIndex);
const afterTag = result.slice(startIndex + optionText.length, startIndex + optionText.length + 4);
if (!beforeTag.includes('<u>') && !afterTag.includes('</u>')) {
const before = result.substring(0, startIndex);
const match = result.substring(startIndex, startIndex + optionText.length);
const after = result.substring(startIndex + optionText.length);
result = `${before}<u>${match}</u>${after}`;
}
// Find next occurrence
startIndex = textLower.indexOf(optionLower, startIndex + 1);
}
}
return result;
};
const validateQuestion = (q: MultipleChoiceQuestion) => {
const errors: string[] = [];
const rawPrompt = stripUnderlineTags(q.prompt).toLowerCase();
q.options.forEach((option) => {
if (option.text?.trim() && !rawPrompt.includes(stripUnderlineTags(option.text).trim().toLowerCase())) {
errors.push(`Option ${option.id} text not found in prompt`);
}
});
setValidationErrors(errors);
onValidationChange?.(errors.length === 0);
return errors.length === 0;
};
useEffect(() => {
validateQuestion(question);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [question]);
const handlePromptChange = (value: string) => {
const newPrompt = addUnderlineTags(value, question.options);
onQuestionChange({
...question,
prompt: newPrompt
});
};
const handleOptionChange = (optionIndex: number, value: string) => {
const updatedOptions = question.options.map((opt, idx) =>
idx === optionIndex ? { ...opt, text: value } : opt
);
const strippedPrompt = stripUnderlineTags(question.prompt);
const newPrompt = addUnderlineTags(strippedPrompt, updatedOptions);
onQuestionChange({
...question,
prompt: newPrompt,
options: updatedOptions
});
};
return (
<div className="space-y-4">
<div className="flex gap-2 items-center">
{isEditing ? (
<input
value={stripUnderlineTags(question.prompt)}
onChange={(e) => handlePromptChange(e.target.value)}
className="flex-1 p-3 border rounded-lg focus:outline-none"
placeholder="Enter text for underlining..."
/>
) : (
<div
className="flex-1 p-3 border rounded-lg min-h-[50px]"
dangerouslySetInnerHTML={{ __html: question.prompt || '' }}
/>
)}
<button
onClick={() => setIsEditing(!isEditing)}
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
>
{isEditing ?
<MdEditOff size={24} className="text-gray-500" /> :
<MdEdit size={24} className="text-gray-500" />
}
</button>
</div>
{validationErrors.length > 0 && (
<div className="text-red-500 text-sm">
{validationErrors.map((error, index) => (
<div key={index}>{error}</div>
))}
</div>
)}
<div className="space-y-2">
{question.options.map((option, optionIndex) => {
const isInvalidOption = option.text?.trim() &&
!stripUnderlineTags(question.prompt || '').toLowerCase()
.includes(stripUnderlineTags(option.text).trim().toLowerCase());
return (
<div key={option.id} className="flex gap-2">
<label
className={clsx(
"flex-none w-12 p-3 text-center rounded-lg border-2 transition-all cursor-pointer",
question.solution === option.id
? 'border-blue-500 bg-blue-50 text-blue-700'
: 'border-gray-200 hover:border-gray-300'
)}
>
<input
type="radio"
name={`solution-${question.id}`}
value={option.id}
checked={question.solution === option.id}
onChange={(e) => onQuestionChange({
...question,
solution: e.target.value
})}
className="sr-only"
/>
{option.id}
</label>
<input
type="text"
value={stripUnderlineTags(option.text || '')}
onChange={(e) => handleOptionChange(optionIndex, e.target.value)}
className={clsx(
"flex-1 p-3 border rounded-lg focus:ring-2 focus:outline-none",
isInvalidOption
? "border-red-500 focus:ring-red-500 bg-red-50"
: "focus:ring-blue-500"
)}
placeholder={`Option ${option.id}...`}
/>
</div>
);
})}
</div>
</div>
);
};
export default UnderlineQuestion;

View File

@@ -0,0 +1,179 @@
import Header from "@/components/ExamEditor/Shared/Header";
import QuestionsList from "../../Shared/QuestionsList";
import SortableQuestion from "../../Shared/SortableQuestion";
import UnderlineQuestion from "./UnderlineQuestion";
import useSectionEdit from "@/components/ExamEditor/Hooks/useSectionEdit";
import { toast } from "react-toastify";
import setEditingAlert from "../../Shared/setEditingAlert";
import { Difficulty, LevelPart, ListeningPart, MultipleChoiceExercise, MultipleChoiceQuestion, ReadingPart } from "@/interfaces/exam";
import useExamEditorStore from "@/stores/examEditor";
import { useCallback, useEffect, useState } from "react";
import { MdAdd } from "react-icons/md";
import Alert, { AlertItem } from "../../Shared/Alert";
import PromptEdit from "../../Shared/PromptEdit";
import { uuidv4 } from "@firebase/util";
const UnderlineMultipleChoice: React.FC<{exercise: MultipleChoiceExercise, sectionId: number}> = ({
exercise,
sectionId,
}) => {
const { currentModule, dispatch } = useExamEditorStore();
const difficulty = useExamEditorStore((state) => state.modules[currentModule].difficulty);
const { state } = useExamEditorStore(
(state) => state.modules[currentModule].sections.find((section) => section.sectionId === sectionId)!
);
const section = state as ReadingPart | ListeningPart | LevelPart;
const [local, setLocal] = useState(exercise);
const [alerts, setAlerts] = useState<AlertItem[]>([]);
useEffect(() => {
setLocal(exercise);
}, [exercise]);
const updateLocal = (exercise: MultipleChoiceExercise) => {
setLocal(exercise);
setEditingAlert(true, setAlerts);
setEditing(true);
};
const handleQuestionChange = (questionIndex: number, updatedQuestion: MultipleChoiceQuestion) => {
const newQuestions = [...local.questions];
newQuestions[questionIndex] = updatedQuestion;
updateLocal({ ...local, questions: newQuestions });
};
const addQuestion = () => {
const newId = (parseInt(local.questions[local.questions.length - 1].id) + 1).toString();
const options = Array.from({ length: 4 }, (_, i) => ({
id: String.fromCharCode(65 + i),
text: ''
}));
updateLocal({
...local,
questions: [
...local.questions,
{
prompt: "",
solution: "",
uuid: uuidv4(),
id: newId,
options,
variant: "text"
},
]
});
};
const deleteQuestion = (index: number) => {
if (local.questions.length === 1) {
toast.error("There needs to be at least one question!");
return;
}
const newQuestions = local.questions.filter((_, i) => i !== index);
updateLocal({ ...local, questions: newQuestions });
};
const { editing, handleSave, handleDiscard, handleDelete, handlePractice, setEditing } = useSectionEdit({
sectionId,
onSave: () => {
setEditing(false);
setAlerts([]);
const newSection = {
...section,
exercises: section.exercises.map((ex) =>
ex.id === local.id ? local : ex
)
};
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: newSection, module: currentModule } });
},
onDiscard: () => {
setAlerts([]);
setLocal(exercise);
setEditing(false);
},
onDelete: () => {
const newSection = {
...section,
exercises: section.exercises.filter((ex) => ex.id !== local.id)
};
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: newSection, module: currentModule } });
},
onPractice: () => {
const updatedExercise = {
...local,
isPractice: !local.isPractice
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
setLocal((prev) => ({...prev, isPractice: !local.isPractice}))
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}
});
const saveDifficulty = useCallback((diff: Difficulty) => {
if (!difficulty.includes(diff)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, diff]} } });
}
const updatedExercise = { ...exercise, difficulty: diff };
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) => ex.id === exercise.id ? updatedExercise : ex );
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}, [currentModule, difficulty, dispatch, exercise, section, sectionId]);
return (
<div className="p-4">
<Header
title='Underline Multiple Choice Exercise'
description="Edit questions with 4 underline options each"
editing={editing}
difficulty={exercise.difficulty}
saveDifficulty={saveDifficulty}
handleSave={handleSave}
handleDelete={handleDelete}
handlePractice={handlePractice}
handleDiscard={handleDiscard}
isEvaluationEnabled={!local.isPractice}
/>
{alerts.length > 0 && <Alert className="mb-6" alerts={alerts} />}
<PromptEdit value={local.prompt} onChange={(prompt: string) => updateLocal({...local, prompt})} />
<div className="space-y-4">
<QuestionsList
ids={local.questions.map(q => q.id)}
handleDragEnd={()=> {}}
>
{local.questions.map((question, questionIndex) => (
<SortableQuestion
key={question.id}
id={question.id}
index={questionIndex}
deleteQuestion={() => deleteQuestion(questionIndex)}
>
<UnderlineQuestion
question={question}
onQuestionChange={(updatedQuestion) =>
handleQuestionChange(questionIndex, updatedQuestion)
}
/>
</SortableQuestion>
))}
</QuestionsList>
<button
onClick={addQuestion}
className="w-full p-4 border-2 border-dashed border-gray-300 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition-colors flex items-center justify-center gap-2 text-gray-600 hover:text-blue-600"
>
<MdAdd size={18} />
Add New Question
</button>
</div>
</div>
);
};
export default UnderlineMultipleChoice;

View File

@@ -0,0 +1,302 @@
import React, { useCallback, useEffect, useState } from 'react';
import { Card, CardContent } from '@/components/ui/card';
import {
MdAdd,
MdEdit,
MdEditOff,
} from 'react-icons/md';
import { ReadingPart, MultipleChoiceExercise, MultipleChoiceQuestion, LevelPart, ListeningPart, Difficulty } from '@/interfaces/exam';
import clsx from 'clsx';
import useExamEditorStore from '@/stores/examEditor';
import { toast } from 'react-toastify';
import { DragEndEvent } from '@dnd-kit/core';
import useSectionEdit from '@/components/ExamEditor/Hooks/useSectionEdit';
import Header from '@/components/ExamEditor/Shared/Header';
import Alert, { AlertItem } from '../../Shared/Alert';
import QuestionsList from '../../Shared/QuestionsList';
import SortableQuestion from '../../Shared/SortableQuestion';
import setEditingAlert from '../../Shared/setEditingAlert';
import { handleMultipleChoiceReorder } from '@/stores/examEditor/reorder/local';
import PromptEdit from '../../Shared/PromptEdit';
import { uuidv4 } from '@firebase/util';
interface MultipleChoiceProps {
exercise: MultipleChoiceExercise;
sectionId: number;
optionsQuantity: number;
}
const validateMultipleChoiceQuestions = (
questions: MultipleChoiceQuestion[],
optionsQuantity: number,
setAlerts: React.Dispatch<React.SetStateAction<AlertItem[]>>
) => {
const validationAlerts: AlertItem[] = [];
questions.forEach((question, index) => {
if (!question.prompt.trim()) {
validationAlerts.push({
variant: 'error',
tag: `missing-prompt-${index}`,
description: `Question ${index + 1} is missing a prompt`
});
}
if (!question.solution) {
validationAlerts.push({
variant: 'error',
tag: `missing-solution-${index}`,
description: `Question ${index + 1} is missing a solution`
});
}
if (question.options.length !== optionsQuantity) {
validationAlerts.push({
variant: 'error',
tag: `invalid-options-${index}`,
description: `Question ${index + 1} must have exactly ${optionsQuantity} options`
});
}
question.options.forEach((option, optionIndex) => {
if (option.text && option.text.trim() === "") {
validationAlerts.push({
variant: 'error',
tag: `empty-option-${index}-${optionIndex}`,
description: `Question ${index + 1} has an empty option`
});
}
});
});
setAlerts(prev => {
const editingAlert = prev.find(alert => alert.tag === 'editing');
return [...validationAlerts, ...(editingAlert ? [editingAlert] : [])];
});
return validationAlerts.length === 0;
};
const MultipleChoice: React.FC<MultipleChoiceProps> = ({ exercise, sectionId, optionsQuantity }) => {
const { currentModule, dispatch } = useExamEditorStore();
const difficulty = useExamEditorStore((state) => state.modules[currentModule].difficulty);
const { state } = useExamEditorStore(
(state) => state.modules[currentModule].sections.find((section) => section.sectionId === sectionId)!
);
const section = state as ReadingPart | ListeningPart| LevelPart;
const [local, setLocal] = useState(exercise);
const [editingPrompt, setEditingPrompt] = useState(false);
const [alerts, setAlerts] = useState<AlertItem[]>([]);
const updateLocal = (exercise: MultipleChoiceExercise) => {
setLocal(exercise);
setEditingAlert(true, setAlerts);
setEditing(true);
};
const updateQuestion = (index: number, field: string, value: string) => {
const newQuestions = [...local.questions];
newQuestions[index] = { ...newQuestions[index], [field]: value };
updateLocal({ ...local, questions: newQuestions });
};
const updateOption = (questionIndex: number, optionIndex: number, value: string) => {
const newQuestions = [...local.questions];
const newOptions = [...newQuestions[questionIndex].options];
newOptions[optionIndex] = { ...newOptions[optionIndex], text: value };
newQuestions[questionIndex] = { ...newQuestions[questionIndex], options: newOptions };
updateLocal({ ...local, questions: newQuestions });
};
const addQuestion = () => {
const newId = (parseInt(local.questions[local.questions.length - 1].id) + 1).toString();
const options = Array.from({ length: optionsQuantity }, (_, i) => ({
id: String.fromCharCode(65 + i),
text: ''
}));
updateLocal({
...local,
questions: [
...local.questions,
{
prompt: "",
solution: "",
uuid: uuidv4(),
id: newId,
options,
variant: "text"
},
]
});
};
const deleteQuestion = (index: number) => {
if (local.questions.length === 1) {
toast.error("There needs to be at least one question!");
return;
}
const newQuestions = local.questions.filter((_, i) => i !== index);
const minId = Math.min(...newQuestions.map(q => parseInt(q.id)));
const updatedQuestions = newQuestions.map((question, i) => ({
...question,
id: String(minId + i)
}));
updateLocal({ ...local, questions: updatedQuestions });
};
const { editing, handleSave, handleDiscard, handleDelete, handlePractice, setEditing } = useSectionEdit({
sectionId,
onSave: () => {
const isValid = validateMultipleChoiceQuestions(
local.questions,
optionsQuantity,
setAlerts
);
if (!isValid) {
toast.error("Please fix the errors before saving!");
return;
}
setEditing(false);
setAlerts([]);
const newSection = {
...section,
exercises: section.exercises.map((ex) => ex.id === local.id ? local : ex)
};
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: newSection, module: currentModule } });
},
onDiscard: () => {
setEditing(false);
setAlerts([]);
setLocal(exercise);
},
onDelete: () => {
const newSection = {
...section,
exercises: section.exercises.filter((ex) => ex.id !== local.id)
};
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: newSection, module: currentModule } });
},
onPractice: () => {
const updatedExercise = {
...local,
isPractice: !local.isPractice
};
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) =>
ex.id === exercise.id ? updatedExercise : ex
);
setLocal((prev) => ({...prev, isPractice: !local.isPractice}))
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}
});
useEffect(() => {
validateMultipleChoiceQuestions(local.questions, optionsQuantity, setAlerts);
}, [local.questions, optionsQuantity]);
const handleDragEnd = (event: DragEndEvent) => {
setEditingAlert(true, setAlerts);
setEditing(true);
setLocal(handleMultipleChoiceReorder(event, local));
};
const saveDifficulty = useCallback((diff: Difficulty) => {
if (!difficulty.includes(diff)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, diff]} } });
}
const updatedExercise = { ...exercise, difficulty: diff };
const newState = { ...section };
newState.exercises = newState.exercises.map((ex) => ex.id === exercise.id ? updatedExercise : ex );
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}, [currentModule, difficulty, dispatch, exercise, section, sectionId]);
return (
<div className="p-4">
<Header
title='Multiple Choice Exercise'
description={`Edit questions with ${optionsQuantity} options each`}
editing={editing}
difficulty={exercise.difficulty}
saveDifficulty={saveDifficulty}
handleSave={handleSave}
handleDelete={handleDelete}
handleDiscard={handleDiscard}
handlePractice={handlePractice}
isEvaluationEnabled={!local.isPractice}
/>
{alerts.length > 0 && <Alert className="mb-6" alerts={alerts} />}
<PromptEdit value={local.prompt} onChange={(prompt: string) => updateLocal({...local, prompt})} />
<div className="space-y-4">
<QuestionsList
ids={local.questions.map(q => q.id)}
handleDragEnd={handleDragEnd}
>
{local.questions.map((question, questionIndex) => (
<SortableQuestion
key={question.id}
id={question.id}
index={questionIndex}
deleteQuestion={deleteQuestion}
>
<div className="space-y-4">
<input
type="text"
value={question.prompt}
onChange={(e) => updateQuestion(questionIndex, 'prompt', e.target.value)}
className="w-full p-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
placeholder="Enter question..."
/>
<div className="space-y-2">
{question.options.map((option, optionIndex) => (
<div key={option.id} className="flex gap-2">
<label
className={clsx(
"flex-none w-12 p-3 text-center rounded-lg border-2 transition-all cursor-pointer",
question.solution === option.id
? 'border-blue-500 bg-blue-50 text-blue-700'
: 'border-gray-200 hover:border-gray-300'
)}
>
<input
type="radio"
name={`solution-${question.id}`}
value={option.id}
checked={question.solution === option.id}
onChange={(e) => updateQuestion(questionIndex, 'solution', e.target.value)}
className="sr-only"
/>
{option.id}
</label>
<input
type="text"
value={option.text}
onChange={(e) => updateOption(questionIndex, optionIndex, e.target.value)}
className="flex-1 p-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
placeholder={`Option ${option.id}...`}
/>
</div>
))}
</div>
</div>
</SortableQuestion>
))}
</QuestionsList>
<button
onClick={addQuestion}
className="w-full p-4 border-2 border-dashed border-gray-300 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition-colors flex items-center justify-center gap-2 text-gray-600 hover:text-blue-600"
>
<MdAdd size={18} />
Add New Question
</button>
</div>
</div>
);
};
export default MultipleChoice;

View File

@@ -0,0 +1,17 @@
import { MultipleChoiceExercise } from "@/interfaces/exam";
import Vanilla from "./Vanilla";
import MultipleChoiceUnderline from "./Underline";
const MultipleChoice: React.FC<{sectionId: number; exercise: MultipleChoiceExercise}> = (props) => {
const {exercise} = props;
const length = exercise.questions[0].options.length;
if (exercise.questions[0].prompt.includes('<u>')) {
return <MultipleChoiceUnderline {...props} />
}
return (<Vanilla {...props} optionsQuantity={length}/>);
}
export default MultipleChoice;

View File

@@ -0,0 +1,86 @@
import AutoExpandingTextArea from "@/components/Low/AutoExpandingTextarea";
import { useState } from "react";
import { FaEdit, FaFemale, FaMale } from "react-icons/fa";
import { FaTrash } from "react-icons/fa6";
import { ScriptLine } from ".";
interface MessageProps {
message: ScriptLine & { position: 'left' | 'right' };
color: string;
editing: boolean;
onEdit?: (text: string) => void;
onDelete?: () => void;
}
const Message: React.FC<MessageProps> = ({ message, color, editing, onEdit, onDelete }) => {
const [isEditing, setIsEditing] = useState(false);
const [editText, setEditText] = useState(message.text);
return (
<div className={`flex items-start gap-2 ${message.position === 'left' ? 'justify-start' : 'justify-end'}`}>
<div className="flex flex-col w-[50%]">
<div className={`flex items-center gap-2 ${message.position === 'right' && 'self-end'}`}>
{message.gender === 'male' ? (
<FaMale className="w-5 h-5 text-blue-500" />
) : (
<FaFemale className="w-5 h-5 text-pink-500" />
)}
<span className="text-sm font-medium">{message.name}</span>
</div>
<div className={`rounded-lg p-3 bg-${color}-100 relative group mt-1`}>
{isEditing ? (
<div className="flex flex-col gap-2">
<AutoExpandingTextArea
value={editText}
onChange={setEditText}
placeholder="Edit message..."
className="w-full min-h-[96px] px-4 py-2 border border-gray-200 rounded-lg focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-base resize-none"
/>
<div className="flex justify-between">
<button
className="px-3 py-1 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors text-sm font-medium"
onClick={() => {
onEdit?.(editText);
setIsEditing(false);
}}
>
Save
</button>
<button
className="px-3 py-1 bg-red-500 rounded-md hover:bg-gray-100 transition-colors text-sm font-medium text-white"
onClick={() => setIsEditing(false)}
>
Cancel
</button>
</div>
</div>
) : (
<div className="flex items-start justify-between gap-2">
<p className="text-gray-700 whitespace-pre-wrap flex-grow">{message.text}</p>
{editing && (
<div className="flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity">
<div className="flex gap-1">
<button
onClick={() => setIsEditing(true)}
className="p-1 rounded hover:bg-gray-200 transition-colors"
>
<FaEdit className="w-3.5 h-3.5 text-gray-600" />
</button>
<button
onClick={onDelete}
className="p-1 rounded hover:bg-gray-200 transition-colors"
>
<FaTrash className="w-3.5 h-3.5 text-red-500" />
</button>
</div>
</div>
)}
</div>
)}
</div>
</div>
</div>
);
};
export default Message;

View File

@@ -0,0 +1,360 @@
import React, { useState, useMemo } from 'react';
import { Script } from "@/interfaces/exam";
import Message from './Message';
import AutoExpandingTextArea from '@/components/Low/AutoExpandingTextarea';
import { Card, CardContent } from '@/components/ui/card';
import Input from '@/components/Low/Input';
import { FaFemale, FaMale, FaPlus } from 'react-icons/fa';
import clsx from 'clsx';
import { toast } from 'react-toastify';
export interface Speaker {
id: number;
name: string;
gender: 'male' | 'female';
color: string;
position: 'left' | 'right';
}
type Gender = 'male' | 'female';
export interface ScriptLine {
name: string;
gender: Gender;
text: string;
voice?: string;
}
interface MessageWithPosition extends ScriptLine {
position: 'left' | 'right';
}
interface Props {
section: number;
editing?: boolean;
local?: Script;
setLocal: (script: Script) => void;
}
const colorOptions = [
'red', 'blue', 'green', 'purple', 'pink', 'indigo', 'teal', 'orange',
'cyan', 'emerald', 'sky', 'violet', 'fuchsia', 'rose', 'lime', 'slate'
];
const ScriptEditor: React.FC<Props> = ({ section, editing = false, local, setLocal }) => {
const isConversation = [1, 3].includes(section);
const speakerCount = section === 1 ? 2 : 4;
if (local === undefined) {
if (isConversation) {
setLocal([]);
} else {
setLocal('');
}
}
const [selectedSpeaker, setSelectedSpeaker] = useState<string>('');
const [newMessage, setNewMessage] = useState('');
const [speakers, setSpeakers] = useState<Speaker[]>(() => {
if (local === undefined) {
return Array.from({ length: speakerCount }, (_, index) => ({
id: index,
name: '',
gender: 'male',
color: colorOptions[index],
position: index % 2 === 0 ? 'left' : 'right'
}));
}
const existingScript = local as ScriptLine[];
const existingSpeakers = new Set<string>();
const speakerGenders = new Map<string, 'male' | 'female'>();
if (Array.isArray(existingScript)) {
existingScript.forEach(line => {
existingSpeakers.add(line.name);
speakerGenders.set(line.name, line.gender.toLowerCase() === 'female' ? 'female' : 'male' as 'male' | 'female');
});
}
const speakerArray = Array.from(existingSpeakers);
const totalNeeded = Math.max(speakerCount, speakerArray.length);
return Array.from({ length: totalNeeded }, (_, index) => {
if (index < speakerArray.length) {
return {
id: index,
name: speakerArray[index],
gender: speakerGenders.get(speakerArray[index]) || 'male',
color: colorOptions[index],
position: index % 2 === 0 ? 'left' : 'right'
};
}
return {
id: index,
name: '',
gender: 'male',
color: colorOptions[index],
position: index % 2 === 0 ? 'left' : 'right'
};
});
});
const speakerProperties = useMemo(() => {
return speakers.reduce((acc, speaker) => {
if (speaker.name) {
acc[speaker.name] = {
color: speaker.color,
gender: speaker.gender
};
}
return acc;
}, {} as Record<string, { color: string; gender: 'male' | 'female' }>);
}, [speakers]);
const allSpeakersConfigured = useMemo(() => {
return speakers.every(speaker => speaker.name.trim() !== '');
}, [speakers]);
const updateSpeaker = (index: number, updates: Partial<Speaker>) => {
const updatedSpeakers = speakers.map((speaker, i) => {
if (i === index) {
return { ...speaker, ...updates };
}
return speaker;
});
setSpeakers(updatedSpeakers);
if (Array.isArray(local)) {
if ('name' in updates && speakers[index].name) {
const oldName = speakers[index].name;
const newName = updates.name || '';
const updatedScript = local.map(line => {
if (line.name === oldName) {
return { ...line, name: newName };
}
return line;
});
setLocal(updatedScript);
}
if ('gender' in updates && speakers[index].name && updates.gender) {
const name = speakers[index].name;
const newGender = updates.gender;
const updatedScript = local.map(line => {
if (line.name === name) {
return { ...line, gender: newGender };
}
return line;
});
setLocal(updatedScript);
}
}
if ('name' in updates && speakers[index].name === selectedSpeaker) {
setSelectedSpeaker(updates.name || '');
}
};
const addMessage = () => {
if (!isConversation || !selectedSpeaker || !newMessage.trim()) return;
if (!Array.isArray(local)) return;
const speaker = speakers.find(s => s.name === selectedSpeaker);
if (!speaker) return;
const newLine: ScriptLine = {
name: selectedSpeaker,
gender: speaker.gender,
text: newMessage.trim()
};
const updatedScript = [...local, newLine];
setLocal(updatedScript);
setNewMessage('');
};
const updateMessage = (index: number, newText: string) => {
if (!Array.isArray(local)) return;
const updatedScript = [...local];
updatedScript[index] = { ...updatedScript[index], text: newText };
setLocal(updatedScript);
};
const deleteMessage = (index: number) => {
if (!Array.isArray(local)) return;
const updatedScript = local.filter((_, i) => i !== index);
setLocal(updatedScript);
};
const updateMonologue = (text: string) => {
setLocal(text);
};
const messages = useMemo(() => {
if (typeof local === 'string' || !Array.isArray(local)) return [];
return local.reduce<MessageWithPosition[]>((acc, line, index) => {
const normalizedLine = {
...line,
gender: line.gender.toLowerCase() === 'female' ? 'female' : 'male'
} as ScriptLine;
if (index === 0) {
acc.push({ ...normalizedLine, position: 'left' });
} else {
const prevMsg = acc[index - 1];
const position = line.name === prevMsg.name
? prevMsg.position
: (prevMsg.position === 'left' ? 'right' : 'left');
acc.push({ ...normalizedLine, position });
}
return acc;
}, []);
}, [local]);
if (!isConversation) {
if (typeof local !== 'string') {
toast.error(`Section ${section} is monologue based, but the import contained a conversation!`);
setLocal('');
return null;
}
return (
<Card>
<CardContent className="py-10">
<div className="w-full">
{editing ? (
<AutoExpandingTextArea
value={local as string}
onChange={updateMonologue}
placeholder='Write the monologue here...'
/>
) : (
<div className="p-8 shadow-inner border border-gray-200 bg-gray-50 rounded-xl">
<span>{(local as string) || "Edit, generate or import your own audio."}</span>
</div>
)}
</div>
</CardContent>
</Card>
);
}
if (typeof local === 'string') {
toast.error(`Section ${section} is conversation based, but the import contained a monologue!`);
setLocal([]);
return null;
}
return (
<Card>
<CardContent className="py-10">
<div className="space-y-6">
{editing && (
<div className="bg-white rounded-2xl p-6 shadow-inner border mb-8">
<h3 className="text-lg font-medium text-gray-700 mb-6">Edit Conversation</h3>
<div className="space-y-4 mb-6">
{speakers.map((speaker, index) => (
<div key={index} className="flex items-center gap-4">
<div className="flex-1">
<Input
type="text"
name=""
value={speaker.name}
onChange={(text) => updateSpeaker(index, { name: text })}
placeholder="Speaker name"
/>
</div>
<div className="w-[140px] relative">
<select
value={speaker.gender}
onChange={(e) => updateSpeaker(index, { gender: e.target.value as 'male' | 'female' })}
className="w-full appearance-none px-4 py-2 border border-gray-200 rounded-full text-base bg-white focus:ring-1 focus:ring-blue-500 focus:outline-none"
>
<option value="female">Female</option>
<option value="male">Male</option>
</select>
<div className="absolute right-3 top-2.5 pointer-events-none">
{speaker.gender === 'male' ? (
<FaMale className="w-5 h-5 text-blue-500" />
) : (
<FaFemale className="w-5 h-5 text-pink-500" />
)}
</div>
</div>
</div>
))}
</div>
<div className="flex gap-4">
<div className="w-[240px] flex flex-col gap-2">
<select
value={selectedSpeaker}
onChange={(e) => setSelectedSpeaker(e.target.value)}
disabled={!allSpeakersConfigured}
className="w-full h-[42px] px-4 appearance-none border border-gray-200 rounded-full focus:ring-1 focus:ring-blue-500 focus:outline-none bg-white text-gray-700 text-base disabled:bg-gray-100"
>
<option value="">Select Speaker ...</option>
{speakers.filter(s => s.name).map((speaker) => (
<option key={speaker.id} value={speaker.name}>
{speaker.name}
</option>
))}
</select>
<button
onClick={addMessage}
disabled={!selectedSpeaker || !newMessage.trim() || !allSpeakersConfigured}
className={clsx(
"w-full h-[42px] rounded-lg flex items-center justify-center gap-2 transition-colors font-medium",
!selectedSpeaker || !newMessage.trim() || !allSpeakersConfigured
? 'bg-gray-100 text-gray-500 cursor-not-allowed'
: 'bg-blue-500 text-white hover:bg-blue-600'
)}
>
<FaPlus className="w-4 h-4" />
Add
</button>
</div>
<div className="flex-1">
<AutoExpandingTextArea
value={newMessage}
onChange={setNewMessage}
placeholder={allSpeakersConfigured ? "Type your message..." : "Configure all speakers first"}
disabled={!allSpeakersConfigured}
className="w-full min-h-[96px] px-4 py-2 border border-gray-200 rounded-lg focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-base resize-none disabled:bg-gray-100"
/>
</div>
</div>
</div>
)}
<div className="space-y-4">
{messages.map((message, index) => {
const properties = speakerProperties[message.name];
if (!properties) return null;
return (
<Message
key={index}
message={message}
color={properties.color}
editing={editing}
onEdit={(text: string) => updateMessage(index, text)}
onDelete={() => deleteMessage(index)}
/>
);
})}
</div>
</div>
</CardContent>
</Card>
);
};
export default ScriptEditor;

View File

@@ -0,0 +1,61 @@
import clsx from "clsx";
import { BiErrorCircle } from "react-icons/bi";
import { IoInformationCircle } from "react-icons/io5";
export interface AlertItem {
variant: "info" | "error";
description: string;
tag?: string;
}
interface Props {
alerts: AlertItem[];
className?: string;
}
const Alert: React.FC<Props> = ({ alerts, className }) => {
const hasError = alerts.some(alert => alert.variant === "error");
const alertsToShow = hasError ? alerts.filter(alert => alert.variant === "error") : alerts;
if (alertsToShow.length === 0) return null;
return (
<div className={clsx("space-y-2", className)}>
{alertsToShow.map((alert, index) => (
<div
key={index}
className={clsx(
"border rounded-xl flex items-center gap-2 py-2 px-4",
{
'bg-amber-50': alert.variant === 'info',
'bg-red-50': alert.variant === 'error'
}
)}
>
{alert.variant === 'info' ? (
<IoInformationCircle
className="h-5 w-5 text-amber-700"
/>
) : (
<BiErrorCircle
className="h-5 w-5 text-red-700"
/>
)}
<p
className={clsx(
"font-medium py-0.5",
{
'text-amber-700': alert.variant === 'info',
'text-red-700': alert.variant === 'error'
}
)}
>
{alert.description}
</p>
</div>
))}
</div>
);
};
export default Alert;

View File

@@ -0,0 +1,14 @@
import clsx from "clsx";
const GenLoader: React.FC<{module: string, custom?: string, className?: string}> = ({module, custom, className}) => {
return (
<div className={clsx("w-full cursor-text px-7 py-8 border-2 border-mti-gray-platinum rounded-3xl", className)}>
<div className="flex flex-col items-center justify-center animate-pulse">
<span className={`loading loading-infinity w-32 bg-ielts-${module}`} />
<span className={`font-bold text-2xl text-ielts-${module}`}>{`${custom ? custom : "Generating..."}`}</span>
</div>
</div>
);
}
export default GenLoader;

View File

@@ -0,0 +1,70 @@
import AutoExpandingTextArea from "@/components/Low/AutoExpandingTextarea";
import { Card, CardContent } from "@/components/ui/card";
import { useState } from "react";
import { MdEdit, MdEditOff } from "react-icons/md";
interface Props {
value: string;
onChange: (text: string) => void;
wrapperCard?: boolean;
}
const PromptEdit: React.FC<Props> = ({ value, onChange, wrapperCard = true }) => {
const [editing, setEditing] = useState(false);
const renderTextWithLineBreaks = (text: string) => {
const unescapedText = text.replace(/\\n/g, '\n');
return unescapedText.split('\n').map((line, index, array) => (
<span key={index}>
{line}
{index < array.length - 1 && <br />}
</span>
));
};
const promptEditTsx = (
<div className="flex justify-between items-start gap-4">
{editing ? (
<AutoExpandingTextArea
className="flex-1 p-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none min-h-[100px]"
value={value}
onChange={onChange}
onBlur={() => setEditing(false)}
/>
) : (
<div className="flex-1">
<h3 className="font-medium text-gray-800 mb-2">
Question/Instructions displayed to the student:
</h3>
<p className="text-gray-600">
{renderTextWithLineBreaks(value)}
</p>
</div>
)}
<button
onClick={() => setEditing(!editing)}
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
>
{editing ? (
<MdEditOff size={20} className="text-gray-500" />
) : (
<MdEdit size={20} className="text-gray-500" />
)}
</button>
</div>
);
if (!wrapperCard) {
return promptEditTsx;
}
return (
<Card className="mb-6">
<CardContent className="p-4">
{promptEditTsx}
</CardContent>
</Card>
);
};
export default PromptEdit;

View File

@@ -0,0 +1,34 @@
import { closestCenter, DndContext, PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
import { ReactNode } from "react";
interface Props {
ids: string[];
handleDragEnd: (event: any) => void;
children: ReactNode;
}
const QuestionsList: React.FC<Props> = ({ ids, handleDragEnd, children }) => {
const sensors = useSensors(
useSensor(PointerSensor),
);
return (
<DndContext
sensors={sensors}
collisionDetection={closestCenter}
onDragEnd={handleDragEnd}
>
<SortableContext
items={ids}
strategy={verticalListSortingStrategy}
>
<div className="space-y-4">
{children}
</div>
</SortableContext>
</DndContext>
);
};
export default QuestionsList;

View File

@@ -0,0 +1,155 @@
import React, { ReactNode, useState } from 'react';
import { Card, CardContent } from '@/components/ui/card';
import { MdDragIndicator, MdDelete, MdEdit, MdEditOff } from 'react-icons/md';
import { useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
import clsx from 'clsx';
interface Props {
id: string;
index: number;
deleteQuestion: (index: any) => void;
onFocus?: () => void;
extra?: ReactNode;
children: ReactNode;
variant?: 'default' | 'writeBlanks' | 'del-up';
title?: string;
onQuestionChange?: (value: string) => void;
questionText?: string;
}
const SortableQuestion: React.FC<Props> = ({
id,
index,
deleteQuestion,
children,
extra,
onFocus,
variant = 'default',
questionText = "",
onQuestionChange
}) => {
const [isEditingQuestion, setIsEditingQuestion] = useState(false);
const {
attributes,
listeners,
setNodeRef,
transform,
transition,
isDragging,
} = useSortable({ id });
const style = {
transform: CSS.Transform.toString(transform),
transition,
opacity: isDragging ? 0.5 : 1,
};
if (variant === 'writeBlanks') {
return (
<Card ref={setNodeRef} style={style} onFocus={onFocus}>
<CardContent className="p-4">
<div className="flex items-stretch gap-4">
<div className='flex flex-col flex-none w-12'>
<div className="flex-none">
<span className="text-sm font-medium text-gray-500">ID: {id}</span>
</div>
<div
className='flex-1 flex items-center justify-center group'
{...attributes}
{...listeners}
>
<div className="p-2 rounded-lg group-hover:bg-gray-100 cursor-grab active:cursor-grabbing transition-colors">
<MdDragIndicator size={24} className="text-gray-400" />
</div>
</div>
</div>
<div className="flex-1">
<div className="flex items-start justify-between gap-4">
{isEditingQuestion ? (
<input
type="text"
value={questionText}
onChange={(e) => onQuestionChange?.(e.target.value)}
className="flex-1 p-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
autoFocus
onBlur={() => setIsEditingQuestion(false)}
onKeyDown={(e) => {
if (e.key === 'Enter') {
setIsEditingQuestion(false);
}
}}
/>
) : (
<span className="flex-1 font-bold text-gray-800">{questionText}</span>
)}
<div className="flex items-center gap-2 flex-none">
<button
onClick={() => setIsEditingQuestion(!isEditingQuestion)}
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
>
{isEditingQuestion ?
<MdEditOff size={20} className="text-gray-500" /> :
<MdEdit size={20} className="text-gray-500" />
}
</button>
<button
onClick={() => deleteQuestion(index)}
className="p-2 text-red-500 hover:bg-red-50 rounded-lg transition-colors"
title="Delete question"
>
<MdDelete size={20} />
</button>
</div>
</div>
<div className="mt-4 space-y-3">
{children}
</div>
</div>
</div>
{extra && <div className="mt-4">{extra}</div>}
</CardContent>
</Card>
);
}
return (
<Card ref={setNodeRef} style={style} onFocus={onFocus}>
<CardContent className="p-4">
<div className="flex items-stretch gap-4">
<div className='flex flex-col flex-none w-12'>
<div className="flex-none">
<span className="text-sm font-medium text-gray-500">ID: {id}</span>
</div>
<div className='flex-1 flex items-center justify-center group'>
<div
{...attributes}
{...listeners}
className="p-2 rounded-lg group-hover:bg-gray-100 cursor-grab active:cursor-grabbing transition-colors"
>
<MdDragIndicator size={24} className="text-gray-400" />
</div>
</div>
</div>
<div className="flex-1 space-y-3">
{children}
</div>
<div className={clsx('flex flex-col gap-4', variant !== "del-up" ? "justify-center": "mt-1.5")}>
<button
onClick={() => deleteQuestion(index)}
className="p-2 text-red-500 hover:bg-red-50 rounded-lg transition-colors"
title="Delete question"
>
<MdDelete size={variant !== "del-up" ? 20 : 24} />
</button>
{extra}
</div>
</div>
</CardContent>
</Card>
);
};
export default SortableQuestion;

View File

@@ -0,0 +1,21 @@
import { AlertItem } from "./Alert";
const setEditingAlert = (editing: boolean, setAlerts: React.Dispatch<React.SetStateAction<AlertItem[]>>) => {
if (editing) {
setAlerts(prev => {
if (!prev.some(alert => alert.variant === "info")) {
return [...prev, {
variant: "info",
description: "You have unsaved changes. Don't forget to save your work!",
tag: "editing"
}];
}
return prev;
});
} else {
setAlerts([]);
}
}
export default setEditingAlert;

View File

@@ -0,0 +1,480 @@
import AutoExpandingTextArea from "@/components/Low/AutoExpandingTextarea";
import { Card, CardContent } from "@/components/ui/card";
import { BiQuestionMark } from 'react-icons/bi';
import { AiOutlineUnorderedList, AiOutlinePlus, AiOutlineDelete } from 'react-icons/ai';
import { Tooltip } from "react-tooltip";
import Header from "../../Shared/Header";
import GenLoader from "../Shared/GenLoader";
import { useCallback, useEffect, useState } from "react";
import useSectionEdit from "../../Hooks/useSectionEdit";
import useExamEditorStore from "@/stores/examEditor";
import { Difficulty, InteractiveSpeakingExercise, LevelPart } from "@/interfaces/exam";
import { BsFileText } from "react-icons/bs";
import { FaChevronLeft, FaChevronRight } from "react-icons/fa6";
import { RiVideoLine } from "react-icons/ri";
import { Module } from "@/interfaces";
interface Props {
sectionId: number;
exercise: InteractiveSpeakingExercise;
module?: Module;
}
const InteractiveSpeaking: React.FC<Props> = ({ sectionId, exercise, module = "speaking" }) => {
const { currentModule, dispatch } = useExamEditorStore();
const difficulty = useExamEditorStore((state) => state.modules[currentModule].difficulty);
const [local, setLocal] = useState(exercise);
const [currentVideoIndex, setCurrentVideoIndex] = useState(0);
const { generating, genResult, state, levelGenResults, levelGenerating } = useExamEditorStore(
(state) => state.modules[module].sections.find((section) => section.sectionId === sectionId)!
);
const { editing, setEditing, handleSave, handleDiscard, handleEdit, handlePractice } = useSectionEdit({
sectionId,
onSave: () => {
setEditing(false);
if (module === "level") {
const updatedState = {
...state,
exercises: (state as LevelPart).exercises.map((ex) =>
ex.id === local.id ? local : ex
)
};
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedState, module }
});
} else {
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: local, module }
});
}
if (genResult) {
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module,
field: "genResult",
value: undefined
}
});
}
const speakingScript = levelGenResults?.find((res) => res.generating === `${local.id}-speakingScript`);
if (module === "level" && speakingScript) {
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD", payload: {
sectionId,
field: "levelGenResults",
value: levelGenResults.filter((res) => res.generating !== `${local.id}-speakingScript`),
module
}
});
}
},
onDiscard: () => {
setLocal(exercise);
},
onPractice: () => {
const updatedLocal = { ...local, isPractice: !local.isPractice };
setLocal(updatedLocal);
if (module === "level") {
const updatedState = {
...state,
exercises: (state as LevelPart).exercises.map((ex) =>
ex.id === local.id ? updatedLocal : ex
)
};
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedState, module }
});
} else {
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedLocal, module }
});
}
},
});
useEffect(() => {
if (genResult && generating === "speakingScript") {
if (!difficulty.includes(genResult.result[0].difficulty)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, genResult.result[0].difficulty]} } });
}
const updatedLocal = {
...local,
title: genResult.result[0].title,
prompts: genResult.result[0].prompts.map((item: any) => ({
text: item || "",
video_url: ""
})),
difficulty: genResult.result[0].difficulty
};
setEditing(true);
setLocal(updatedLocal);
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module,
field: "generating",
value: undefined
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [genResult, generating]);
useEffect(() => {
if (genResult && generating === "video") {
const updatedLocal = { ...local, prompts: genResult.result[0].prompts };
setLocal(updatedLocal);
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedLocal, module }
});
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module,
field: "generating",
value: undefined
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [genResult, generating]);
useEffect(() => {
const speakingScript = levelGenResults?.find((res) => res.generating === `${local.id}-speakingScript`);
const isGenerating = levelGenerating?.includes(`${local.id}-speakingScript`);
if (speakingScript && isGenerating) {
if (!difficulty.includes(speakingScript.result[0].difficulty)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, speakingScript.result[0].difficulty]} } });
}
const updatedLocal = {
...local,
title: speakingScript.result[0].title,
prompts: speakingScript.result[0].prompts.map((item: any) => ({
text: item || "",
video_url: ""
})),
difficulty: speakingScript.result[0].difficulty
};
setEditing(true);
setLocal(updatedLocal);
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD", payload: {
sectionId,
field: "levelGenerating",
value: levelGenerating.filter((g) => g !== `${local.id}-speakingScript`),
module
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [levelGenResults, levelGenerating]);
useEffect(() => {
const speakingVideo = levelGenResults?.find((res) => res.generating === `${local.id}-video`);
const isGenerating = levelGenerating?.includes(`${local.id}-video`);
if (speakingVideo && isGenerating) {
const updatedLocal = { ...local, prompts: speakingVideo.result[0].prompts };
setLocal(updatedLocal);
const updatedState = {
...state,
exercises: (state as LevelPart).exercises.map((ex) =>
ex.id === local.id ? updatedLocal : ex
)
};
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedState, module }
});
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD", payload: {
sectionId,
field: "levelGenerating",
value: levelGenerating.filter((g) => g !== `${local.id}-video`),
module
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [levelGenResults, levelGenerating]);
const addPrompt = () => {
setLocal(prev => ({
...prev,
prompts: [...prev.prompts, { text: "", video_url: "" }]
}));
};
const removePrompt = (index: number) => {
setLocal(prev => ({
...prev,
prompts: prev.prompts.filter((_, i) => i !== index)
}));
};
const updatePrompt = (index: number, text: string) => {
setLocal(prev => {
const newPrompts = [...prev.prompts];
newPrompts[index] = { ...newPrompts[index], text };
return { ...prev, prompts: newPrompts };
});
};
const isUnedited = local.prompts.length === 0;
useEffect(() => {
if (genResult && generating === "video") {
setLocal({ ...local, prompts: genResult.result[0].prompts });
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: { ...local, prompts: genResult.result[0].prompts }, module: module } });
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module: module,
field: "generating",
value: undefined
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [genResult, generating]);
const handlePrevVideo = () => {
setCurrentVideoIndex((prev) => (prev > 0 ? prev - 1 : prev));
};
const handleNextVideo = () => {
setCurrentVideoIndex((prev) =>
(prev < local.prompts.length - 1 ? prev + 1 : prev)
);
};
const saveDifficulty = useCallback((diff: Difficulty)=> {
if (!difficulty.includes(diff)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, diff]} } });
}
if (module !== "level") {
const updatedExercise = { ...exercise, difficulty: diff };
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: updatedExercise, module: currentModule } });
} else {
const updatedExercise = { ...exercise, difficulty: diff };
const newState = { ...state as LevelPart };
newState.exercises = (newState as LevelPart).exercises.map((ex) => ex.id === exercise.id ? updatedExercise : ex );
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}
}, [currentModule, difficulty, dispatch, exercise, module, sectionId, state]);
return (
<>
<div className='relative pb-4'>
<Header
title={`Interactive Speaking Script`}
description='Generate or write the scripts for the videos.'
editing={editing}
difficulty={exercise.difficulty}
saveDifficulty={saveDifficulty}
handleSave={handleSave}
handleEdit={handleEdit}
handleDiscard={handleDiscard}
handlePractice={handlePractice}
isEvaluationEnabled={!local.isPractice}
module="speaking"
/>
</div>
{(generating && generating === "speakingScript") || (levelGenerating.find((g) => g === `${local.id}-speakingScript`)) ? (
<GenLoader module={module} />
) : (
<>
{editing ? (
<>
{local.prompts.every((p) => p.video_url !== "") && (
<Card>
<CardContent className="pt-6">
<div className="flex flex-col items-start gap-3">
<div className="flex flex-row mb-3 gap-4 w-full justify-between items-center">
<div className="flex flex-row gap-4">
<RiVideoLine className="h-5 w-5 text-amber-500 mt-1" />
<h3 className="font-semibold text-xl">Videos</h3>
</div>
<div className="flex items-center gap-4">
<button
onClick={handlePrevVideo}
disabled={currentVideoIndex === 0}
className={`p-2 rounded-full ${currentVideoIndex === 0
? 'text-gray-400 cursor-not-allowed'
: 'text-gray-600 hover:bg-gray-100'
}`}
>
<FaChevronLeft className="w-4 h-4" />
</button>
<span className="text-sm text-gray-600">
{currentVideoIndex + 1} / {local.prompts.length}
</span>
<button
onClick={handleNextVideo}
disabled={currentVideoIndex === local.prompts.length - 1}
className={`p-2 rounded-full ${currentVideoIndex === local.prompts.length - 1
? 'text-gray-400 cursor-not-allowed'
: 'text-gray-600 hover:bg-gray-100'
}`}
>
<FaChevronRight className="w-4 h-4" />
</button>
</div>
</div>
<div className="flex flex-col gap-4 w-full items-center">
<div className="w-full">
<video
key={local.prompts[currentVideoIndex].video_url}
controls
className="w-full rounded-xl"
>
<source src={local.prompts[currentVideoIndex].video_url} />
</video>
</div>
</div>
</div>
</CardContent>
</Card>
)}
{(generating && generating === "video") || levelGenerating.find((g) => g === `${local.id}-video`) &&
<GenLoader module={module} custom="Generating the videos ... This may take a while ..." />
}
<Card>
<CardContent>
<div className="flex flex-col py-2 mt-2">
<h2 className="font-semibold text-xl mb-2">Title</h2>
<AutoExpandingTextArea
value={local.title || ''}
onChange={(text) => setLocal(prev => ({ ...prev, title: text }))}
className="w-full p-3 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent min-h-[80px] transition-all"
placeholder="Enter the title"
/>
</div>
</CardContent>
</Card>
<Card>
<CardContent>
<div className="flex items-center mb-4 mt-6">
<h2 className="font-semibold text-xl">Questions</h2>
</div>
<div className="space-y-5">
{local.prompts.length === 0 ? (
<div className="py-12 text-center bg-gray-200 rounded-lg border-2 border-dashed border-gray-400">
<p className="text-gray-600">No questions added yet</p>
</div>
) : (
local.prompts.map((prompt, index) => (
<Card key={index}>
<CardContent>
<div className="bg-gray-50 rounded-lg pt-4">
<div className="flex justify-between items-center mb-3">
<h3 className="font-medium text-gray-700">Question {index + 1}</h3>
<button
type="button"
className="p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-full transition-colors"
onClick={() => removePrompt(index)}
>
<AiOutlineDelete className="h-5 w-5" />
</button>
</div>
<AutoExpandingTextArea
value={prompt.text}
onChange={(text) => updatePrompt(index, text)}
className="w-full p-3 border border-gray-200 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent min-h-[80px] transition-all bg-white"
placeholder={`Enter question ${index + 1}`}
/>
</div>
</CardContent>
</Card>
))
)}
</div>
<div className="mt-6">
<button
type="button"
onClick={addPrompt}
className="w-full py-3 px-4 bg-gray-50 border border-gray-200 rounded-lg hover:bg-gray-100 transition-colors flex items-center justify-center gap-2 text-gray-600 font-medium"
>
<AiOutlinePlus className="h-5 w-5" />
Add Question
</button>
</div>
</CardContent>
</Card>
</>
) : isUnedited ? (
<p className="w-full text-gray-600 px-7 py-8 border-2 bg-white rounded-3xl whitespace-pre-line">
Generate or edit the questions!
</p>
) : (
<div className="space-y-6">
<Card>
<CardContent className="pt-6">
<div className="flex flex-col items-start gap-3">
<div className="flex flex-row mb-3 gap-4">
<BsFileText className="h-5 w-5 text-blue-500 mt-1" />
<h3 className="font-semibold text-xl">Title</h3>
</div>
<div className="w-full px-4 py-3 bg-white shadow-inner rounded-lg border border-gray-100">
<p className="text-lg">{local.title || 'Untitled'}</p>
</div>
</div>
</CardContent>
</Card>
<Card>
<CardContent className="pt-6">
<div className="flex flex-col items-start gap-3">
<div className="flex flex-row mb-3 gap-4">
<AiOutlineUnorderedList className="h-5 w-5 text-purple-500 mt-1" />
<h3 className="font-semibold text-xl">Questions</h3>
</div>
<div className="w-full space-y-4">
{local.prompts
.filter(prompt => prompt.text !== "")
.map((prompt, index) => (
<div key={index} className="bg-white shadow-inner rounded-lg border border-gray-100 p-4">
<h4 className="font-medium text-gray-700 mb-2">Question {index + 1}</h4>
<p className="text-gray-700">{prompt.text}</p>
</div>
))
}
</div>
</div>
</CardContent>
</Card>
</div>
)}
</>
)}
</>
);
};
export default InteractiveSpeaking;

View File

@@ -0,0 +1,544 @@
import React, { useCallback, useEffect, useState } from 'react';
import AutoExpandingTextArea from "@/components/Low/AutoExpandingTextarea";
import { Card, CardContent } from "@/components/ui/card";
import { AiOutlineUnorderedList, AiOutlinePlus, AiOutlineDelete } from 'react-icons/ai';
import Header from "../../Shared/Header";
import GenLoader from "../Shared/GenLoader";
import useSectionEdit from "../../Hooks/useSectionEdit";
import useExamEditorStore from "@/stores/examEditor";
import { Difficulty, InteractiveSpeakingExercise, LevelPart } from "@/interfaces/exam";
import { BsFileText } from "react-icons/bs";
import { RiVideoLine } from 'react-icons/ri';
import { FaChevronLeft, FaChevronRight } from 'react-icons/fa6';
import { Module } from '@/interfaces';
interface Props {
sectionId: number;
exercise: InteractiveSpeakingExercise;
module?: Module;
}
const Speaking1: React.FC<Props> = ({ sectionId, exercise, module = "speaking" }) => {
const { currentModule, dispatch } = useExamEditorStore();
const difficulty = useExamEditorStore((state) => state.modules[currentModule].difficulty);
const [local, setLocal] = useState(() => {
const defaultPrompts = [
{ text: "Hello my name is {avatar}, what is yours?", video_url: "" },
{ text: "Do you work or do you study?", video_url: "" },
...exercise.prompts.slice(2)
];
return { ...exercise, prompts: defaultPrompts };
});
const [currentVideoIndex, setCurrentVideoIndex] = useState(0);
const { generating, genResult, state, levelGenResults, levelGenerating } = useExamEditorStore(
(state) => state.modules[module].sections.find((section) => section.sectionId === sectionId)!
);
const { editing, setEditing, handleSave, handleDiscard, handleEdit, handlePractice } = useSectionEdit({
sectionId,
onSave: () => {
setEditing(false);
if (module === "level") {
const updatedState = {
...state,
exercises: (state as LevelPart).exercises.map((ex) =>
ex.id === local.id ? local : ex
)
};
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedState, module }
});
} else {
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: local, module }
});
}
if (genResult) {
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module,
field: "genResult",
value: undefined
}
});
}
const speakingScript = levelGenResults?.find((res) => res.generating === `${local.id}-speakingScript`);
if (module === "level" && speakingScript) {
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD", payload: {
sectionId,
field: "levelGenResults",
value: levelGenResults.filter((res) => res.generating !== `${local.id}-speakingScript`),
module
}
});
}
},
onDiscard: () => {
setLocal({
...exercise,
prompts: [
{ text: "Hello my name is {avatar}, what is yours?", video_url: "" },
{ text: "Do you work or do you study?", video_url: "" },
...exercise.prompts.slice(2)
]
});
},
onPractice: () => {
const updatedLocal = { ...local, isPractice: !local.isPractice };
setLocal(updatedLocal);
if (module === "level") {
const updatedState = {
...state,
exercises: (state as LevelPart).exercises.map((ex) =>
ex.id === local.id ? updatedLocal : ex
)
};
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedState, module }
});
} else {
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedLocal, module }
});
}
},
});
useEffect(() => {
if (genResult && generating === "speakingScript") {
if (!difficulty.includes(genResult.result[0].difficulty)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, genResult.result[0].difficulty]} } });
}
const updatedLocal = {
...local,
first_title: genResult.result[0].first_topic,
second_title: genResult.result[0].second_topic,
prompts: [
local.prompts[0],
local.prompts[1],
...genResult.result[0].prompts.map((item: any) => ({
text: item,
video_url: ""
}))
],
difficulty: genResult.result[0].difficulty
};
setEditing(true);
setLocal(updatedLocal);
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module,
field: "generating",
value: undefined
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [genResult, generating]);
useEffect(() => {
if (genResult && generating === "video") {
const updatedLocal = { ...local, prompts: genResult.result[0].prompts };
setLocal(updatedLocal);
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedLocal, module }
});
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module,
field: "generating",
value: undefined
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [genResult, generating]);
useEffect(() => {
const speakingScript = levelGenResults?.find((res) => res.generating === `${local.id}-speakingScript`);
const isGenerating = levelGenerating?.includes(`${local.id}-speakingScript`);
if (speakingScript && isGenerating) {
if (!difficulty.includes(speakingScript.result[0].difficulty)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, speakingScript.result[0].difficulty]} } });
}
const updatedLocal = {
...local,
first_title: speakingScript.result[0].first_topic,
second_title: speakingScript.result[0].second_topic,
difficulty: speakingScript.result[0].difficulty,
prompts: [
local.prompts[0],
local.prompts[1],
...speakingScript.result[0].prompts.map((item: any) => ({
text: item,
video_url: ""
}))
]
};
setEditing(true);
setLocal(updatedLocal);
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD", payload: {
sectionId,
field: "levelGenerating",
value: levelGenerating.filter((g) => g !== `${local.id}-speakingScript`),
module
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [levelGenResults, levelGenerating]);
useEffect(() => {
const speakingVideo = levelGenResults?.find((res) => res.generating === `${local.id}-video`);
const isGenerating = levelGenerating?.includes(`${local.id}-video`);
if (speakingVideo && isGenerating) {
const updatedLocal = { ...local, video_url: speakingVideo.result[0].video_url };
setLocal(updatedLocal);
const updatedState = {
...state,
exercises: (state as LevelPart).exercises.map((ex) =>
ex.id === local.id ? updatedLocal : ex
)
};
dispatch({
type: "UPDATE_SECTION_STATE",
payload: { sectionId, update: updatedState, module }
});
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD", payload: {
sectionId,
field: "levelGenerating",
value: levelGenerating.filter((g) => g !== `${local.id}-video`),
module
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [levelGenResults, levelGenerating]);
const addPrompt = () => {
setLocal(prev => ({
...prev,
prompts: [...prev.prompts, { text: "", video_url: "" }]
}));
};
const removePrompt = (index: number) => {
if (index < 2) return;
setLocal(prev => ({
...prev,
prompts: prev.prompts.filter((_, i) => i !== index)
}));
};
const updatePrompt = (index: number, text: string) => {
if (index < 2) return;
setLocal(prev => {
const newPrompts = [...prev.prompts];
newPrompts[index] = { ...newPrompts[index], text };
return { ...prev, prompts: newPrompts };
});
};
const isUnedited = local.prompts.length === 2;
useEffect(() => {
if (genResult && generating === "video") {
setLocal({ ...local, prompts: genResult.result[0].prompts });
dispatch({ type: "UPDATE_SECTION_STATE", payload: { sectionId, update: { ...local, prompts: genResult.result[0].prompts }, module } });
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module: module,
field: "generating",
value: undefined
}
});
dispatch({
type: "UPDATE_SECTION_SINGLE_FIELD",
payload: {
sectionId,
module: module,
field: "genResult",
value: undefined
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [genResult, generating]);
const handlePrevVideo = () => {
setCurrentVideoIndex((prev) => (prev > 0 ? prev - 1 : prev));
};
const handleNextVideo = () => {
setCurrentVideoIndex((prev) =>
(prev < local.prompts.length - 1 ? prev + 1 : prev)
);
};
const saveDifficulty = useCallback((diff: Difficulty)=> {
if (!difficulty.includes(diff)) {
dispatch({ type: 'UPDATE_MODULE', payload: { updates: { difficulty: [...difficulty, diff]} } });
}
if (module !== "level") {
const updatedExercise = { ...exercise, difficulty: diff };
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: updatedExercise, module: currentModule } });
} else {
const updatedExercise = { ...exercise, difficulty: diff };
const newState = { ...state as LevelPart };
newState.exercises = (newState as LevelPart).exercises.map((ex) => ex.id === exercise.id ? updatedExercise : ex );
dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } });
}
}, [currentModule, difficulty, dispatch, exercise, module, sectionId, state]);
return (
<>
<div className='relative pb-4'>
<Header
title={`Speaking 1 Script`}
description='Generate or write the scripts for the videos.'
editing={editing}
difficulty={exercise.difficulty}
saveDifficulty={saveDifficulty}
handleSave={handleSave}
handleEdit={handleEdit}
handleDiscard={handleDiscard}
handlePractice={handlePractice}
isEvaluationEnabled={!local.isPractice}
module="speaking"
/>
</div>
{(generating && generating === "speakingScript") || (levelGenerating.find((g) => g === `${local.id}-speakingScript`)) ? (
<GenLoader module={module} />
) : (
<>
{editing ? (
<>
<Card>
<CardContent>
<div className="py-2 mt-2">
<div className="flex flex-row mb-3 gap-4">
<BsFileText className="h-5 w-5 text-blue-500 mt-1" />
<h3 className="font-semibold text-xl">Titles</h3>
</div>
<div className="flex gap-6 mt-6">
<div className="flex-1">
<h2 className="font-semibold text-lg mb-2">First Title</h2>
<AutoExpandingTextArea
value={local.first_title || ''}
onChange={(text) => setLocal(prev => ({ ...prev, first_title: text }))}
className="w-full p-3 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent min-h-[80px] transition-all"
placeholder="Enter the first title"
/>
</div>
<div className="flex-1">
<h2 className="font-semibold text-lg mb-2">Second Title</h2>
<AutoExpandingTextArea
value={local.second_title || ''}
onChange={(text) => setLocal(prev => ({ ...prev, second_title: text }))}
className="w-full p-3 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent min-h-[80px] transition-all"
placeholder="Enter the second title"
/>
</div>
</div>
</div>
</CardContent>
</Card>
<Card>
<CardContent>
<div className="flex items-center justify-between mb-4 mt-6">
<h2 className="font-semibold text-xl">Questions</h2>
</div>
<div className="space-y-5">
{local.prompts.length === 2 ? (
<div className="py-12 text-center bg-gray-200 rounded-lg border-2 border-dashed border-gray-400">
<p className="text-gray-600">No questions added yet</p>
</div>
) : (
local.prompts.slice(2).map((prompt, index) => (
<Card key={index}>
<CardContent>
<div className="bg-gray-50 rounded-lg pt-4">
<div className="flex justify-between items-center mb-3">
<h3 className="font-medium text-gray-700">Question {index + 1}</h3>
<button
type="button"
className="p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-full transition-colors"
onClick={() => removePrompt(index + 2)}
>
<AiOutlineDelete className="h-5 w-5" />
</button>
</div>
<AutoExpandingTextArea
value={prompt.text}
onChange={(text) => updatePrompt(index + 2, text)}
className="w-full p-3 border border-gray-200 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent min-h-[80px] transition-all bg-white"
placeholder={`Enter question ${index + 1}`}
/>
</div>
</CardContent>
</Card>
))
)}
</div>
<div className="mt-6">
<button
type="button"
onClick={addPrompt}
className="w-full py-3 px-4 bg-gray-50 border border-gray-200 rounded-lg hover:bg-gray-100 transition-colors flex items-center justify-center gap-2 text-gray-600 font-medium"
>
<AiOutlinePlus className="h-5 w-5" />
Add Question
</button>
</div>
</CardContent>
</Card>
</>
) : isUnedited ? (
<p className="w-full text-gray-600 px-7 py-8 border-2 bg-white rounded-3xl whitespace-pre-line">
Generate or edit the questions!
</p>
) : (
<div className="space-y-6">
{local.prompts.every((p) => p.video_url !== "") && (
<Card>
<CardContent className="pt-6">
<div className="flex flex-col items-start gap-3">
<div className="flex flex-row mb-3 gap-4 w-full justify-between items-center">
<div className="flex flex-row gap-4">
<RiVideoLine className="h-5 w-5 text-amber-500 mt-1" />
<h3 className="font-semibold text-xl">Videos</h3>
</div>
<div className="flex items-center gap-4">
<button
onClick={handlePrevVideo}
disabled={currentVideoIndex === 0}
className={`p-2 rounded-full ${currentVideoIndex === 0
? 'text-gray-400 cursor-not-allowed'
: 'text-gray-600 hover:bg-gray-100'
}`}
>
<FaChevronLeft className="w-4 h-4" />
</button>
<span className="text-sm text-gray-600">
{currentVideoIndex + 1} / {local.prompts.length}
</span>
<button
onClick={handleNextVideo}
disabled={currentVideoIndex === local.prompts.length - 1}
className={`p-2 rounded-full ${currentVideoIndex === local.prompts.length - 1
? 'text-gray-400 cursor-not-allowed'
: 'text-gray-600 hover:bg-gray-100'
}`}
>
<FaChevronRight className="w-4 h-4" />
</button>
</div>
</div>
<div className="flex flex-col gap-4 w-full items-center">
<div className="w-full">
<video
key={local.prompts[currentVideoIndex].video_url}
controls
className="w-full rounded-xl"
>
<source src={local.prompts[currentVideoIndex].video_url} />
</video>
</div>
</div>
</div>
</CardContent>
</Card>
)}
{(generating && generating === "video") || levelGenerating.find((g) => g === `${local.id}-video`) &&
<GenLoader module={module} custom="Generating the videos ... This may take a while ..." />
}
<Card>
<CardContent className="pt-6">
<div className="flex flex-col items-start">
<div className="flex flex-row mb-4 gap-4">
<BsFileText className="h-5 w-5 text-blue-500 mt-1" />
<h3 className="font-semibold text-xl">Titles</h3>
</div>
<div className="w-full flex gap-6 mt-6">
<div className="flex-1">
<h4 className="font-medium text-gray-700 mb-2">First Title</h4>
<div className="w-full px-4 py-3 bg-white shadow-inner rounded-lg border border-gray-100">
<p className="text-lg">{local.first_title || 'No first title'}</p>
</div>
</div>
<div className="flex-1">
<h4 className="font-medium text-gray-700 mb-2">Second Title</h4>
<div className="w-full px-4 py-3 bg-white shadow-inner rounded-lg border border-gray-100">
<p className="text-lg">{local.second_title || 'No second title'}</p>
</div>
</div>
</div>
</div>
</CardContent>
</Card>
<Card>
<CardContent className="pt-6">
<div className="flex flex-col items-start gap-3">
<div className="flex flex-row mb-3 gap-4">
<AiOutlineUnorderedList className="h-5 w-5 text-purple-500 mt-1" />
<h3 className="font-semibold text-xl">Questions</h3>
</div>
<div className="w-full space-y-4">
{local.prompts.slice(2)
.filter(prompt => prompt.text !== "")
.map((prompt, index) => (
<div key={index} className="bg-white shadow-inner rounded-lg border border-gray-100 p-4">
<h4 className="font-medium text-gray-700 mb-2">Question {index + 1}</h4>
<p className="text-gray-700">{prompt.text}</p>
</div>
))
}
</div>
</div>
</CardContent>
</Card>
</div>
)}
</>
)}
</>
);
};
export default Speaking1;

Some files were not shown because too many files have changed in this diff Show More