-
Notifications
You must be signed in to change notification settings - Fork 296
Leave space - UI #5354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leave space - UI #5354
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #5354 +/- ##
===========================================
- Coverage 80.99% 80.97% -0.02%
===========================================
Files 2306 2312 +6
Lines 63090 63448 +358
Branches 7977 8010 +33
===========================================
+ Hits 51099 51378 +279
- Misses 9060 9131 +71
- Partials 2931 2939 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM in general, a couple of comments but nothing blocking.
data object StartLeaveSpace : SpaceEvents | ||
data object LeaveSpace : SpaceEvents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have some naming/structure we usually follow for these cases?
I think we'd usually have something like data class LeaveSpace(val needsConfirmation: Boolean)
and use tell apart the 2 states. Or we'd also sometimes have LeaveSpace
and some DoLeaveSpace
events, if I'm not mistaken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, we also have AsyncAction
with a confirmation state, which is maybe better here. I'll give it a try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class RoomMembershipObserver { | ||
data class RoomMembershipUpdate( | ||
val roomId: RoomId, | ||
val roomInfo: RoomInfo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit weird to bundle the whole RoomInfo
here, is it just to have access to the isSpace
property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the phrasing here seems a bit odd, I'd expect something like "You'll be leaving all your rooms in this space too", which seems simpler. But if it was designed like this 🤷 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording will probably get updated, I'll move this PR to draft.
7406259
to
a916661
Compare
|
Translations will be back during the next Localazy sync.
5f88777
to
4d1a503
Compare
@jmartinesp the UI has changed a bit, and we may want to merge this PR even if the usage of the SDK is not finished. The entry point to leave Space has been commented out. This would need a brand new review I think. Sorry for the extra work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, I also haven't really tested the latest changes.
mutableStateOf<Set<RoomId>>(emptySet()) | ||
} | ||
val joinedSpaceRooms by produceState(emptyList()) { | ||
// TODO Get the joined room from the SDK, should also have the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment seems incomplete, so much suspense 🕵️ .
@Composable | ||
private fun LeaveSpaceButtons( | ||
showLeaveButton: Boolean, | ||
nbOfSelectedRooms: Int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selectedRoomsCount
?
) | ||
.clickable( | ||
enabled = selectableSpaceRoom.isLastAdmin.not(), | ||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing TODO details here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes. I'll address this comment in the next PR, it's about a11y.
val showQuickAction = rooms | ||
.any { !it.isLastAdmin } | ||
|
||
/** | ||
* True if there are rooms and they are all selected. | ||
*/ | ||
val areAllSelected = rooms | ||
.filter { !it.isLastAdmin } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal, but maybe we could reuse the rooms.filter
here for the .any
above and the .all
below instead of filtering the list 3 times? Since it'll be a small list (probably) maybe it's not worth it.
), | ||
) | ||
// By default select all rooms | ||
selectedRoomIds.value = rooms.map { it.roomId }.toSet() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be an immutable set so it won't trigger unnecessary recompositions? As in using ImmutableSet
instead of Set
for the value.
|
Content
Add UI for the ability to leave space.
Waiting for new Rust SDK api to get the list of rooms to left when leaving the space to finalize the work, but this PR can be reviewed and merged, the entry point to leave the space has been commented out.
Sharing a space should work though.
Motivation and context
Closes #5300
Partially implement #5301
Screenshots / GIFs
See recorded ones
Tests
Tested devices
Checklist