From 7c04105b147ce648c855a4964369d23b973a5a53 Mon Sep 17 00:00:00 2001 From: ulysse Date: Wed, 7 Oct 2026 17:51:45 +0200 Subject: [PATCH] COM-4299: trainer courses on web --- src/components/ImagePreview/index.tsx | 10 +++++----- src/components/ImagePreview/styles.ts | 8 ++++++++ src/components/UploadMethods/index.tsx | 11 ++++++----- src/navigation/Home/index.tsx | 4 ++-- src/screens/courses/list/TrainerCourses/index.tsx | 12 +++++------- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/components/ImagePreview/index.tsx b/src/components/ImagePreview/index.tsx index 747babf16..1abb83faf 100644 --- a/src/components/ImagePreview/index.tsx +++ b/src/components/ImagePreview/index.tsx @@ -1,9 +1,9 @@ import { useCallback, useEffect, useState } from 'react'; -import { View, Alert, BackHandler, Text, TouchableOpacity } from 'react-native'; +import { View, Alert, BackHandler, Text, TouchableOpacity, Linking } from 'react-native'; import { File, Paths } from 'expo-file-system'; import * as Print from 'expo-print'; import { WebView } from 'react-native-webview'; -import { IMAGE, IS_IOS } from '../../core/data/constants'; +import { IMAGE, IS_IOS, IS_WEB } from '../../core/data/constants'; import { WHITE } from '../../styles/colors'; import { ICON, SCREEN_HEIGHT } from '../../styles/metrics'; import NiImage from '../Image'; @@ -83,7 +83,7 @@ const ImagePreview = ({ source, deleteFile, onRequestClose, showButton = true }: }; return ( - + onDeleteFile(true)} visible={confirmationModal} title={'Supprimer les émargements'} onPressCancelButton={() => onDeleteFile(false)} @@ -97,8 +97,8 @@ const ImagePreview = ({ source, deleteFile, onRequestClose, showButton = true }: ? - : + : (IS_WEB ? Linking.openURL(link) : onPressViewDocument())} + style={styles.linkContainer} disabled={isDocumentLoading}> Pour visualiser le document veuillez cliquer ici diff --git a/src/components/ImagePreview/styles.ts b/src/components/ImagePreview/styles.ts index 1f8d26c47..3b07c259d 100644 --- a/src/components/ImagePreview/styles.ts +++ b/src/components/ImagePreview/styles.ts @@ -4,6 +4,14 @@ import { FIRA_SANS_REGULAR } from '../../styles/fonts'; import { MARGIN } from '../../styles/metrics'; const styles = StyleSheet.create({ + overlay: { + position: 'absolute', + top: 0, + left: 0, + width: '100%', + height: '100%', + zIndex: 100, + }, container: { backgroundColor: BLACK, flexGrow: 1, diff --git a/src/components/UploadMethods/index.tsx b/src/components/UploadMethods/index.tsx index e096a8b30..795dd4d0c 100644 --- a/src/components/UploadMethods/index.tsx +++ b/src/components/UploadMethods/index.tsx @@ -12,6 +12,7 @@ import { SLOTS_SELECTION, ATTENDANCE_SIGNATURE, TRAINEES_ATTENDANCES, + IS_WEB, } from '../../core/data/constants'; import AttendanceSheets from '../../api/attendanceSheets'; import styles from './styles'; @@ -130,12 +131,12 @@ const UploadMethods = ({ - + + disabled={isLoading || severalAttendanceSheetsToAdd || IS_WEB} onPress={requestPermissionsForImagePicker} + color={severalAttendanceSheetsToAdd || IS_WEB ? GREY[300] : PINK[500]} /> { navigation.navigate(getSlotSelectionNextScreen())} bgColor={GREY[100]} />} diff --git a/src/navigation/Home/index.tsx b/src/navigation/Home/index.tsx index 3fd33479a..c22076b31 100644 --- a/src/navigation/Home/index.tsx +++ b/src/navigation/Home/index.tsx @@ -16,7 +16,7 @@ import Catalog from '../../screens/explore/Catalog'; import ProfileDetails from '../../screens/profile/Profile'; import styles from './styles'; import { RootBottomTabParamList } from '../../types/NavigationType'; -import { VENDOR_ADMIN, TRAINING_ORGANISATION_MANAGER, TRAINER, IS_WEB } from '../../core/data/constants'; +import { VENDOR_ADMIN, TRAINING_ORGANISATION_MANAGER, TRAINER } from '../../core/data/constants'; import { EDGES } from '../../styles/metrics'; import { tabsNames } from '../../core/data/tabs'; @@ -56,7 +56,7 @@ const profileIcon = ({ focused }: tabBarProps) => (focused const Home = () => { const userVendorRole = useGetUserVendorRole(); - const showTrainerTab = !!userVendorRole && !IS_WEB && + const showTrainerTab = !!userVendorRole && [VENDOR_ADMIN, TRAINING_ORGANISATION_MANAGER, TRAINER].includes(userVendorRole); return ( diff --git a/src/screens/courses/list/TrainerCourses/index.tsx b/src/screens/courses/list/TrainerCourses/index.tsx index 56d5335f4..7b4550219 100644 --- a/src/screens/courses/list/TrainerCourses/index.tsx +++ b/src/screens/courses/list/TrainerCourses/index.tsx @@ -191,13 +191,11 @@ const TrainerCourses = ({ navigation }: TrainerCoursesProps) => { return ( - - item.title} - ListHeaderComponent={} - renderItem={({ item }) => renderCourseDisplay(item)} showsVerticalScrollIndicator={false} - ListEmptyComponent={} ListFooterComponent={renderFooter} - refreshControl={renderRefreshControl} /> - + item.title} + ListHeaderComponent={} + renderItem={({ item }) => renderCourseDisplay(item)} showsVerticalScrollIndicator={false} + ListEmptyComponent={} ListFooterComponent={renderFooter} + refreshControl={renderRefreshControl} /> ); };