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

Commit ea18cba

Browse files
committed
Hide reset x-signing flow on account view under a collapsible heading
1 parent 682a6ce commit ea18cba

File tree

7 files changed

+318
-16
lines changed

7 files changed

+318
-16
lines changed

frontend/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"next": "Next",
2525
"previous": "Previous",
2626
"saved": "Saved",
27-
"saving": "Saving…"
27+
"saving": "Saving…",
28+
"e2ee": "End-to-end encryption"
2829
},
2930
"frontend": {
3031
"account": {

frontend/package-lock.json

Lines changed: 198 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"dependencies": {
2020
"@fontsource/inconsolata": "^5.0.18",
2121
"@fontsource/inter": "^5.0.20",
22+
"@radix-ui/react-collapsible": "^1.1.0",
2223
"@radix-ui/react-dialog": "^1.0.5",
2324
"@tanstack/react-router": "^1.46.4",
2425
"@urql/core": "^5.0.5",
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* Copyright 2024 The Matrix.org Foundation C.I.C.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
.trigger {
17+
display: flex;
18+
width: 100%;
19+
}
20+
21+
.trigger-title {
22+
flex-grow: 1;
23+
text-align: start;
24+
}
25+
26+
[data-state="closed"] .trigger-icon {
27+
transform: rotate(180deg);
28+
}
29+
30+
.content {
31+
margin-top: var(--cpd-space-2x);
32+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright 2024 The Matrix.org Foundation C.I.C.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import * as Collapsible from "@radix-ui/react-collapsible";
16+
import IconChevronUp from "@vector-im/compound-design-tokens/assets/web/icons/chevron-up";
17+
import classNames from "classnames";
18+
19+
import styles from "./Collapsible.module.css";
20+
21+
export const Trigger: React.FC<
22+
React.ComponentProps<typeof Collapsible.Trigger>
23+
> = ({ children, className, ...props }) => {
24+
return (
25+
<Collapsible.Trigger
26+
{...props}
27+
className={classNames(styles.trigger, className)}
28+
>
29+
<div className={styles.triggerTitle}>{children}</div>
30+
<IconChevronUp
31+
className={styles.triggerIcon}
32+
height="24px"
33+
width="24px"
34+
/>
35+
</Collapsible.Trigger>
36+
);
37+
};
38+
39+
export const Content: React.FC<
40+
React.ComponentProps<typeof Collapsible.Content>
41+
> = ({ className, ...props }) => {
42+
return (
43+
<Collapsible.Content
44+
{...props}
45+
className={classNames(styles.content, className)}
46+
/>
47+
);
48+
};
49+
50+
export const Root = Collapsible.Root;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2024 The Matrix.org Foundation C.I.C.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
export * from "./Collapsible";

frontend/src/routes/_account.index.lazy.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ import {
1717
notFound,
1818
useNavigate,
1919
} from "@tanstack/react-router";
20-
import IconKey from "@vector-im/compound-design-tokens/assets/web/icons/key";
21-
import { Alert, Separator } from "@vector-im/compound-web";
20+
import { Alert, Heading, Separator, Text } from "@vector-im/compound-web";
2221
import { Suspense } from "react";
2322
import { useTranslation } from "react-i18next";
2423
import { useQuery } from "urql";
2524

2625
import AccountManagementPasswordPreview from "../components/AccountManagementPasswordPreview";
27-
import BlockList from "../components/BlockList/BlockList";
26+
import BlockList from "../components/BlockList";
2827
import { ButtonLink } from "../components/ButtonLink";
28+
import * as Collapsible from "../components/Collapsible";
2929
import LoadingSpinner from "../components/LoadingSpinner";
3030
import UserEmail from "../components/UserEmail";
3131
import AddEmailForm from "../components/UserProfile/AddEmailForm";
@@ -78,23 +78,28 @@ function Index(): React.ReactElement {
7878
<AddEmailForm userId={user.id} onAdd={onAdd} />
7979
)}
8080
</div>
81-
8281
<Separator />
83-
8482
{siteConfig.passwordLoginEnabled && (
8583
<AccountManagementPasswordPreview siteConfig={siteConfig} />
8684
)}
87-
8885
<Separator />
89-
90-
<ButtonLink
91-
to="/reset-cross-signing"
92-
kind="tertiary"
93-
destructive
94-
Icon={IconKey}
95-
>
96-
{t("frontend.reset_cross_signing.heading")}
97-
</ButtonLink>
86+
<Collapsible.Root>
87+
<Collapsible.Trigger>
88+
<Heading size="sm" weight="semibold">
89+
{t("common.e2ee")}
90+
</Heading>
91+
</Collapsible.Trigger>
92+
<Collapsible.Content>
93+
<BlockList>
94+
<Text className="text-secondary" size="md">
95+
{t("frontend.reset_cross_signing.description")}
96+
</Text>
97+
<ButtonLink to="/reset-cross-signing" kind="primary" destructive>
98+
{t("frontend.reset_cross_signing.button")}
99+
</ButtonLink>
100+
</BlockList>
101+
</Collapsible.Content>
102+
</Collapsible.Root>
98103
</BlockList>
99104
</>
100105
);

0 commit comments

Comments
 (0)