Skip to content

Commit 923226b

Browse files
committed
RU-T46 PR#193 Fixes
1 parent ed433bc commit 923226b

5 files changed

Lines changed: 14 additions & 16 deletions

File tree

src/components/calls/call-images-modal.tsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as ImageManipulator from 'expo-image-manipulator';
44
import * as ImagePicker from 'expo-image-picker';
55
import { CameraIcon, ChevronLeftIcon, ChevronRightIcon, ImageIcon, PlusIcon, X } from 'lucide-react-native';
66
import { useColorScheme } from 'nativewind';
7-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
7+
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
88
import { useTranslation } from 'react-i18next';
99
import { Dimensions, Keyboard, Modal, SafeAreaView, StyleSheet, TouchableOpacity, View } from 'react-native';
1010
import { KeyboardStickyView } from 'react-native-keyboard-controller';
@@ -50,7 +50,7 @@ const CallImagesModal: React.FC<CallImagesModalProps> = ({ isOpen, onClose, call
5050
const [isAddingImage, setIsAddingImage] = useState(false);
5151
const [imageErrors, setImageErrors] = useState<Set<string>>(new Set());
5252
const [fullScreenImage, setFullScreenImage] = useState<{ source: any; name?: string } | null>(null);
53-
const flatListRef = useRef<any>(null); // FlashList ref type
53+
const flatListRef = useRef<FlatList<CallFileResultData>>(null);
5454

5555
const { callImages, isLoadingImages, errorImages, fetchCallImages, uploadCallImage, clearImages } = useCallDetailStore();
5656

@@ -206,6 +206,10 @@ const CallImagesModal: React.FC<CallImagesModalProps> = ({ isOpen, onClose, call
206206
setImageErrors((prev) => new Set([...prev, itemId]));
207207
};
208208

209+
const handleImagePress = useCallback((source: { uri: string }, name?: string) => {
210+
setFullScreenImage({ source, name });
211+
}, []);
212+
209213
// Reset active index when valid images change
210214

211215
const renderImageItem = ({ item, index }: { item: CallFileResultData; index: number }) => {
@@ -246,16 +250,7 @@ const CallImagesModal: React.FC<CallImagesModalProps> = ({ isOpen, onClose, call
246250
// At this point, imageSource is guaranteed to be non-null
247251
return (
248252
<Box className="w-full items-center justify-center px-4" style={{ width }}>
249-
<TouchableOpacity
250-
onPress={() => {
251-
setFullScreenImage({ source: imageSource, name: item.Name });
252-
}}
253-
testID={`image-${item.Id}-touchable`}
254-
activeOpacity={0.7}
255-
style={{ width: '100%' }}
256-
delayPressIn={0}
257-
delayPressOut={0}
258-
>
253+
<TouchableOpacity onPress={() => handleImagePress(imageSource, item.Name)} testID={`image-${item.Id}-touchable`} activeOpacity={0.7} style={{ width: '100%' }} delayPressIn={0} delayPressOut={0}>
259254
<Image
260255
key={`${item.Id}-${index}`}
261256
source={imageSource}
@@ -467,12 +462,12 @@ const CallImagesModal: React.FC<CallImagesModalProps> = ({ isOpen, onClose, call
467462
<View style={[styles.header, isDark && styles.headerDark]}>
468463
<Heading size="lg">{isAddingImage ? t('callImages.add_new') : t('callImages.title')}</Heading>
469464
<HStack className="items-center space-x-2">
470-
{!isAddingImage && !isLoadingImages && (
465+
{!isAddingImage && !isLoadingImages ? (
471466
<Button size="sm" variant="outline" onPress={() => setIsAddingImage(true)}>
472467
<ButtonIcon as={PlusIcon} />
473468
<ButtonText>{t('callImages.add')}</ButtonText>
474469
</Button>
475-
)}
470+
) : null}
476471
<TouchableOpacity onPress={handleClose} style={styles.closeButton} testID="close-button">
477472
<X size={24} color={isDark ? '#D1D5DB' : '#374151'} />
478473
</TouchableOpacity>
@@ -550,4 +545,4 @@ const styles = StyleSheet.create({
550545
},
551546
});
552547

553-
export default CallImagesModal;
548+
export default memo(CallImagesModal);

src/components/calls/call-notes-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const CallNotesModal = ({ isOpen, onClose, callId }: CallNotesModalProps) => {
134134
keyboardShouldPersistTaps="handled"
135135
/>
136136
) : (
137-
<ZeroState heading="No notes found" />
137+
<ZeroState heading={t('callNotes.noNotesFound')} />
138138
)}
139139
</View>
140140

src/translations/ar.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
"addNoteLabel": "إضافة ملاحظة جديدة",
108108
"addNotePlaceholder": "أضف ملاحظة جديدة...",
109109
"noNotes": "لا توجد ملاحظات متاحة لهذه المكالمة",
110+
"noNotesFound": "لم يتم العثور على ملاحظات",
110111
"noSearchResults": "لا توجد ملاحظات تطابق بحثك",
111112
"searchPlaceholder": "البحث في الملاحظات...",
112113
"title": "ملاحظات المكالمة"

src/translations/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
"addNoteLabel": "Add New Note",
108108
"addNotePlaceholder": "Add a new note...",
109109
"noNotes": "No notes available for this call",
110+
"noNotesFound": "No notes found",
110111
"noSearchResults": "No notes match your search",
111112
"searchPlaceholder": "Search notes...",
112113
"title": "Call Notes"

src/translations/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
"addNoteLabel": "Añadir Nueva Nota",
108108
"addNotePlaceholder": "Añadir una nueva nota...",
109109
"noNotes": "No hay notas disponibles para esta llamada",
110+
"noNotesFound": "No se encontraron notas",
110111
"noSearchResults": "No hay notas que coincidan con tu búsqueda",
111112
"searchPlaceholder": "Buscar notas...",
112113
"title": "Notas de la llamada"

0 commit comments

Comments
 (0)