diff --git a/apps/admin-ui/jest.config.mjs b/apps/admin-ui/jest.config.mjs index 9583252e80..998f76eb10 100644 --- a/apps/admin-ui/jest.config.mjs +++ b/apps/admin-ui/jest.config.mjs @@ -11,7 +11,8 @@ const customJestConfig = { modulePathIgnorePatterns: ["/.next/"], setupFilesAfterEnv: ["/jest.setup.ts"], moduleDirectories: ["node_modules", "/"], - testEnvironment: "jest-environment-jsdom", + // jsdom has broken stylesheet parsing + testEnvironment: "@happy-dom/jest-environment", // "jest-environment-jsdom", }; const jestConfig = async () => { diff --git a/apps/admin-ui/package.json b/apps/admin-ui/package.json index ca39afe11f..6c43a51f7b 100644 --- a/apps/admin-ui/package.json +++ b/apps/admin-ui/package.json @@ -40,8 +40,8 @@ "eslint-config-custom": "workspace:*", "form-data": "^4.0.0", "graphql": "^16.9.0", - "hds-core": "^3.11.0", - "hds-react": "^3.11.0", + "hds-core": "^4.1.0", + "hds-react": "^4.1.0", "i18next": "^23.15.1", "lodash": "^4.17.21", "next": "15.0.3", @@ -64,6 +64,7 @@ "zod": "^3.23.8" }, "devDependencies": { + "@happy-dom/jest-environment": "^16.5.3", "@svgr/webpack": "^8.1.0", "@testing-library/jest-dom": "^6.5.0", "@testing-library/react": "^16.0.1", @@ -78,9 +79,9 @@ "@types/react-router-dom": "^5.3.3", "@types/styled-components": "^5.1.29", "@vercel/style-guide": "^6.0.0", + "happy-dom": "^16.5.3", "jest": "^29.7.0", "jest-axe": "^8.0.0", - "jest-environment-jsdom": "^29.7.0", "lint-staged": "^15.2.10", "postcss-scss": "^4.0.9", "postcss-styled-syntax": "^0.6.4", diff --git a/apps/admin-ui/src/common/ScrollToTop.tsx b/apps/admin-ui/src/common/ScrollToTop.tsx index a675ac29c1..2151080663 100644 --- a/apps/admin-ui/src/common/ScrollToTop.tsx +++ b/apps/admin-ui/src/common/ScrollToTop.tsx @@ -5,11 +5,8 @@ import { Button, IconAngleUp } from "hds-react"; import { useDebounce, useWindowSize } from "react-use"; import { breakpoints } from "common/src/common/style"; -const Btn = styled(Button).attrs({ - style: { - "--color-bus": "var(--color-black)", - } as React.CSSProperties, -})` +// "--color-bus": "var(--color-black)", +const Btn = styled(Button)` width: 40px; height: 40px; background-color: var(--color-black); @@ -54,9 +51,13 @@ function ScrollToTop(): JSX.Element | null { 300 ); + const handleClick = () => { + window.scroll({ top: 0, left: 0, behavior: "smooth" }); + } + return isEnabled && isVisible ? ( - window.scroll({ top: 0, left: 0, behavior: "smooth" })}> - + }> + "" ) : null; } diff --git a/apps/admin-ui/src/component/DenyDialog.tsx b/apps/admin-ui/src/component/DenyDialog.tsx index 7f2ab2c80b..7bb27dd43b 100644 --- a/apps/admin-ui/src/component/DenyDialog.tsx +++ b/apps/admin-ui/src/component/DenyDialog.tsx @@ -3,8 +3,10 @@ import { useTranslation } from "react-i18next"; import styled from "styled-components"; import { Button, + ButtonVariant, Dialog, RadioButton, + Select, SelectionGroup, TextArea, } from "hds-react"; @@ -19,14 +21,13 @@ import { OrderStatus, } from "@gql/gql-types"; import { useModal } from "@/context/ModalContext"; -import { Select } from "@/component/Select"; import { CenterSpinner, Flex } from "common/styles/util"; import { CustomDialogHeader } from "@/component/CustomDialogHeader"; import { useDenyReasonOptions } from "@/hooks"; import { successToast, errorToast } from "common/src/common/toast"; import { gql } from "@apollo/client"; import { getValidationErrors } from "common/src/apolloUtils"; -import { toNumber } from "common/src/helpers"; +import { convertOptionToHDS, toNumber } from "common/src/helpers"; const ActionButtons = styled(Dialog.ActionButtons)` justify-content: end; @@ -180,14 +181,19 @@ function DialogContent({ reservation, onClose, onReject }: Props): JSX.Element {