diff --git a/assets/translations/en.json b/assets/translations/en.json index 831d9df7..89615f0d 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -247,7 +247,9 @@ "virtualClassroomsSectionTitle": "Virtual classrooms" }, "courseListItem": { - "courseWithoutDetailsAlertTitle": "This course doesn't have any details" + "courseWithoutDetailsAlertTitle": "This course doesn't have any details", + "extra": "Extra APSP", + "overbooking": "Overbooking" }, "courseNoticesTab": { "emptyState": "There are no notices here", diff --git a/assets/translations/it.json b/assets/translations/it.json index dc25b194..cce4594f 100644 --- a/assets/translations/it.json +++ b/assets/translations/it.json @@ -248,7 +248,9 @@ "virtualClassroomsSectionTitle": "Virtual classrooms" }, "courseListItem": { - "courseWithoutDetailsAlertTitle": "Questo corso non ha dettagli" + "courseWithoutDetailsAlertTitle": "Questo corso non ha dettagli", + "extra": "Extra carico", + "overbooking": "Overbooking" }, "courseNoticesTab": { "emptyState": "Non ci sono avvisi", diff --git a/src/core/queries/courseHooks.ts b/src/core/queries/courseHooks.ts index fc784513..1ec6df4a 100644 --- a/src/core/queries/courseHooks.ts +++ b/src/core/queries/courseHooks.ts @@ -44,6 +44,7 @@ export const useGetCourses = () => { coursesClient .getCourses() .then(pluckData) + .then(c => c.sort((a, b) => (a.name > b.name ? 1 : -1))) .then(p => { let hasNewPreferences = false; // Associate each course with a set of preferences, if missing diff --git a/src/features/teaching/components/CourseListItem.tsx b/src/features/teaching/components/CourseListItem.tsx index 3658e3a6..da298974 100644 --- a/src/features/teaching/components/CourseListItem.tsx +++ b/src/features/teaching/components/CourseListItem.tsx @@ -1,4 +1,4 @@ -import { PropsWithChildren } from 'react'; +import { PropsWithChildren, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { Alert, Platform, View } from 'react-native'; @@ -71,9 +71,18 @@ export const CourseListItem = ({ const hasDetails = course.id != null; + const subtitle = useMemo(() => { + return ( + `${course.cfu} ${t('common.credits').toLowerCase()}` + + (!course.isInPersonalStudyPlan ? ` • ${t('courseListItem.extra')}` : '') + + (course.isOverBooking ? ` • ${t('courseListItem.overbooking')}` : '') + ); + }, [course.cfu, course.isInPersonalStudyPlan, course.isOverBooking, t]); + const listItem = (