From cf7935baaee34e963df0e6d55535542a45486596 Mon Sep 17 00:00:00 2001 From: Isky Date: Sat, 17 Aug 2024 15:16:30 +0800 Subject: [PATCH] Added two more remarkText for phone and SMS, Fixed text wraping on Full Content Modal --- components/ScannedDataBox.tsx | 155 +++++++++++++++++++++------------- 1 file changed, 96 insertions(+), 59 deletions(-) diff --git a/components/ScannedDataBox.tsx b/components/ScannedDataBox.tsx index 4adec6e..e2c8e73 100644 --- a/components/ScannedDataBox.tsx +++ b/components/ScannedDataBox.tsx @@ -229,41 +229,53 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData return ( - - + + - {/* The Top Scan Icon with payload, truncated */} - - - setIsContentModalVisible(true)}> - {truncateContent(contents, 30)} - - +{/* The Top Scan Icon with payload, truncated */} + + + setIsContentModalVisible(true)}> + {truncateContent(contents, 30)} + + - - {/* Display QR Code, timestamp and Description */} - - - - - - {data.createdAt ? new Date(data.createdAt).toLocaleString() : 'Invalid Date'} - Description: {description} - {/* Conditionally display the shortening service message */} - {isShorteningService && ( - This is a shortening service - )} - {/* Conditionally display the IP address message */} - {hasIpAddress && ( - {hasIpAddress} - )} - - + + {/* Display QR Code, timestamp and Description */} + + + + + + {data.createdAt ? new Date(data.createdAt).toLocaleString() : 'Invalid Date'} + Description: {description} + + + + + {/* Conditionally display the shortening service message */} + {isShorteningService && ( + This is a shortening service + )} + + {/* Conditionally display the IP address message */} + {hasIpAddress && ( + {hasIpAddress} + )} + + {/* Conditionally display the remarks message */} + {details.remarks && ( + {details.remarks} + )} - {/* The Main Result in appropriate color */} - - Result: {resultText} - + {/* Conditionally display the keywordDetected message */} + {details.keywordDetected && ( + {details.keywordDetected} + )} +{/* The Main Result in appropriate color */} + + Result: {resultText} + {/* URL Type */} {type === 'URL' && ( @@ -434,16 +446,20 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData )} - {type === 'PHONE Nume' && ( - Linking.openURL(contents)}> +{type === 'PHONE' && ( + + Linking.openURL(contents)}> + + {/* Divider */} - Call Number + Call {details.phone} )} + {type === 'SMS' && ( = ({ qrCodeId, clearScanData )} {/* Full Content Modal */} - setIsContentModalVisible(false)} - > - - - Full Content - - {contents} - - setIsContentModalVisible(false)}> - Close - - - - + setIsContentModalVisible(false)} +> + + + Full Content + + {contents} + + setIsContentModalVisible(false)}> + Close + + + + + {/* POP UP Security Header and Redirect button */} {/* Security Headers Modal */} @@ -652,7 +669,6 @@ const styles = StyleSheet.create({ }, // Display check styles - // Aligning the boxes displayCheck: { flexDirection: 'row', alignItems: 'center', @@ -724,7 +740,7 @@ const styles = StyleSheet.create({ }, 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 @@ -805,9 +821,9 @@ const styles = StyleSheet.create({ justifyContent: 'space-between', }, shorteningServiceText: { - fontSize: screenWidth * 0.03, // Adjust size as needed - color: '#ff6347', // Example color (Tomato) - marginTop: screenWidth * 0.02, // Adjust spacing as needed + fontSize: screenWidth * 0.03, + color: '#ff6347', + marginTop: screenWidth * 0.02, }, // Vertical divider styles @@ -855,11 +871,32 @@ const styles = StyleSheet.create({ }, classificationText: { - fontSize: screenWidth * 0.0375, // Adjust size to be consistent with other text + fontSize: screenWidth * 0.0375, color: '#000', // Black color for contrast textAlign: 'center', 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;