import { useState } from 'react'; import { Accordion, Box, Stack, useToken } from '@chakra-ui/react'; import { motion, AnimatePresence } from 'framer-motion'; import { AnimatedDiv, Label } from '~/components'; import { useConfig, useBreakpointValue } from '~/context'; import { Result } from './individual'; import type { TResults } from './types'; export const Results = (props: TResults) => { const { queryLocation, queryType, queryVrf, queryTarget, ...rest } = props; const { request_timeout, devices, queries, vrfs, web } = useConfig(); const targetBg = useToken('colors', 'teal.600'); const queryBg = useToken('colors', 'cyan.500'); const vrfBg = useToken('colors', 'blue.500'); const animateLeft = useBreakpointValue({ base: { opacity: 1, x: 0 }, md: { opacity: 1, x: 0 }, lg: { opacity: 1, x: 0 }, xl: { opacity: 1, x: 0 }, }); const animateCenter = useBreakpointValue({ base: { opacity: 1 }, md: { opacity: 1 }, lg: { opacity: 1 }, xl: { opacity: 1 }, }); const animateRight = useBreakpointValue({ base: { opacity: 1, x: 0 }, md: { opacity: 1, x: 0 }, lg: { opacity: 1, x: 0 }, xl: { opacity: 1, x: 0 }, }); const initialLeft = useBreakpointValue({ base: { opacity: 0, x: -100 }, md: { opacity: 0, x: -100 }, lg: { opacity: 0, x: -100 }, xl: { opacity: 0, x: -100 }, }); const initialCenter = useBreakpointValue({ base: { opacity: 0 }, md: { opacity: 0 }, lg: { opacity: 0 }, xl: { opacity: 0 }, }); const initialRight = useBreakpointValue({ base: { opacity: 0, x: 100 }, md: { opacity: 0, x: 100 }, lg: { opacity: 0, x: 100 }, xl: { opacity: 0, x: 100 }, }); const [resultsComplete, setComplete] = useState(null); const matchedVrf = vrfs.filter(v => v.id === queryVrf)[0] ?? vrfs.filter(v => v.id === 'default')[0]; return ( <> {queryLocation && ( <> )} {queryLocation && queryLocation.map((loc, i) => { const device = devices.filter(d => d.name === loc)[0]; return ( ); })} ); };