diff --git a/components/ScannedDataBox.tsx b/components/ScannedDataBox.tsx index a40687c..700bc87 100644 --- a/components/ScannedDataBox.tsx +++ b/components/ScannedDataBox.tsx @@ -5,6 +5,9 @@ import { Ionicons, MaterialCommunityIcons, SimpleLineIcons } from '@expo/vector- import { getQRCodeDetails } from '../api/qrCodeAPI'; import SecureWebView from '../components/SecureWebView'; + + + const { width: screenWidth, height: screenHeight } = Dimensions.get('window'); interface ScannedDataBoxProps { @@ -106,9 +109,16 @@ const getSecurityHeaderStatus = (headers) => { return { text: 'No Security Headers', color: '#ffa500', hasHeaders: false }; // Orange without headers } }; - const securityHeaderStatus = getSecurityHeaderStatus(details.hstsHeader || []); +const getRedirectStatus = (redirectCount: number) => { + if (redirectCount === 0) { + return { text: 'No Redirects', color: '#44c167', hasRedirects: false }; // Green with no redirects + } else { + return { text: 'Redirects', color: '#ff0000', hasRedirects: true }; // Red with redirects + } +}; +const redirectStatus = getRedirectStatus(details.redirect || 0); @@ -231,12 +241,20 @@ const handleConnectToWifi = (wifiContent) => { )} - {/* Redirects Button */} - setIsRedirectModalVisible(true)}> - 1 ? "#ff0000" : "#44c167"} /> - Redirects - - +{/* Redirects Button */} +{redirectStatus.hasRedirects ? ( + setIsRedirectModalVisible(true)}> + + {redirectStatus.text} + + +) : ( + + + {redirectStatus.text} + +)} + {/* Divider */}