import React from 'react'; import {useQuery} from 'react-apollo'; import {RouteComponentProps} from 'react-router'; import {VariantCell} from 'display-library/VariantCell'; import {LookCell} from 'display-library/LookCell'; import {Grid} from 'display-library/Grid'; import { TrunkshowVariables as TrunkshowQueryVars, Trunkshow as TrunkshowQueryData } from 'generated_types/Trunkshow'; import Loader from 'shared/components/loader'; import TRUNKSHOW_QUERY from 'trunkshow/queries/trunkshow'; import TRUNKSHOW_MODULES_QUERY, { TrunkshowModulesQueryData, TrunkshowModulesQueryVars } from 'trunkshow/queries/trunkshow_modules.rest'; type Props = RouteComponentProps<{slug: string}>; const Trunkshow: React.FC = ({match}: Props) => { const {slug} = match.params; const trunkshowQuery = useQuery( TRUNKSHOW_QUERY, { variables: { slug, countryCode: 'US', abTests: [] } } ); const modulesQuery = useQuery< TrunkshowModulesQueryData, TrunkshowModulesQueryVars >(TRUNKSHOW_MODULES_QUERY, {variables: {slug}}); if (trunkshowQuery.loading || modulesQuery.loading) return ; if (trunkshowQuery.error) throw trunkshowQuery.error; if (modulesQuery.error) throw modulesQuery.error; const {mods} = modulesQuery.data.trunkshow_modules.meta; return (
{mods[0] ?

{mods[0].attributes.module_type}

: null} {trunkshowQuery.data.trunkshow.looks.edges.map(edge => ( ))} {trunkshowQuery.data.trunkshow.variants.edges.map(edge => ( Promise.resolve(null)} /> ))}
); }; export default Trunkshow;