From f938bfaab947887e8bc49f619923a3bc9786220c Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Mon, 13 Dec 2021 17:46:32 +0100 Subject: [PATCH] Right panel chat style changes for read receipts and optimizations for smaller widths (#7297) Co-authored-by: J. Ryan Stinnett --- res/css/views/right_panel/_TimelineCard.scss | 51 +++++++++++++++++++ src/components/structures/RightPanel.tsx | 1 + .../views/right_panel/TimelineCard.tsx | 25 ++++----- 3 files changed, 63 insertions(+), 14 deletions(-) diff --git a/res/css/views/right_panel/_TimelineCard.scss b/res/css/views/right_panel/_TimelineCard.scss index c6e6f9d51b..8e8c904126 100644 --- a/res/css/views/right_panel/_TimelineCard.scss +++ b/res/css/views/right_panel/_TimelineCard.scss @@ -33,4 +33,55 @@ limitations under the License. right: 0; } } + .mx_AutoHideScrollbar { + padding-right: 10px; + width: calc(100% - 10px); + } + + // Style to optimize the layout for the right panel area + .mx_EventTile_content { + margin-right: 0; + } + .mx_EventTile:not([data-layout="bubble"]) .mx_EventTile_line { + padding-left: 36px; + padding-right: 36px; + } + + .mx_GroupLayout .mx_EventTile > .mx_SenderProfile { + margin-left: 36px; + } + .mx_EventTile:not([data-layout="bubble"]) .mx_EventTile_avatar { + top: 12px; + left: 0px; + } + + .mx_CallEvent_wrapper { + justify-content: center; + margin: auto 5px; + .mx_CallEvent { + margin: 4px; + } + } + .mx_EventTile:not([data-layout="bubble"]) .mx_MessageTimestamp { + right: -4px; + left: auto; + } + + .mx_EventTile:not([data-layout="bubble"]) .mx_EventTile_msgOption { + margin-right: 2px; + } + .mx_GroupLayout .mx_EventTile .mx_EventTile_line { + padding-bottom: 8px; + } + .mx_EventTile_readAvatars { + top: -10px; + } + + // mx_EventTile_info + .mx_EventTile:not([data-layout="bubble"]).mx_EventTile_info .mx_EventTile_line { + padding-left: 36px; + } + .mx_EventTile:not([data-layout="bubble"]).mx_EventTile_info .mx_EventTile_avatar { + left: 18px; + } } diff --git a/src/components/structures/RightPanel.tsx b/src/components/structures/RightPanel.tsx index 5431b848ba..f0b5918581 100644 --- a/src/components/structures/RightPanel.tsx +++ b/src/components/structures/RightPanel.tsx @@ -338,6 +338,7 @@ export default class RightPanel extends React.Component { case RightPanelPhases.Timeline: if (!SettingsStore.getValue("feature_maximised_widgets")) break; panel = { private dispatcherRef: string; private timelinePanelRef: React.RefObject = React.createRef(); private roomStoreToken: EventSubscription; - private settingWatchers: string[]; + private readReceiptsSettingWatcher: string; constructor(props: IProps) { super(props); this.state = { - showReadReceipts: false, + showReadReceipts: SettingsStore.getValue("showReadReceipts", props.room.roomId), }; - this.settingWatchers = []; + this.readReceiptsSettingWatcher = null; } public componentDidMount(): void { this.roomStoreToken = RoomViewStore.addListener(this.onRoomViewStoreUpdate); this.dispatcherRef = dis.register(this.onAction); + this.readReceiptsSettingWatcher = SettingsStore.watchSetting("showReadReceipts", null, + (...[,,, value]) => {this.setState({ showReadReceipts: value as boolean });}, + ); } public componentWillUnmount(): void { @@ -88,28 +92,21 @@ export default class TimelineCard extends React.Component { this.roomStoreToken.remove(); } dis.unregister(this.dispatcherRef); - for (const watcher of this.settingWatchers) { - SettingsStore.unwatchSetting(watcher); + if (this.readReceiptsSettingWatcher) { + SettingsStore.unwatchSetting(this.readReceiptsSettingWatcher); } } private onRoomViewStoreUpdate = async (initial?: boolean): Promise => { - const roomId = this.props.room.roomId; const newState: Pick = { // roomLoading: RoomViewStore.isRoomLoading(), // roomLoadError: RoomViewStore.getRoomLoadError(), - showReadReceipts: SettingsStore.getValue("showReadReceipts", roomId), initialEventId: RoomViewStore.getInitialEventId(), initialEventHighlighted: RoomViewStore.isInitialEventHighlighted(), replyToEvent: RoomViewStore.getQuotingEvent(), }; - this.settingWatchers = this.settingWatchers.concat([ - SettingsStore.watchSetting("showReadReceipts", roomId, (...[,,, value]) => - this.setState({ showReadReceipts: value as boolean }), - ), - ]); this.setState(newState); }; @@ -159,14 +156,14 @@ export default class TimelineCard extends React.Component { liveTimeline: this.props.timelineSet.getLiveTimeline(), }}>