Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Make the layout wider on "account" pages #2371

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions frontend/src/components/Layout/Layout.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@
flex-direction: column;

max-width: calc(420px + var(--cpd-space-5x) * 2);

/* Fallback for browsers that do not support 100svh */
min-height: 100vh;
min-height: 100svh;

margin: 0 auto;
padding-inline: var(--cpd-space-5x);
padding-block: var(--cpd-space-12x);
gap: var(--cpd-space-8x);

&.wide {
max-width: calc(520px + var(--cpd-space-5x) * 2);
}
}

@media screen and (min-width: 768px) {
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import cx from "classnames";

Check warning on line 16 in frontend/src/components/Layout/Layout.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/components/Layout/Layout.tsx#L15-L16

Added lines #L15 - L16 were not covered by tests
import appConfig from "../../config";
import Footer from "../Footer";

Expand All @@ -20,8 +22,9 @@
const Layout: React.FC<{
children?: React.ReactNode;
dontSuspend?: boolean;
}> = ({ children, dontSuspend }) => (
<div className={styles.layoutContainer}>
wide?: boolean;
}> = ({ children, dontSuspend, wide }) => (
<div className={cx(styles.layoutContainer, wide && styles.wide)}>

Check warning on line 27 in frontend/src/components/Layout/Layout.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/components/Layout/Layout.tsx#L25-L27

Added lines #L25 - L27 were not covered by tests
{children}

<Footer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

.loading-screen {
display: flex;

/* Fallback for browsers that do not support 100svh */
min-height: 100vh;
min-height: 100svh;

justify-content: center;
align-items: center;
}
}
1 change: 0 additions & 1 deletion frontend/src/components/NavBar/NavBar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

.nav-bar {
border-bottom: var(--cpd-border-width-1) solid var(--cpd-color-gray-400);
padding: 0 var(--cpd-space-10x);
}

.nav-bar-items {
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import ErrorBoundary from "./components/ErrorBoundary";
import GenericError from "./components/GenericError";
import Layout from "./components/Layout";
import LoadingScreen from "./components/LoadingScreen";
import config from "./config";
import { client } from "./graphql";
Expand Down Expand Up @@ -51,9 +50,7 @@
<UrqlProvider value={client}>
<I18nextProvider i18n={i18n}>
<TooltipProvider>
<Layout>
<RouterProvider router={router} context={{ client }} />
</Layout>
<RouterProvider router={router} context={{ client }} />

Check warning on line 53 in frontend/src/main.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/main.tsx#L53

Added line #L53 was not covered by tests
</TooltipProvider>
</I18nextProvider>
</UrqlProvider>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/routes/_account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { useTranslation } from "react-i18next";
import { useQuery } from "urql";

import Layout from "../components/Layout";

Check warning on line 19 in frontend/src/routes/_account.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/_account.tsx#L19

Added line #L19 was not covered by tests
import NavBar from "../components/NavBar";
import NavItem from "../components/NavItem";
import UserGreeting from "../components/UserGreeting";
Expand Down Expand Up @@ -53,7 +54,7 @@
if (user?.__typename !== "User") throw notFound();

return (
<>
<Layout wide>

Check warning on line 57 in frontend/src/routes/_account.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/_account.tsx#L57

Added line #L57 was not covered by tests
<UserGreeting user={user} />

<NavBar>
Expand All @@ -66,6 +67,6 @@
</NavBar>

<Outlet />
</>
</Layout>

Check warning on line 70 in frontend/src/routes/_account.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/_account.tsx#L70

Added line #L70 was not covered by tests
);
}
7 changes: 6 additions & 1 deletion frontend/src/routes/clients.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { useQuery } from "urql";

import OAuth2ClientDetail from "../components/Client/OAuth2ClientDetail";
import Layout from "../components/Layout";

Check warning on line 19 in frontend/src/routes/clients.$id.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/clients.$id.tsx#L19

Added line #L19 was not covered by tests
import { graphql } from "../gql";

const QUERY = graphql(/* GraphQL */ `
Expand Down Expand Up @@ -49,5 +50,9 @@
const client = result.data?.oauth2Client;
if (!client) throw new Error(); // Should have been caught by the loader

return <OAuth2ClientDetail client={client} />;
return (
<Layout>
<OAuth2ClientDetail client={client} />
</Layout>
);

Check warning on line 57 in frontend/src/routes/clients.$id.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/clients.$id.tsx#L53-L57

Added lines #L53 - L57 were not covered by tests
}
17 changes: 10 additions & 7 deletions frontend/src/routes/devices.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { Alert } from "@vector-im/compound-web";
import { useTranslation } from "react-i18next";

import Layout from "../components/Layout";

Check warning on line 19 in frontend/src/routes/devices.$id.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/devices.$id.tsx#L19

Added line #L19 was not covered by tests
import { Link } from "../components/Link";
import { graphql } from "../gql";

Expand Down Expand Up @@ -79,12 +80,14 @@
const { t } = useTranslation();
const { id: deviceId } = Route.useParams();
return (
<Alert
type="critical"
title={t("frontend.session_detail.alert.title", { deviceId })}
>
{t("frontend.session_detail.alert.text")}
<Link to="/sessions">{t("frontend.session_detail.alert.button")}</Link>
</Alert>
<Layout>
<Alert
type="critical"
title={t("frontend.session_detail.alert.title", { deviceId })}
>
{t("frontend.session_detail.alert.text")}
<Link to="/sessions">{t("frontend.session_detail.alert.button")}</Link>
</Alert>
</Layout>

Check warning on line 91 in frontend/src/routes/devices.$id.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/devices.$id.tsx#L83-L91

Added lines #L83 - L91 were not covered by tests
);
}
7 changes: 6 additions & 1 deletion frontend/src/routes/emails.$id.verify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import { createFileRoute, notFound } from "@tanstack/react-router";
import { useQuery } from "urql";

import Layout from "../components/Layout";

Check warning on line 18 in frontend/src/routes/emails.$id.verify.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/emails.$id.verify.tsx#L18

Added line #L18 was not covered by tests
import VerifyEmailComponent from "../components/VerifyEmail";
import { graphql } from "../gql";

Expand Down Expand Up @@ -50,5 +51,9 @@
const email = result.data?.userEmail;
if (email == null) throw notFound();

return <VerifyEmailComponent email={email} />;
return (
<Layout>
<VerifyEmailComponent email={email} />
</Layout>
);

Check warning on line 58 in frontend/src/routes/emails.$id.verify.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/emails.$id.verify.tsx#L54-L58

Added lines #L54 - L58 were not covered by tests
}
99 changes: 51 additions & 48 deletions frontend/src/routes/reset-cross-signing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import BlockList from "../components/BlockList";
import { ButtonLink } from "../components/ButtonLink";
import Layout from "../components/Layout";

Check warning on line 25 in frontend/src/routes/reset-cross-signing.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/reset-cross-signing.tsx#L25

Added line #L25 was not covered by tests
import LoadingSpinner from "../components/LoadingSpinner";
import PageHeading from "../components/PageHeading";
import { graphql } from "../gql";
Expand Down Expand Up @@ -84,56 +85,58 @@
};

return (
<BlockList>
<PageHeading
Icon={IconKey}
title={t("frontend.reset_cross_signing.heading")}
invalid
/>
<Layout>
<BlockList>
<PageHeading
Icon={IconKey}
title={t("frontend.reset_cross_signing.heading")}
invalid
/>

Check warning on line 94 in frontend/src/routes/reset-cross-signing.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/reset-cross-signing.tsx#L88-L94

Added lines #L88 - L94 were not covered by tests

{!result.data && !result.error && (
<>
<Text className="text-justify">
{t("frontend.reset_cross_signing.description")}
</Text>
<Button
kind="primary"
destructive
disabled={result.fetching}
onClick={onClick}
{!result.data && !result.error && (
<>
<Text className="text-justify">
{t("frontend.reset_cross_signing.description")}
</Text>
<Button
kind="primary"
destructive
disabled={result.fetching}
onClick={onClick}
>
{!!result.fetching && <LoadingSpinner inline />}
{t("frontend.reset_cross_signing.button")}
</Button>
</>
)}
{result.data && (
<Alert
type="info"
title={t("frontend.reset_cross_signing.success.title")}

Check warning on line 115 in frontend/src/routes/reset-cross-signing.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/reset-cross-signing.tsx#L96-L115

Added lines #L96 - L115 were not covered by tests
>
{!!result.fetching && <LoadingSpinner inline />}
{t("frontend.reset_cross_signing.button")}
</Button>
</>
)}
{result.data && (
<Alert
type="info"
title={t("frontend.reset_cross_signing.success.title")}
>
{t("frontend.reset_cross_signing.success.description")}
</Alert>
)}
{result.error && (
<Alert
type="critical"
title={t("frontend.reset_cross_signing.failure.title")}
>
{t("frontend.reset_cross_signing.failure.description")}
</Alert>
)}
{t("frontend.reset_cross_signing.success.description")}
</Alert>
)}
{result.error && (
<Alert
type="critical"
title={t("frontend.reset_cross_signing.failure.title")}
>
{t("frontend.reset_cross_signing.failure.description")}
</Alert>
)}

Check warning on line 127 in frontend/src/routes/reset-cross-signing.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/reset-cross-signing.tsx#L117-L127

Added lines #L117 - L127 were not covered by tests

{!deepLink && (
<ButtonLink
to=".."
from={Route.fullPath}
kind="tertiary"
Icon={IconArrowLeft}
>
{t("action.back")}
</ButtonLink>
)}
</BlockList>
{!deepLink && (
<ButtonLink
to=".."
from={Route.fullPath}
kind="tertiary"
Icon={IconArrowLeft}
>
{t("action.back")}
</ButtonLink>
)}
</BlockList>
</Layout>

Check warning on line 140 in frontend/src/routes/reset-cross-signing.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/routes/reset-cross-signing.tsx#L129-L140

Added lines #L129 - L140 were not covered by tests
);
}
Loading