import { FC, Fragment } from "react"; import { View, ViewStyle } from "react-native"; import { IconBackground } from "./IconBackground"; interface RouteMapIconProps { size?: number; color?: string; glowColor?: string; colorPreset?: "orange" | "cyan" | "purple" | "pink" | "yellow" | "green"; variant?: "circuit" | "matrix" | "glitch" | "nodes" | "grid"; noBackground?: boolean; } const ColorPresets = { orange: { color: "#f59e0b", glow: "#f59e0b" }, cyan: { color: "#00D4FF", glow: "#00D4FF" }, purple: { color: "#a78bfa", glow: "#a78bfa" }, pink: { color: "#FF45FF", glow: "#FF45FF" }, yellow: { color: "#FFD700", glow: "#FFD700" }, green: { color: "#00FF88", glow: "#00FF88" }, }; // Route nodes - representing different screens/routes in the app const ROUTE_NODES = [ { x: 0.5, y: 0.2, size: 1.2, isActive: true }, // Home/root { x: 0.25, y: 0.45, size: 1, isActive: false }, // Route 1 { x: 0.75, y: 0.45, size: 1, isActive: false }, // Route 2 { x: 0.35, y: 0.7, size: 0.9, isActive: false }, // Route 3 { x: 0.65, y: 0.7, size: 0.9, isActive: false }, // Route 4 ]; // Connections between routes - representing navigation paths const ROUTE_CONNECTIONS = [ { from: 0, to: 1 }, // Home to Route 1 { from: 0, to: 2 }, // Home to Route 2 { from: 1, to: 3 }, // Route 1 to Route 3 { from: 2, to: 4 }, // Route 2 to Route 4 ]; export const RouteMapIcon: FC = ({ size = 24, color, glowColor, colorPreset = "orange", variant = "nodes", noBackground = true, }) => { const scale = noBackground ? size / 24 : size / 26; const preset = ColorPresets[colorPreset as keyof typeof ColorPresets] || ColorPresets.orange; const activeColor = color || preset.color; const activeGlow = glowColor || preset.glow; const iconContent = ( <> {/* Draw connections first (behind nodes) */} {ROUTE_CONNECTIONS.map((connection, index) => { const fromNode = ROUTE_NODES[connection.from]; const toNode = ROUTE_NODES[connection.to]; const startX = fromNode.x * size; const startY = fromNode.y * size; const endX = toNode.x * size; const endY = toNode.y * size; const distance = Math.sqrt( Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2), ); const angle = Math.atan2(endY - startY, endX - startX); return ( {/* Connection glow */} {/* Connection line */} {/* Animated direction indicator dots */} {[0.3, 0.6].map((position, dotIndex) => ( ))} ); })} {/* Draw route nodes */} {ROUTE_NODES.map((node, index) => { const nodeX = node.x * size - node.size * 1.5 * scale; const nodeY = node.y * size - node.size * 1.5 * scale; return ( {/* Node outer glow */} {/* Node main circle */} {/* Node inner highlight */} {/* Active node indicator */} {node.isActive && ( <> {/* Pulsing center dot */} )} ); })} ); if (noBackground) { return ( {iconContent} ); } return ( {iconContent} ); }; export const RouteIcon = RouteMapIcon; export const NavigationIcon = RouteMapIcon;