Skip to content

Commit

Permalink
IS-Refactor-folder-structure (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
vetlesolgaard authored Dec 4, 2024
1 parent c842f02 commit 0409332
Show file tree
Hide file tree
Showing 35 changed files with 56 additions and 57 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/routers/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { ReactElement } from 'react';
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
import Side from '../sider/Side';
import Side from '../components/Side';
import Decorator from '../decorator/Decorator';
import OversiktContainer from '@/containers/OversiktContainer';
import OversiktContainer from '@/sider/oversikt/OversiktContainer';
import ErrorBoundary from '@/components/error/ErrorBoundary';
import SokContainer from '@/components/sokperson/SokContainer';
import SokContainer from '@/sider/sokperson/SokContainer';
import { routes } from '@/routers/routes';

const AppRouter = (): ReactElement => {
Expand Down
18 changes: 9 additions & 9 deletions src/containers/Oversikt.tsx → src/sider/oversikt/Oversikt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import {
PersonregisterState,
} from '@/api/types/personregisterTypes';
import { toPersonData } from '@/utils/toPersondata';
import { PersonFilter } from '@/components/Filter/PersonFilter';
import Sokeresultat from '@/components/Sokeresultat';
import { PersonFilter } from '@/sider/oversikt/filter/PersonFilter';
import Sokeresultat from '@/sider/oversikt/sokeresultat/Sokeresultat';
import styled from 'styled-components';
import { TekstFilter } from '@/components/Filter/TekstFilter';
import { ClearFiltersButton } from '@/components/Filter/ClearFiltersButton';
import { TekstFilter } from '@/sider/oversikt/filter/TekstFilter';
import { ClearFiltersButton } from '@/sider/oversikt/filter/ClearFiltersButton';
import {
Filterable,
filterEventsOnVeileder,
} from '@/utils/hendelseFilteringUtils';
import { PersonOversiktStatusDTO } from '@/api/types/personoversiktTypes';
import { useFilters } from '@/context/filters/FilterContext';
import { useAktivVeilederQuery } from '@/data/veiledereQueryHooks';
import { HendelseFilter } from '@/components/Filter/HendelseFilter';
import { HendelseFilter } from '@/sider/oversikt/filter/HendelseFilter';
import { Box } from '@navikt/ds-react';
import { TabType, useTabType } from '@/hooks/useTabType';

Expand All @@ -39,15 +39,15 @@ const OversiktContainerInnhold = styled.div`
}
`;

interface OversiktProps {
interface Props {
personoversiktData: PersonOversiktStatusDTO[];
personregisterData: PersonregisterData[];
}

export const Oversikt = ({
export default function Oversikt({
personoversiktData,
personregisterData,
}: OversiktProps) => {
}: Props) {
const aktivVeilederQuery = useAktivVeilederQuery();
const { filterState } = useFilters();
const { selectedTab } = useTabType();
Expand Down Expand Up @@ -90,4 +90,4 @@ export const Oversikt = ({
<Sokeresultat allEvents={allEvents} />
</OversiktContainerInnhold>
);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { ReactElement, useEffect } from 'react';
import { usePersonregisterQuery } from '@/data/personregisterHooks';
import { usePersonoversiktQuery } from '@/data/personoversiktHooks';
import AppSpinner from '@/components/AppSpinner';
import { Oversikt } from '@/containers/Oversikt';
import { NavigationBar } from '@/components/NavigationBar';
import { NotificationBar } from '@/components/error/NotificationBar';
import ErrorBoundary from '@/components/error/ErrorBoundary';
Expand All @@ -13,6 +12,7 @@ import { StoreKey, useLocalStorageState } from '@/hooks/useLocalStorageState';
import { getWeeksBetween } from '@/utils/dateUtils';
import { useFeatureToggles } from '@/data/unleash/unleashQueryHooks';
import { TabType, useTabType } from '@/hooks/useTabType';
import Oversikt from '@/sider/oversikt/Oversikt';

function logPageView(tab: TabType) {
Amplitude.logEvent({
Expand All @@ -32,7 +32,7 @@ function toReadableString(overviewTabType: TabType): string {
}
}

const OversiktContainer = (): ReactElement => {
export default function OversiktContainer(): ReactElement {
const personregisterQuery = usePersonregisterQuery();
const personoversiktQuery = usePersonoversiktQuery();
const { toggles } = useFeatureToggles();
Expand Down Expand Up @@ -74,6 +74,4 @@ const OversiktContainer = (): ReactElement => {
</div>
</ErrorBoundary>
);
};

export default OversiktContainer;
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactElement } from 'react';
import styled from 'styled-components';
import themes from '@/styles/themes';
import SlettIkon from '@/components/common/SlettIkon';
import SlettIkon from '@/sider/oversikt/filter/SlettIkon';
import { useFilters } from '@/context/filters/FilterContext';
import { ActionType } from '@/context/filters/filterContextActions';

Expand All @@ -20,12 +20,15 @@ const ClearFiltersWrapper = styled.div`
padding: 0.5rem 0.25rem;
-webkit-user-select: none;
user-select: none;
:hover {
cursor: pointer;
}
:active {
border: 2px solid ${themes.color.navBla};
}
> svg {
margin-right: 0.25em;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { PersonregisterState } from '@/api/types/personregisterTypes';
import { mapPersonregisterToCompanyList } from '@/utils/personDataUtil';
import { useFilters } from '@/context/filters/FilterContext';
import { ActionType } from '@/context/filters/filterContextActions';
import { FristFilter } from '@/components/Filter/FristFilter';
import { FristFilter } from '@/sider/oversikt/filter/FristFilter';
import {
AgeFilterOption,
FristFilterOption,
} from '@/utils/hendelseFilteringUtils';
import { AgeFilter } from '@/components/Filter/AgeFilter';
import { AgeFilter } from '@/sider/oversikt/filter/AgeFilter';
import { VStack } from '@navikt/ds-react';

interface PersonFilterProps {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {
filterOnPersonregister,
} from '@/utils/hendelseFilteringUtils';
import { useFilters } from '@/context/filters/FilterContext';
import { NewOversikt } from '@/components/NewOversikt';
import { OversiktTableContainer } from '@/sider/oversikt/sokeresultat/oversikttable/OversiktTableContainer';
import { TabType, useTabType } from '@/hooks/useTabType';

interface SokeresultatProps {
interface Props {
allEvents: Filterable<PersonregisterState>;
}

Expand All @@ -30,7 +30,7 @@ const lagListe = (
}));
};

const Sokeresultat = ({ allEvents }: SokeresultatProps) => {
export default function Sokeresultat({ allEvents }: Props) {
const tildelVeileder = useTildelVeileder();
const { filterState } = useFilters();
const { selectedTab } = useTabType();
Expand Down Expand Up @@ -88,7 +88,7 @@ const Sokeresultat = ({ allEvents }: SokeresultatProps) => {
checkAllHandler={checkAllHandler}
markertePersoner={markertePersoner}
/>
<NewOversikt
<OversiktTableContainer
personregister={filteredEvents.value}
startItem={startItem}
endItem={endItem}
Expand All @@ -97,6 +97,4 @@ const Sokeresultat = ({ allEvents }: SokeresultatProps) => {
/>
</div>
);
};

export default Sokeresultat;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EmptyDrawerImage } from '../../../img/ImageComponents';
import { EmptyDrawerImage } from '../../../../../img/ImageComponents';
import React from 'react';
import { BodyShort } from '@navikt/ds-react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ReactElement } from 'react';
import { Checkbox, Table } from '@navikt/ds-react';
import { VeilederColumn } from '@/components/VeilederColumn';
import { VeilederColumn } from '@/sider/oversikt/sokeresultat/oversikttable/VeilederColumn';
import { PersonData } from '@/api/types/personregisterTypes';
import { PersonRadVirksomhetColumn } from '@/components/PersonRadVirksomhetColumn';
import { FristDataCell } from '@/components/FristDataCell';
import { PersonRadVirksomhetColumn } from '@/sider/oversikt/sokeresultat/oversikttable/PersonRadVirksomhetColumn';
import { FristDataCell } from '@/sider/oversikt/sokeresultat/oversikttable/fristdatacell/FristDataCell';
import { Sorting, SortingKey, useSorting } from '@/hooks/useSorting';
import { LinkSyfomodiaperson } from '@/components/LinkSyfomodiaperson';
import { toLastnameFirstnameFormat } from '@/utils/stringUtil';
Expand All @@ -29,7 +29,7 @@ interface Props {
setSorting: (sorting: Sorting) => void;
}

export function NewOversiktTable({
export function OversiktTable({
personListe,
selectedRows,
setSelectedRows,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { useVeiledereQuery } from '@/data/veiledereQueryHooks';
import { PersonregisterState } from '@/api/types/personregisterTypes';
import { getSortedEventsFromSortingType } from '@/utils/hendelseFilteringUtils';
import { EmptyDrawer } from '@/components/EmptyDrawer/EmptyDrawer';
import { NewOversiktTable } from '@/components/NewOversiktTable';
import { EmptyDrawer } from '@/sider/oversikt/sokeresultat/oversikttable/EmptyDrawer';
import { OversiktTable } from '@/sider/oversikt/sokeresultat/oversikttable/OversiktTable';
import { useSorting } from '@/hooks/useSorting';

interface Props {
Expand All @@ -14,7 +14,7 @@ interface Props {
setSelectedRows: (rows: string[]) => void;
}

export const NewOversikt = ({
export const OversiktTableContainer = ({
personregister,
startItem,
endItem,
Expand All @@ -38,7 +38,7 @@ export const NewOversikt = ({
}

return (
<NewOversiktTable
<OversiktTable
sorting={sorting}
setSorting={setSorting}
personListe={personListe}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import React, { ReactElement, useState } from 'react';
import { AktivitetskravStatus } from '@/api/types/personoversiktTypes';
import { Button, Table, Tooltip } from '@navikt/ds-react';
import OppfolgingsoppgaveModal from '@/components/OppfolgingsoppgaveModal';
import OppfolgingsoppgaveModal from '@/sider/oversikt/sokeresultat/oversikttable/fristdatacell/OppfolgingsoppgaveModal';
import * as Amplitude from '@/utils/amplitude';
import { TabType, useTabType } from '@/hooks/useTabType';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { ChangeEvent, ReactElement, useState } from 'react';
import OpenDropdownButton from '../OpenDropdownButton/OpenDropdownButton';
import OpenDropdownButton from '../../../../components/toolbar/OpenDropdownButton/OpenDropdownButton';
import { VeilederDTO } from '@/api/types/veiledereTypes';
import styled from 'styled-components';
import { Dropdown } from '../Dropdown/Dropdown';
import { Dropdown } from '../../../../components/toolbar/Dropdown/Dropdown';
import {
filterVeiledereWithActiveOppgave,
sortVeiledereAlphabeticallyWithGivenVeilederFirst,
} from '@/utils/veiledereUtils';
import { filterVeiledereOnInput } from '@/utils/assignVeilederUtils';
import { DropdownButtonTexts } from '../Dropdown/DropdownButtons';
import { DropdownButtonTexts } from '../../../../components/toolbar/Dropdown/DropdownButtons';
import {
useAktivVeilederQuery,
useVeiledereQuery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React, { ChangeEvent, ReactElement, useEffect, useState } from 'react';
import { filterVeiledereOnInput } from '@/utils/assignVeilederUtils';
import { sortVeiledereAlphabeticallyWithGivenVeilederFirst } from '@/utils/veiledereUtils';
import { VeilederDTO } from '@/api/types/veiledereTypes';
import OpenDropdownButton from '../OpenDropdownButton/OpenDropdownButton';
import { Dropdown } from '../Dropdown/Dropdown';
import { DropdownButtonTexts } from '../Dropdown/DropdownButtons';
import OpenDropdownButton from '../../../../components/toolbar/OpenDropdownButton/OpenDropdownButton';
import { Dropdown } from '../../../../components/toolbar/Dropdown/Dropdown';
import { DropdownButtonTexts } from '../../../../components/toolbar/Dropdown/DropdownButtons';
import {
useAktivVeilederQuery,
useVeiledereQuery,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import TildelVeileder from './AssignVeileder/TildelVeileder';
import SearchVeileder from './SearchVeileder/SearchVeileder';
import TildelVeileder from './TildelVeileder';
import SearchVeileder from './SearchVeileder';
import React from 'react';
import styled from 'styled-components';
import themes from '../../styles/themes';
import themes from '../../../../styles/themes';
import { ToolbarWrapperProps } from './ToolbarWrapper';
import PaginationContainer from '@/components/toolbar/PaginationContainer';
import PaginationContainer from '@/sider/oversikt/sokeresultat/toolbar/PaginationContainer';
import { TabType, useTabType } from '@/hooks/useTabType';

const Innhold = styled.section`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactElement, useState } from 'react';
import Toolbar from './Toolbar';
import { Label } from '@navikt/ds-react';
import { PAGINATED_NUMBER_OF_ITEMS } from '@/components/toolbar/PaginationContainer';
import { PAGINATED_NUMBER_OF_ITEMS } from '@/sider/oversikt/sokeresultat/toolbar/PaginationContainer';

export interface ToolbarWrapperProps {
alleMarkert: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { NavigationBar } from '@/components/NavigationBar';
import SokPerson from '@/components/sokperson/SokPerson';
import SokPerson from '@/sider/sokperson/SokPerson';

export default function SokContainer() {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@navikt/ds-react';
import { useSokPerson } from '@/data/personoversiktHooks';
import { SokDTO } from '@/api/types/sokDTO';
import SokPersonResultat from '@/components/sokperson/SokPersonResultat';
import SokPersonResultat from '@/sider/sokperson/SokPersonResultat';
import { MagnifyingGlassIcon } from '@navikt/aksel-icons';
import { isNumeric, removePunctuation } from '@/utils/stringUtil';
import { parseDateString } from '@/utils/dateUtils';
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/components/FristColumnTest.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { screen } from '@testing-library/react';
import { FristDataCell } from '@/components/FristDataCell';
import { FristDataCell } from '@/sider/oversikt/sokeresultat/oversikttable/fristdatacell/FristDataCell';
import React from 'react';
import { PersonData, Skjermingskode } from '@/api/types/personregisterTypes';
import { testdata } from '../data/fellesTestdata';
Expand Down
2 changes: 1 addition & 1 deletion test/components/HendelseTypeFilter.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { HendelseFilter } from '@/components/Filter/HendelseFilter';
import { HendelseFilter } from '@/sider/oversikt/filter/HendelseFilter';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { screen } from '@testing-library/react';
import { beforeEach, describe, expect, it } from 'vitest';
Expand Down
4 changes: 2 additions & 2 deletions test/components/NewOversiktTableTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getQueryClientWithMockdata,
testQueryClient,
} from '../testQueryClient';
import { NewOversiktTable } from '@/components/NewOversiktTable';
import { OversiktTable } from '@/sider/oversikt/sokeresultat/oversikttable/OversiktTable';
import {
PersonData,
PersonregisterState,
Expand Down Expand Up @@ -89,7 +89,7 @@ const renderOversikt = (personer: PersonregisterState) =>
handleAktivEnhetChanged: () => void 0,
}}
>
<NewOversiktTable
<OversiktTable
personListe={Object.entries(personer)}
selectedRows={[]}
setSelectedRows={() => void 0}
Expand Down
2 changes: 1 addition & 1 deletion test/components/SokPersonTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { AktivEnhetProvider } from '@/context/aktivEnhet/AktivEnhetContext';
import { beforeEach, describe, expect, it } from 'vitest';
import { testQueryClient } from '../testQueryClient';
import SokPerson from '@/components/sokperson/SokPerson';
import SokPerson from '@/sider/sokperson/SokPerson';
import userEvent from '@testing-library/user-event';
import { SokDTO } from '@/api/types/sokDTO';
import { parseDateString } from '@/utils/dateUtils';
Expand Down
2 changes: 1 addition & 1 deletion test/components/Sokeresultat.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Sokeresultat from '../../src/components/Sokeresultat';
import Sokeresultat from '@/sider/oversikt/sokeresultat/Sokeresultat';
import { personregister } from '../data/fellesTestdata';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { Filterable } from '@/utils/hendelseFilteringUtils';
Expand Down
2 changes: 1 addition & 1 deletion test/containers/OversiktContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { AktivEnhetContext } from '@/context/aktivEnhet/AktivEnhetContext';
import { NotificationContext } from '@/context/notification/NotificationContext';
import OversiktContainer from '@/containers/OversiktContainer';
import OversiktContainer from '@/sider/oversikt/OversiktContainer';
import { stubPersonoversikt } from '../stubs/stubPersonoversikt';
import { stubPersonregister } from '../stubs/stubPersonregister';
import { stubAktivVeileder } from '../stubs/stubAktivVeileder';
Expand Down

0 comments on commit 0409332

Please sign in to comment.