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

Commit 54d5e94

Browse files
authored
Iterate cross signing reset flows (#3102)
* Handle UIA fallback authDone API for cross signing reset unlock * Extract VisualList into a more reusable component * Redesign cross signing reset unlock flow * Fix block gap * Hide reset x-signing flow on account view under a collapsible heading * i18n * Iterate * Downgrade Radix react-collapsible * Fix class names * Update snapshots
1 parent 19cef28 commit 54d5e94

16 files changed

+450
-116
lines changed

frontend/locales/en.json

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
}
2121
},
2222
"common": {
23+
"e2ee": "End-to-end encryption",
2324
"loading": "Loading…",
2425
"next": "Next",
2526
"previous": "Previous",
@@ -185,17 +186,28 @@
185186
}
186187
},
187188
"reset_cross_signing": {
188-
"button": "Allow crypto identity reset",
189-
"description": "If you are not signed in anywhere else, and have forgotten or lost all recovery options you’ll need to reset your crypto identity. This means you will lose your existing message history, other users will see that you have reset your identity and you will need to verify your existing devices again.",
189+
"button": "Reset identity",
190+
"cancelled": {
191+
"description_1": "You can close this window and go back to the app to continue.",
192+
"description_2": "If you're signed out everywhere and don't remember your recovery code, you'll still need to reset your identity.",
193+
"heading": "Identity reset cancelled."
194+
},
195+
"description": "If you're not signed in to any other devices and you've lost your recovery key, then you'll need to reset your identity to continue using the app.",
196+
"effect_list": {
197+
"negative_1": "You will lose your existing message history",
198+
"negative_2": "You will need to verify all your existing devices and contacts again",
199+
"positive_1": "Your account details, contacts, preferences, and chat list will be kept"
200+
},
190201
"failure": {
191202
"description": "This might be a temporary problem, so please try again later. If the problem persists, please contact your server administrator.",
192-
"title": "Failed to allow crypto identity"
203+
"heading": "Failed to allow crypto identity reset"
193204
},
194-
"heading": "Reset crypto identity",
205+
"heading": "Reset your identity in case you can't confirm another way",
195206
"success": {
196-
"description": "A client can now temporarily reset your account crypto identity. Follow the instructions in your client to complete the process.",
197-
"title": "Crypto identity reset temporarily allowed"
198-
}
207+
"description": "The identity reset has been approved for the next {{minutes}} minutes. You can close this window and go back to the app to continue.",
208+
"heading": "Identity reset successfully. Go back to the app to finish the process."
209+
},
210+
"warning": "Only reset your identity if you don't have access to another signed-in device and you've lost your recovery key."
199211
},
200212
"session": {
201213
"client_id_label": "Client ID",

frontend/package-lock.json

Lines changed: 32 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.0.3",
2223
"@radix-ui/react-dialog": "^1.0.5",
2324
"@tanstack/react-router": "^1.46.7",
2425
"@urql/core": "^5.0.5",

frontend/src/components/BlockList/BlockList.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
display: flex;
1818
flex-direction: column;
1919
align-content: flex-start;
20-
gap: var(--cpd-space-8x);
20+
gap: var(--cpd-space-6x);
2121
}
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/components/PageHeading/PageHeading.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
text-align: center;
6464

6565
& .title {
66-
font: var(--cpd-font-heading-lg-semibold);
66+
font: var(--cpd-font-heading-md-semibold);
6767
letter-spacing: var(--cpd-font-letter-spacing-heading-xl);
6868
color: var(--cpd-color-text-primary);
6969
text-wrap: balance;

frontend/src/components/SessionDetail/SessionDetails.module.css

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,3 @@
3939
text-overflow: ellipsis;
4040
overflow: hidden;
4141
}
42-
43-
.scope-list {
44-
display: flex;
45-
flex-direction: column;
46-
gap: var(--cpd-space-scale);
47-
border-radius: var(--cpd-space-5x);
48-
overflow: hidden;
49-
}
50-
51-
.scope {
52-
background: var(--cpd-color-bg-subtle-secondary);
53-
padding: var(--cpd-space-3x) var(--cpd-space-5x);
54-
display: flex;
55-
align-items: center;
56-
gap: var(--cpd-space-3x);
57-
}
58-
59-
.scope svg {
60-
inline-size: var(--cpd-space-6x);
61-
block-size: var(--cpd-space-6x);
62-
color: var(--cpd-color-icon-tertiary);
63-
}

frontend/src/components/SessionDetail/SessionDetails.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { useTranslation } from "react-i18next";
2525
import Block from "../Block/Block";
2626
import DateTime from "../DateTime";
2727
import LastActive from "../Session/LastActive";
28+
import { VisualList, VisualListItem } from "../VisualList/VisualList";
2829

2930
import styles from "./SessionDetails.module.css";
3031

@@ -68,12 +69,7 @@ const Scope: React.FC<{ scope: string }> = ({ scope }) => {
6869
return (
6970
<>
7071
{mappedScopes.map(([Icon, text], i) => (
71-
<li className={styles.scope} key={i}>
72-
<Icon />
73-
<Text size="md" weight="medium">
74-
{text}
75-
</Text>
76-
</li>
72+
<VisualListItem key={i} Icon={Icon} label={text} />
7773
))}
7874
</>
7975
);
@@ -153,11 +149,11 @@ const SessionDetails: React.FC<Props> = ({
153149
<Datum
154150
label={t("frontend.session.scopes_label")}
155151
value={
156-
<ul className={styles.scopeList}>
152+
<VisualList>
157153
{scopes.map((scope) => (
158154
<Scope key={scope} scope={scope} />
159155
))}
160-
</ul>
156+
</VisualList>
161157
}
162158
/>
163159
)}

0 commit comments

Comments
 (0)