diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 3b81bf7e..1da6251f 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -21,7 +21,7 @@ "i18n:sort": "tsx ./src/i18n/check.ts --sort" }, "dependencies": { - "@altinn/altinn-components": "^0.1.0", + "@altinn/altinn-components": "^0.6.8", "@digdir/designsystemet-css": "0.11.0-next.10", "@digdir/designsystemet-react": "1.0.0-next.15", "@digdir/designsystemet-theme": "1.0.0-next.14", diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsx index 6b85beec..75cb5625 100644 --- a/packages/frontend/src/App.tsx +++ b/packages/frontend/src/App.tsx @@ -1,5 +1,5 @@ import { Navigate, Route, Routes } from 'react-router-dom'; -import { ProtectedPageLayout } from './components/PageLayout/PageLayout.tsx'; +import { ProtectedPageLayout } from './components/PageLayout/PageLayoutArbeidsFlate.tsx'; import { Inbox } from './pages/Inbox'; import { Routes as AppRoutes } from './pages/Inbox/Inbox.tsx'; import { InboxItemPage } from './pages/InboxItemPage'; diff --git a/packages/frontend/src/api/useDialogs.tsx b/packages/frontend/src/api/useDialogs.tsx index 0840fdd3..69f7fb62 100644 --- a/packages/frontend/src/api/useDialogs.tsx +++ b/packages/frontend/src/api/useDialogs.tsx @@ -20,11 +20,10 @@ import { getOrganization } from './organizations.ts'; import { graphQLSDK } from './queries.ts'; export type InboxViewType = 'inbox' | 'drafts' | 'sent' | 'archive' | 'bin'; +export type DialogsByView = { [key in InboxViewType]: InboxItemInput[] }; interface UseDialogsOutput { dialogs: InboxItemInput[]; - dialogsByView: { - [key in InboxViewType]: InboxItemInput[]; - }; + dialogsByView: DialogsByView; isSuccess: boolean; isLoading: boolean; } diff --git a/packages/frontend/src/components/PageLayout/PageLayout.tsx b/packages/frontend/src/components/PageLayout/PageLayout.tsx deleted file mode 100644 index d8fdec5d..00000000 --- a/packages/frontend/src/components/PageLayout/PageLayout.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import type { AvatarType } from '@altinn/altinn-components'; -import { useQueryClient } from '@tanstack/react-query'; -import cx from 'classnames'; -import type React from 'react'; -import { memo, useEffect } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Outlet, useLocation, useSearchParams } from 'react-router-dom'; -import { Footer, Header, type ItemPerViewCount, Sidebar } from '..'; -import { useWindowSize } from '../../../utils/useWindowSize.tsx'; -import { useDialogs } from '../../api/useDialogs.tsx'; -import { useParties } from '../../api/useParties.ts'; -import { getSearchStringFromQueryParams } from '../../pages/Inbox/queryParams.ts'; -import { useSavedSearches } from '../../pages/SavedSearches/useSavedSearches.ts'; -import { useProfile } from '../../profile'; -import { BetaBanner } from '../BetaBanner/BetaBanner.tsx'; -import { BottomDrawerContainer } from '../BottomDrawer'; -import { useAuth } from '../Login/AuthContext.tsx'; -import { Snackbar } from '../Snackbar'; -import { SelectedDialogsContainer, useSelectedDialogs } from './SelectedDialogs.tsx'; -import styles from './pageLayout.module.css'; - -export const useUpdateOnLocationChange = (fn: () => void) => { - const location = useLocation(); - // biome-ignore lint/correctness/useExhaustiveDependencies: Full control of what triggers this code is needed - useEffect(() => { - fn(); - }, [location, fn]); -}; - -interface PageLayoutContentProps { - name: string; - profile: AvatarType; - notificationCount?: number; -} - -const PageLayoutContent: React.FC = memo( - ({ name, profile }: { name: string; profile: AvatarType }) => { - const { inSelectionMode } = useSelectedDialogs(); - const { isTabletOrSmaller } = useWindowSize(); - const showSidebar = !isTabletOrSmaller && !inSelectionMode; - const { selectedPartyIds, selectedParties } = useParties(); - const { currentPartySavedSearches } = useSavedSearches(selectedPartyIds); - const { dialogsByView } = useDialogs(selectedParties); - const itemsPerViewCount = { - inbox: dialogsByView.inbox.filter((item) => !item.isSeenByEndUser).length, - drafts: dialogsByView.drafts.length, - sent: dialogsByView.sent.length, - 'saved-searches': currentPartySavedSearches?.length ?? 0, - archive: dialogsByView.archive.length, - bin: dialogsByView.bin.length, - } as ItemPerViewCount; - - return ( - <> -
-
- {showSidebar && } - -
-