From 3b0f5013b7fe41b05046d5c614430f065da11983 Mon Sep 17 00:00:00 2001 From: Joanna Dyczka Date: Mon, 25 Mar 2024 10:57:40 +0100 Subject: [PATCH] [#541] move dashboard components into features folder --- govtool/frontend/src/App.tsx | 2 +- .../dashboard}/DashboardCards.tsx | 12 ++++--- .../dashboard}/DashboardDrawerMobile.tsx | 5 +-- .../dashboard}/DashboardTopNav.tsx | 2 +- .../dashboard/cards}/DRepDashboardCard.tsx | 7 ++-- .../dashboard/cards}/DashboardActionCard.tsx | 2 +- .../cards}/DelegateDashboardCard.tsx | 7 ++-- .../cards}/ListGovActionsDashboardCard.tsx | 2 +- .../cards}/ProposeGovActionDashboardCard.tsx | 2 +- .../cards}/SoleVoterDashboardCard.tsx | 2 +- .../features/dashboard/cards/index.ts | 6 ++++ .../components/features/dashboard/index.ts | 5 +++ .../frontend/src/components/features/index.ts | 1 + .../molecules/CenteredBoxPageWrapper.tsx | 2 +- .../src/components/molecules/index.ts | 1 - .../src/components/organisms/index.ts | 4 --- .../src/components/organisms/types.ts | 7 ++-- .../src/pages/CreateGovernanceAction.tsx | 2 +- govtool/frontend/src/pages/Dashboard.tsx | 3 +- govtool/frontend/src/pages/DelegateTodRep.tsx | 2 +- govtool/frontend/src/pages/RegisterAsdRep.tsx | 2 +- .../frontend/src/pages/UpdatedRepMetadata.tsx | 3 +- .../src/stories/DashboardCard.stories.ts | 32 ++++++++++++------- .../src/stories/DashboardTopNav.stories.ts | 2 +- govtool/frontend/tsconfig.json | 1 + govtool/frontend/vite.config.ts | 4 +++ 26 files changed, 68 insertions(+), 52 deletions(-) rename govtool/frontend/src/components/{organisms => features/dashboard}/DashboardCards.tsx (90%) rename govtool/frontend/src/components/{organisms => features/dashboard}/DashboardDrawerMobile.tsx (94%) rename govtool/frontend/src/components/{organisms => features/dashboard}/DashboardTopNav.tsx (97%) rename govtool/frontend/src/components/{organisms/DashboardCards => features/dashboard/cards}/DRepDashboardCard.tsx (96%) rename govtool/frontend/src/components/{molecules => features/dashboard/cards}/DashboardActionCard.tsx (98%) rename govtool/frontend/src/components/{organisms/DashboardCards => features/dashboard/cards}/DelegateDashboardCard.tsx (97%) rename govtool/frontend/src/components/{organisms/DashboardCards => features/dashboard/cards}/ListGovActionsDashboardCard.tsx (93%) rename govtool/frontend/src/components/{organisms/DashboardCards => features/dashboard/cards}/ProposeGovActionDashboardCard.tsx (96%) rename govtool/frontend/src/components/{organisms/DashboardCards => features/dashboard/cards}/SoleVoterDashboardCard.tsx (97%) create mode 100644 govtool/frontend/src/components/features/dashboard/cards/index.ts create mode 100644 govtool/frontend/src/components/features/dashboard/index.ts create mode 100644 govtool/frontend/src/components/features/index.ts diff --git a/govtool/frontend/src/App.tsx b/govtool/frontend/src/App.tsx index 7db190366..a23f94a6c 100644 --- a/govtool/frontend/src/App.tsx +++ b/govtool/frontend/src/App.tsx @@ -5,7 +5,6 @@ import { Modal, ScrollToTop } from "@atoms"; import { PATHS } from "@consts"; import { useCardano, useModal } from "@context"; import { - DashboardCards, DashboardGovernanceActions, DashboardGovernanceActionDetails, } from "@organisms"; @@ -29,6 +28,7 @@ import { WALLET_LS_KEY, removeItemFromLocalStorage, } from "@utils"; +import { DashboardCards } from "@features"; import { SetupInterceptors } from "./services"; import { useWalletConnectionListener } from "./hooks"; import { RegisterAsSoleVoter } from "./pages/RegisterAsSoleVoter"; diff --git a/govtool/frontend/src/components/organisms/DashboardCards.tsx b/govtool/frontend/src/components/features/dashboard/DashboardCards.tsx similarity index 90% rename from govtool/frontend/src/components/organisms/DashboardCards.tsx rename to govtool/frontend/src/components/features/dashboard/DashboardCards.tsx index cac0320db..0467ade12 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards.tsx +++ b/govtool/frontend/src/components/features/dashboard/DashboardCards.tsx @@ -9,11 +9,13 @@ import { useGetVoterInfo, useTranslation } from "@hooks"; -import { DelegateDashboardCard } from "./DashboardCards/DelegateDashboardCard"; -import { DRepDashboardCard } from "./DashboardCards/DRepDashboardCard"; -import { SoleVoterDashboardCard } from "./DashboardCards/SoleVoterDashboardCard"; -import { ListGovActionsDashboardCards } from "./DashboardCards/ListGovActionsDashboardCard"; -import { ProposeGovActionDashboardCard } from "./DashboardCards/ProposeGovActionDashboardCard"; +import { + DelegateDashboardCard, + DRepDashboardCard, + SoleVoterDashboardCard, + ListGovActionsDashboardCards, + ProposeGovActionDashboardCard +} from "./cards"; export const DashboardCards = () => { const { diff --git a/govtool/frontend/src/components/organisms/DashboardDrawerMobile.tsx b/govtool/frontend/src/components/features/dashboard/DashboardDrawerMobile.tsx similarity index 94% rename from govtool/frontend/src/components/organisms/DashboardDrawerMobile.tsx rename to govtool/frontend/src/components/features/dashboard/DashboardDrawerMobile.tsx index ee75b1df1..7920fe70f 100644 --- a/govtool/frontend/src/components/organisms/DashboardDrawerMobile.tsx +++ b/govtool/frontend/src/components/features/dashboard/DashboardDrawerMobile.tsx @@ -5,13 +5,14 @@ import { CONNECTED_NAV_ITEMS, ICONS } from "@consts"; import { DRepInfoCard, WalletInfoCard } from "@molecules"; import { useGetVoterInfo, useScreenDimension } from "@hooks"; import { openInNewTab } from "@utils"; - -import { DashboardDrawerMobileProps } from "./types"; +import { DrawerMobileProps } from "@/components/organisms/types"; const DRAWER_PADDING = 2; // 8 is number of multiple in Material UI 2 is left and right side const CALCULATED_DRAWER_PADDING = DRAWER_PADDING * 8 * 2; +export type DashboardDrawerMobileProps = Omit; + export const DashboardDrawerMobile = ({ isDrawerOpen, setIsDrawerOpen, diff --git a/govtool/frontend/src/components/organisms/DashboardTopNav.tsx b/govtool/frontend/src/components/features/dashboard/DashboardTopNav.tsx similarity index 97% rename from govtool/frontend/src/components/organisms/DashboardTopNav.tsx rename to govtool/frontend/src/components/features/dashboard/DashboardTopNav.tsx index 787735251..1af84b6ee 100644 --- a/govtool/frontend/src/components/organisms/DashboardTopNav.tsx +++ b/govtool/frontend/src/components/features/dashboard/DashboardTopNav.tsx @@ -4,7 +4,7 @@ import { Box, IconButton } from "@mui/material"; import { VotingPowerChips, Typography } from "@atoms"; import { ICONS } from "@consts"; import { useScreenDimension } from "@hooks"; -import { DashboardDrawerMobile } from "@organisms"; +import { DashboardDrawerMobile } from "./DashboardDrawerMobile"; type DashboardTopNavProps = { title: string; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx b/govtool/frontend/src/components/features/dashboard/cards/DRepDashboardCard.tsx similarity index 96% rename from govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx rename to govtool/frontend/src/components/features/dashboard/cards/DRepDashboardCard.tsx index 957314dfc..210883230 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx +++ b/govtool/frontend/src/components/features/dashboard/cards/DRepDashboardCard.tsx @@ -3,14 +3,11 @@ import { useNavigate } from "react-router-dom"; import { IMAGES, PATHS } from "@consts"; import { useTranslation } from "@hooks"; -import { - CopyableInfo, - DashboardActionCard, - DashboardActionCardProps, -} from "@molecules"; +import { CopyableInfo } from "@molecules"; import { openInNewTab } from "@utils"; import { PendingTransaction } from "@/context/pendingTransaction"; import { VoterInfo } from "@/models"; +import { DashboardActionCard, DashboardActionCardProps } from "./DashboardActionCard"; type DRepDashboardCardProps = { dRepIDBech32: string; diff --git a/govtool/frontend/src/components/molecules/DashboardActionCard.tsx b/govtool/frontend/src/components/features/dashboard/cards/DashboardActionCard.tsx similarity index 98% rename from govtool/frontend/src/components/molecules/DashboardActionCard.tsx rename to govtool/frontend/src/components/features/dashboard/cards/DashboardActionCard.tsx index 55dde49ad..4248d594d 100644 --- a/govtool/frontend/src/components/molecules/DashboardActionCard.tsx +++ b/govtool/frontend/src/components/features/dashboard/cards/DashboardActionCard.tsx @@ -3,7 +3,7 @@ import { FC, ReactNode } from "react"; import { LoadingButton, LoadingButtonProps, Typography } from "@atoms"; import { useScreenDimension, useTranslation } from "@hooks"; -import { Card } from "./Card"; +import { Card } from "@molecules"; export type DashboardActionCardProps = { buttons?: LoadingButtonProps[]; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx b/govtool/frontend/src/components/features/dashboard/cards/DelegateDashboardCard.tsx similarity index 97% rename from govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx rename to govtool/frontend/src/components/features/dashboard/cards/DelegateDashboardCard.tsx index 6f68f06a9..2d06b47bc 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx +++ b/govtool/frontend/src/components/features/dashboard/cards/DelegateDashboardCard.tsx @@ -3,13 +3,10 @@ import { Trans } from "react-i18next"; import { IMAGES, PATHS } from "@consts"; import { useTranslation } from "@hooks"; -import { - CopyableInfo, - DashboardActionCard, - DashboardActionCardProps, -} from "@molecules"; +import { CopyableInfo } from "@molecules"; import { correctAdaFormat, formHexToBech32, openInNewTab } from "@utils"; import { PendingTransaction } from "@/context/pendingTransaction"; +import { DashboardActionCard, DashboardActionCardProps } from "./DashboardActionCard"; type DelegateDashboardCardProps = { currentDelegation: string; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx b/govtool/frontend/src/components/features/dashboard/cards/ListGovActionsDashboardCard.tsx similarity index 93% rename from govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx rename to govtool/frontend/src/components/features/dashboard/cards/ListGovActionsDashboardCard.tsx index dfc42cc36..278c52043 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx +++ b/govtool/frontend/src/components/features/dashboard/cards/ListGovActionsDashboardCard.tsx @@ -2,8 +2,8 @@ import { useNavigate } from "react-router-dom"; import { IMAGES, PATHS } from "@consts"; import { useTranslation } from "@hooks"; -import { DashboardActionCard } from "@molecules"; import { VoterInfo } from "@/models"; +import { DashboardActionCard } from "./DashboardActionCard"; type ListGovActionsDashboardCardsProps = { voter: VoterInfo; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx b/govtool/frontend/src/components/features/dashboard/cards/ProposeGovActionDashboardCard.tsx similarity index 96% rename from govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx rename to govtool/frontend/src/components/features/dashboard/cards/ProposeGovActionDashboardCard.tsx index 6bace3a8d..43227ed8b 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx +++ b/govtool/frontend/src/components/features/dashboard/cards/ProposeGovActionDashboardCard.tsx @@ -2,9 +2,9 @@ import { useNavigate } from "react-router-dom"; import { IMAGES, PATHS } from "@consts"; import { useTranslation } from "@hooks"; -import { DashboardActionCard } from "@molecules"; import { openInNewTab } from "@utils"; import { PendingTransaction } from "@/context/pendingTransaction"; +import { DashboardActionCard } from "./DashboardActionCard"; type ProposeGovActionDashboardCardProps = { createGovActionTx: PendingTransaction["createGovAction"]; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/SoleVoterDashboardCard.tsx b/govtool/frontend/src/components/features/dashboard/cards/SoleVoterDashboardCard.tsx similarity index 97% rename from govtool/frontend/src/components/organisms/DashboardCards/SoleVoterDashboardCard.tsx rename to govtool/frontend/src/components/features/dashboard/cards/SoleVoterDashboardCard.tsx index 95eb1449b..6a4f289a2 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/SoleVoterDashboardCard.tsx +++ b/govtool/frontend/src/components/features/dashboard/cards/SoleVoterDashboardCard.tsx @@ -3,11 +3,11 @@ import { Trans } from "react-i18next"; import { IMAGES, PATHS } from "@consts"; import { useTranslation } from "@hooks"; -import { DashboardActionCard, DashboardActionCardProps } from "@molecules"; import { correctAdaFormat, openInNewTab } from "@utils"; import { LoadingButtonProps } from "@atoms"; import { PendingTransaction } from "@/context/pendingTransaction"; import { VoterInfo } from "@/models"; +import { DashboardActionCard, DashboardActionCardProps } from "./DashboardActionCard"; type SoleVoterDashboardCardProps = { pendingTransaction: PendingTransaction; diff --git a/govtool/frontend/src/components/features/dashboard/cards/index.ts b/govtool/frontend/src/components/features/dashboard/cards/index.ts new file mode 100644 index 000000000..7e223d364 --- /dev/null +++ b/govtool/frontend/src/components/features/dashboard/cards/index.ts @@ -0,0 +1,6 @@ +export * from "./DRepDashboardCard"; +export * from "./DashboardActionCard"; +export * from "./DelegateDashboardCard"; +export * from "./ListGovActionsDashboardCard"; +export * from "./ProposeGovActionDashboardCard"; +export * from "./SoleVoterDashboardCard"; diff --git a/govtool/frontend/src/components/features/dashboard/index.ts b/govtool/frontend/src/components/features/dashboard/index.ts new file mode 100644 index 000000000..f6b630da9 --- /dev/null +++ b/govtool/frontend/src/components/features/dashboard/index.ts @@ -0,0 +1,5 @@ +export * from "./DashboardCards"; +export * from "./DashboardDrawerMobile"; +export * from "./DashboardTopNav"; + +export * from "./cards"; diff --git a/govtool/frontend/src/components/features/index.ts b/govtool/frontend/src/components/features/index.ts new file mode 100644 index 000000000..e578baa93 --- /dev/null +++ b/govtool/frontend/src/components/features/index.ts @@ -0,0 +1 @@ +export * from "./dashboard"; diff --git a/govtool/frontend/src/components/molecules/CenteredBoxPageWrapper.tsx b/govtool/frontend/src/components/molecules/CenteredBoxPageWrapper.tsx index c9ad0c9b9..2c51625e0 100644 --- a/govtool/frontend/src/components/molecules/CenteredBoxPageWrapper.tsx +++ b/govtool/frontend/src/components/molecules/CenteredBoxPageWrapper.tsx @@ -3,7 +3,7 @@ import { Box, Link } from "@mui/material"; import { Background, Typography } from "@atoms"; import { ICONS } from "@consts"; -import { DashboardTopNav } from "@organisms"; +import { DashboardTopNav } from "@features"; import { useScreenDimension } from "@hooks"; import { useNavigate } from "react-router-dom"; import { theme } from "@/theme"; diff --git a/govtool/frontend/src/components/molecules/index.ts b/govtool/frontend/src/components/molecules/index.ts index 49002a007..3c4f7ab2f 100644 --- a/govtool/frontend/src/components/molecules/index.ts +++ b/govtool/frontend/src/components/molecules/index.ts @@ -4,7 +4,6 @@ export * from "./Card"; export * from "./CenteredBoxBottomButtons"; export * from "./CenteredBoxPageWrapper"; export * from "./CopyableInfo"; -export * from "./DashboardActionCard"; export * from "./DataActionsBar"; export * from "./DataMissingInfoBox"; export * from "./DRepInfoCard"; diff --git a/govtool/frontend/src/components/organisms/index.ts b/govtool/frontend/src/components/organisms/index.ts index cccbc8400..409607012 100644 --- a/govtool/frontend/src/components/organisms/index.ts +++ b/govtool/frontend/src/components/organisms/index.ts @@ -3,13 +3,9 @@ export * from "./ChooseStakeKeyPanel"; export * from "./ChooseWalletModal"; export * from "./ControlledField"; export * from "./CreateGovernanceActionSteps"; -export * from "./DashboardCards"; -export * from "./DashboardCards"; -export * from "./DashboardDrawerMobile"; export * from "./DashboardGovernanceActionDetails"; export * from "./DashboardGovernanceActions"; export * from "./DashboardGovernanceActionsVotedOn"; -export * from "./DashboardTopNav"; export * from "./DelegateTodRepStepOne"; export * from "./DelegateTodRepStepTwo"; export * from "./Drawer"; diff --git a/govtool/frontend/src/components/organisms/types.ts b/govtool/frontend/src/components/organisms/types.ts index 4207dd2db..82b793f74 100644 --- a/govtool/frontend/src/components/organisms/types.ts +++ b/govtool/frontend/src/components/organisms/types.ts @@ -12,11 +12,8 @@ export type BgCardProps = { sx?: SxProps; }; -export type DashboardDrawerMobileProps = { +export type DrawerMobileProps = { + isConnectButton: boolean; isDrawerOpen: boolean; setIsDrawerOpen: Dispatch>; }; - -export type DrawerMobileProps = DashboardDrawerMobileProps & { - isConnectButton: boolean; -}; diff --git a/govtool/frontend/src/pages/CreateGovernanceAction.tsx b/govtool/frontend/src/pages/CreateGovernanceAction.tsx index 1977dd5af..4dbe476d8 100644 --- a/govtool/frontend/src/pages/CreateGovernanceAction.tsx +++ b/govtool/frontend/src/pages/CreateGovernanceAction.tsx @@ -15,13 +15,13 @@ import { LinkWithIcon } from "@molecules"; import { ChooseGovernanceActionType, CreateGovernanceActionForm, - DashboardTopNav, Footer, ReviewCreatedGovernanceAction, StorageInformation, StoreDataInfo, WhatGovernanceActionIsAbout, } from "@organisms"; +import { DashboardTopNav } from "@features"; import { checkIsWalletConnected } from "@utils"; export const CreateGovernanceAction = () => { diff --git a/govtool/frontend/src/pages/Dashboard.tsx b/govtool/frontend/src/pages/Dashboard.tsx index 1483ab7fb..75995e170 100644 --- a/govtool/frontend/src/pages/Dashboard.tsx +++ b/govtool/frontend/src/pages/Dashboard.tsx @@ -6,8 +6,9 @@ import { Background, ScrollToManage } from "@atoms"; import { PATHS } from "@consts"; import { useCardano } from "@context"; import { useScreenDimension, useTranslation } from "@hooks"; -import { DashboardTopNav, Drawer, Footer } from "@organisms"; +import { Drawer, Footer } from "@organisms"; import { checkIsWalletConnected } from "@utils"; +import { DashboardTopNav } from "@features"; export const Dashboard = () => { const { isEnabled, stakeKey } = useCardano(); diff --git a/govtool/frontend/src/pages/DelegateTodRep.tsx b/govtool/frontend/src/pages/DelegateTodRep.tsx index 56b0c8ff3..6b9c28b0d 100644 --- a/govtool/frontend/src/pages/DelegateTodRep.tsx +++ b/govtool/frontend/src/pages/DelegateTodRep.tsx @@ -6,11 +6,11 @@ import { Background } from "@atoms"; import { PATHS } from "@consts"; import { useScreenDimension, useTranslation } from "@hooks"; import { - DashboardTopNav, DelegateTodRepStepOne, DelegateTodRepStepTwo, Footer, } from "@organisms"; +import { DashboardTopNav } from "@features"; import { checkIsWalletConnected } from "@utils"; export const DelegateTodRep = () => { diff --git a/govtool/frontend/src/pages/RegisterAsdRep.tsx b/govtool/frontend/src/pages/RegisterAsdRep.tsx index fed238aa3..614916ca6 100644 --- a/govtool/frontend/src/pages/RegisterAsdRep.tsx +++ b/govtool/frontend/src/pages/RegisterAsdRep.tsx @@ -13,13 +13,13 @@ import { } from "@hooks"; import { LinkWithIcon } from "@molecules"; import { - DashboardTopNav, DRepStorageInformation, DRepStoreDataInfo, Footer, RegisterAsDRepForm, RolesAndResponsibilities, } from "@organisms"; +import { DashboardTopNav } from "@features"; import { checkIsWalletConnected } from "@utils"; export const RegisterAsdRep = () => { diff --git a/govtool/frontend/src/pages/UpdatedRepMetadata.tsx b/govtool/frontend/src/pages/UpdatedRepMetadata.tsx index 0900eeb1c..21aa8259f 100644 --- a/govtool/frontend/src/pages/UpdatedRepMetadata.tsx +++ b/govtool/frontend/src/pages/UpdatedRepMetadata.tsx @@ -10,7 +10,8 @@ import { useUpdatedRepMetadataForm, useTranslation, } from "@hooks"; -import { ControlledField, DashboardTopNav, Footer } from "@organisms"; +import { ControlledField, Footer } from "@organisms"; +import { DashboardTopNav } from "@features"; import { checkIsWalletConnected, openInNewTab } from "@utils"; import { theme } from "@/theme"; diff --git a/govtool/frontend/src/stories/DashboardCard.stories.ts b/govtool/frontend/src/stories/DashboardCard.stories.ts index 7574a9f5a..64928a773 100644 --- a/govtool/frontend/src/stories/DashboardCard.stories.ts +++ b/govtool/frontend/src/stories/DashboardCard.stories.ts @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; -import { DashboardActionCard } from "@molecules"; +import { DashboardActionCard } from "@features"; import { within } from "@storybook/testing-library"; import { expect } from "@storybook/jest"; import { IMAGES } from "@/consts"; @@ -19,10 +19,12 @@ type Story = StoryObj; export const DashboardCardComponent: Story = { args: { + buttons: [ + { children: "first button" }, + { children: "second button" }, + ], description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit.", - firstButtonLabel: "first button", imageURL: IMAGES.govActionDelegateImage, - secondButtonLabel: "second button", title: "Action card", }, play: async ({ canvasElement }) => { @@ -36,23 +38,27 @@ export const DashboardCardComponent: Story = { }, }; -export const WithDRepIdDashboardCardComponent: Story = { +export const WithChildrenDashboardCardComponent: Story = { args: { + buttons: [ + { children: "first button" }, + { children: "second button" }, + ], description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit.", - firstButtonLabel: "first button", imageURL: IMAGES.govActionDelegateImage, - secondButtonLabel: "second button", title: "Action card", - cardId: "drep1gwsw9ckkhuwscj9savt5f7u9xsrudw209hne7pggcktzuw5sv32", + children: "You can insert any children you want", }, }; export const LoadingDashboardCard: Story = { args: { + buttons: [ + { children: "first button" }, + { children: "second button" }, + ], description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit.", - firstButtonLabel: "first button", imageURL: IMAGES.govActionDelegateImage, - secondButtonLabel: "second button", title: "Action card", isLoading: true, }, @@ -67,12 +73,14 @@ export const LoadingDashboardCard: Story = { export const InProgressDashboardCard: Story = { args: { + buttons: [ + { children: "first button" }, + { children: "second button" }, + ], description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit.", - firstButtonLabel: "first button", imageURL: IMAGES.govActionDelegateImage, - secondButtonLabel: "second button", title: "Action card", - inProgress: true, + state: "inProgress", }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); diff --git a/govtool/frontend/src/stories/DashboardTopNav.stories.ts b/govtool/frontend/src/stories/DashboardTopNav.stories.ts index aa02015af..a243fbbba 100644 --- a/govtool/frontend/src/stories/DashboardTopNav.stories.ts +++ b/govtool/frontend/src/stories/DashboardTopNav.stories.ts @@ -1,6 +1,6 @@ import type { Meta, StoryObj } from "@storybook/react"; -import { DashboardTopNav } from "@organisms"; +import { DashboardTopNav } from "@features"; import { within, userEvent, waitFor, screen } from "@storybook/testing-library"; import { expect } from "@storybook/jest"; diff --git a/govtool/frontend/tsconfig.json b/govtool/frontend/tsconfig.json index 89bd35942..57c82be11 100644 --- a/govtool/frontend/tsconfig.json +++ b/govtool/frontend/tsconfig.json @@ -31,6 +31,7 @@ "@services": ["./src/services/index.ts"], "@molecules": ["./src/components/molecules/index.ts"], "@organisms": ["./src/components/organisms/index.ts"], + "@features": ["./src/components/features/index.ts"], "@context": ["./src/context/index.ts"], "@models": ["./src/models/index.ts"], "@utils": ["./src/utils/index.ts"] diff --git a/govtool/frontend/vite.config.ts b/govtool/frontend/vite.config.ts index 582926efb..e0459b439 100644 --- a/govtool/frontend/vite.config.ts +++ b/govtool/frontend/vite.config.ts @@ -30,6 +30,10 @@ const viteConfig = defineViteConfig({ find: "@organisms", replacement: path.resolve(__dirname, "./src/components/organisms"), }, + { + find: "@features", + replacement: path.resolve(__dirname, "./src/components/features"), + }, { find: "@context", replacement: path.resolve(__dirname, "./src/context"),