Skip to content

Commit

Permalink
Fjern klarsprak feature toggle (#1198)
Browse files Browse the repository at this point in the history
* Fjern klarsprak feature toggle

* Remove toggle from features request also

* Remove stuff
  • Loading branch information
tu55eladd authored Oct 10, 2023
1 parent 2341e88 commit 43f1445
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 60 deletions.
6 changes: 2 additions & 4 deletions src/mocks/data/feature.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Features, VIS_SPRAKSJEKK } from '../../moduler/feature/feature';
import { Features } from '../../moduler/feature/feature';

export const features: Features = {
[VIS_SPRAKSJEKK]: true,
};
export const features: Features = {};
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ import { Spraksjekk, checkText } from '@navikt/dab-spraksjekk';
import { Button, Select, Switch, TextField, Textarea } from '@navikt/ds-react';
import React, { MutableRefObject, useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import { useSelector } from 'react-redux';
import { z } from 'zod';

import { logReferatFullfort, logToggleSpraksjekkToggle } from '../../../../amplitude/amplitude';
import { AktivitetStatus, Kanal } from '../../../../datatypes/aktivitetTypes';
import { SamtalereferatAktivitet, VeilarbAktivitetType } from '../../../../datatypes/internAktivitetTypes';
import ControlledDatePicker from '../../../../felles-komponenter/skjema/datovelger/ControlledDatePicker';
import { VIS_SPRAKSJEKK } from '../../../feature/feature';
import { selectFeature } from '../../../feature/feature-selector';
import AktivitetFormHeader from '../AktivitetFormHeader';
import CustomErrorSummary from '../CustomErrorSummary';
import { dateOrUndefined } from '../ijobb/AktivitetIjobbForm';
Expand Down Expand Up @@ -43,10 +40,7 @@ interface Props {

const InnerSamtalereferatForm = (props: Props) => {
const { onSubmit, dirtyRef, aktivitet } = props;

const [open, setOpen] = useState(true);
const visSpraksjekk = useSelector(selectFeature(VIS_SPRAKSJEKK));

const startTekst = useReferatStartTekst();
const nyAktivitet = !aktivitet;

Expand Down Expand Up @@ -121,25 +115,16 @@ const InnerSamtalereferatForm = (props: Props) => {
error={errors.referat && errors.referat.message}
value={referatValue}
/>

{visSpraksjekk && (
<>
<Switch
checked={open}
onChange={() => {
setOpen(!open);
logToggleSpraksjekkToggle(!open);
}}
>
Klarspråkhjelpen
</Switch>
<Spraksjekk
value={referatValue}
open={open}
options={{ tools: false, longWords: false }}
/>
</>
)}
<Switch
checked={open}
onChange={() => {
setOpen(!open);
logToggleSpraksjekkToggle(!open);
}}
>
Klarspråkhjelpen
</Switch>
<Spraksjekk value={referatValue} open={open} options={{ tools: false, longWords: false }} />
</>
)}

Expand Down
36 changes: 12 additions & 24 deletions src/moduler/aktivitet/visning/referat/OppdaterReferatForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { MoteAktivitet, SamtalereferatAktivitet } from '../../../../datatypes/in
import { HiddenIfHovedknapp } from '../../../../felles-komponenter/hidden-if/HiddenIfHovedknapp';
import useAppDispatch from '../../../../felles-komponenter/hooks/useAppDispatch';
import { DirtyContext } from '../../../context/dirty-context';
import { VIS_SPRAKSJEKK } from '../../../feature/feature';
import { selectFeature } from '../../../feature/feature-selector';
import { selectPubliserOgOppdaterReferatFeil } from '../../../feilmelding/feil-selector';
import Feilmelding from '../../../feilmelding/Feilmelding';
import { oppdaterReferat, publiserReferat } from '../../aktivitet-actions';
Expand All @@ -34,16 +32,10 @@ interface Props {

const OppdaterReferatForm = (props: Props) => {
const { aktivitet, onFerdig } = props;

const [open, setOpen] = useState(true);
const visSpraksjekk = useSelector(selectFeature(VIS_SPRAKSJEKK));

const startTekst = useReferatStartTekst();

const dispatch = useAppDispatch();

const aktivitetsStatus = useSelector(selectAktivitetStatus);

const erReferatPublisert = aktivitet.erReferatPublisert;

const {
Expand Down Expand Up @@ -111,22 +103,18 @@ const OppdaterReferatForm = (props: Props) => {
{...register('referat')}
value={referatValue}
/>

{visSpraksjekk && (
<>
<Switch
checked={open}
onChange={() => {
setOpen(!open);
logToggleSpraksjekkToggle(!open);
}}
>
Klarspråkhjelpen
</Switch>
<Spraksjekk value={referatValue} open={open} options={{ tools: false, longWords: false }} />
</>
)}

<>
<Switch
checked={open}
onChange={() => {
setOpen(!open);
logToggleSpraksjekkToggle(!open);
}}
>
Klarspråkhjelpen
</Switch>
<Spraksjekk value={referatValue} open={open} options={{ tools: false, longWords: false }} />
</>
<Feilmelding feilmeldinger={feil} />
<div className="space-x-4">
<HiddenIfHovedknapp
Expand Down
6 changes: 2 additions & 4 deletions src/moduler/feature/feature-slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import { createAsyncThunk } from '@reduxjs/toolkit';

import * as Api from '../../api/featureAPI';
import createGenericSlice, { GenericState, Status } from '../../createGenericSlice';
import { Features, VIS_SPRAKSJEKK } from './feature';
import { Features } from './feature';

const initialFeatures: Features = {
[VIS_SPRAKSJEKK]: false,
};
const initialFeatures: Features = {};

const featureSlice = createGenericSlice({
name: 'feature',
Expand Down
4 changes: 1 addition & 3 deletions src/moduler/feature/feature.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export const VIS_SPRAKSJEKK = 'aktivitetsplan.vis-spraksjekk';

const ALL_TOGGLES = [VIS_SPRAKSJEKK] as const;
const ALL_TOGGLES = [] as const;

export type Feature = (typeof ALL_TOGGLES)[number];
export type Features = Record<Feature, boolean>;
Expand Down

0 comments on commit 43f1445

Please sign in to comment.