bloom-frontend
bloom-frontend copied to clipboard
Refactor Session and Session_iba template
Overview
We created a duplicate but slightly different template for our IBA course. There is now a large amount of shared loginc between the regular session template and the session_iba template.
The IBA session page can be found in pages/courses/image-based-abuse/[sessionSlug].tsx
and the regular session page can be found in pages/courses/[slug]/[sessionSlug].tsx
This ticket is to pull out duplicated logic / code between the two pages into either separate components or functions that can then be shared by the two pages.
Action Items
Here are some suggestions for possible refactors. These are suggestions and you may take a different route:
- [ ] Extract logic which determines chat access into separate function
- [ ] Extract logic which determines session completion into separate function
- [ ] Create SessionHeader component which wraps around the Header component and its children
- [ ] Create SessionVideo component to wrap around current implementation with SessionContentCard which contains Video and transcript as children
-
callStartSession
can move into this component - the
useEffect
to open transcript modal can also be moved to this component
-
- [ ] to handle Create Activity component to wrap around current implementation with SessionContentCard
- [ ] Create Chat component to wrap around the current implementation of the Chat card
Testing
- [ ] Once your refactor is complete, please compare your pages to the live pages.
- [ ] Ensure you have run cypress tests and everything still works
It may make sense to split this ticket out into separate PRs as there could be a lot of changes.