Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor layouts #1500

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c4372b2
remove: unused components
joonatank Oct 30, 2024
dad12f0
refactor: type check url builder pages
joonatank Nov 6, 2024
c3d1683
refactor: initial work on admin-ui page layout
joonatank Oct 30, 2024
d098c0f
remove: heading $legacy variable
joonatank Oct 31, 2024
3cca7f0
refactor: move styled util classes to common
joonatank Oct 31, 2024
f5853e0
refactor: customer ui layouts
joonatank Oct 31, 2024
bc76b32
fix: container layout variables
joonatank Nov 6, 2024
b9e12ae
refactor: reservation-unit Head
joonatank Nov 1, 2024
90918a4
refactor: customer reservation layouts
joonatank Nov 1, 2024
f279235
refactor: webstore related pages to use SSR
joonatank Nov 4, 2024
2c19a37
refactor: css consistant margins and headers
joonatank Nov 5, 2024
ffd87ec
fix: application page notes position
joonatank Nov 5, 2024
2de4aed
fix: reservation-unit page layout
joonatank Nov 5, 2024
f2f59fe
refactor: reduce custom css on unit page
joonatank Nov 5, 2024
fd65452
refactor: remove container hack
joonatank Nov 5, 2024
76c8686
fix: reservation edit grid layout
joonatank Nov 6, 2024
5f3d108
refactor: calendar toolbar component
joonatank Nov 6, 2024
e5ebdc0
refactor: use same css for layouts in both apps
joonatank Nov 6, 2024
5b2ca39
remove: old Container
joonatank Nov 6, 2024
5e3acfa
remove: deprected modal component
joonatank Nov 6, 2024
72470d2
remove: one custom accordion
joonatank Nov 6, 2024
3712908
refactor: replace old confirm page with rewrite
joonatank Nov 6, 2024
0d15935
refactor: reservation confirmation to single file
joonatank Nov 8, 2024
7b3cf19
cleanup: unnecessary css in new reservation
joonatank Nov 6, 2024
8d5af3c
refactor: Calendar controls styling
joonatank Nov 7, 2024
df0b6c7
refactor: customer search form styling
joonatank Nov 7, 2024
dd92c8f
fix: hide empty divs in page wrapper
joonatank Nov 7, 2024
7edfd7b
fix: admin-ui filter layout issues
joonatank Nov 7, 2024
009535c
fix: disappearing search button icon on en page
joonatank Nov 8, 2024
3d22bad
refactor: page title section margins
joonatank Nov 8, 2024
cc839ad
fix: reservation-unit url builder
joonatank Nov 8, 2024
b2c13dd
rework: custom modal for application
joonatank Nov 9, 2024
d586869
refactor: replace two column grid with autogrid
joonatank Nov 9, 2024
30b7798
refactor: cancel reservation page styling
joonatank Nov 9, 2024
e3dd9c4
remove: unnecessary util functions
joonatank Nov 10, 2024
97e3ec1
refactor: simplify reservation confirmation
joonatank Nov 11, 2024
8f99d97
refactor: less css for reservation page
joonatank Nov 11, 2024
e04678d
refactor: admin-ui h1 margins
joonatank Nov 11, 2024
7621e92
fix: styling recurring page margins
joonatank Nov 11, 2024
44c455c
fix: layout issues on customer application page
joonatank Nov 11, 2024
6a680c1
fix: sanitized content styling
joonatank Nov 12, 2024
fa92da2
refactor: simplify reservation status tag styling
joonatank Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions apps/admin-ui/src/common/Error403.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -59,7 +50,7 @@ const LogoutSection = ({
const { t } = useTranslation();

return (
<Column>
<Flex>
<Link external href="/">
{t("errorPages.linkToVaraamo")}
</Link>
Expand All @@ -73,7 +64,7 @@ const LogoutSection = ({
</Button>
</ButtonContainer>
)}
</Column>
</Flex>
);
};

Expand All @@ -89,7 +80,7 @@ const Error403 = ({
return (
<Wrapper>
<div>
<H1 $legacy>403 - {t("errorPages.accessForbidden.title")}</H1>
<H1>403 - {t("errorPages.accessForbidden.title")}</H1>
<p>{t("errorPages.accessForbidden.description")}</p>
<LogoutSection apiBaseUrl={apiBaseUrl} feedbackUrl={feedbackUrl} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/admin-ui/src/common/Error404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Error404({ message }: { message?: string }): JSX.Element {
return (
<Wrapper>
<Content>
<H1 $legacy>404: Sivua ei löytynyt</H1>
<H1>404: Sivua ei löytynyt</H1>
{message && <p>{message}</p>}
<Link href={PUBLIC_URL ?? "/"}>Siirry etusivulle</Link>
</Content>
Expand Down
2 changes: 1 addition & 1 deletion apps/admin-ui/src/common/Error5xx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Error5xx = ({ feedbackUrl }: { feedbackUrl: string }): JSX.Element => {
return (
<Wrapper>
<Content>
<H1 $legacy>{t("errorPages.generalError.title")}</H1>
<H1>{t("errorPages.generalError.title")}</H1>
<p>{t("errorPages.generalError.title")}</p>
<Link external href="/">
{t("errorPages.linkToVaraamo")}
Expand Down
8 changes: 0 additions & 8 deletions apps/admin-ui/src/common/hds-fork/Accordion.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions apps/admin-ui/src/common/hds-fork/breakpoints.css

This file was deleted.

7 changes: 7 additions & 0 deletions apps/admin-ui/src/common/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,10 @@ export function getRecurringReservationUrl(
}
return `/my-units/${pk}/recurring`;
}

export function getNotificationUrl(pk: Maybe<number> | undefined): string {
if (pk == null || !(pk > 0)) {
return "";
}
return `${bannerNotificationsUrl}/${pk}`;
}
14 changes: 10 additions & 4 deletions apps/admin-ui/src/common/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion apps/admin-ui/src/component/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function Accordion({
data-testid="accordion__header"
$disabled={disabled}
>
<StyledH2 className="heading" $legacy as={headingLevel}>
<StyledH2 className="heading" as={headingLevel}>
{heading}
</StyledH2>
<ToggleButton
Expand Down
6 changes: 3 additions & 3 deletions apps/admin-ui/src/component/BirthDate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useApplicationDateOfBirthQuery,
} from "@gql/gql-types";
import { formatDate } from "@/common/util";
import { HorisontalFlex } from "@/styles/layout";
import { Flex } from "common/styles/util";
import { base64encode } from "common/src/helpers";

// NOTE separate query because all requests for dateOfBirth are logged
Expand Down Expand Up @@ -117,7 +117,7 @@ export function BirthDate(props: Props): JSX.Element {
const showLabel = t("RequestedReservation.showBirthDate");

return (
<HorisontalFlex style={{ gap: "var(--spacing-2-xs)" }}>
<Flex $gap="2-xs" $direction="row">
{isLoading ? (
<span>{t("common.loading")}</span>
) : error != null ? (
Expand All @@ -134,6 +134,6 @@ export function BirthDate(props: Props): JSX.Element {
</Button>
</>
)}
</HorisontalFlex>
</Flex>
);
}
10 changes: 5 additions & 5 deletions apps/admin-ui/src/component/DenyDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -241,7 +241,7 @@ const DialogContent = ({
return (
<>
<Dialog.Content>
<VerticalFlex>
<Flex>
<Select
required
id="denyReason"
Expand All @@ -266,7 +266,7 @@ const DialogContent = ({
onChange={setReturnState}
price={findPrice(reservations)}
/>
</VerticalFlex>
</Flex>
</Dialog.Content>
<ActionButtons>
<Button
Expand Down Expand Up @@ -305,7 +305,7 @@ function DenyDialog({
aria-labelledby="modal-header"
isOpen={isOpen}
>
<VerticalFlex>
<Flex>
<CustomDialogHeader
id="modal-header"
title={title ?? t("RequestedReservation.DenyDialog.title")}
Expand All @@ -316,7 +316,7 @@ function DenyDialog({
onReject={onReject}
onClose={onClose}
/>
</VerticalFlex>
</Flex>
</Dialog>
);
}
Expand Down
11 changes: 7 additions & 4 deletions apps/admin-ui/src/component/LinkPrev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import React from "react";
import styled from "styled-components";
import { useTranslation } from "react-i18next";
import { IconAngleLeft } from "hds-react";
import { BasicLink } from "../styles/util";
import { Link } from "react-router-dom";

const StyledLink = styled(BasicLink)`
const StyledLink = styled(Link)`
display: inline-flex;
align-items: center;
font-size: var(--fontsize-body-m);
color: var(--tilavaraus-admin-content-text-color);
padding-right: var(--spacing-s);
text-decoration: none;
user-select: none;
gap: var(--spacing-2-xs);
align-content: center;
align-items: center;
`;

type Props = {
Expand All @@ -36,7 +39,7 @@ function LinkPrevInner({ route, style, className }: Props): JSX.Element {
}

const PreviousLinkWrapper = styled.div`
padding: var(--spacing-s);
padding: var(--spacing-s) 0 0;
`;

export function LinkPrev(props: Props): JSX.Element {
Expand Down
22 changes: 3 additions & 19 deletions apps/admin-ui/src/component/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
import React from "react";
import styled from "styled-components";
import { LoadingSpinner } from "hds-react";
import { CenterSpinner } from "common/styles/util";

const Wrapper = styled.div`
width: 100%;
display: flex;
justify-content: center;
margin-top: 4em;
`;

function Loader(): JSX.Element {
return (
<Wrapper>
<LoadingSpinner />
</Wrapper>
);
}

export default Loader;
// TODO rename this file / remove it
export default CenterSpinner;
109 changes: 0 additions & 109 deletions apps/admin-ui/src/component/Modal.tsx

This file was deleted.

Loading