Switch rooms documentation and polishing
This commit is contained in:
parent
c428736191
commit
4851e96297
3 changed files with 12 additions and 5 deletions
|
@ -650,6 +650,7 @@ export default class MessagePanel extends React.Component {
|
||||||
as="li"
|
as="li"
|
||||||
data-scroll-tokens={scrollToken}
|
data-scroll-tokens={scrollToken}
|
||||||
ref={this._collectEventNode.bind(this, eventId)}
|
ref={this._collectEventNode.bind(this, eventId)}
|
||||||
|
alwaysShowTimestamps={this.props.alwaysShowTimestamps}
|
||||||
mxEvent={mxEv}
|
mxEvent={mxEv}
|
||||||
continuation={continuation}
|
continuation={continuation}
|
||||||
isRedacted={mxEv.isRedacted()}
|
isRedacted={mxEv.isRedacted()}
|
||||||
|
|
|
@ -83,7 +83,7 @@ import { objectHasDiff } from "../../utils/objects";
|
||||||
import SpaceRoomView from "./SpaceRoomView";
|
import SpaceRoomView from "./SpaceRoomView";
|
||||||
import { IOpts } from "../../createRoom";
|
import { IOpts } from "../../createRoom";
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
import _ from 'lodash';
|
import { omit } from 'lodash';
|
||||||
|
|
||||||
const DEBUG = false;
|
const DEBUG = false;
|
||||||
let debuglog = function(msg: string) {};
|
let debuglog = function(msg: string) {};
|
||||||
|
@ -532,14 +532,16 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
const hasPropsDiff = objectHasDiff(this.props, nextProps);
|
const hasPropsDiff = objectHasDiff(this.props, nextProps);
|
||||||
|
|
||||||
|
// React only shallow comparison and we only want to trigger
|
||||||
|
// a component re-render if a room requires an upgrade
|
||||||
const newUpgradeRecommendation = nextState.upgradeRecommendation || {}
|
const newUpgradeRecommendation = nextState.upgradeRecommendation || {}
|
||||||
|
|
||||||
const state = _.omit(this.state, ['upgradeRecommendation']);
|
const state = omit(this.state, ['upgradeRecommendation']);
|
||||||
const newState = _.omit(nextState, ['upgradeRecommendation'])
|
const newState = omit(nextState, ['upgradeRecommendation'])
|
||||||
|
|
||||||
const hasStateDiff =
|
const hasStateDiff =
|
||||||
objectHasDiff(state, newState) ||
|
objectHasDiff(state, newState) ||
|
||||||
(newUpgradeRecommendation && newUpgradeRecommendation.needsUpgrade === true)
|
(newUpgradeRecommendation.needsUpgrade === true)
|
||||||
|
|
||||||
return hasPropsDiff || hasStateDiff;
|
return hasPropsDiff || hasStateDiff;
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,6 +280,9 @@ interface IProps {
|
||||||
|
|
||||||
// Symbol of the root node
|
// Symbol of the root node
|
||||||
as?: string
|
as?: string
|
||||||
|
|
||||||
|
// whether or not to always show timestamps
|
||||||
|
alwaysShowTimestamps?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
|
@ -979,7 +982,8 @@ export default class EventTile extends React.Component<IProps, IState> {
|
||||||
onFocusChange={this.onActionBarFocusChange}
|
onFocusChange={this.onActionBarFocusChange}
|
||||||
/> : undefined;
|
/> : undefined;
|
||||||
|
|
||||||
const timestamp = this.props.mxEvent.getTs() && this.state.hover ?
|
const showTimestamp = this.props.mxEvent.getTs() && (this.props.alwaysShowTimestamps || this.state.hover);
|
||||||
|
const timestamp = showTimestamp ?
|
||||||
<MessageTimestamp showTwelveHour={this.props.isTwelveHour} ts={this.props.mxEvent.getTs()} /> : null;
|
<MessageTimestamp showTwelveHour={this.props.isTwelveHour} ts={this.props.mxEvent.getTs()} /> : null;
|
||||||
|
|
||||||
const keyRequestHelpText =
|
const keyRequestHelpText =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue