From e7341aa32afe42232692a32ff50c3db4140a074e Mon Sep 17 00:00:00 2001 From: Kerry Archibald Date: Tue, 20 Dec 2022 18:41:14 +1300 Subject: [PATCH 1/5] indent device details --- res/css/_components.pcss | 1 + .../devices/_CurrentDeviceSection.pcss | 20 +++++++++++++++++++ .../settings/devices/_DeviceDetails.pcss | 2 -- .../settings/devices/_FilteredDeviceList.pcss | 5 +++++ .../settings/devices/CurrentDeviceSection.tsx | 1 + .../views/settings/devices/DeviceDetails.tsx | 5 ++++- .../settings/devices/FilteredDeviceList.tsx | 1 + .../CurrentDeviceSection-test.tsx.snap | 2 +- 8 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 res/css/components/views/settings/devices/_CurrentDeviceSection.pcss diff --git a/res/css/_components.pcss b/res/css/_components.pcss index 1abf50ee411..c8fe59d3151 100644 --- a/res/css/_components.pcss +++ b/res/css/_components.pcss @@ -30,6 +30,7 @@ @import "./components/views/location/_ZoomButtons.pcss"; @import "./components/views/messages/_MBeaconBody.pcss"; @import "./components/views/messages/shared/_MediaProcessingError.pcss"; +@import "./components/views/settings/devices/_CurrentDeviceSection.pcss"; @import "./components/views/settings/devices/_DeviceDetailHeading.pcss"; @import "./components/views/settings/devices/_DeviceDetails.pcss"; @import "./components/views/settings/devices/_DeviceExpandDetailsButton.pcss"; diff --git a/res/css/components/views/settings/devices/_CurrentDeviceSection.pcss b/res/css/components/views/settings/devices/_CurrentDeviceSection.pcss new file mode 100644 index 00000000000..552270db1d0 --- /dev/null +++ b/res/css/components/views/settings/devices/_CurrentDeviceSection.pcss @@ -0,0 +1,20 @@ +/* +Copyright 2022 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +.mx_CurrentDeviceSection_deviceDetails { + // align with text of session tile + margin-left: 56px; +} diff --git a/res/css/components/views/settings/devices/_DeviceDetails.pcss b/res/css/components/views/settings/devices/_DeviceDetails.pcss index 8c4aac6cbf2..9b34fa378aa 100644 --- a/res/css/components/views/settings/devices/_DeviceDetails.pcss +++ b/res/css/components/views/settings/devices/_DeviceDetails.pcss @@ -19,8 +19,6 @@ limitations under the License. flex-direction: column; box-sizing: border-box; - width: 100%; - margin-top: $spacing-16; padding: $spacing-24; border-radius: 8px; diff --git a/res/css/components/views/settings/devices/_FilteredDeviceList.pcss b/res/css/components/views/settings/devices/_FilteredDeviceList.pcss index d34270e8ad8..9f9bd0cc712 100644 --- a/res/css/components/views/settings/devices/_FilteredDeviceList.pcss +++ b/res/css/components/views/settings/devices/_FilteredDeviceList.pcss @@ -50,3 +50,8 @@ limitations under the License. flex-direction: row; gap: $spacing-8; } + +.mx_FilteredDeviceList_deviceDetails { + // align with text of session tile + margin-left: 88px; +} diff --git a/src/components/views/settings/devices/CurrentDeviceSection.tsx b/src/components/views/settings/devices/CurrentDeviceSection.tsx index 9044f882ec8..2394e63a50b 100644 --- a/src/components/views/settings/devices/CurrentDeviceSection.tsx +++ b/src/components/views/settings/devices/CurrentDeviceSection.tsx @@ -124,6 +124,7 @@ const CurrentDeviceSection: React.FC = ({ onVerifyDevice={onVerifyCurrentDevice} onSignOutDevice={onSignOutCurrentDevice} saveDeviceName={saveDeviceName} + className="mx_CurrentDeviceSection_deviceDetails" /> ) : ( <> diff --git a/src/components/views/settings/devices/DeviceDetails.tsx b/src/components/views/settings/devices/DeviceDetails.tsx index 7e47f835041..ace23be335c 100644 --- a/src/components/views/settings/devices/DeviceDetails.tsx +++ b/src/components/views/settings/devices/DeviceDetails.tsx @@ -27,6 +27,7 @@ import ToggleSwitch from "../../elements/ToggleSwitch"; import { DeviceDetailHeading } from "./DeviceDetailHeading"; import { DeviceVerificationStatusCard } from "./DeviceVerificationStatusCard"; import { ExtendedDevice } from "./types"; +import classNames from "classnames"; interface Props { device: ExtendedDevice; @@ -38,6 +39,7 @@ interface Props { saveDeviceName: (deviceName: string) => Promise; setPushNotifications?: (deviceId: string, enabled: boolean) => Promise | undefined; supportsMSC3881?: boolean | undefined; + className?: string; } interface MetadataTable { @@ -56,6 +58,7 @@ const DeviceDetails: React.FC = ({ saveDeviceName, setPushNotifications, supportsMSC3881, + className, }) => { const metadata: MetadataTable[] = [ { @@ -113,7 +116,7 @@ const DeviceDetails: React.FC = ({ } return ( -
+
diff --git a/src/components/views/settings/devices/FilteredDeviceList.tsx b/src/components/views/settings/devices/FilteredDeviceList.tsx index 026add74a40..c31fb8ca30d 100644 --- a/src/components/views/settings/devices/FilteredDeviceList.tsx +++ b/src/components/views/settings/devices/FilteredDeviceList.tsx @@ -213,6 +213,7 @@ const DeviceListItem: React.FC<{ saveDeviceName={saveDeviceName} setPushNotifications={setPushNotifications} supportsMSC3881={supportsMSC3881} + className="mx_FilteredDeviceList_deviceDetails" /> )} diff --git a/test/components/views/settings/devices/__snapshots__/CurrentDeviceSection-test.tsx.snap b/test/components/views/settings/devices/__snapshots__/CurrentDeviceSection-test.tsx.snap index 739f559ad40..34759a9ede8 100644 --- a/test/components/views/settings/devices/__snapshots__/CurrentDeviceSection-test.tsx.snap +++ b/test/components/views/settings/devices/__snapshots__/CurrentDeviceSection-test.tsx.snap @@ -3,7 +3,7 @@ exports[` displays device details on toggle click 1`] = ` HTMLCollection [
Date: Tue, 20 Dec 2022 18:52:18 +1300 Subject: [PATCH 2/5] udpate copy for current device security warning --- .../settings/devices/CurrentDeviceSection.tsx | 6 +++++- .../views/settings/devices/DeviceDetails.tsx | 4 +++- .../devices/DeviceVerificationStatusCard.tsx | 16 ++++++++++++---- src/i18n/strings/en_EN.json | 4 +++- .../CurrentDeviceSection-test.tsx.snap | 6 +++--- .../__snapshots__/DeviceDetails-test.tsx.snap | 6 +++--- .../SessionManagerTab-test.tsx.snap | 4 ++-- 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/components/views/settings/devices/CurrentDeviceSection.tsx b/src/components/views/settings/devices/CurrentDeviceSection.tsx index 2394e63a50b..46c6f3e7d12 100644 --- a/src/components/views/settings/devices/CurrentDeviceSection.tsx +++ b/src/components/views/settings/devices/CurrentDeviceSection.tsx @@ -129,7 +129,11 @@ const CurrentDeviceSection: React.FC = ({ ) : ( <>
- + )} diff --git a/src/components/views/settings/devices/DeviceDetails.tsx b/src/components/views/settings/devices/DeviceDetails.tsx index ace23be335c..313f418d811 100644 --- a/src/components/views/settings/devices/DeviceDetails.tsx +++ b/src/components/views/settings/devices/DeviceDetails.tsx @@ -40,6 +40,7 @@ interface Props { setPushNotifications?: (deviceId: string, enabled: boolean) => Promise | undefined; supportsMSC3881?: boolean | undefined; className?: string; + isCurrentDevice?: boolean; } interface MetadataTable { @@ -59,6 +60,7 @@ const DeviceDetails: React.FC = ({ setPushNotifications, supportsMSC3881, className, + isCurrentDevice, }) => { const metadata: MetadataTable[] = [ { @@ -119,7 +121,7 @@ const DeviceDetails: React.FC = ({
- +

{_t("Session details")}

diff --git a/src/components/views/settings/devices/DeviceVerificationStatusCard.tsx b/src/components/views/settings/devices/DeviceVerificationStatusCard.tsx index 6f7d71ff275..632ca9343ab 100644 --- a/src/components/views/settings/devices/DeviceVerificationStatusCard.tsx +++ b/src/components/views/settings/devices/DeviceVerificationStatusCard.tsx @@ -24,23 +24,28 @@ import { DeviceSecurityVariation, ExtendedDevice } from "./types"; interface Props { device: ExtendedDevice; + isCurrentDevice?: boolean; onVerifyDevice?: () => void; } const getCardProps = ( device: ExtendedDevice, + isCurrentDevice?: boolean, ): { variation: DeviceSecurityVariation; heading: string; description: React.ReactNode; } => { if (device.isVerified) { + const descriptionText = isCurrentDevice + ? _t("Your current session is ready for secure messaging.") + : _t("This session is ready for secure messaging."); return { variation: DeviceSecurityVariation.Verified, heading: _t("Verified session"), description: ( <> - {_t("This session is ready for secure messaging.")} + {descriptionText} ), @@ -59,20 +64,23 @@ const getCardProps = ( }; } + const descriptionText = isCurrentDevice + ? _t("Verify your current session for enhanced secure messaging.") + : _t("Verify or sign out from this session for best security and reliability."); return { variation: DeviceSecurityVariation.Unverified, heading: _t("Unverified session"), description: ( <> - {_t("Verify or sign out from this session for best security and reliability.")} + {descriptionText} ), }; }; -export const DeviceVerificationStatusCard: React.FC = ({ device, onVerifyDevice }) => { - const securityCardProps = getCardProps(device); +export const DeviceVerificationStatusCard: React.FC = ({ device, isCurrentDevice, onVerifyDevice }) => { + const securityCardProps = getCardProps(device, isCurrentDevice); return ( diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 306e0483555..203ed3264a6 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1815,9 +1815,11 @@ "Mobile session": "Mobile session", "Web session": "Web session", "Unknown session type": "Unknown session type", - "Verified session": "Verified session", + "Your current session is ready for secure messaging.": "Your current session is ready for secure messaging.", "This session is ready for secure messaging.": "This session is ready for secure messaging.", + "Verified session": "Verified session", "This session doesn't support encryption and thus can't be verified.": "This session doesn't support encryption and thus can't be verified.", + "Verify your current session for enhanced secure messaging.": "Verify your current session for enhanced secure messaging.", "Verify or sign out from this session for best security and reliability.": "Verify or sign out from this session for best security and reliability.", "Verify session": "Verify session", "For best security, sign out from any session that you don't recognize or use anymore.": "For best security, sign out from any session that you don't recognize or use anymore.", diff --git a/test/components/views/settings/devices/__snapshots__/CurrentDeviceSection-test.tsx.snap b/test/components/views/settings/devices/__snapshots__/CurrentDeviceSection-test.tsx.snap index 34759a9ede8..907e6396ddb 100644 --- a/test/components/views/settings/devices/__snapshots__/CurrentDeviceSection-test.tsx.snap +++ b/test/components/views/settings/devices/__snapshots__/CurrentDeviceSection-test.tsx.snap @@ -49,7 +49,7 @@ HTMLCollection [

- Verify or sign out from this session for best security and reliability. + Verify your current session for enhanced secure messaging.