diff --git a/res/css/_components.pcss b/res/css/_components.pcss index 82f8cda556b..3e8e4cd80b7 100644 --- a/res/css/_components.pcss +++ b/res/css/_components.pcss @@ -288,7 +288,6 @@ @import "./views/rooms/_PinnedEventTile.pcss"; @import "./views/rooms/_PresenceLabel.pcss"; @import "./views/rooms/_ReadReceiptGroup.pcss"; -@import "./views/rooms/_RecentlyViewedButton.pcss"; @import "./views/rooms/_ReplyPreview.pcss"; @import "./views/rooms/_ReplyTile.pcss"; @import "./views/rooms/_RoomBreadcrumbs.pcss"; diff --git a/res/css/views/rooms/_RecentlyViewedButton.pcss b/res/css/views/rooms/_RecentlyViewedButton.pcss deleted file mode 100644 index f4e9206c67f..00000000000 --- a/res/css/views/rooms/_RecentlyViewedButton.pcss +++ /dev/null @@ -1,77 +0,0 @@ -/* -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_RecentlyViewedButton_ContextMenu { - padding: 16px 8px 16px 16px; - width: max-content; - max-width: 240px; - max-height: 400px; - border: 1px solid rgba($primary-content, 0.1); - border-radius: 8px; - box-shadow: 0 8px 4px rgba(0, 0, 0, 0.08); - display: flex; - flex-direction: column; - - > h4 { - margin: 0 0 12px 0; - } - - > div { - overflow-y: auto; - - * { - margin-right: 4px; - } - } - - .mx_AccessibleButton { - margin-top: 2px; - padding: 4px; - display: flex; - align-items: center; - border-radius: 8px; - min-height: 34px; - - &:hover { - background-color: $panel-actions; - } - - .mx_DecoratedRoomAvatar { - margin-right: 8px; - width: 24px; - - .mx_BaseAvatar { - width: inherit; - } - } - - .mx_RecentlyViewedButton_entry_label { - display: grid; - - > div { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } - } - - .mx_RecentlyViewedButton_entry_spaces { - font-size: $font-12px; - line-height: $font-15px; - color: $secondary-content; - } - } -} diff --git a/src/components/structures/LeftPanel.tsx b/src/components/structures/LeftPanel.tsx index 81209a3b09a..985850cbc51 100644 --- a/src/components/structures/LeftPanel.tsx +++ b/src/components/structures/LeftPanel.tsx @@ -33,13 +33,11 @@ import { getKeyBindingsManager } from "../../KeyBindingsManager"; import UIStore from "../../stores/UIStore"; import { IState as IRovingTabIndexState } from "../../accessibility/RovingTabIndex"; import RoomListHeader from "../views/rooms/RoomListHeader"; -import RecentlyViewedButton from "../views/rooms/RecentlyViewedButton"; import { BreadcrumbsStore } from "../../stores/BreadcrumbsStore"; import RoomListStore, { LISTS_UPDATE_EVENT } from "../../stores/room-list/RoomListStore"; import { UPDATE_EVENT } from "../../stores/AsyncStore"; import IndicatorScrollbar from "./IndicatorScrollbar"; import RoomBreadcrumbs from "../views/rooms/RoomBreadcrumbs"; -import SettingsStore from "../../settings/SettingsStore"; import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts"; import { shouldShowComponent } from "../../customisations/helpers/UIComponents"; import { UIComponent } from "../../settings/UIFeature"; @@ -57,7 +55,6 @@ interface IProps { enum BreadcrumbsMode { Disabled, Legacy, - Labs, } interface IState { @@ -85,8 +82,7 @@ export default class LeftPanel extends React.Component { } private static get breadcrumbsMode(): BreadcrumbsMode { - if (!BreadcrumbsStore.instance.visible) return BreadcrumbsMode.Disabled; - return SettingsStore.getValue("feature_breadcrumbs_v2") ? BreadcrumbsMode.Labs : BreadcrumbsMode.Legacy; + return !BreadcrumbsStore.instance.visible ? BreadcrumbsMode.Disabled : BreadcrumbsMode.Legacy; } public componentDidMount(): void { @@ -344,9 +340,7 @@ export default class LeftPanel extends React.Component { } let rightButton: JSX.Element | undefined; - if (this.state.showBreadcrumbs === BreadcrumbsMode.Labs) { - rightButton = ; - } else if (this.state.activeSpace === MetaSpace.Home && shouldShowComponent(UIComponent.ExploreRooms)) { + if (this.state.activeSpace === MetaSpace.Home && shouldShowComponent(UIComponent.ExploreRooms)) { rightButton = ( { - const tooltipRef = useRef(null); - const crumbs = useEventEmitterState(BreadcrumbsStore.instance, UPDATE_EVENT, () => BreadcrumbsStore.instance.rooms); - - const content = ( -
-

{_t("Recently viewed")}

-
- {crumbs.map((crumb) => { - return ( - { - dis.dispatch({ - action: Action.ViewRoom, - room_id: crumb.roomId, - metricsTrigger: "WebVerticalBreadcrumbs", - metricsViaKeyboard: ev.type !== "click", - }); - tooltipRef.current?.hideTooltip(); - }} - > - {crumb.isSpaceRoom() ? ( - - ) : ( - - )} - -
{crumb.name}
- -
-
- ); - })} -
-
- ); - - return ( - - {({ ref, onMouseOver }) => ( - - )} - - ); -}; - -export default RecentlyViewedButton; diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx index cc485dca45c..2def23fb782 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx @@ -141,7 +141,7 @@ export default class PreferencesUserSettingsTab extends React.Component("FTUE.useCaseSelection"); const roomListSettings = PreferencesUserSettingsTab.ROOM_LIST_SETTINGS // Only show the breadcrumbs setting if breadcrumbs v2 is disabled - .filter((it) => it !== "breadcrumbs" || !SettingsStore.getValue("feature_breadcrumbs_v2")) + .filter((it) => it !== "breadcrumbs") // Only show the user onboarding setting if the user should see the user onboarding page .filter((it) => it !== "FTUE.userOnboardingButton" || showUserOnboardingPage(useCase)); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 8991a6d4e9f..2367518b0d8 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -970,7 +970,6 @@ "Show current avatar and name for users in message history": "Show current avatar and name for users in message history", "Show HTML representation of room topics": "Show HTML representation of room topics", "Show info about bridges in room settings": "Show info about bridges in room settings", - "Use new room breadcrumbs": "Use new room breadcrumbs", "Right panel stays open": "Right panel stays open", "Defaults to room member list.": "Defaults to room member list.", "Jump to date (adds /jumptodate and jump to date headers)": "Jump to date (adds /jumptodate and jump to date headers)", @@ -1984,7 +1983,6 @@ "Seen by %(count)s people|other": "Seen by %(count)s people", "Seen by %(count)s people|one": "Seen by %(count)s person", "Read receipts": "Read receipts", - "Recently viewed": "Recently viewed", "Replying": "Replying", "Room %(name)s": "Room %(name)s", "Recently visited rooms": "Recently visited rooms", @@ -3112,6 +3110,7 @@ "To search messages, look for this icon at the top of a room ": "To search messages, look for this icon at the top of a room ", "Recent searches": "Recent searches", "Clear": "Clear", + "Recently viewed": "Recently viewed", "Use to scroll": "Use to scroll", "Search Dialog": "Search Dialog", "Remove search filter for %(filter)s": "Remove search filter for %(filter)s", diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 5ff31b602fa..52bcac185ad 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -331,13 +331,6 @@ export const SETTINGS: { [setting: string]: ISetting } = { displayName: _td("Show info about bridges in room settings"), default: false, }, - "feature_breadcrumbs_v2": { - isFeature: true, - labsGroup: LabGroup.Rooms, - supportedLevels: LEVELS_FEATURE, - displayName: _td("Use new room breadcrumbs"), - default: false, - }, "feature_right_panel_default_open": { isFeature: true, labsGroup: LabGroup.Rooms, @@ -856,7 +849,6 @@ export const SETTINGS: { [setting: string]: ISetting } = { supportedLevels: LEVELS_ACCOUNT_SETTINGS, displayName: _td("Show shortcuts to recently viewed rooms above the room list"), default: true, - controller: new IncompatibleController("feature_breadcrumbs_v2", true), }, "FTUE.userOnboardingButton": { supportedLevels: LEVELS_ACCOUNT_SETTINGS, diff --git a/src/stores/BreadcrumbsStore.ts b/src/stores/BreadcrumbsStore.ts index a3fb1a90ac5..89211f068c4 100644 --- a/src/stores/BreadcrumbsStore.ts +++ b/src/stores/BreadcrumbsStore.ts @@ -50,7 +50,6 @@ export class BreadcrumbsStore extends AsyncStoreWithClient { SettingsStore.monitorSetting("breadcrumb_rooms", null); SettingsStore.monitorSetting("breadcrumbs", null); - SettingsStore.monitorSetting("feature_breadcrumbs_v2", null); } public static get instance(): BreadcrumbsStore { @@ -69,11 +68,9 @@ export class BreadcrumbsStore extends AsyncStoreWithClient { * Do we have enough rooms to justify showing the breadcrumbs? * (Or is the labs feature enabled?) * - * @returns true if there are at least 20 visible rooms or - * feature_breadcrumbs_v2 is enabled. + * @returns true if there are at least 20 visible rooms. */ public get meetsRoomRequirement(): boolean { - if (SettingsStore.getValue("feature_breadcrumbs_v2")) return true; const msc3946ProcessDynamicPredecessor = SettingsStore.getValue("feature_dynamic_room_predecessors"); return !!this.matrixClient && this.matrixClient.getVisibleRooms(msc3946ProcessDynamicPredecessor).length >= 20; } @@ -83,7 +80,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient { if (payload.action === Action.SettingUpdated) { if (payload.settingName === "breadcrumb_rooms") { await this.updateRooms(); - } else if (payload.settingName === "breadcrumbs" || payload.settingName === "feature_breadcrumbs_v2") { + } else if (payload.settingName === "breadcrumbs") { await this.updateState({ enabled: SettingsStore.getValue("breadcrumbs", null) }); } } else if (payload.action === Action.ViewRoom) { diff --git a/test/components/views/settings/tabs/user/__snapshots__/PreferencesUserSettingsTab-test.tsx.snap b/test/components/views/settings/tabs/user/__snapshots__/PreferencesUserSettingsTab-test.tsx.snap index 2426d97f3a7..d8eb88066d5 100644 --- a/test/components/views/settings/tabs/user/__snapshots__/PreferencesUserSettingsTab-test.tsx.snap +++ b/test/components/views/settings/tabs/user/__snapshots__/PreferencesUserSettingsTab-test.tsx.snap @@ -20,48 +20,6 @@ exports[`PreferencesUserSettingsTab should render 1`] = `
-
-
-

- Room list -

-
-
-
- -
-
-
-
-
-
diff --git a/test/stores/BreadcrumbsStore-test.ts b/test/stores/BreadcrumbsStore-test.ts index 1a213918a43..cb0f4022118 100644 --- a/test/stores/BreadcrumbsStore-test.ts +++ b/test/stores/BreadcrumbsStore-test.ts @@ -32,65 +32,41 @@ describe("BreadcrumbsStore", () => { store = BreadcrumbsStore.instance; setupAsyncStoreWithClient(store, client); jest.spyOn(SettingsStore, "setValue").mockImplementation(() => Promise.resolve()); + jest.spyOn(SettingsStore, "getValue").mockReturnValue(false); }); - describe("If the feature_breadcrumbs_v2 feature is not enabled", () => { - beforeEach(() => { - jest.spyOn(SettingsStore, "getValue").mockReturnValue(false); - }); - - it("does not meet room requirements if there are not enough rooms", () => { - // We don't have enough rooms, so we don't meet requirements - mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(2)); - expect(store.meetsRoomRequirement).toBe(false); - }); - - it("meets room requirements if there are enough rooms", () => { - // We do have enough rooms to show breadcrumbs - mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(25)); - expect(store.meetsRoomRequirement).toBe(true); - }); - - describe("And the feature_dynamic_room_predecessors is enabled", () => { - beforeEach(() => { - // Turn on feature_dynamic_room_predecessors setting - jest.spyOn(SettingsStore, "getValue").mockImplementation( - (settingName) => settingName === "feature_dynamic_room_predecessors", - ); - }); - - it("passes through the dynamic room precessors flag", () => { - mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(25)); - store.meetsRoomRequirement; - expect(client.getVisibleRooms).toHaveBeenCalledWith(true); - }); - }); + it("does not meet room requirements if there are not enough rooms", () => { + // We don't have enough rooms, so we don't meet requirements + mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(2)); + expect(store.meetsRoomRequirement).toBe(false); + }); - describe("And the feature_dynamic_room_predecessors is not enabled", () => { - it("passes through the dynamic room precessors flag", () => { - mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(25)); - store.meetsRoomRequirement; - expect(client.getVisibleRooms).toHaveBeenCalledWith(false); - }); - }); + it("meets room requirements if there are enough rooms", () => { + // We do have enough rooms to show breadcrumbs + mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(25)); + expect(store.meetsRoomRequirement).toBe(true); }); - describe("If the feature_breadcrumbs_v2 feature is enabled", () => { + describe("And the feature_dynamic_room_predecessors is enabled", () => { beforeEach(() => { - // Turn on feature_breadcrumbs_v2 setting + // Turn on feature_dynamic_room_predecessors setting jest.spyOn(SettingsStore, "getValue").mockImplementation( - (settingName) => settingName === "feature_breadcrumbs_v2", + (settingName) => settingName === "feature_dynamic_room_predecessors", ); }); - it("always meets room requirements", () => { - // With enough rooms, we meet requirements + it("passes through the dynamic room precessors flag", () => { mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(25)); - expect(store.meetsRoomRequirement).toBe(true); + store.meetsRoomRequirement; + expect(client.getVisibleRooms).toHaveBeenCalledWith(true); + }); + }); - // And even with not enough we do, because the feature is enabled. - mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(2)); - expect(store.meetsRoomRequirement).toBe(true); + describe("And the feature_dynamic_room_predecessors is not enabled", () => { + it("passes through the dynamic room precessors flag", () => { + mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(25)); + store.meetsRoomRequirement; + expect(client.getVisibleRooms).toHaveBeenCalledWith(false); }); });