Skip to content

Commit

Permalink
Merge pull request #36 from UKHomeOffice/DRTII-1572-Hide-Show-flights…
Browse files Browse the repository at this point in the history
…-options-until-flights-are-highlighted

Drtii 1572 hide show flights options until flights are highlighted
  • Loading branch information
richbirch authored Aug 30, 2024
2 parents 91b2285 + 2866d28 commit 0be2ea0
Show file tree
Hide file tree
Showing 7 changed files with 526 additions and 433 deletions.
21 changes: 12 additions & 9 deletions src/components/FlightFlagger/FlightFlagger.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useState} from "react";
import {Country, FlightFlaggerFilters} from "./FlightFlaggerFilters";
import {Country, FlightFlaggerFilters, FormState} from "./FlightFlaggerFilters";
import { FlightFlaggerResults } from "./FlightFlaggerResults";
import { SearchFilterPayload } from "./FlightFlaggerFilters";
import {CircularProgress} from "@mui/material";
Expand All @@ -11,10 +11,11 @@ export interface IFlightFlagger {
ageGroups: string[],
submitCallback: (payload:SearchFilterPayload) => void,
flights: FlightArrival[],
isLoading: boolean
isLoading: boolean,
maybeInitialFilterFormState?: FormState
}

const FlightFlagger = ({nationalities, ageGroups, submitCallback, flights, isLoading}: IFlightFlagger) => {
const FlightFlagger = ({nationalities, ageGroups, submitCallback, flights, isLoading, maybeInitialFilterFormState}: IFlightFlagger) => {

const [showHighlightOnly, setShowHighlightOnly] = useState<boolean>(false);

Expand All @@ -25,13 +26,15 @@ const FlightFlagger = ({nationalities, ageGroups, submitCallback, flights, isLoa
const onChangeInput = (searchTerm: string) => {}

return <>
<FlightFlaggerFilters
nationalities={nationalities}
ageGroups={ageGroups}
<FlightFlaggerFilters
nationalities={nationalities}
ageGroups={ageGroups}
onChangeInput={onChangeInput}
submitCallback={submitCallback}
clearFiltersCallback={()=>{}}
showAllCallback={toggleHighlightDisplay} />
submitCallback={submitCallback}
clearFiltersCallback={()=> {}}
showAllCallback={toggleHighlightDisplay}
maybeInitialState={maybeInitialFilterFormState}
/>
{ isLoading? <div style={{display: 'flex', justifyContent: 'center', padding: '50px'}}><CircularProgress data-testid="flight-flagger-loading-spinner" /></div> : <FlightFlaggerResults flights={flights} showHighlightOnly={showHighlightOnly} />}
</>
}
Expand Down
Loading

0 comments on commit 0be2ea0

Please sign in to comment.