Dramatically simplify use of mx_fadable

by applying it to parent elements of things that need to be faded.
This commit is contained in:
Luke Barnard 2017-10-25 15:15:49 +01:00
parent 2f8f2ce76e
commit b1f2a6c1e9
6 changed files with 21 additions and 39 deletions

View file

@ -116,7 +116,6 @@ const FilePanel = React.createClass({
timelineSet={this.state.timelineSet} timelineSet={this.state.timelineSet}
showUrlPreview = {false} showUrlPreview = {false}
tileShape="file_grid" tileShape="file_grid"
disabled={this.props.disabled}
empty={_t('There are no visible files in this room')} empty={_t('There are no visible files in this room')}
/> />
); );

View file

@ -79,9 +79,6 @@ module.exports = React.createClass({
// callback which is called when more content is needed. // callback which is called when more content is needed.
onFillRequest: React.PropTypes.func, onFillRequest: React.PropTypes.func,
// whether to display as faded and uninteractable
disabled: React.PropTypes.bool,
// className for the panel // className for the panel
className: React.PropTypes.string.isRequired, className: React.PropTypes.string.isRequired,
@ -652,10 +649,9 @@ module.exports = React.createClass({
const style = this.props.hidden ? { display: 'none' } : {}; const style = this.props.hidden ? { display: 'none' } : {};
const className = classNames( const className = classNames(
this.props.className, "mx_fadable", this.props.className,
{ {
"mx_MessagePanel_alwaysShowTimestamps": this.props.alwaysShowTimestamps, "mx_MessagePanel_alwaysShowTimestamps": this.props.alwaysShowTimestamps,
"mx_fadable_faded": this.props.disabled,
}, },
); );

View file

@ -45,7 +45,6 @@ const NotificationPanel = React.createClass({
manageReadMarkers={false} manageReadMarkers={false}
timelineSet={timelineSet} timelineSet={timelineSet}
showUrlPreview = {false} showUrlPreview = {false}
opacity={this.props.opacity}
tileShape="notif" tileShape="notif"
empty={_t('You have no visible notifications')} empty={_t('You have no visible notifications')}
/> />

View file

@ -1753,15 +1753,9 @@ module.exports = React.createClass({
let hideMessagePanel = false; let hideMessagePanel = false;
if (this.state.searchResults) { if (this.state.searchResults) {
const searchResultsClasses = classNames(
"mx_RoomView_messagePanel", "mx_RoomView_searchResultsPanel", "mx_fadable",
{
"mx_fadable_faded": this.props.disabled,
},
);
searchResultsPanel = ( searchResultsPanel = (
<ScrollPanel ref="searchResultsPanel" <ScrollPanel ref="searchResultsPanel"
className={searchResultsClasses} className="mx_RoomView_messagePanel mx_RoomView_searchResultsPanel"
onFillRequest={this.onSearchResultsFillRequest} onFillRequest={this.onSearchResultsFillRequest}
onResize={this.onSearchResultsResize} onResize={this.onSearchResultsResize}
> >
@ -1794,21 +1788,14 @@ module.exports = React.createClass({
onScroll={this.onMessageListScroll} onScroll={this.onMessageListScroll}
onReadMarkerUpdated={this._updateTopUnreadMessagesBar} onReadMarkerUpdated={this._updateTopUnreadMessagesBar}
showUrlPreview = {this.state.showUrlPreview} showUrlPreview = {this.state.showUrlPreview}
disabled={this.props.disabled}
className="mx_RoomView_messagePanel" className="mx_RoomView_messagePanel"
/>); />);
let topUnreadMessagesBar = null; let topUnreadMessagesBar = null;
if (this.state.showTopUnreadMessagesBar) { if (this.state.showTopUnreadMessagesBar) {
const TopUnreadMessagesBar = sdk.getComponent('rooms.TopUnreadMessagesBar'); const TopUnreadMessagesBar = sdk.getComponent('rooms.TopUnreadMessagesBar');
const topUnreadMessagesBarClasses = classNames(
"mx_RoomView_topUnreadMessagesBar", "mx_fadable",
{
"mx_fadable_faded": this.props.disabled,
},
);
topUnreadMessagesBar = ( topUnreadMessagesBar = (
<div className={topUnreadMessagesBarClasses}> <div className="mx_RoomView_topUnreadMessagesBar">
<TopUnreadMessagesBar <TopUnreadMessagesBar
onScrollUpClick={this.jumpToReadMarker} onScrollUpClick={this.jumpToReadMarker}
onCloseClick={this.forgetReadMarker} onCloseClick={this.forgetReadMarker}
@ -1817,9 +1804,15 @@ module.exports = React.createClass({
); );
} }
const statusBarAreaClass = classNames( const statusBarAreaClass = classNames(
"mx_RoomView_statusArea", "mx_fadable", "mx_RoomView_statusArea",
{ {
"mx_RoomView_statusArea_expanded": isStatusAreaExpanded, "mx_RoomView_statusArea_expanded": isStatusAreaExpanded,
},
);
const fadableSectionClasses = classNames(
"mx_RoomView_body", "mx_fadable",
{
"mx_fadable_faded": this.props.disabled, "mx_fadable_faded": this.props.disabled,
}, },
); );
@ -1841,6 +1834,7 @@ module.exports = React.createClass({
onLeaveClick={(myMember && myMember.membership === "join") ? this.onLeaveClick : null} onLeaveClick={(myMember && myMember.membership === "join") ? this.onLeaveClick : null}
/> />
{ auxPanel } { auxPanel }
<div className={fadableSectionClasses}>
{ topUnreadMessagesBar } { topUnreadMessagesBar }
{ messagePanel } { messagePanel }
{ searchResultsPanel } { searchResultsPanel }
@ -1852,6 +1846,7 @@ module.exports = React.createClass({
</div> </div>
{ messageComposer } { messageComposer }
</div> </div>
</div>
); );
}, },
}); });

View file

@ -89,9 +89,6 @@ var TimelinePanel = React.createClass({
// callback which is called when the read-up-to mark is updated. // callback which is called when the read-up-to mark is updated.
onReadMarkerUpdated: React.PropTypes.func, onReadMarkerUpdated: React.PropTypes.func,
// whether to display as faded and uninteractable
disabled: React.PropTypes.bool,
// maximum number of events to show in a timeline // maximum number of events to show in a timeline
timelineCap: React.PropTypes.number, timelineCap: React.PropTypes.number,
@ -1157,7 +1154,6 @@ var TimelinePanel = React.createClass({
onScroll={this.onMessageListScroll} onScroll={this.onMessageListScroll}
onFillRequest={this.onMessageListFillRequest} onFillRequest={this.onMessageListFillRequest}
onUnfillRequest={this.onMessageListUnfillRequest} onUnfillRequest={this.onMessageListUnfillRequest}
disabled={this.props.disabled}
isTwelveHour={this.state.isTwelveHour} isTwelveHour={this.state.isTwelveHour}
alwaysShowTimestamps={this.state.alwaysShowTimestamps} alwaysShowTimestamps={this.state.alwaysShowTimestamps}
className={this.props.className} className={this.props.className}

View file

@ -371,7 +371,7 @@ export default class MessageComposer extends React.Component {
); );
return ( return (
<div className="mx_MessageComposer mx_fadable" style={{ opacity: this.props.opacity }}> <div className="mx_MessageComposer">
<div className="mx_MessageComposer_wrapper"> <div className="mx_MessageComposer_wrapper">
<div className="mx_MessageComposer_row"> <div className="mx_MessageComposer_row">
{ controls } { controls }
@ -410,9 +410,6 @@ MessageComposer.propTypes = {
// callback when a file to upload is chosen // callback when a file to upload is chosen
uploadFile: React.PropTypes.func.isRequired, uploadFile: React.PropTypes.func.isRequired,
// opacity for dynamic UI fading effects
opacity: React.PropTypes.number,
// string representing the current room app drawer state // string representing the current room app drawer state
showApps: React.PropTypes.bool, showApps: React.PropTypes.bool,
}; };