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

Add room topic and animation #11352

Merged
merged 22 commits into from
Aug 2, 2023
Merged

Add room topic and animation #11352

merged 22 commits into from
Aug 2, 2023

Conversation

germain-gg
Copy link
Contributor

@germain-gg germain-gg commented Aug 1, 2023

For element-hq/element-web#25892

Screen.Recording.2023-08-01.at.13.27.39.mov

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

This change is marked as an internal change (Task), so will not be included in the changelog.

@germain-gg germain-gg added the T-Task Refactoring, enabling or disabling functionality, other engineering tasks label Aug 1, 2023
@germain-gg germain-gg requested a review from a team as a code owner August 1, 2023 14:20
@t3chguy
Copy link
Member

t3chguy commented Aug 1, 2023

@germain-gg any chance of a screenshot with a multi-line topic? Like the one in Element Web/Desktop

image

@germain-gg
Copy link
Contributor Author

@t3chguy
Screenshot 2023-08-01 at 17 12 05

@t3chguy
Copy link
Member

t3chguy commented Aug 2, 2023

@germain-gg thanks, is it intentional that links aren't linkified?

@germain-gg
Copy link
Contributor Author

yes

@t3chguy
Copy link
Member

t3chguy commented Aug 2, 2023

Cool, liking the animation. Should we be concerned about prefers-reduced-motion at all?

@germain-gg
Copy link
Contributor Author

Probably yes, that's a good shout. @t3chguy wanna give this pull request a review?

@t3chguy
Copy link
Member

t3chguy commented Aug 2, 2023

@germain-gg any chance it can meet the sonar gate so it doesn't need to bypass the merge queue?

: rightPanel.setCard({ phase: RightPanelPhases.RoomSummary });
}}
>
{room && <DecoratedRoomAvatar room={room} oobData={oobData} avatarSize={40} displayBadge={false} />}
Copy link
Member

Choose a reason for hiding this comment

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

We want an avatar built from oobData if no room is present RoomAvatar doesn't require a room and will do just that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DecoratedRoomAvatar requires a room model. I'm not sure how that would work?
The entire component runs under the assumption this model exists and is passed down

Copy link
Member

Choose a reason for hiding this comment

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

Switch between the two components depending on whether or not you have a room or make DecoratedRoomAvatar's room prop optional like RoomAvatar? The whole point of oobData.avatarUrl is to be able to render an avatar even if you don't have a room object

Copy link
Member

Choose a reason for hiding this comment

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

Either that or make room required like LegacyRoomHeader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So this behaviour is currently not possible. I've added a task to deal with that element-hq/element-web#25902 but this is probably not the right pull request to deal with it.

Copy link
Member

@t3chguy t3chguy Aug 2, 2023

Choose a reason for hiding this comment

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

Suggested change
{room && <DecoratedRoomAvatar room={room} oobData={oobData} avatarSize={40} displayBadge={false} />}
{room ? <DecoratedRoomAvatar room={room} oobData={oobData} avatarSize={40} displayBadge={false} /> : <RoomAvatar oobData={oobData} width={40} height={40} />}

Switch between the two components depending on whether or not you have a room

Is very much possible

Either that or make room required like LegacyRoomHeader

As is this, it isn't at all clear why room is optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we should embed the logic here. But it is done so that we can move on and merge this pull request.

Room is marked as optional because it is the reality of the types. LegacyRoomHeader types are wrong.
The room object is passed from the RoomContext and the room property is Room | undefined there. I have not spent the time investigating nor decided how i'm going to fix it properly moving forward.

Copy link
Member

@t3chguy t3chguy Aug 2, 2023

Choose a reason for hiding this comment

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

The primary call site of LegacyRoomHeader is in RoomView, this is guarded by this block which ensures that a falsey room is not passed

image

Typescript reflects this type narrowing

image

The call site in WaitingForThirdPartyRoomView is similarly guarded though indirectly
image

The one in LocalRoomView is type asserted but then room.isError is accessed so that would throw before RoomHeader, again causing narrowing

image

The only one breaking assertions is LocalRoomCreateLoader

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I've pushed your suggestion, so we should probably keep it like this for this pull request to not have other matters creep in.

Unless you have other suggestions, we should be good to go?

src/components/views/avatars/DecoratedRoomAvatar.tsx Outdated Show resolved Hide resolved
@germain-gg germain-gg added this pull request to the merge queue Aug 2, 2023
Merged via the queue into develop with commit 33299af Aug 2, 2023
19 checks passed
@germain-gg germain-gg deleted the germain-gg/25892-ui branch August 2, 2023 11:18
@MTRNord
Copy link
Contributor

MTRNord commented Aug 2, 2023

yes

( #11352 (comment) )

That is going to break probably more than 70% of the matrix room topics. Most projects use it to link to their github, website and so on. Not being able to linkify is a major downgrade and probably not well accepted when it is launched :/ It makes the already fairly useless topics even less useful. (useless in the sense that it currently has a very limited amount of info it can carry)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants