Skip to content

Commit 0358b7f

Browse files
authored
Add KeyIcon to key storage out of sync toast (#29201)
* feat(toast crypto): add KeyIcon to key storage out of sync toast * test(toast crypto): update key storage out of sync snapshot
1 parent 4a381c2 commit 0358b7f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Loading

src/toasts/SetupEncryptionToast.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
66
Please see LICENSE files in the repository root for full details.
77
*/
88

9+
import KeyIcon from "@vector-im/compound-design-tokens/assets/web/icons/key";
10+
import { type ComponentType } from "react";
11+
12+
import type React from "react";
913
import Modal from "../Modal";
1014
import { _t } from "../languageHandler";
1115
import DeviceListener from "../DeviceListener";
@@ -61,6 +65,19 @@ const getSetupCaption = (kind: Kind): string => {
6165
}
6266
};
6367

68+
/**
69+
* Get the icon to show on the primary button.
70+
* @param kind
71+
*/
72+
const getPrimaryButtonIcon = (kind: Kind): ComponentType<React.SVGAttributes<SVGElement>> | undefined => {
73+
switch (kind) {
74+
case Kind.KEY_STORAGE_OUT_OF_SYNC:
75+
return KeyIcon;
76+
default:
77+
return;
78+
}
79+
};
80+
6481
const getSecondaryButtonLabel = (kind: Kind): string => {
6582
switch (kind) {
6683
case Kind.SET_UP_RECOVERY:
@@ -162,6 +179,7 @@ export const showToast = (kind: Kind): void => {
162179
props: {
163180
description: getDescription(kind),
164181
primaryLabel: getSetupCaption(kind),
182+
PrimaryIcon: getPrimaryButtonIcon(kind),
165183
onPrimaryClick,
166184
secondaryLabel: getSecondaryButtonLabel(kind),
167185
onSecondaryClick,

0 commit comments

Comments
 (0)