Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/ImagePreview/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -83,7 +83,7 @@ const ImagePreview = ({ source, deleteFile, onRequestClose, showButton = true }:
};

return (
<View>
<View style={IS_WEB && styles.overlay}>
<View style={styles.container}>
<ConfirmationModal onPressConfirmButton={() => onDeleteFile(true)} visible={confirmationModal}
title={'Supprimer les émargements'} onPressCancelButton={() => onDeleteFile(false)}
Expand All @@ -97,8 +97,8 @@ const ImagePreview = ({ source, deleteFile, onRequestClose, showButton = true }:
? <View style={styles.pdfContainer}>
<WebView source={{ uri: link }} style={styles.pdfContent} startInLoadingState />
</View>
: <TouchableOpacity onPress={onPressViewDocument} style={styles.linkContainer}
disabled={isDocumentLoading}>
: <TouchableOpacity onPress={() => (IS_WEB ? Linking.openURL(link) : onPressViewDocument())}
style={styles.linkContainer} disabled={isDocumentLoading}>
<Text style={styles.linkContent}>
Pour visualiser le document veuillez cliquer <Text style={styles.link}>ici</Text>
</Text>
Expand Down
8 changes: 8 additions & 0 deletions src/components/ImagePreview/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 6 additions & 5 deletions src/components/UploadMethods/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -130,12 +131,12 @@ const UploadMethods = ({
<FeatherButton name='arrow-left' onPress={navigation.goBack} size={ICON.MD} color={GREY[600]} />
</View>
<View style={styles.container}>
<NiPrimaryButton caption='Prendre une photo' customStyle={styles.button} onPress={requestPermissionsForCamera}
disabled={isLoading || severalAttendanceSheetsToAdd} bgColor={GREY[100]}
color={severalAttendanceSheetsToAdd ? GREY[300] : PINK[500]} />
<NiPrimaryButton caption='Prendre une photo' customStyle={styles.button} onPress={requestPermissionsForCamera}
disabled={isLoading || severalAttendanceSheetsToAdd || IS_WEB} bgColor={GREY[100]}
color={severalAttendanceSheetsToAdd || IS_WEB ? GREY[300] : PINK[500]} />
<NiPrimaryButton caption='Ajouter une photo' customStyle={styles.button} bgColor={GREY[100]}
disabled={isLoading || severalAttendanceSheetsToAdd} onPress={requestPermissionsForImagePicker}
color={severalAttendanceSheetsToAdd ? GREY[300] : PINK[500]} />
disabled={isLoading || severalAttendanceSheetsToAdd || IS_WEB} onPress={requestPermissionsForImagePicker}
color={severalAttendanceSheetsToAdd || IS_WEB ? GREY[300] : PINK[500]} />
{<NiPrimaryButton caption='Ajouter une signature' customStyle={styles.button} disabled={isLoading}
color={PINK[500]} onPress={() => navigation.navigate(getSlotSelectionNextScreen())}
bgColor={GREY[100]} />}
Expand Down
4 changes: 2 additions & 2 deletions src/navigation/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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 (
Expand Down
12 changes: 5 additions & 7 deletions src/screens/courses/list/TrainerCourses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,11 @@ const TrainerCourses = ({ navigation }: TrainerCoursesProps) => {

return (
<SafeAreaView style={commonStyles.container} edges={[]}>
<View style={styles.container}>
<FlatList data={filteredCoursesDisplays} keyExtractor={item => item.title}
ListHeaderComponent={<TrainerCoursesHeader answer={answer} setAnswer={setAnswer} nextSteps={nextSteps} />}
renderItem={({ item }) => renderCourseDisplay(item)} showsVerticalScrollIndicator={false}
ListEmptyComponent={<TrainerEmptyState />} ListFooterComponent={renderFooter}
refreshControl={renderRefreshControl} />
</View>
<FlatList data={filteredCoursesDisplays} keyExtractor={item => item.title}
ListHeaderComponent={<TrainerCoursesHeader answer={answer} setAnswer={setAnswer} nextSteps={nextSteps} />}
renderItem={({ item }) => renderCourseDisplay(item)} showsVerticalScrollIndicator={false}
ListEmptyComponent={<TrainerEmptyState />} ListFooterComponent={renderFooter}
refreshControl={renderRefreshControl} />
</SafeAreaView>
);
};
Expand Down
Loading