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

History based navigation with new right panel store #7398

Merged
merged 116 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 105 commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
2575cb1
RightPanelStore getSharedInstance() > get instance
toger5 Dec 6, 2021
790e162
initial working refactor
toger5 Dec 8, 2021
cdb56d1
remove check right panel
toger5 Dec 8, 2021
b0c4558
change to fucntions instaed of actions
toger5 Dec 8, 2021
78f4e5e
refactor to readyWatchingStore
toger5 Dec 8, 2021
b4f1a95
using the new functions, fixing import cycle,
toger5 Dec 8, 2021
4f010e8
refactor toggle to RightPanelStore.togglePanel()
toger5 Dec 8, 2021
560585f
fix viewedRoomId undefined
toger5 Dec 8, 2021
88bf032
refactor SetRightPanelPhasePayload to IPanelState
toger5 Dec 8, 2021
094bf11
remove AfterRightPanelPhaseChangeAction
toger5 Dec 8, 2021
4620154
remove imports
toger5 Dec 8, 2021
3349076
Update typing and move RightPanelStore to folder
toger5 Dec 9, 2021
3bad57f
remove all the comments
toger5 Dec 9, 2021
1116c97
remove more commnets
toger5 Dec 9, 2021
766377f
fix loading and saving to device settings
toger5 Dec 9, 2021
0df5e63
Merge branch 'develop' into toger5/RightPanelStore_refactor
toger5 Dec 9, 2021
9ddf830
remove more comments
toger5 Dec 9, 2021
1522f85
rename thread realted properites for IPanelState
toger5 Dec 9, 2021
8e23f2e
remove more comments
toger5 Dec 9, 2021
213fc04
Merge branch 'develop' into toger5/RightPanelStore_refactor
toger5 Dec 10, 2021
8ea987b
fix saving with new thread event names
toger5 Dec 10, 2021
44e6e57
fix wrong this. (needed to use _this)
toger5 Dec 10, 2021
9071ee2
fix git ci
toger5 Dec 10, 2021
a9e9fbf
comment clean up
toger5 Dec 10, 2021
eab46c4
make the group stuff more compact
toger5 Dec 10, 2021
4cb7ed3
Merge branch 'develop' into toger5/RightPanelStore_refactor
toger5 Dec 13, 2021
0a209bc
fix import order
toger5 Dec 13, 2021
5839777
add console log
toger5 Dec 13, 2021
5a883cc
Merge branch 'develop' into toger5/RightPanelStore_refactor
toger5 Dec 13, 2021
49e89d0
rename room -> panel
toger5 Dec 13, 2021
0eff48e
Update src/components/structures/RightPanel.tsx
toger5 Dec 14, 2021
5f690a3
Update src/components/views/right_panel/HeaderButtons.tsx
toger5 Dec 14, 2021
7c82f8d
Update src/stores/right-panel/RightPanelStore.ts
toger5 Dec 14, 2021
726243a
Update src/stores/right-panel/RightPanelStore.ts
toger5 Dec 14, 2021
52d87c4
Update src/stores/right-panel/RightPanelStore.ts
toger5 Dec 14, 2021
cec0330
Update src/stores/right-panel/RightPanelStore.ts
toger5 Dec 14, 2021
125ff03
Update src/stores/right-panel/RightPanelStore.ts
toger5 Dec 14, 2021
97b2210
Update src/stores/right-panel/RightPanelStore.ts
toger5 Dec 14, 2021
ab32836
Update src/stores/right-panel/RightPanelStore.ts
toger5 Dec 14, 2021
ab6771a
Update src/stores/right-panel/RightPanelStore.ts
toger5 Dec 14, 2021
2ffb5b9
resolve review
toger5 Dec 14, 2021
a3f8ab6
Merge branch 'develop' into toger5/RightPanelStore_refactor
toger5 Dec 14, 2021
7301c64
remove comment (review)
toger5 Dec 14, 2021
2356c52
use default dispatcher
toger5 Dec 14, 2021
9be935f
check for dispatcherRef
toger5 Dec 14, 2021
c739f77
not unregisting dispatcher (for wrench test)
toger5 Dec 15, 2021
02ca999
unregister in destory
toger5 Dec 15, 2021
86bbb58
"react set state on unmounted" fixes
toger5 Dec 15, 2021
b8d0b7c
header button highlighting fix
toger5 Dec 15, 2021
3cfc79f
comments
toger5 Dec 15, 2021
715cf05
rename interfaces and function signatures:
toger5 Dec 15, 2021
5211c5f
another `unmounted` fix
toger5 Dec 15, 2021
64ddcea
add memberInfoEvent
toger5 Dec 15, 2021
8a2a3de
rightPanel state uses a cardState param
toger5 Dec 15, 2021
baf1471
fix displaying user in UserView
toger5 Dec 15, 2021
fc82e1e
fix error on close of overwrite card
toger5 Dec 15, 2021
a31196e
fix missing setRightPanel->setCard
toger5 Dec 15, 2021
bbf2415
Merge branch 'develop' into toger5/RightPanelStore_refactor
toger5 Dec 15, 2021
eea2af1
review fixes
toger5 Dec 15, 2021
0c63bdd
this.byRoom does not need to be set...
toger5 Dec 15, 2021
4dfdee9
some more cleanup
toger5 Dec 15, 2021
7ec26c4
Update src/stores/right-panel/RightPanelStoreIPanelState.ts
toger5 Dec 16, 2021
f6ae28b
Update src/stores/right-panel/RightPanelStoreIPanelState.ts
toger5 Dec 16, 2021
9f0383d
Update src/components/structures/UserView.tsx
toger5 Dec 16, 2021
8288bfb
Update src/components/structures/ThreadView.tsx
toger5 Dec 16, 2021
d2c0682
Update src/components/views/context_menus/RoomContextMenu.tsx
toger5 Dec 16, 2021
9192ec0
Update src/components/views/elements/MemberEventListSummary.tsx
toger5 Dec 16, 2021
7cdd1bc
Update src/components/views/right_panel/BaseCard.tsx
toger5 Dec 16, 2021
36b9bdd
rewrap try 2
toger5 Dec 16, 2021
bf97a40
Merge branch 'develop' into toger5/RightPanelStore_refactor
toger5 Dec 16, 2021
dad8ffd
fix saving space (now saves with only Id not space object)
toger5 Dec 16, 2021
a124133
fix toggling panel with setCard function
toger5 Dec 16, 2021
d709735
fix spaceId
toger5 Dec 16, 2021
6f20bf4
history based navigation with ne right panel store
toger5 Dec 16, 2021
60f8cac
fix history
toger5 Dec 16, 2021
cd42fa4
fix history of right panel when clicking on threads:
toger5 Dec 20, 2021
47ecf31
linter
toger5 Dec 20, 2021
e1068aa
review fixes (ryan and jano)
toger5 Dec 20, 2021
0e60e32
linter and code cleanup
toger5 Dec 20, 2021
5c82690
fix loading of settings for all rooms
toger5 Dec 20, 2021
697b8b3
fix back label
toger5 Dec 27, 2021
0d7bbbe
i18n
toger5 Dec 27, 2021
57ee4d4
fix member stored as object (now using just id's)
toger5 Jan 4, 2022
c46615f
fix: loading veridication request from store
toger5 Jan 4, 2022
071983d
fix continuing verification request on site reload
toger5 Jan 4, 2022
77d71e3
Merge branch 'toger5/RightPanelStore_refactor' into toger5/RightPanel…
toger5 Jan 4, 2022
15f11cd
remove toggle from setCard
toger5 Jan 4, 2022
ea0fca3
update and fix the verification flows.
toger5 Jan 4, 2022
3c7068c
remove unecassary `as` operators
toger5 Jan 4, 2022
ba0e359
review: showThread function signature
toger5 Jan 4, 2022
9880667
der linter der linter
toger5 Jan 4, 2022
dcfe2f6
linter
toger5 Jan 4, 2022
8bdca7a
Update src/components/structures/RoomView.tsx
toger5 Jan 5, 2022
1824701
Update src/components/structures/RoomView.tsx
toger5 Jan 5, 2022
6572947
Update src/components/views/right_panel/EncryptionPanel.tsx
toger5 Jan 5, 2022
6f267c3
Update src/components/views/toasts/VerificationRequestToast.tsx
toger5 Jan 5, 2022
1b2b0a7
Update src/verification.ts
toger5 Jan 5, 2022
a90b783
Merge branch 'develop' into toger5/RightPanelStore_refactor
toger5 Jan 5, 2022
cfdbfbb
forward roomId in all cases
toger5 Jan 5, 2022
54197eb
Merge branch 'toger5/RightPanelStore_refactor' into toger5/RightPanel…
toger5 Jan 5, 2022
32795b9
some more cleanup
toger5 Jan 5, 2022
056c0d0
prevent toggle hack for e2e test
toger5 Jan 5, 2022
89e0dc1
remove more code because toggle on setCard is disabled
toger5 Jan 5, 2022
7b8c88f
linter
toger5 Jan 5, 2022
53fa4cc
Merge branch 'toger5/RightPanelStore_refactor' into toger5/RightPanel…
toger5 Jan 5, 2022
6aebe0e
_t(Back to threads) -> _t(Threads)
toger5 Jan 5, 2022
6f092c4
fix bind memory leak
toger5 Jan 5, 2022
606fb07
Update src/stores/right-panel/RightPanelStore.ts
toger5 Jan 5, 2022
146a8ef
semicolons
toger5 Jan 5, 2022
8aabdbd
refactor store card conversions (no more `as` casts)
toger5 Jan 5, 2022
eb6b168
Merge branch 'toger5/RightPanelStore_refactor' into toger5/RightPanel…
toger5 Jan 5, 2022
7154e00
lines too long
toger5 Jan 5, 2022
56b9827
l
toger5 Jan 5, 2022
0f1d6a4
Merge branch 'develop' into toger5/RightPanelStore_useNewStore
toger5 Jan 5, 2022
33cfbef
hotfix hiding right panel
toger5 Jan 5, 2022
0e7c10f
linter
toger5 Jan 5, 2022
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
2 changes: 1 addition & 1 deletion src/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import SettingsStore from "../settings/SettingsStore";
import { ActiveRoomObserver } from "../ActiveRoomObserver";
import { Notifier } from "../Notifier";
import type { Renderer } from "react-dom";
import RightPanelStore from "../stores/RightPanelStore";
import RightPanelStore from "../stores/right-panel/RightPanelStore";
import WidgetStore from "../stores/WidgetStore";
import CallHandler from "../CallHandler";
import { Analytics } from "../Analytics";
Expand Down
10 changes: 3 additions & 7 deletions src/TextForEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import { isValid3pidInvite } from "./RoomInvite";
import SettingsStore from "./settings/SettingsStore";
import { ALL_RULE_TYPES, ROOM_RULE_TYPES, SERVER_RULE_TYPES, USER_RULE_TYPES } from "./mjolnir/BanList";
import { WIDGET_LAYOUT_EVENT_TYPE } from "./stores/widgets/WidgetLayoutStore";
import { RightPanelPhases } from './stores/RightPanelStorePhases';
import { RightPanelPhases } from './stores/right-panel/RightPanelStorePhases';
import { Action } from './dispatcher/actions';
import defaultDispatcher from './dispatcher/dispatcher';
import { SetRightPanelPhasePayload } from './dispatcher/payloads/SetRightPanelPhasePayload';
import { MatrixClientPeg } from "./MatrixClientPeg";
import { ROOM_SECURITY_TAB } from "./components/views/dialogs/RoomSettingsDialog";
import RightPanelStore from './stores/right-panel/RightPanelStore';

// These functions are frequently used just to check whether an event has
// any text to display at all. For this reason they return deferred values
Expand Down Expand Up @@ -503,11 +503,7 @@ const onPinnedOrUnpinnedMessageClick = (messageId: string, roomId: string): void
};

const onPinnedMessagesClick = (): void => {
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
action: Action.SetRightPanelPhase,
phase: RightPanelPhases.PinnedMessages,
allowClose: false,
});
RightPanelStore.instance.setCard({ phase: RightPanelPhases.PinnedMessages }, false);
};

function textForPinnedEvent(event: MatrixEvent, allowJSX: boolean): () => string | JSX.Element | null {
Expand Down
7 changes: 1 addition & 6 deletions src/components/structures/FilePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ import { logger } from "matrix-js-sdk/src/logger";
import { MatrixClientPeg } from '../../MatrixClientPeg';
import EventIndexPeg from "../../indexing/EventIndexPeg";
import { _t } from '../../languageHandler';
import BaseCard from "../views/right_panel/BaseCard";
import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
import DesktopBuildsNotice, { WarningKind } from "../views/elements/DesktopBuildsNotice";
import BaseCard from "../views/right_panel/BaseCard";
import { replaceableComponent } from "../../utils/replaceableComponent";
import ResizeNotifier from '../../utils/ResizeNotifier';
import TimelinePanel from "./TimelinePanel";
Expand Down Expand Up @@ -221,7 +220,6 @@ class FilePanel extends React.Component<IProps, IState> {
return <BaseCard
className="mx_FilePanel mx_RoomView_messageListWrapper"
onClose={this.props.onClose}
previousPhase={RightPanelPhases.RoomSummary}
>
<div className="mx_RoomView_empty">
{ _t("You must <a>register</a> to use this functionality",
Expand All @@ -234,7 +232,6 @@ class FilePanel extends React.Component<IProps, IState> {
return <BaseCard
className="mx_FilePanel mx_RoomView_messageListWrapper"
onClose={this.props.onClose}
previousPhase={RightPanelPhases.RoomSummary}
>
<div className="mx_RoomView_empty">{ _t("You must join the room to see its files") }</div>
</BaseCard>;
Expand All @@ -258,7 +255,6 @@ class FilePanel extends React.Component<IProps, IState> {
<BaseCard
className="mx_FilePanel"
onClose={this.props.onClose}
previousPhase={RightPanelPhases.RoomSummary}
withoutScrollContainer
>
<DesktopBuildsNotice isRoomEncrypted={isRoomEncrypted} kind={WarningKind.Files} />
Expand All @@ -285,7 +281,6 @@ class FilePanel extends React.Component<IProps, IState> {
<BaseCard
className="mx_FilePanel"
onClose={this.props.onClose}
previousPhase={RightPanelPhases.RoomSummary}
>
<Spinner />
</BaseCard>
Expand Down
21 changes: 8 additions & 13 deletions src/components/structures/GroupView.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ import GroupStore from '../../stores/GroupStore';
import FlairStore from '../../stores/FlairStore';
import { showGroupAddRoomDialog } from '../../GroupAddressPicker';
import { makeGroupPermalink, makeUserPermalink } from "../../utils/permalinks/Permalinks";
import RightPanelStore from "../../stores/RightPanelStore";
import RightPanelStore from "../../stores/right-panel/RightPanelStore";
import AutoHideScrollbar from "./AutoHideScrollbar";
import { mediaFromMxc } from "../../customisations/Media";
import { replaceableComponent } from "../../utils/replaceableComponent";
import { createSpaceFromCommunity } from "../../utils/space";
import { Action } from "../../dispatcher/actions";
import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
import { RightPanelPhases } from "../../stores/right-panel/RightPanelStorePhases";
import { UPDATE_EVENT } from "../../stores/AsyncStore";

const LONG_DESC_PLACEHOLDER = _td(
`<h1>HTML for your community's page</h1>
Expand Down Expand Up @@ -427,7 +428,7 @@ export default class GroupView extends React.Component {
membershipBusy: false,
publicityBusy: false,
inviterProfile: null,
showRightPanel: RightPanelStore.getSharedInstance().isOpenForGroup,
showRightPanel: RightPanelStore.instance.isOpenForGroup,
showUpgradeNotice: !localStorage.getItem(UPGRADE_NOTICE_LS_KEY),
};

Expand All @@ -439,18 +440,15 @@ export default class GroupView extends React.Component {
this._initGroupStore(this.props.groupId, true);

this._dispatcherRef = dis.register(this._onAction);
this._rightPanelStoreToken = RightPanelStore.getSharedInstance().addListener(this._onRightPanelStoreUpdate);
RightPanelStore.instance.on(UPDATE_EVENT, this._onRightPanelStoreUpdate);
}

componentWillUnmount() {
this._unmounted = true;
this._matrixClient.removeListener("Group.myMembership", this._onGroupMyMembership);
dis.unregister(this._dispatcherRef);

// Remove RightPanelStore listener
if (this._rightPanelStoreToken) {
this._rightPanelStoreToken.remove();
}
RightPanelStore.instance.off(UPDATE_EVENT, this._onRightPanelStoreUpdate);
}

// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
Expand All @@ -468,7 +466,7 @@ export default class GroupView extends React.Component {

_onRightPanelStoreUpdate = () => {
this.setState({
showRightPanel: RightPanelStore.getSharedInstance().isOpenForGroup,
showRightPanel: RightPanelStore.instance.isOpenForGroup,
});
};

Expand Down Expand Up @@ -824,10 +822,7 @@ export default class GroupView extends React.Component {
};

_onAdminsLinkClick = () => {
dis.dispatch({
action: Action.SetRightPanelPhase,
phase: RightPanelPhases.GroupMemberList,
});
RightPanelStore.instance.setCard({ phase: RightPanelPhases.GroupMemberList });
};

_getGroupSection() {
Expand Down
7 changes: 2 additions & 5 deletions src/components/structures/LoggedInView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import CallContainer from '../views/voip/CallContainer';
import { ViewRoomDeltaPayload } from "../../dispatcher/payloads/ViewRoomDeltaPayload";
import RoomListStore from "../../stores/room-list/RoomListStore";
import NonUrgentToastContainer from "./NonUrgentToastContainer";
import { ToggleRightPanelPayload } from "../../dispatcher/payloads/ToggleRightPanelPayload";
import { IOOBData, IThreepidInvite } from "../../stores/ThreepidInviteStore";
import Modal from "../../Modal";
import { ICollapseConfig } from "../../resizer/distributors/collapse";
Expand All @@ -68,6 +67,7 @@ import GroupFilterPanel from './GroupFilterPanel';
import CustomRoomTagPanel from './CustomRoomTagPanel';
import { mediaFromMxc } from "../../customisations/Media";
import LegacyCommunityPreview from "./LegacyCommunityPreview";
import RightPanelStore from '../../stores/right-panel/RightPanelStore';

// We need to fetch each pinned message individually (if we don't already have it)
// so each pinned message may trigger a request. Limit the number per room for sanity.
Expand Down Expand Up @@ -489,10 +489,7 @@ class LoggedInView extends React.Component<IProps, IState> {
break;
case NavigationAction.ToggleRoomSidePanel:
if (this.props.page_type === "room_view" || this.props.page_type === "group_view") {
dis.dispatch<ToggleRightPanelPayload>({
action: Action.ToggleRightPanel,
type: this.props.page_type === "room_view" ? "room" : "group",
});
RightPanelStore.instance.togglePanel();
handled = true;
}
break;
Expand Down
Loading