Added two more remarkText for phone and SMS, Fixed text wraping on Full Content Modal

This commit is contained in:
2024-08-17 15:16:30 +08:00
parent 7cce7b66d7
commit cf7935baae

View File

@@ -230,17 +230,17 @@ const ScannedDataBox: React.FC<ScannedDataBoxProps> = ({ qrCodeId, clearScanData
<View style={styles.dataBox}> <View style={styles.dataBox}>
<TouchableOpacity style={styles.closeButton} onPress={clearScanData}> <TouchableOpacity style={styles.closeButton} onPress={clearScanData}>
<Ionicons name="close-circle-outline" size={screenWidth * 0.05} color="#ff69b4" /> <Ionicons name="close-circle-outline" size={screenWidth * 0.05} color="#ff69b4" />
</TouchableOpacity> </TouchableOpacity>
{/* The Top Scan Icon with payload, truncated */} {/* The Top Scan Icon with payload, truncated */}
<View style={[styles.row, styles.shadowBox]}> <View style={[styles.row, styles.shadowBox]}>
<Image source={require('../assets/ScanIcon3.png')} style={styles.scan_icon} /> <Image source={require('../assets/ScanIcon3.png')} style={styles.scan_icon} />
<Text style={styles.payload} onPress={() => setIsContentModalVisible(true)}> <Text style={styles.payload} onPress={() => setIsContentModalVisible(true)}>
{truncateContent(contents, 30)} {truncateContent(contents, 30)}
</Text> </Text>
</View> </View>
<View style={styles.mainContent}> <View style={styles.mainContent}>
{/* Display QR Code, timestamp and Description */} {/* Display QR Code, timestamp and Description */}
<View style={styles.qrSection}> <View style={styles.qrSection}>
<QRCode value={contents || 'No Data'} size={screenWidth * 0.2} backgroundColor="transparent" /> <QRCode value={contents || 'No Data'} size={screenWidth * 0.2} backgroundColor="transparent" />
@@ -249,21 +249,33 @@ const ScannedDataBox: React.FC<ScannedDataBoxProps> = ({ qrCodeId, clearScanData
<View style={styles.detailsSection}> <View style={styles.detailsSection}>
<Text style={styles.timestampText}>{data.createdAt ? new Date(data.createdAt).toLocaleString() : 'Invalid Date'}</Text> <Text style={styles.timestampText}>{data.createdAt ? new Date(data.createdAt).toLocaleString() : 'Invalid Date'}</Text>
<Text style={styles.typeText}>Description: {description}</Text> <Text style={styles.typeText}>Description: {description}</Text>
</View>
</View>
{/* Conditionally display the shortening service message */} {/* Conditionally display the shortening service message */}
{isShorteningService && ( {isShorteningService && (
<Text style={styles.shorteningServiceText}>This is a shortening service</Text> <Text style={styles.remarksText}>This is a shortening service</Text>
)} )}
{/* Conditionally display the IP address message */} {/* Conditionally display the IP address message */}
{hasIpAddress && ( {hasIpAddress && (
<Text style={styles.shorteningServiceText}>{hasIpAddress}</Text> <Text style={styles.remarksText}>{hasIpAddress}</Text>
)} )}
</View>
</View>
{/* The Main Result in appropriate color */} {/* Conditionally display the remarks message */}
<Text style={[styles.resultText, { color: resultColor }]}> {details.remarks && (
<Text style={styles.remarksText}>{details.remarks}</Text>
)}
{/* Conditionally display the keywordDetected message */}
{details.keywordDetected && (
<Text style={styles.remarksText}>{details.keywordDetected}</Text>
)}
{/* The Main Result in appropriate color */}
<Text style={[styles.resultText, { color: resultColor }]}>
Result: {resultText} Result: {resultText}
</Text> </Text>
{/* URL Type */} {/* URL Type */}
{type === 'URL' && ( {type === 'URL' && (
@@ -434,16 +446,20 @@ const ScannedDataBox: React.FC<ScannedDataBoxProps> = ({ qrCodeId, clearScanData
</> </>
)} )}
{type === 'PHONE Nume' && ( {type === 'PHONE' && (
<TouchableOpacity style={styles.iconButton} onPress={() => Linking.openURL(contents)}> <TouchableOpacity style={styles.iconButton} onPress={() => Linking.openURL(contents)}>
<View style={styles.dividerHorizontal} /> <View style={styles.dividerHorizontal} />
<Ionicons name="call-outline" size={screenWidth * 0.045} color="#2196F3" /> <Ionicons name="call-outline" size={screenWidth * 0.045} color="#2196F3" />
{/* Divider */} {/* Divider */}
<Text style={styles.iconText}>Call Number</Text> <Text style={styles.iconText}>Call {details.phone}</Text>
</TouchableOpacity> </TouchableOpacity>
)} )}
{type === 'SMS' && ( {type === 'SMS' && (
<TouchableOpacity <TouchableOpacity
style={styles.iconButton} style={styles.iconButton}
@@ -471,24 +487,25 @@ const ScannedDataBox: React.FC<ScannedDataBoxProps> = ({ qrCodeId, clearScanData
)} )}
{/* Full Content Modal */} {/* Full Content Modal */}
<Modal <Modal
visible={isContentModalVisible} visible={isContentModalVisible}
transparent={true} transparent={true}
animationType="fade" animationType="fade"
onRequestClose={() => setIsContentModalVisible(false)} onRequestClose={() => setIsContentModalVisible(false)}
> >
<View style={styles.modalContainer}> <View style={styles.modalContainer}>
<View style={styles.modalContent}> <View style={styles.modalContent}>
<Text style={styles.modalTitle}>Full Content</Text> <Text style={styles.modalTitle}>Full Content</Text>
<ScrollView style={styles.modalScrollContent}> <ScrollView style={styles.fullContentScroll}>
<Text style={styles.modalText}>{contents}</Text> <Text style={styles.fullContentText}>{contents}</Text>
</ScrollView> </ScrollView>
<TouchableOpacity style={styles.closeModalButton} onPress={() => setIsContentModalVisible(false)}> <TouchableOpacity style={styles.closeModalButton} onPress={() => setIsContentModalVisible(false)}>
<Text style={styles.closeModalButtonText}>Close</Text> <Text style={styles.closeModalButtonText}>Close</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
</Modal> </Modal>
{/* POP UP Security Header and Redirect button */} {/* POP UP Security Header and Redirect button */}
{/* Security Headers Modal */} {/* Security Headers Modal */}
@@ -652,7 +669,6 @@ const styles = StyleSheet.create({
}, },
// Display check styles // Display check styles
// Aligning the boxes
displayCheck: { displayCheck: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
@@ -724,7 +740,7 @@ const styles = StyleSheet.create({
}, },
horizontalContentContainer: { horizontalContentContainer: {
flexGrow: 1, // Ensure the content container expands to fit its children flexGrow: 1, // content container expands to fit its children
}, },
// Close modal button styles // Close modal button styles
@@ -805,9 +821,9 @@ const styles = StyleSheet.create({
justifyContent: 'space-between', justifyContent: 'space-between',
}, },
shorteningServiceText: { shorteningServiceText: {
fontSize: screenWidth * 0.03, // Adjust size as needed fontSize: screenWidth * 0.03,
color: '#ff6347', // Example color (Tomato) color: '#ff6347',
marginTop: screenWidth * 0.02, // Adjust spacing as needed marginTop: screenWidth * 0.02,
}, },
// Vertical divider styles // Vertical divider styles
@@ -855,11 +871,32 @@ const styles = StyleSheet.create({
}, },
classificationText: { classificationText: {
fontSize: screenWidth * 0.0375, // Adjust size to be consistent with other text fontSize: screenWidth * 0.0375,
color: '#000', // Black color for contrast color: '#000', // Black color for contrast
textAlign: 'center', textAlign: 'center',
marginTop: screenWidth * 0.01875, // Add some spacing above marginTop: screenWidth * 0.01875, // Add some spacing above
}, },
remarksText: {
fontSize: screenWidth * 0.03,
color: '#ff6347',
textAlign: 'center',
marginTop: screenWidth * 0.02,
marginBottom: screenWidth * 0.1, // Add marginBottom for spacing below the remarks
},
// Modal scroll content styles for full content
fullContentScroll: {
maxHeight: screenHeight * 0.6, // Adjust height as needed
marginVertical: screenHeight * 0.02,
},
// Full content text styles
fullContentText: {
fontSize: screenWidth * 0.0375,
color: '#000', // Black text color
textAlign: 'left', // Ensure the text aligns properly
flexWrap: 'wrap', // Ensure the text wraps
},
}); });
export default ScannedDataBox; export default ScannedDataBox;