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

Create room threads list view #6904

Merged
merged 53 commits into from
Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2de3716
Refactor RoomHeader buttons to a list
Oct 5, 2021
8808886
Refactor dispatching events and dispatch properly
Oct 5, 2021
3e5e444
Use ThreadView in ThreadView.tsx
Oct 5, 2021
81c3c6a
Use injected MatrixClient instead
Oct 5, 2021
f77a33e
Fix icon
Oct 5, 2021
282c011
Initial styling run of threads list
Oct 7, 2021
45095bb
Add proper separator color
Oct 7, 2021
15b7853
Make right panel buttons threads list button active
Oct 7, 2021
bed9262
Don't show download link for ThreadPanel images
Oct 9, 2021
498ebf4
More styling changes
Oct 9, 2021
a39e8d9
Remove follow threads button
Oct 9, 2021
c1de0e3
Fix eslint killing my vibe
Oct 9, 2021
05e7c17
Ideal hover state dimensions
Oct 9, 2021
e7cecf9
Better MessageActionBar position
Oct 9, 2021
5774385
Perfect dimensions
Oct 9, 2021
f1d0545
Fix wrong button position (now drifting from design)
Oct 9, 2021
e78cbbf
Properly stretch the container
Oct 9, 2021
2e920ae
Move ThreadPanel scss to it's own file
Oct 9, 2021
8b61277
Fix padding issues
Oct 9, 2021
8329b29
Hide close button and add room header
Oct 9, 2021
bb99972
Add proper threads filtering w/o css
Oct 9, 2021
f74355b
Fix react key error
Oct 9, 2021
eaa6b6b
Add filtering
Oct 9, 2021
cd4b107
Center header items
Oct 9, 2021
8193674
Eslint is stupid.
Oct 9, 2021
0cce2f2
Fix unused variable
Oct 9, 2021
b1fa8d8
Slightly cleanup css
Oct 9, 2021
577d623
Add proper hover state
Oct 9, 2021
f355a45
Show selection status
Oct 9, 2021
ad92419
Add cutesey fade-in filtering animation
Oct 9, 2021
f57bc21
Fix CI being sad about imports
Oct 9, 2021
51ebe68
Fix getting userId
Oct 11, 2021
9940cb8
Fix import
Oct 11, 2021
9fee5f4
Fix weird merge
Oct 11, 2021
82aebbc
Add missing event handlers removal
Oct 11, 2021
eb1bcd8
Get rid of MFileBody hack
Oct 11, 2021
baf048d
Refactor to TimelinePanel
Oct 11, 2021
3fa416a
remove tileshape
Oct 11, 2021
eb3bc79
Update according to PR comments
Oct 12, 2021
ef69749
Fix missing copyright header
Oct 12, 2021
a54a69f
Always show threads button
Oct 12, 2021
c5166c0
Fix accidental override
Oct 12, 2021
757e30c
Properly override the ThreadView previous phase
Oct 12, 2021
d4e08e5
Remove todo tests
Oct 12, 2021
9823ffd
Merge remote-tracking branch 'origin/develop' into feature/palid/18957
Oct 12, 2021
3b8c5e8
Fix typescript being unhappy
Oct 12, 2021
ea8970d
Add basic tests
Oct 12, 2021
21fc950
Add some basic ThreadPanelHeader tests
Oct 13, 2021
c2ec71f
Merge remote-tracking branch 'origin/develop' into feature/palid/18957
Oct 13, 2021
ab756db
Fix imports order
Oct 13, 2021
96874ff
Fix left-positioned time
Oct 13, 2021
357dd39
Temporarily revert the ThreadPanel items order
Oct 14, 2021
3a1b919
Add TileShape to hide typing indicator
Oct 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions res/css/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
@import "./views/right_panel/_UserInfo.scss";
@import "./views/right_panel/_VerificationPanel.scss";
@import "./views/right_panel/_WidgetCard.scss";
@import "./views/right_panel/_ThreadPanel.scss";
@import "./views/room_settings/_AliasSettings.scss";
@import "./views/rooms/_AppsDrawer.scss";
@import "./views/rooms/_Autocomplete.scss";
Expand Down
4 changes: 4 additions & 0 deletions res/css/structures/_RightPanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ limitations under the License.
}
}

.mx_RightPanel_threadsButton::before {
mask-image: url('$(res)/img/element-icons/room/thread.svg');
Palid marked this conversation as resolved.
Show resolved Hide resolved
}

.mx_RightPanel_notifsButton::before {
mask-image: url('$(res)/img/element-icons/notifications.svg');
mask-position: center;
Expand Down
152 changes: 152 additions & 0 deletions res/css/views/right_panel/_ThreadPanel.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
/*
Palid marked this conversation as resolved.
Show resolved Hide resolved
Copyright 2021 The Matrix.org Foundation C.I.C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/


.mx_ThreadPanel {
display: flex;
flex-direction: column;

.mx_BaseCard_header {
padding: 6px 0;

.mx_BaseCard_close {
margin-top: 15px;
}
}

.mx_AccessibleButton.mx_BaseCard_back {
display: none;
}

&__header {
Copy link
Contributor

Choose a reason for hiding this comment

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

More a personal opinion/preference, but I usually try to stay away from writing this.
It might be slightly shorter to write, but forces one to look up to figure out how the classname will be computed, but more importantly breaks the codebase searchability giving less us confidence to delete things in the long term

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not doing it to shorten things up, but to couple it together - I agree that it makes things hard to search for, but makes it a lot easier to look at context of that specific class in scss file, which in this particular case really does help.

width: calc(100% - 40px);
display: flex;
flex: 1;
justify-content: space-between;

span:first-of-type {
font-weight: 600;
font-size: 15px;
line-height: 18px;
color: $secondary-content;
}

.mx_AccessibleButton {
font-size: 12px;
color: $secondary-content;
}

.mx_ContextualMenu_wrapper {
// It's added here due to some weird error if I pass it directly in the style, even though it's a numeric value, so it's being passed 0 instead.
// The error: react_devtools_backend.js:2526 Warning: `NaN` is an invalid value for the `top` css style property.
top: 43px;
}

.mx_ContextualMenu {
position: initial;
span:first-of-type {
font-weight: 600;
font-size: 12px;
color: $primary-content;
}

font-size: 12px;
color: $secondary-content;
}

.mx_ThreadPanel_Header_FilterOptionItem {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably live within the contextual menu component.
None of it is inherently tied to threads and I could see this new design declination spread throughout the codebase.

The current naming and where the code lives might prevent that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is inherently tied to threads though. If it's not then we should create a normalized components for contextual menu items that should always be used there.
This is out of scope of this issue.

display: flex;
flex-grow: 1;
justify-content: space-between;
flex-direction: column;
overflow: visible;
width: 100%;
padding: 20px;
padding-left: 30px;
position: relative;

&:hover {
background-color: $event-selected-color;
}
&[aria-selected="true"] {
&::before {
content: "";
width: 12px;
height: 12px;
grid-column: 1;
grid-row: 1;
mask-image: url("$(res)/img/feather-customised/check.svg");
mask-size: 100%;
mask-repeat: no-repeat;
position: absolute;
top: 22px;
left: 10px;
background-color: $primary-content;
}
}
}
}

.mx_RoomView_messageListWrapper {
background-color: $background;
border-radius: 8px;
padding-top: 8px;
padding-bottom: 12px;
}

.mx_ScrollPanel {
.mx_RoomView_MessageList {
padding: 0;
}
}

.mx_EventTile, .mx_EventListSummary {
// Account for scrollbar when hovering
width: calc(100% - 3px);
margin: 0 2px;

.mx_MessageTimestamp {
// We need to add !important here due to some enormous selectors overriding it anyways
// See: _EventTile.scss:241
left: unset !important;
right: 0 !important;
top: 16px;
}

.mx_EventTile_line.mx_EventTile_line {
position: unset;
}

.mx_ThreadInfo {
position: relative;
padding-right: 11px;
&::after {
content: '';
display: block;
position: absolute;
left: 0;
bottom: -16px;
height: 1px;
width: 100%;
border-bottom: 1px solid $message-action-bar-border-color;
}
}

.mx_DateSeparator {
display: none;
}
}
}
1 change: 1 addition & 0 deletions res/img/element-icons/room/thread.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import shouldHideEvent from '../../shouldHideEvent';
import { wantsDateSeparator } from '../../DateUtils';
import { MatrixClientPeg } from '../../MatrixClientPeg';
import SettingsStore from '../../settings/SettingsStore';
import RoomContext from "../../contexts/RoomContext";
import RoomContext, { TimelineRenderingType } from "../../contexts/RoomContext";
import { Layout } from "../../settings/Layout";
import { _t } from "../../languageHandler";
import EventTile, { haveTileForEvent, IReadReceiptProps, TileShape } from "../views/rooms/EventTile";
Expand Down Expand Up @@ -66,7 +66,9 @@ export function shouldFormContinuation(
prevEvent: MatrixEvent,
mxEvent: MatrixEvent,
showHiddenEvents: boolean,
timelineRenderingType?: TimelineRenderingType,
): boolean {
if (timelineRenderingType === TimelineRenderingType.ThreadsList) return false;
// sanity check inputs
if (!prevEvent || !prevEvent.sender || !mxEvent.sender) return false;
// check if within the max continuation period
Expand Down Expand Up @@ -722,7 +724,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {

// is this a continuation of the previous message?
const continuation = !wantsDateSeparator &&
shouldFormContinuation(prevEvent, mxEv, this.showHiddenEvents);
shouldFormContinuation(prevEvent, mxEv, this.showHiddenEvents, this.context.timelineRenderingType);

const eventId = mxEv.getId();
const highlight = (eventId === this.props.highlightedEventId);
Expand Down Expand Up @@ -794,6 +796,9 @@ export default class MessagePanel extends React.Component<IProps, IState> {
}

public wantsDateSeparator(prevEvent: MatrixEvent, nextEventDate: Date): boolean {
if (this.context.timelineRenderingType === TimelineRenderingType.ThreadsList) {
return false;
}
if (prevEvent == null) {
// first event in the panel: depends if we could back-paginate from
// here.
Expand Down
7 changes: 2 additions & 5 deletions src/components/structures/RightPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { throttle } from 'lodash';
import SpaceStore from "../../stores/SpaceStore";
import { RoomPermalinkCreator } from '../../utils/permalinks/Permalinks';
import { E2EStatus } from '../../utils/ShieldUtils';
import { SetRightPanelPhasePayload } from '../../dispatcher/payloads/SetRightPanelPhasePayload';
import { dispatchShowThreadsPanelEvent } from '../../dispatcher/dispatch-actions/threads';

interface IProps {
room?: Room; // if showing panels for a given room, this is set
Expand Down Expand Up @@ -199,10 +199,7 @@ export default class RightPanel extends React.Component<IProps, IState> {
const isChangingRoom = payload.action === 'view_room' && payload.room_id !== this.props.room.roomId;
const isViewingThread = this.state.phase === RightPanelPhases.ThreadView;
if (isChangingRoom && isViewingThread) {
dis.dispatch<SetRightPanelPhasePayload>({
action: Action.SetRightPanelPhase,
phase: RightPanelPhases.ThreadPanel,
});
dispatchShowThreadsPanelEvent();
}

if (payload.action === Action.AfterRightPanelPhaseChange) {
Expand Down
Loading