Skip to content

feat: add sortBy functionality to 'My Courses' for students (#1044)#793

Open
josefacastillo wants to merge 2 commits intomainfrom
feat/1044-sort-drafted-courses-by-lastUpdate
Open

feat: add sortBy functionality to 'My Courses' for students (#1044)#793
josefacastillo wants to merge 2 commits intomainfrom
feat/1044-sort-drafted-courses-by-lastUpdate

Conversation

@josefacastillo
Copy link
Contributor

https://github.com/corona-school/project-user/issues/1044

Added a Select Component to 'My Courses' section for Students which can sort by 'updatedAt' and 'nextLecture.start', for current, drafted and past Courses.

We could extend this to every course overview.

TODO: add translation to missing languages: turkish, ukranian, arabic, russian.

@Jonasdoubleyou Jonasdoubleyou temporarily deployed to user-app-feat-1044-sort-p8c2g2 March 1, 2025 18:16 Inactive
@Jonasdoubleyou Jonasdoubleyou temporarily deployed to user-app-feat-1044-sort-p8c2g2 March 1, 2025 18:20 Inactive
Copy link
Member

@Jonasdoubleyou Jonasdoubleyou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome back!

const { t } = useTranslation();
const navigate = useNavigate();
const [sortedCourses, setSortedCourses] = useState({
current: currentCourses,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not reflect changes if the outer component passed in different courses. I think it would be better to add a state for the dropdown and do the sort in a memo:

const [sortOrder, setSortOrder] = useState('updated');

const sortedCourses = useMemo(() => {
  // ...
}, [courses, sortOrder]);

Copy link
Contributor

@JeangelLF JeangelLF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! 🙌 Let me know if you need any help with the translations :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants