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

various fixes to RoomHeader #880

Merged
merged 5 commits into from
May 15, 2017
Merged

various fixes to RoomHeader #880

merged 5 commits into from
May 15, 2017

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented May 11, 2017

  • don't show buttons if they don't do anything
  • don't show search when we're not in the room (it'll fail opaquely)
  • hide settings button when appropriate (it'd do nothing)

and some smaller fixes

closes element-hq/element-web#3859

so unless I'm going insane, it should be a string.

fixes
```
rageshake.js:61 Warning: Failed prop type: The prop `onClick` is marked as required in `AccessibleButton`, but its value is `undefined`.
    in AccessibleButton (created by RoomHeader)
    in RoomHeader (created by RoomView)
    in div (created by RoomView)
    in RoomView (created by LoggedInView)
    in main (created by LoggedInView)
    in div (created by LoggedInView)
    in div (created by LoggedInView)
    in LoggedInView (created by MatrixChat)
    in MatrixChat
```

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pass inRoom prop to RoomHeader (defaults to false)
remove default onSettingsClick, handle if it is passed EVERYWHERE

if onSettingsClick is passes, show that button
show search button only if we are in the room, seems to fail otherwise
this seems to handle all cases I could throw at it. Give it your best

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@lukebarnard1 lukebarnard1 self-assigned this May 12, 2017
const innerName =
<EmojiText element="div"
className={ "mx_RoomHeader_nametext " + (settingsHint ? "mx_RoomHeader_settingsHint" : "") }
title={ roomName }>{roomName}</EmojiText>;
Copy link
Contributor

Choose a reason for hiding this comment

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

A few things here:

  • props should be {"someValue"} (no spaces)
  • children should be { someChild }

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough, I actually just copied that and did not change it. Will add a commit to remedy that

@@ -225,12 +226,17 @@ module.exports = React.createClass({
roomName = this.props.room.name;
}

const innerName =
<EmojiText element="div"
className={ "mx_RoomHeader_nametext " + (settingsHint ? "mx_RoomHeader_settingsHint" : "") }
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be really awesome if this used classnames which can be imported from /src. Then the indentation could be a bit nicer 😀 (i.e. someClasses = classnames({...}) ... className={someClasses} )

className={ "mx_RoomHeader_nametext " + (settingsHint ? "mx_RoomHeader_settingsHint" : "") }
title={ roomName }>{roomName}</EmojiText>;

if (this.props.onSettingsClick) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure it's ok to pass undefined to onClick, so this is a bit redundant.

Copy link
Member Author

Choose a reason for hiding this comment

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

rageshake.js:61 Warning: Failed prop type: The prop `onClick` is marked as required in `AccessibleButton`, but its value is `undefined`.
in AccessibleButton (created by RoomHeader)
in RoomHeader (created by RoomView)
in div (created by RoomView)
in RoomView (created by LoggedInView)
in main (created by LoggedInView)
in div (created by LoggedInView)
in div (created by LoggedInView)
in LoggedInView (created by MatrixChat)
in MatrixChat

Copy link
Contributor

Choose a reason for hiding this comment

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

But this isn't an AccessibleButton, it's a div so that error must be for the other thing.

@@ -299,6 +305,14 @@ module.exports = React.createClass({
</AccessibleButton>;
}

let search_button;
if (this.props.onSearchClick && this.props.inRoom) {
Copy link
Contributor

@lukebarnard1 lukebarnard1 May 12, 2017

Choose a reason for hiding this comment

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

Again I don't think we should be checking for the optional onSearchClick, let's allow AccessibleButton to decide whether to call undefined or not.

What even am I saying, a button without an onClick is quite useless. Ignore me whilst I miss the point entirely 😬

Copy link
Member Author

Choose a reason for hiding this comment

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

This is so we don't show a search button if it's a no-op
It's confusing

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
#880 (comment)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@ara4n
Copy link
Member

ara4n commented May 15, 2017

given the changes are approved, why isn't this merged? :)

@ara4n ara4n merged commit 7f78e73 into develop May 15, 2017
@t3chguy t3chguy deleted the t3chguy/fixRoomHeaderPreviewing branch October 29, 2017 17:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Join Room / Peek View has RoomSettings and search buttons
4 participants