diff --git a/apps/admin-ui/src/common/Error403.tsx b/apps/admin-ui/src/common/Error403.tsx index ba2f37d909..4f721c7e1b 100644 --- a/apps/admin-ui/src/common/Error403.tsx +++ b/apps/admin-ui/src/common/Error403.tsx @@ -8,6 +8,7 @@ import { breakpoints } from "common/src/common/style"; import { useSession } from "@/hooks/auth"; import { PUBLIC_URL } from "./const"; import { env } from "@/env.mjs"; +import { ButtonContainer, Flex } from "common/styles/util"; const Wrapper = styled.div` padding: var(--spacing-layout-s); @@ -33,20 +34,10 @@ const Wrapper = styled.div` } `; -const Column = styled.div` - display: flex; - flex-direction: column; - gap: var(--spacing-layout-2-xs); -`; - const Image = styled.img` width: 100%; `; -const ButtonContainer = styled.div` - margin-top: var(--spacing-s); -`; - const LogoutSection = ({ apiBaseUrl, feedbackUrl, @@ -59,7 +50,7 @@ const LogoutSection = ({ const { t } = useTranslation(); return ( - + {t("errorPages.linkToVaraamo")} @@ -73,7 +64,7 @@ const LogoutSection = ({ )} - + ); }; @@ -89,7 +80,7 @@ const Error403 = ({ return (
-

403 - {t("errorPages.accessForbidden.title")}

+

403 - {t("errorPages.accessForbidden.title")}

{t("errorPages.accessForbidden.description")}

diff --git a/apps/admin-ui/src/common/Error404.tsx b/apps/admin-ui/src/common/Error404.tsx index 48e729520c..b84d4582ba 100644 --- a/apps/admin-ui/src/common/Error404.tsx +++ b/apps/admin-ui/src/common/Error404.tsx @@ -41,7 +41,7 @@ function Error404({ message }: { message?: string }): JSX.Element { return ( -

404: Sivua ei löytynyt

+

404: Sivua ei löytynyt

{message &&

{message}

} Siirry etusivulle
diff --git a/apps/admin-ui/src/common/Error5xx.tsx b/apps/admin-ui/src/common/Error5xx.tsx index 3f036d1814..4aabf05fd6 100644 --- a/apps/admin-ui/src/common/Error5xx.tsx +++ b/apps/admin-ui/src/common/Error5xx.tsx @@ -49,7 +49,7 @@ const Error5xx = ({ feedbackUrl }: { feedbackUrl: string }): JSX.Element => { return ( -

{t("errorPages.generalError.title")}

+

{t("errorPages.generalError.title")}

{t("errorPages.generalError.title")}

{t("errorPages.linkToVaraamo")} diff --git a/apps/admin-ui/src/common/hds-fork/Accordion.tsx b/apps/admin-ui/src/common/hds-fork/Accordion.tsx deleted file mode 100644 index 0c674037c2..0000000000 --- a/apps/admin-ui/src/common/hds-fork/Accordion.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from "react"; -import { Accordion as HDSAccordion, AccordionProps } from "hds-react"; - -const Accordion = ({ ...props }: AccordionProps) => ( - -); - -export { Accordion }; diff --git a/apps/admin-ui/src/common/hds-fork/breakpoints.css b/apps/admin-ui/src/common/hds-fork/breakpoints.css deleted file mode 100644 index 7d0814809e..0000000000 --- a/apps/admin-ui/src/common/hds-fork/breakpoints.css +++ /dev/null @@ -1,15 +0,0 @@ -@value small-up: only screen and (min-width: 576px); -@value medium-up: only screen and (min-width: 768px); -@value large-up: only screen and (min-width: 992px); -@value x-large-up: only screen and (min-width: 1248px); - -@value x-small-down: only screen and (max-width: 575.98px); -@value small-down: only screen and (max-width: 767.98px); -@value medium-down: only screen and (max-width: 991.98px); -@value large-down: only screen and (max-width: 1247.98px); - -@value x-small-only: only screen and (max-width: 575.98px); -@value small-only: only screen and (min-width: 576px) and (max-width: 767.98px); -@value medium-only: only screen and (min-width: 768px) and (max-width: 991.98px); -@value large-only: only screen and (min-width: 992px) and (max-width: 1247.98px); -@value x-large-only: only screen and (min-width: 1248px) diff --git a/apps/admin-ui/src/common/urls.ts b/apps/admin-ui/src/common/urls.ts index eeaaf5ffe0..419ca479f6 100644 --- a/apps/admin-ui/src/common/urls.ts +++ b/apps/admin-ui/src/common/urls.ts @@ -105,3 +105,10 @@ export function getRecurringReservationUrl( } return `/my-units/${pk}/recurring`; } + +export function getNotificationUrl(pk: Maybe | undefined): string { + if (pk == null || !(pk > 0)) { + return ""; + } + return `${bannerNotificationsUrl}/${pk}`; +} diff --git a/apps/admin-ui/src/common/util.ts b/apps/admin-ui/src/common/util.ts index a99f0e3363..f9c5f31db1 100644 --- a/apps/admin-ui/src/common/util.ts +++ b/apps/admin-ui/src/common/util.ts @@ -96,21 +96,27 @@ export function formatAgeGroup( return group ? `${group.minimum}-${group.maximum || ""}` : null; } -// TODO rename to format -export function parseAddress( +export function formatAddress( location: LocationFieldsFragment | null | undefined ): string { if (!location) { - return ""; + return "-"; } - return trim( + const res = trim( `${location.addressStreetFi ?? ""}, ${location.addressZip} ${ location.addressCityFi ?? "" }`, ", " ); + if (res === "") { + return "-"; + } + return res; } +// @deprecated use formatAddress +export { formatAddress as parseAddress }; + export const sortByName = (a?: string, b?: string): number => a && b ? a.toLowerCase().localeCompare(b.toLowerCase()) : !a ? 1 : -1; diff --git a/apps/admin-ui/src/component/Accordion.tsx b/apps/admin-ui/src/component/Accordion.tsx index f67201afdc..0375bdde3b 100644 --- a/apps/admin-ui/src/component/Accordion.tsx +++ b/apps/admin-ui/src/component/Accordion.tsx @@ -127,7 +127,7 @@ export function Accordion({ data-testid="accordion__header" $disabled={disabled} > - + {heading} + {isLoading ? ( {t("common.loading")} ) : error != null ? ( @@ -134,6 +134,6 @@ export function BirthDate(props: Props): JSX.Element { )} - + ); } diff --git a/apps/admin-ui/src/component/DenyDialog.tsx b/apps/admin-ui/src/component/DenyDialog.tsx index ff91f6903c..7a0334640f 100644 --- a/apps/admin-ui/src/component/DenyDialog.tsx +++ b/apps/admin-ui/src/component/DenyDialog.tsx @@ -18,7 +18,7 @@ import { import { useModal } from "@/context/ModalContext"; import Loader from "@/component/Loader"; import { Select } from "@/component/Select"; -import { VerticalFlex } from "@/styles/layout"; +import { Flex } from "common/styles/util"; import { CustomDialogHeader } from "@/component/CustomDialogHeader"; import { useDenyReasonOptions } from "@/hooks"; import { filterNonNullable } from "common/src/helpers"; @@ -241,7 +241,7 @@ const DialogContent = ({ return ( <> - + v.value === field.value) ?? null - } - onChange={(v: (typeof ageGroupOptions)[0]) => - field.onChange(v.value) - } - required - label={t("application:Page1.ageGroup")} - options={ageGroupOptions} - invalid={errors.applicationSections?.[index]?.ageGroup != null} - error={getTranslatedError("ageGroup")} - /> - )} + label={t("application:Page1.ageGroup")} + options={ageGroupOptions} + error={getTranslatedError("ageGroup")} /> - ( - x.value === field.value) ?? null - } - placeholder={t("common:select")} - options={durationOptions} - label={t("application:Page1.minDuration")} - required - onChange={(selection: (typeof durationOptions)[0]): void => { - field.onChange(selection.value); - }} - invalid={errors.applicationSections?.[index]?.minDuration != null} - error={getTranslatedError("minDuration")} - /> - )} + options={durationOptions} + label={t("application:Page1.minDuration")} + required + error={getTranslatedError("minDuration")} /> - {/* TODO should use ControlledSelect */} - ( -