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

Commit

Permalink
Merge pull request #6070 from matrix-org/t3chguy/fix/17360
Browse files Browse the repository at this point in the history
Improve explore rooms when no results are found
  • Loading branch information
t3chguy authored May 23, 2021
2 parents 71f8063 + 35b9388 commit a6adfde
Show file tree
Hide file tree
Showing 7 changed files with 426 additions and 278 deletions.
38 changes: 33 additions & 5 deletions res/css/structures/_RoomDirectory.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,39 @@ limitations under the License.
.mx_RoomDirectory_tableWrapper {
overflow-y: auto;
flex: 1 1 0;

.mx_RoomDirectory_footer {
margin-top: 24px;
text-align: center;

> h5 {
margin: 0;
font-weight: $font-semi-bold;
font-size: $font-15px;
line-height: $font-18px;
color: $primary-fg-color;
}

> p {
margin: 40px auto 60px;
font-size: $font-14px;
line-height: $font-20px;
color: $secondary-fg-color;
max-width: 464px; // easier reading
}

> hr {
margin: 0;
border: none;
height: 1px;
background-color: $header-panel-bg-color;
}

.mx_RoomDirectory_newRoom {
margin: 24px auto 0;
width: max-content;
}
}
}

.mx_RoomDirectory_table {
Expand Down Expand Up @@ -138,11 +171,6 @@ limitations under the License.
color: $settings-grey-fg-color;
}

.mx_RoomDirectory_table tr {
padding-bottom: 10px;
cursor: pointer;
}

.mx_RoomDirectory .mx_RoomView_MessageList {
padding: 0;
}
Expand Down
9 changes: 6 additions & 3 deletions src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
break;
}
case 'view_create_room':
this.createRoom(payload.public);
this.createRoom(payload.public, payload.defaultName);
break;
case 'view_create_group': {
let CreateGroupDialog = sdk.getComponent("dialogs.CreateGroupDialog")
Expand Down Expand Up @@ -1011,7 +1011,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
});
}

private async createRoom(defaultPublic = false) {
private async createRoom(defaultPublic = false, defaultName?: string) {
const communityId = CommunityPrototypeStore.instance.getSelectedCommunityId();
if (communityId) {
// double check the user will have permission to associate this room with the community
Expand All @@ -1025,7 +1025,10 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
}

const CreateRoomDialog = sdk.getComponent('dialogs.CreateRoomDialog');
const modal = Modal.createTrackedDialog('Create Room', '', CreateRoomDialog, { defaultPublic });
const modal = Modal.createTrackedDialog('Create Room', '', CreateRoomDialog, {
defaultPublic,
defaultName,
});

const [shouldCreate, opts] = await modal.finished;
if (shouldCreate) {
Expand Down
Loading

0 comments on commit a6adfde

Please sign in to comment.