Skip to content

Apply new design and display logic to logout confirmation dialog#33426

Open
uhoreg wants to merge 16 commits into
element-hq:developfrom
uhoreg:logout_dialog_redesign
Open

Apply new design and display logic to logout confirmation dialog#33426
uhoreg wants to merge 16 commits into
element-hq:developfrom
uhoreg:logout_dialog_redesign

Conversation

@uhoreg
Copy link
Copy Markdown
Member

@uhoreg uhoreg commented May 8, 2026

Part of element-hq/element-meta#2834

Applies the new design to the dialog that prompts the user to set up recovery when they try to log out.

Image

Also applies new logic for determining when to show the prompt:

  • only shows if this is the user's last device
  • shows even if the user is not in any encrypted rooms (since the user will need the recovery key to confirm their identity)

I've also taking this opportunity to switch to a functional component, and move the non-display code into hooks.

This PR does not implement allowing the user to get their recovery key in-line (it just brings them to the settings dialog).

Checklist

@t3chguy
Copy link
Copy Markdown
Member

t3chguy commented May 8, 2026

Spacing between heading and text looks wrong compared to Figma

image

@uhoreg
Copy link
Copy Markdown
Member Author

uhoreg commented May 11, 2026

Spacing between heading and text looks wrong compared to Figma

Added some spacing

@uhoreg
Copy link
Copy Markdown
Member Author

uhoreg commented May 11, 2026

Not sure why one of the playwright tests is still failing, but this should otherwise be ready for review.

@uhoreg uhoreg marked this pull request as ready for review May 11, 2026 01:45
@uhoreg uhoreg requested review from a team as code owners May 11, 2026 01:45
@t3chguy
Copy link
Copy Markdown
Member

t3chguy commented May 11, 2026

Not sure why one of the playwright tests is still failing, but this should otherwise be ready for review.

It is looking for a button which does not seem to exist

image image

@uhoreg
Copy link
Copy Markdown
Member Author

uhoreg commented May 11, 2026

Right, because it has another device in that test, so it's just showing a logout confirmation, rather than a nag about setting up recovery.

@florianduros
Copy link
Copy Markdown
Member

HI! I'll take a look once the feature is approved by the crypto team

Copy link
Copy Markdown
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

@andybalaam
Copy link
Copy Markdown
Member

@florianduros this is ready for you to review, thanks!

Comment thread apps/web/src/components/views/dialogs/LogoutDialog.tsx
onFinished: function () {},
};
export default function LogoutDialog(props: IProps): JSX.Element {
const client = MatrixClientPeg.safeGet();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const client = MatrixClientPeg.safeGet();
const client = useMatrixClientContext();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had tried this, but useMatrixClientContext seems to be returning undefined. So somehow the context isn't passed through properly. But I don't know much about contexts.

Copy link
Copy Markdown
Member

@florianduros florianduros May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means that the dialog is not wrapped in a MatrixClient context provider

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at where this dialog gets used, it's created (in 2 places) by a call to Modal.createDialog(), which I think means that if I want to wrap it in a MatrixClient context provider, means that I would need to modify the Modal component to somehow receive a MatrixClient and pass it on to child components. Which ... I'm not sure how comfortable I would be to do that, given that Modal is used in other places, and also seems like beyond the scope of this PR.
I could change it so that LogoutDialog takes the client as a property, though, if that would be better.

Comment thread apps/web/src/components/views/dialogs/LogoutDialog.tsx Outdated
Comment thread apps/web/src/components/views/dialogs/LogoutDialog.tsx Outdated
Comment thread apps/web/src/components/views/dialogs/LogoutDialog.tsx
Comment on lines +140 to +145
<p>{_t("auth|logout_dialog|setup_secure_backup_description")}</p>
<div>
<a target="_blank" href="https://element.io/en/help#encryption16">
{_t("action|learn_more")} <PopOutIcon />
</a>
</div>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For text prefer typography component of compound cf https://github.com/element-hq/element-web/blob/develop/code_style.md#react
If you can't, be sure to apply the correct letter spacing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That part of the doc links to https://compound.element.io/?path=%2Fdocs%2Fcompound-web_typography--docs, which only seems to offer the <Heading> component, which probably isn't what we want here. The docs also don't say how to "apply the correct CSS classes for font and letter spacing". Where can I learn more about that.

So, I did originally try to use the <Link> component for this, but <Link> makes the link black, whereas the design calls for it to be blue. What's the preferred way of doing this?

Copy link
Copy Markdown
Member

@florianduros florianduros May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a <Text /> component https://compound.element.io/?path=/story/compound-web_typography--text that you can use both p and a marker.

The docs also don't say how to "apply the correct CSS classes for font and letter spacing".

For a md font: font-letter-spacing: var(--cpd-font-letter-spacing-body-md). However I strongly encourage to use the compound typography component because it both applies the font and the letter spacing

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've changed it to use <Text>. Hopefully I did it right.

Comment on lines +112 to +116
<Text>
<a target="_blank" href="https://element.io/en/help#encryption16">
{_t("action|learn_more")} <PopOutIcon />
</a>
</div>
</Text>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a div here (there is no class on it)?
We can use <Text as="a"> to have a tag with the Text properties

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I've changed it to use <Text as="a">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants