diff --git a/assets/translations/en.json b/assets/translations/en.json index 9d06741b..653382b7 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -314,6 +314,9 @@ "agendaSectionEmptyState": "This course has no entries in the agenda", "agendaSectionTitle": "This course in the agenda", "creditsLabel": "Credits", + "linkDefaultTitle": "Link to", + "linksSectionEmptyState": "There are no links related to the course", + "linksSectionTitle": "Useful links", "moreSectionTitle": "More", "staffSectionTitle": "Staff", "teacherLabel": "Teacher", diff --git a/assets/translations/it.json b/assets/translations/it.json index a204d34b..fd165e6a 100644 --- a/assets/translations/it.json +++ b/assets/translations/it.json @@ -314,6 +314,9 @@ "agendaSectionEmptyState": "Non ci sono eventi relativi a questo corso", "agendaSectionTitle": "Questo corso nell'agenda", "creditsLabel": "Crediti", + "linkDefaultTitle": "Collegamento a", + "linksSectionEmptyState": "Non ci sono link relativi al corso", + "linksSectionTitle": "Link utili", "moreSectionTitle": "Altro", "staffSectionTitle": "Docenti", "teacherLabel": "Docente", diff --git a/package-lock.json b/package-lock.json index be0b1962..e498753a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@miblanchard/react-native-slider": "^2.2.0", "@openspacelabs/react-native-zoomable-view": "^2.1.5", "@orama/orama": "^2.0.0-beta.8", - "@polito/api-client": "^1.0.0-ALPHA.62", + "@polito/api-client": "^1.0.0-ALPHA.63", "@react-native-async-storage/async-storage": "^1.17.11", "@react-native-clipboard/clipboard": "^1.12.1", "@react-native-community/blur": "^4.3.0", @@ -3816,9 +3816,9 @@ } }, "node_modules/@polito/api-client": { - "version": "1.0.0-ALPHA.62", - "resolved": "https://npm.pkg.github.com/download/@polito/api-client/1.0.0-ALPHA.62/1d46f20f6408038eca5e46da14204d01a3727050", - "integrity": "sha512-Drws313VBaGkH9dm9IPLTfLeqyslhn3+IaZ3WHkfx0KrugafIx9+uZTDAkP9U6SWrFPW700n7QaO74aTgBeaDg==" + "version": "1.0.0-ALPHA.63", + "resolved": "https://npm.pkg.github.com/download/@polito/api-client/1.0.0-ALPHA.63/c061fbc916fd4dfdca7edec5a2ef838593cbc22a", + "integrity": "sha512-AGnKq41yX1MBQOqztG+1cQu2OhfTZ0tKGMr9b8ez8tbual1axW94QLwu/ECmQM/7258sqcA/H8GuTgI+6UEPCw==" }, "node_modules/@react-native-async-storage/async-storage": { "version": "1.19.8", diff --git a/package.json b/package.json index 9cae1974..25de0afb 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@miblanchard/react-native-slider": "^2.2.0", "@openspacelabs/react-native-zoomable-view": "^2.1.5", "@orama/orama": "^2.0.0-beta.8", - "@polito/api-client": "^1.0.0-ALPHA.62", + "@polito/api-client": "^1.0.0-ALPHA.63", "@react-native-async-storage/async-storage": "^1.17.11", "@react-native-clipboard/clipboard": "^1.12.1", "@react-native-community/blur": "^4.3.0", diff --git a/src/features/courses/screens/CourseInfoScreen.tsx b/src/features/courses/screens/CourseInfoScreen.tsx index 66b9c5e8..51fd55a1 100644 --- a/src/features/courses/screens/CourseInfoScreen.tsx +++ b/src/features/courses/screens/CourseInfoScreen.tsx @@ -1,8 +1,15 @@ import { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native'; +import { + Linking, + SafeAreaView, + ScrollView, + StyleSheet, + View, +} from 'react-native'; import { faAngleDown } from '@fortawesome/free-solid-svg-icons'; +import { faLink } from '@fortawesome/free-solid-svg-icons'; import { Card } from '@lib/ui/components/Card'; import { Grid } from '@lib/ui/components/Grid'; import { Icon } from '@lib/ui/components/Icon'; @@ -18,6 +25,7 @@ import { SectionHeader } from '@lib/ui/components/SectionHeader'; import { StatefulMenuView } from '@lib/ui/components/StatefulMenuView'; import { Text } from '@lib/ui/components/Text'; import { useStylesheet } from '@lib/ui/hooks/useStylesheet'; +import { useTheme } from '@lib/ui/hooks/useTheme'; import { Theme } from '@lib/ui/types/Theme'; import { Person } from '@polito/api-client/models/Person'; import { useNavigation } from '@react-navigation/native'; @@ -45,6 +53,7 @@ export const CourseInfoScreen = () => { const { t } = useTranslation(); const courseId = useCourseContext(); const styles = useStylesheet(createStyles); + const { fontSizes } = useTheme(); const [staff, setStaff] = useState([]); const { data: editions } = useGetCourseEditions(courseId); const courseQuery = useGetCourse(courseId); @@ -90,7 +99,6 @@ export const CourseInfoScreen = () => { ) === undefined, [courseId, queryClient], ); - const isGuideDisabled = useOfflineDisabled(isGuideDataMissing); return ( @@ -205,6 +213,30 @@ export const CourseInfoScreen = () => { ))} + +
+ + + {courseQuery.data?.links.map(link => ( + } + title={link.description ?? t('courseInfoTab.linkDefaultTitle')} + subtitle={link.url} + onPress={() => Linking.openURL(link.url)} + /> + ))} + +
+