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 { useDevice, useLGState } from '~/hooks'; import { isQueryType } from '~/types'; import { Result } from './individual'; export const Results = () => { const { queries, vrfs, web } = useConfig(); const { formData } = useLGState(); const { query_location: queryLocation, query_target: queryTarget, query_type: queryType, query_vrf: queryVrf, } = formData; const getDevice = useDevice(); 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.value)[0] ?? vrfs.filter(v => v.id === 'default')[0]; let queryTypeLabel = ''; if (isQueryType(queryType.value)) { queryTypeLabel = queries[queryType.value].display_name; } return ( <> {queryLocation && ( <> )} {queryLocation && queryLocation.map((loc, i) => { const device = getDevice(loc.value); return ( ); })} ); };