Skip to content

Commit

Permalink
tc-53 featurebranch er gucci
Browse files Browse the repository at this point in the history
  • Loading branch information
taniaholst committed Apr 1, 2022
1 parent 8b7d39f commit 34e04df
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 27 deletions.
5 changes: 4 additions & 1 deletion frontend/mulighetsrommet-veileder-flate/src/api/features.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
export const ALERT_INFO = 'mulighetsrommet.alert-info';
export const FAKE_DOOR = 'mulighetsrommet.fake-door';

export const ALL_TOGGLES = [ALERT_INFO];
export const ALL_TOGGLES = [ALERT_INFO, FAKE_DOOR];

export interface Features {
[ALERT_INFO]: boolean;
[FAKE_DOOR]: boolean;
}
export const initialFeatures: Features = {
[ALERT_INFO]: true,
[FAKE_DOOR]: false,
};
3 changes: 2 additions & 1 deletion frontend/mulighetsrommet-veileder-flate/src/mock/api/data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Features, ALERT_INFO } from '../../api/features';
import { Features, ALERT_INFO, FAKE_DOOR } from '../../api/features';

export const mockFeatures: Features = {
[ALERT_INFO]: true,
[FAKE_DOOR]: true,
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import SearchFieldTag from '../../components/tags/SearchFieldTag';
import { tiltakstypefilter, visSidemeny } from '../../core/atoms/atoms';
import { logEvent } from '../../api/logger';
import { useFetchFeatureToggle } from '../../api/api';
import { ALERT_INFO } from '../../api/features';
import { ALERT_INFO, FAKE_DOOR } from '../../api/features';
import { hasData } from '../../api/utils';
import Show from '../../utils/Show';

Expand All @@ -25,6 +25,7 @@ const ViewTiltakstypeOversikt = () => {

const features = useFetchFeatureToggle();
const visAlertInfoFeature = hasData(features) && features.data[ALERT_INFO];
const visFakeDoorFeature = hasData(features) && features.data[FAKE_DOOR];

const { data, isFetching, isError } = useTiltakstyper(filtrertListe); //isLoading vs isFetching?

Expand Down Expand Up @@ -52,31 +53,39 @@ const ViewTiltakstypeOversikt = () => {
};

return (
<div className="tiltakstype-oversikt" id="tiltakstype-oversikt" data-testid="tiltakstype-oversikt">
<Show if={sidemenyVisning}>
<Filtermeny handleClickSkjulSidemeny={handleClickSkjulSidemeny} />
</Show>
<div className="filtercontainer">
<Ikonknapp className="filterknapp" handleClick={handleClickSkjulSidemeny} ariaLabel="Filterknapp">
<Filter aria-label="Filterknapp" />
</Ikonknapp>
<div className="filtertags">
<InnsatsgruppefilterTags />
<SearchFieldTag />
<>
{visFakeDoorFeature ? (
<Alert variant="info">
Ååååja, så du tror at hvis du trykker på en knapp så skjer det ting automatisk, du da?
</Alert>
) : (
<div className="tiltakstype-oversikt" id="tiltakstype-oversikt" data-testid="tiltakstype-oversikt">
<Show if={sidemenyVisning}>
<Filtermeny handleClickSkjulSidemeny={handleClickSkjulSidemeny} />
</Show>
<div className="filtercontainer">
<Ikonknapp className="filterknapp" handleClick={handleClickSkjulSidemeny} ariaLabel="Filterknapp">
<Filter aria-label="Filterknapp" />
</Ikonknapp>
<div className="filtertags">
<InnsatsgruppefilterTags />
<SearchFieldTag />
</div>
</div>
<Show if={visInfoboks && visAlertInfoFeature}>
<Infotekst />
</Show>
<div className="tiltakstype-oversikt__tiltak">
<Heading level="1" size="xsmall">
Viser {data?.length} av {data?.length} tiltak
</Heading>
{isFetching && !data && <Loader variant="neutral" size="2xlarge" />}
{data && <TiltakstypeTabell tiltakstypeliste={data} />}
{isError && <Alert variant="error">En feil oppstod. Vi har problemer med å hente tiltakstypene.</Alert>}
</div>
</div>
</div>
<Show if={visInfoboks && visAlertInfoFeature}>
<Infotekst />
</Show>
<div className="tiltakstype-oversikt__tiltak">
<Heading level="1" size="xsmall">
Viser {data?.length} av {data?.length} tiltak
</Heading>
{isFetching && !data && <Loader variant="neutral" size="2xlarge" />}
{data && <TiltakstypeTabell tiltakstypeliste={data} />}
{isError && <Alert variant="error">En feil oppstod. Vi har problemer med å hente tiltakstypene.</Alert>}
</div>
</div>
)}
</>
);
};

Expand Down

0 comments on commit 34e04df

Please sign in to comment.