Room list: move sections out of labs to all the users (#33810)
* feat: remove section labs flag * test: update tests * feat: remove favourites and low prioriy filter in SC * test: update screenshots * test: update snapshots * test: update playwright tests * test: update playright screenshots * test: update screenshot * test: close release announcement * test: fix skeleton screenshot * test: fix sliding sync * test: update room list tests * test: update room list tests after section dnd * test: update toast screenshot * test: update again room list tests * test: update screenshot
This commit is contained in:
@@ -135,10 +135,7 @@
|
||||
"no_chats": "No chats yet",
|
||||
"no_chats_description": "Get started by messaging someone or by creating a room",
|
||||
"no_chats_description_no_room_rights": "Get started by messaging someone",
|
||||
"no_favourites": "You don't have favourite chats yet",
|
||||
"no_favourites_description": "You can add a chat to your favourites in the chat settings",
|
||||
"no_invites": "You don't have any unread invites",
|
||||
"no_lowpriority": "You don't have any low priority rooms",
|
||||
"no_mentions": "You don't have any unread mentions",
|
||||
"no_people": "You don’t have direct chats with anyone yet",
|
||||
"no_people_description": "You can deselect filters in order to see your other chats",
|
||||
@@ -151,9 +148,7 @@
|
||||
"expand_all_sections": "Expand all sections",
|
||||
"expand_filters": "Expand filter list",
|
||||
"filters": {
|
||||
"favourite": "Favourites",
|
||||
"invites": "Invites",
|
||||
"low_priority": "Low priority",
|
||||
"mentions": "Mentions",
|
||||
"people": "People",
|
||||
"rooms": "Rooms",
|
||||
|
||||
-12
@@ -91,12 +91,6 @@ export const NoSpaceMenu: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const NoComposeMenu: Story = {
|
||||
args: {
|
||||
displayComposeMenu: false,
|
||||
},
|
||||
};
|
||||
|
||||
export const LongTitle: Story = {
|
||||
decorators: [
|
||||
(Story) => (
|
||||
@@ -110,12 +104,6 @@ export const LongTitle: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const PlusIcon: Story = {
|
||||
args: {
|
||||
useComposeIcon: false,
|
||||
},
|
||||
};
|
||||
|
||||
export const CollapseSections: Story = {
|
||||
args: {
|
||||
collapseSections: "collapse",
|
||||
|
||||
+1
-6
@@ -12,7 +12,7 @@ import React from "react";
|
||||
|
||||
import * as stories from "./RoomListHeaderView.stories";
|
||||
|
||||
const { Default, NoComposeMenu, NoSpaceMenu, CollapseSections, ExpandSections } = composeStories(stories);
|
||||
const { Default, NoSpaceMenu, CollapseSections, ExpandSections } = composeStories(stories);
|
||||
|
||||
describe("RoomListHeaderView", () => {
|
||||
it("renders the default state", () => {
|
||||
@@ -20,11 +20,6 @@ describe("RoomListHeaderView", () => {
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders without compose menu", () => {
|
||||
const { container } = render(<NoComposeMenu />);
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders without space menu", () => {
|
||||
const { container } = render(<NoSpaceMenu />);
|
||||
expect(container).toMatchSnapshot();
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
import React, { type JSX } from "react";
|
||||
import { IconButton, H1 } from "@vector-im/compound-web";
|
||||
import ComposeIcon from "@vector-im/compound-design-tokens/assets/web/icons/compose";
|
||||
import PlusIcon from "@vector-im/compound-design-tokens/assets/web/icons/plus";
|
||||
import { CollapseAllIcon, ExpandAllIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||
|
||||
import { type ViewModel, useViewModel } from "../../core/viewmodel";
|
||||
@@ -32,11 +30,6 @@ export interface RoomListHeaderViewSnapshot {
|
||||
* The title of the room list
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* Whether to display the compose menu
|
||||
* True if the user can create rooms
|
||||
*/
|
||||
displayComposeMenu: boolean;
|
||||
/**
|
||||
* Whether to display the space menu
|
||||
* True if there is an active space
|
||||
@@ -66,14 +59,6 @@ export interface RoomListHeaderViewSnapshot {
|
||||
* Whether message previews are enabled in the room list.
|
||||
*/
|
||||
isMessagePreviewEnabled: boolean;
|
||||
/**
|
||||
* Whether the user can create sections in the room list.
|
||||
*/
|
||||
canCreateSection: boolean;
|
||||
/**
|
||||
* Whether to use the compose icon instead of the create icon.
|
||||
*/
|
||||
useComposeIcon: boolean;
|
||||
/**
|
||||
* If "collapse", an icon to collapse all sections is shown.
|
||||
* If "expand", an icon to expand all sections is shown.
|
||||
@@ -160,7 +145,7 @@ interface RoomListHeaderViewProps {
|
||||
*/
|
||||
export function RoomListHeaderView({ vm }: Readonly<RoomListHeaderViewProps>): JSX.Element {
|
||||
const { translate: _t } = useI18n();
|
||||
const { title, displaySpaceMenu, displayComposeMenu, useComposeIcon, collapseSections } = useViewModel(vm);
|
||||
const { title, displaySpaceMenu, collapseSections } = useViewModel(vm);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
@@ -197,24 +182,7 @@ export function RoomListHeaderView({ vm }: Readonly<RoomListHeaderViewProps>): J
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
{/* If we don't display the compose menu, it means that the user can only send DM */}
|
||||
{displayComposeMenu ? (
|
||||
<ComposeMenuView vm={vm} />
|
||||
) : (
|
||||
<IconButton
|
||||
size="28px"
|
||||
style={{ padding: "4px" }}
|
||||
onClick={(e) => vm.createChatRoom(e.nativeEvent)}
|
||||
tooltip={_t("action|new_conversation")}
|
||||
>
|
||||
{useComposeIcon ? (
|
||||
<ComposeIcon color="var(--cpd-color-icon-secondary)" aria-hidden />
|
||||
) : (
|
||||
<PlusIcon color="var(--cpd-color-icon-secondary)" aria-hidden />
|
||||
)}
|
||||
</IconButton>
|
||||
)}
|
||||
<ComposeMenuView vm={vm} />
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
|
||||
+4
-152
@@ -145,12 +145,7 @@ exports[`RoomListHeaderView > renders collapse button 1`] = `
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
clip-rule="evenodd"
|
||||
d="M16.937 2.82a2 2 0 0 1 2.828 0l1.415 1.414a2 2 0 0 1 0 2.829l-7.071 7.07c-.195.196-.42.342-.66.44a1 1 0 0 1-.168.072l-3.993 1.331a1 1 0 0 1-1.265-1.265l1.331-3.992q.03-.09.073-.168m10.338-4.903-6.717 6.718-1.414-1.414 6.717-6.718z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
<path
|
||||
d="M3 5a2 2 0 0 1 2-2h6a1 1 0 1 1 0 2H5v14h14v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
|
||||
d="M11 13H6a.97.97 0 0 1-.713-.287A.97.97 0 0 1 5 12q0-.424.287-.713A.97.97 0 0 1 6 11h5V6q0-.424.287-.713A.97.97 0 0 1 12 5q.424 0 .713.287Q13 5.576 13 6v5h5q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 18 13h-5v5q0 .424-.287.712A.97.97 0 0 1 12 19a.97.97 0 0 1-.713-.288A.97.97 0 0 1 11 18z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
@@ -306,12 +301,7 @@ exports[`RoomListHeaderView > renders expand button 1`] = `
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
clip-rule="evenodd"
|
||||
d="M16.937 2.82a2 2 0 0 1 2.828 0l1.415 1.414a2 2 0 0 1 0 2.829l-7.071 7.07c-.195.196-.42.342-.66.44a1 1 0 0 1-.168.072l-3.993 1.331a1 1 0 0 1-1.265-1.265l1.331-3.992q.03-.09.073-.168m10.338-4.903-6.717 6.718-1.414-1.414 6.717-6.718z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
<path
|
||||
d="M3 5a2 2 0 0 1 2-2h6a1 1 0 1 1 0 2H5v14h14v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
|
||||
d="M11 13H6a.97.97 0 0 1-.713-.287A.97.97 0 0 1 5 12q0-.424.287-.713A.97.97 0 0 1 6 11h5V6q0-.424.287-.713A.97.97 0 0 1 12 5q.424 0 .713.287Q13 5.576 13 6v5h5q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 18 13h-5v5q0 .424-.287.712A.97.97 0 0 1 12 19a.97.97 0 0 1-.713-.288A.97.97 0 0 1 11 18z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
@@ -440,140 +430,7 @@ exports[`RoomListHeaderView > renders the default state 1`] = `
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
clip-rule="evenodd"
|
||||
d="M16.937 2.82a2 2 0 0 1 2.828 0l1.415 1.414a2 2 0 0 1 0 2.829l-7.071 7.07c-.195.196-.42.342-.66.44a1 1 0 0 1-.168.072l-3.993 1.331a1 1 0 0 1-1.265-1.265l1.331-3.992q.03-.09.073-.168m10.338-4.903-6.717 6.718-1.414-1.414 6.717-6.718z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
<path
|
||||
d="M3 5a2 2 0 0 1 2-2h6a1 1 0 1 1 0 2H5v14h14v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`RoomListHeaderView > renders without compose menu 1`] = `
|
||||
<div>
|
||||
<header
|
||||
aria-label="Room options"
|
||||
class="Flex-module_flex RoomListHeaderView-module_header"
|
||||
data-testid="room-list-header"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: end; --mx-flex-justify: start; --mx-flex-gap: 0; --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<div
|
||||
class="Flex-module_flex RoomListHeaderView-module_container"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: space-between; --mx-flex-gap: var(--cpd-space-3x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<div
|
||||
class="Flex-module_flex RoomListHeaderView-module_title"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<h1
|
||||
class="_typography_6v6n8_153 _font-heading-sm-semibold_6v6n8_93"
|
||||
title="Rooms"
|
||||
>
|
||||
Rooms
|
||||
</h1>
|
||||
<button
|
||||
aria-disabled="false"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="menu"
|
||||
aria-label="Open space menu"
|
||||
class="_icon-button_1215g_8 SpaceMenuView-module_button"
|
||||
data-kind="primary"
|
||||
data-state="closed"
|
||||
id="radix-react-use-id-1"
|
||||
role="button"
|
||||
style="--cpd-icon-button-size: 24px; padding: 2px;"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="_indicator-icon_147l5_17"
|
||||
style="--cpd-icon-button-size: 100%;"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M12 14.95q-.2 0-.375-.062a.9.9 0 0 1-.325-.213l-4.6-4.6a.95.95 0 0 1-.275-.7q0-.425.275-.7a.95.95 0 0 1 .7-.275q.425 0 .7.275l3.9 3.9 3.9-3.9a.95.95 0 0 1 .7-.275q.425 0 .7.275a.95.95 0 0 1 .275.7.95.95 0 0 1-.275.7l-4.6 4.6q-.15.15-.325.212a1.1 1.1 0 0 1-.375.063"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="Flex-module_flex"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-2x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<button
|
||||
aria-disabled="false"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="menu"
|
||||
aria-label="Room Options"
|
||||
aria-labelledby="react-use-id-2"
|
||||
class="_icon-button_1215g_8"
|
||||
data-kind="primary"
|
||||
data-state="closed"
|
||||
id="radix-react-use-id-3"
|
||||
role="button"
|
||||
style="--cpd-icon-button-size: 28px; padding: 4px;"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="_indicator-icon_147l5_17"
|
||||
style="--cpd-icon-button-size: 100%;"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M6 14q-.824 0-1.412-.588A1.93 1.93 0 0 1 4 12q0-.825.588-1.412A1.93 1.93 0 0 1 6 10q.824 0 1.412.588Q8 11.175 8 12t-.588 1.412A1.93 1.93 0 0 1 6 14m6 0q-.825 0-1.412-.588A1.93 1.93 0 0 1 10 12q0-.825.588-1.412A1.93 1.93 0 0 1 12 10q.825 0 1.412.588Q14 11.175 14 12t-.588 1.412A1.93 1.93 0 0 1 12 14m6 0q-.824 0-1.413-.588A1.93 1.93 0 0 1 16 12q0-.825.587-1.412A1.93 1.93 0 0 1 18 10q.824 0 1.413.588Q20 11.175 20 12t-.587 1.412A1.93 1.93 0 0 1 18 14"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
aria-labelledby="react-use-id-4"
|
||||
class="_icon-button_1215g_8"
|
||||
data-kind="primary"
|
||||
role="button"
|
||||
style="--cpd-icon-button-size: 28px; padding: 4px;"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="_indicator-icon_147l5_17"
|
||||
style="--cpd-icon-button-size: 100%;"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
color="var(--cpd-color-icon-secondary)"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
clip-rule="evenodd"
|
||||
d="M16.937 2.82a2 2 0 0 1 2.828 0l1.415 1.414a2 2 0 0 1 0 2.829l-7.071 7.07c-.195.196-.42.342-.66.44a1 1 0 0 1-.168.072l-3.993 1.331a1 1 0 0 1-1.265-1.265l1.331-3.992q.03-.09.073-.168m10.338-4.903-6.717 6.718-1.414-1.414 6.717-6.718z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
<path
|
||||
d="M3 5a2 2 0 0 1 2-2h6a1 1 0 1 1 0 2H5v14h14v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
|
||||
d="M11 13H6a.97.97 0 0 1-.713-.287A.97.97 0 0 1 5 12q0-.424.287-.713A.97.97 0 0 1 6 11h5V6q0-.424.287-.713A.97.97 0 0 1 12 5q.424 0 .713.287Q13 5.576 13 6v5h5q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 18 13h-5v5q0 .424-.287.712A.97.97 0 0 1 12 19a.97.97 0 0 1-.713-.288A.97.97 0 0 1 11 18z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
@@ -671,12 +528,7 @@ exports[`RoomListHeaderView > renders without space menu 1`] = `
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
clip-rule="evenodd"
|
||||
d="M16.937 2.82a2 2 0 0 1 2.828 0l1.415 1.414a2 2 0 0 1 0 2.829l-7.071 7.07c-.195.196-.42.342-.66.44a1 1 0 0 1-.168.072l-3.993 1.331a1 1 0 0 1-1.265-1.265l1.331-3.992q.03-.09.073-.168m10.338-4.903-6.717 6.718-1.414-1.414 6.717-6.718z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
<path
|
||||
d="M3 5a2 2 0 0 1 2-2h6a1 1 0 1 1 0 2H5v14h14v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
|
||||
d="M11 13H6a.97.97 0 0 1-.713-.287A.97.97 0 0 1 5 12q0-.424.287-.713A.97.97 0 0 1 6 11h5V6q0-.424.287-.713A.97.97 0 0 1 12 5q.424 0 .713.287Q13 5.576 13 6v5h5q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 18 13h-5v5q0 .424-.287.712A.97.97 0 0 1 12 19a.97.97 0 0 1-.713-.288A.97.97 0 0 1 11 18z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,6 @@ import { type RoomListHeaderViewSnapshot } from "./RoomListHeaderView";
|
||||
|
||||
export const defaultSnapshot: RoomListHeaderViewSnapshot = {
|
||||
title: "Rooms",
|
||||
displayComposeMenu: true,
|
||||
displaySpaceMenu: true,
|
||||
canCreateRoom: true,
|
||||
canCreateVideoRoom: true,
|
||||
@@ -17,7 +16,5 @@ export const defaultSnapshot: RoomListHeaderViewSnapshot = {
|
||||
canAccessSpaceSettings: true,
|
||||
activeSortOption: "recent",
|
||||
isMessagePreviewEnabled: true,
|
||||
useComposeIcon: true,
|
||||
canCreateSection: true,
|
||||
displaySectionReleaseAnnouncement: false,
|
||||
};
|
||||
|
||||
+3
-11
@@ -7,7 +7,6 @@
|
||||
|
||||
import React, { useState, type JSX } from "react";
|
||||
import { IconButton, Menu, MenuItem, ReleaseAnnouncement } from "@vector-im/compound-web";
|
||||
import ComposeIcon from "@vector-im/compound-design-tokens/assets/web/icons/compose";
|
||||
import VideoCallIcon from "@vector-im/compound-design-tokens/assets/web/icons/video-call";
|
||||
import ChatIcon from "@vector-im/compound-design-tokens/assets/web/icons/chat";
|
||||
import RoomIcon from "@vector-im/compound-design-tokens/assets/web/icons/room";
|
||||
@@ -37,17 +36,12 @@ interface ComposeMenuViewProps {
|
||||
export function ComposeMenuView({ vm }: ComposeMenuViewProps): JSX.Element {
|
||||
const { translate: _t } = useI18n();
|
||||
const [open, setOpen] = useState(false);
|
||||
const { canCreateRoom, canCreateVideoRoom, canCreateSection, useComposeIcon, displaySectionReleaseAnnouncement } =
|
||||
useViewModel(vm);
|
||||
const { canCreateRoom, canCreateVideoRoom, displaySectionReleaseAnnouncement } = useViewModel(vm);
|
||||
|
||||
// 28px button with a 20px icon
|
||||
const button = (
|
||||
<IconButton size="28px" style={{ padding: "4px" }} tooltip={_t("action|new_conversation")}>
|
||||
{useComposeIcon ? (
|
||||
<ComposeIcon color="var(--cpd-color-icon-secondary)" aria-hidden />
|
||||
) : (
|
||||
<PlusIcon color="var(--cpd-color-icon-secondary)" aria-hidden />
|
||||
)}
|
||||
<PlusIcon color="var(--cpd-color-icon-secondary)" aria-hidden />
|
||||
</IconButton>
|
||||
);
|
||||
|
||||
@@ -86,9 +80,7 @@ export function ComposeMenuView({ vm }: ComposeMenuViewProps): JSX.Element {
|
||||
hideChevron
|
||||
/>
|
||||
)}
|
||||
{canCreateSection && (
|
||||
<MenuItem Icon={SectionIcon} label={_t("action|new_section")} onSelect={vm.createSection} hideChevron />
|
||||
)}
|
||||
<MenuItem Icon={SectionIcon} label={_t("action|new_section")} onSelect={vm.createSection} hideChevron />
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
+1
-6
@@ -30,12 +30,7 @@ exports[`<ComposeMenuView /> > should match snapshot 1`] = `
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
clip-rule="evenodd"
|
||||
d="M16.937 2.82a2 2 0 0 1 2.828 0l1.415 1.414a2 2 0 0 1 0 2.829l-7.071 7.07c-.195.196-.42.342-.66.44a1 1 0 0 1-.168.072l-3.993 1.331a1 1 0 0 1-1.265-1.265l1.331-3.992q.03-.09.073-.168m10.338-4.903-6.717 6.718-1.414-1.414 6.717-6.718z"
|
||||
fill-rule="evenodd"
|
||||
/>
|
||||
<path
|
||||
d="M3 5a2 2 0 0 1 2-2h6a1 1 0 1 1 0 2H5v14h14v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
|
||||
d="M11 13H6a.97.97 0 0 1-.713-.287A.97.97 0 0 1 5 12q0-.424.287-.713A.97.97 0 0 1 6 11h5V6q0-.424.287-.713A.97.97 0 0 1 12 5q.424 0 .713.287Q13 5.576 13 6v5h5q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 18 13h-5v5q0 .424-.287.712A.97.97 0 0 1 12 19a.97.97 0 0 1-.713-.288A.97.97 0 0 1 11 18z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
// All available filter IDs
|
||||
const allFilterIds: FilterId[] = ["unread", "people", "rooms", "favourite", "mentions", "invites", "low_priority"];
|
||||
const allFilterIds: FilterId[] = ["unread", "people", "rooms", "mentions", "invites"];
|
||||
|
||||
// Subset of filters for narrow container tests
|
||||
const fewFilterIds: FilterId[] = ["people", "rooms", "unread"];
|
||||
|
||||
-4
@@ -26,14 +26,10 @@ const filterIdToLabel = (filterId: FilterId): string => {
|
||||
return _t("room_list|filters|people");
|
||||
case "rooms":
|
||||
return _t("room_list|filters|rooms");
|
||||
case "favourite":
|
||||
return _t("room_list|filters|favourite");
|
||||
case "mentions":
|
||||
return _t("room_list|filters|mentions");
|
||||
case "invites":
|
||||
return _t("room_list|filters|invites");
|
||||
case "low_priority":
|
||||
return _t("room_list|filters|low_priority");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
-90
@@ -7,33 +7,6 @@ exports[`<RoomListPrimaryFilters /> stories > snapshots > renders Default story
|
||||
data-testid="primary-filters"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row-reverse; --mx-flex-align: start; --mx-flex-justify: space-between; --mx-flex-gap: var(--cpd-space-3x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<button
|
||||
aria-controls="react-use-id-1"
|
||||
aria-expanded="false"
|
||||
aria-label="Expand filter list"
|
||||
class="_icon-button_1215g_8 RoomListPrimaryFilters-module_iconButton"
|
||||
data-kind="secondary"
|
||||
role="button"
|
||||
style="--cpd-icon-button-size: 28px;"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="_indicator-icon_147l5_17"
|
||||
style="--cpd-icon-button-size: 100%;"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M12 14.95q-.2 0-.375-.062a.9.9 0 0 1-.325-.213l-4.6-4.6a.95.95 0 0 1-.275-.7q0-.425.275-.7a.95.95 0 0 1 .7-.275q.425 0 .7.275l3.9 3.9 3.9-3.9a.95.95 0 0 1 .7-.275q.425 0 .7.275a.95.95 0 0 1 .275.7.95.95 0 0 1-.275.7l-4.6 4.6q-.15.15-.325.212a1.1 1.1 0 0 1-.375.063"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
<div
|
||||
aria-label="Room list filters"
|
||||
class="Flex-module_flex RoomListPrimaryFilters-module_list"
|
||||
@@ -68,15 +41,6 @@ exports[`<RoomListPrimaryFilters /> stories > snapshots > renders Default story
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
@@ -95,15 +59,6 @@ exports[`<RoomListPrimaryFilters /> stories > snapshots > renders Default story
|
||||
>
|
||||
Invites
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="true"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8 wrapping"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Low priority
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -285,33 +240,6 @@ exports[`<RoomListPrimaryFilters /> stories > snapshots > renders PeopleSelected
|
||||
data-testid="primary-filters"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row-reverse; --mx-flex-align: start; --mx-flex-justify: space-between; --mx-flex-gap: var(--cpd-space-3x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<button
|
||||
aria-controls="react-use-id-1"
|
||||
aria-expanded="false"
|
||||
aria-label="Expand filter list"
|
||||
class="_icon-button_1215g_8 RoomListPrimaryFilters-module_iconButton"
|
||||
data-kind="secondary"
|
||||
role="button"
|
||||
style="--cpd-icon-button-size: 28px;"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="_indicator-icon_147l5_17"
|
||||
style="--cpd-icon-button-size: 100%;"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M12 14.95q-.2 0-.375-.062a.9.9 0 0 1-.325-.213l-4.6-4.6a.95.95 0 0 1-.275-.7q0-.425.275-.7a.95.95 0 0 1 .7-.275q.425 0 .7.275l3.9 3.9 3.9-3.9a.95.95 0 0 1 .7-.275q.425 0 .7.275a.95.95 0 0 1 .275.7.95.95 0 0 1-.275.7l-4.6 4.6q-.15.15-.325.212a1.1 1.1 0 0 1-.375.063"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
<div
|
||||
aria-label="Room list filters"
|
||||
class="Flex-module_flex RoomListPrimaryFilters-module_list"
|
||||
@@ -346,15 +274,6 @@ exports[`<RoomListPrimaryFilters /> stories > snapshots > renders PeopleSelected
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
@@ -373,15 +292,6 @@ exports[`<RoomListPrimaryFilters /> stories > snapshots > renders PeopleSelected
|
||||
>
|
||||
Invites
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="true"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8 wrapping"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Low priority
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import { useEffect, useState } from "react";
|
||||
* Standard filter identifiers that can be used across implementations.
|
||||
* These are stable keys - the view layer maps them to translated labels.
|
||||
*/
|
||||
export type FilterId = "unread" | "people" | "rooms" | "favourite" | "mentions" | "invites" | "low_priority";
|
||||
export type FilterId = "unread" | "people" | "rooms" | "mentions" | "invites";
|
||||
|
||||
/**
|
||||
* A hook to sort the filter IDs by active state.
|
||||
|
||||
@@ -64,13 +64,6 @@ export const RoomListEmptyStateView: React.FC<RoomListEmptyStateViewProps> = ({
|
||||
|
||||
// Handle different filter cases based on filter ID
|
||||
switch (snapshot.activeFilterId) {
|
||||
case "favourite":
|
||||
return (
|
||||
<GenericPlaceholder
|
||||
title={_t("room_list|empty|no_favourites")}
|
||||
description={_t("room_list|empty|no_favourites_description")}
|
||||
/>
|
||||
);
|
||||
case "people":
|
||||
return (
|
||||
<GenericPlaceholder
|
||||
@@ -109,14 +102,6 @@ export const RoomListEmptyStateView: React.FC<RoomListEmptyStateViewProps> = ({
|
||||
onAction={() => vm.onToggleFilter(snapshot.activeFilterId!)}
|
||||
/>
|
||||
);
|
||||
case "low_priority":
|
||||
return (
|
||||
<ActionPlaceholder
|
||||
title={_t("room_list|empty|no_lowpriority")}
|
||||
action={_t("room_list|empty|show_activity")}
|
||||
onAction={() => vm.onToggleFilter(snapshot.activeFilterId!)}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<GenericPlaceholder
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
type RoomListViewProps = RoomListViewSnapshot &
|
||||
RoomListViewActions & { renderAvatar: (room: Room) => React.ReactElement };
|
||||
|
||||
const mockFilterIds: FilterId[] = ["unread", "people", "rooms", "favourite"];
|
||||
const mockFilterIds: FilterId[] = ["unread", "people", "rooms"];
|
||||
|
||||
// Wrapper component that creates a mocked ViewModel
|
||||
const RoomListViewWrapperImpl = ({
|
||||
@@ -164,12 +164,12 @@ export const EmptyWithoutCreatePermission: Story = {
|
||||
|
||||
export const WithActiveFilter: Story = {
|
||||
args: {
|
||||
filterIds: ["unread", "people", "rooms", "favourite"],
|
||||
activeFilterId: "favourite",
|
||||
filterIds: ["unread", "people", "rooms"],
|
||||
activeFilterId: "people",
|
||||
roomListState: {
|
||||
activeRoomIndex: undefined,
|
||||
spaceId: "!space:server",
|
||||
filterKeys: ["favourites"],
|
||||
filterKeys: ["people"],
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -184,14 +184,6 @@ export const WithSelection: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const EmptyFavouriteFilter: Story = {
|
||||
args: {
|
||||
isRoomListEmpty: true,
|
||||
filterIds: ["favourite", "people"],
|
||||
activeFilterId: "favourite",
|
||||
},
|
||||
};
|
||||
|
||||
export const EmptyPeopleFilter: Story = {
|
||||
args: {
|
||||
isRoomListEmpty: true,
|
||||
@@ -233,14 +225,6 @@ export const EmptyMentionsFilter: Story = {
|
||||
},
|
||||
};
|
||||
|
||||
export const EmptyLowPriorityFilter: Story = {
|
||||
args: {
|
||||
isRoomListEmpty: true,
|
||||
filterIds: ["low_priority", "people"],
|
||||
activeFilterId: "low_priority",
|
||||
},
|
||||
};
|
||||
|
||||
export const SmallFlatList: Story = {
|
||||
args: {
|
||||
sections: mockSmallListSections,
|
||||
|
||||
@@ -30,13 +30,11 @@ const {
|
||||
LargeFlatList,
|
||||
SmallSectionList,
|
||||
LargeSectionList,
|
||||
EmptyFavouriteFilter,
|
||||
EmptyPeopleFilter,
|
||||
EmptyRoomsFilter,
|
||||
EmptyUnreadFilter,
|
||||
EmptyInvitesFilter,
|
||||
EmptyMentionsFilter,
|
||||
EmptyLowPriorityFilter,
|
||||
Toast,
|
||||
} = composeStories(stories);
|
||||
|
||||
@@ -96,11 +94,6 @@ describe("<RoomListView />", () => {
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders EmptyFavouriteFilter story", () => {
|
||||
const { container } = renderWithMockContext(<EmptyFavouriteFilter />);
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders EmptyPeopleFilter story", () => {
|
||||
const { container } = renderWithMockContext(<EmptyPeopleFilter />);
|
||||
expect(container).toMatchSnapshot();
|
||||
@@ -126,11 +119,6 @@ describe("<RoomListView />", () => {
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders EmptyLowPriorityFilter story", () => {
|
||||
const { container } = renderWithMockContext(<EmptyLowPriorityFilter />);
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders Toast story", () => {
|
||||
const { container } = renderWithMockContext(<Toast />);
|
||||
expect(container).toMatchSnapshot();
|
||||
@@ -190,21 +178,12 @@ describe("<RoomListView />", () => {
|
||||
expect(EmptyMentionsFilter.args.onToggleFilter).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should call onToggleFilter when See all activity is clicked in low priority empty state", async () => {
|
||||
const user = userEvent.setup();
|
||||
renderWithMockContext(<EmptyLowPriorityFilter />);
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "See all activity" }));
|
||||
|
||||
expect(EmptyLowPriorityFilter.args.onToggleFilter).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should call closeToast when close button is clicked on toast", async () => {
|
||||
const user = userEvent.setup();
|
||||
renderWithMockContext(<Toast />);
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "Close" }));
|
||||
|
||||
expect(EmptyLowPriorityFilter.args.closeToast).toHaveBeenCalled();
|
||||
expect(Toast.args.closeToast).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
+1
-233
@@ -45,15 +45,6 @@ exports[`<RoomListView /> > renders Default story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2726,15 +2717,6 @@ exports[`<RoomListView /> > renders Empty story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2815,75 +2797,6 @@ exports[`<RoomListView /> > renders Empty story 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<RoomListView /> > renders EmptyFavouriteFilter story 1`] = `
|
||||
<div>
|
||||
<div
|
||||
style="width: 320px; height: 600px; border: 1px solid var(--cpd-color-border-interactive-primary); display: flex; flex-direction: column; resize: horizontal; overflow: auto; min-width: 250px; max-width: 800px;"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="Flex-module_flex RoomListPrimaryFilters-module_roomListPrimaryFilters"
|
||||
data-testid="primary-filters"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row-reverse; --mx-flex-align: start; --mx-flex-justify: space-between; --mx-flex-gap: var(--cpd-space-3x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<div
|
||||
aria-label="Room list filters"
|
||||
class="Flex-module_flex RoomListPrimaryFilters-module_list"
|
||||
id="react-use-id-1"
|
||||
role="listbox"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-2x); --mx-flex-wrap: wrap;"
|
||||
>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="true"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
People
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Flex-module_flex RoomListView-module_list"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: column; --mx-flex-align: start; --mx-flex-justify: start; --mx-flex-gap: 0; --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<div
|
||||
class="AutoHideScrollbar-module_scrollbar RoomListView-module_scrollbar"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="Flex-module_flex RoomListEmptyStateView-module_genericPlaceholder"
|
||||
data-testid="empty-room-list"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: column; --mx-flex-align: stretch; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-2x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<span
|
||||
class="RoomListEmptyStateView-module_title"
|
||||
>
|
||||
You don't have favourite chats yet
|
||||
</span>
|
||||
<span
|
||||
class="RoomListEmptyStateView-module_description"
|
||||
>
|
||||
You can add a chat to your favourites in the chat settings
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<RoomListView /> > renders EmptyInvitesFilter story 1`] = `
|
||||
<div>
|
||||
<div
|
||||
@@ -2957,79 +2870,6 @@ exports[`<RoomListView /> > renders EmptyInvitesFilter story 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<RoomListView /> > renders EmptyLowPriorityFilter story 1`] = `
|
||||
<div>
|
||||
<div
|
||||
style="width: 320px; height: 600px; border: 1px solid var(--cpd-color-border-interactive-primary); display: flex; flex-direction: column; resize: horizontal; overflow: auto; min-width: 250px; max-width: 800px;"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="Flex-module_flex RoomListPrimaryFilters-module_roomListPrimaryFilters"
|
||||
data-testid="primary-filters"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row-reverse; --mx-flex-align: start; --mx-flex-justify: space-between; --mx-flex-gap: var(--cpd-space-3x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<div
|
||||
aria-label="Room list filters"
|
||||
class="Flex-module_flex RoomListPrimaryFilters-module_list"
|
||||
id="react-use-id-1"
|
||||
role="listbox"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-2x); --mx-flex-wrap: wrap;"
|
||||
>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="true"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Low priority
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
People
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Flex-module_flex RoomListView-module_list"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: column; --mx-flex-align: start; --mx-flex-justify: start; --mx-flex-gap: 0; --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<div
|
||||
class="AutoHideScrollbar-module_scrollbar RoomListView-module_scrollbar"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div
|
||||
class="Flex-module_flex RoomListEmptyStateView-module_genericPlaceholder"
|
||||
data-testid="empty-room-list"
|
||||
style="--mx-flex-display: flex; --mx-flex-direction: column; --mx-flex-align: stretch; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-2x); --mx-flex-wrap: nowrap;"
|
||||
>
|
||||
<span
|
||||
class="RoomListEmptyStateView-module_title"
|
||||
>
|
||||
You don't have any low priority rooms
|
||||
</span>
|
||||
<button
|
||||
class="_button_1nw83_8"
|
||||
data-kind="tertiary"
|
||||
data-size="lg"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
See all activity
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`<RoomListView /> > renders EmptyMentionsFilter story 1`] = `
|
||||
<div>
|
||||
<div
|
||||
@@ -3359,15 +3199,6 @@ exports[`<RoomListView /> > renders EmptyWithoutCreatePermission story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3472,15 +3303,6 @@ exports[`<RoomListView /> > renders LargeFlatList story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -8373,15 +8195,6 @@ exports[`<RoomListView /> > renders LargeSectionList story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -13434,15 +13247,6 @@ exports[`<RoomListView /> > renders Loading story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -13508,15 +13312,6 @@ exports[`<RoomListView /> > renders SmallFlatList story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -13870,15 +13665,6 @@ exports[`<RoomListView /> > renders SmallSectionList story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -14368,15 +14154,6 @@ exports[`<RoomListView /> > renders Toast story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -17067,7 +16844,7 @@ exports[`<RoomListView /> > renders WithActiveFilter story 1`] = `
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="false"
|
||||
aria-selected="true"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
@@ -17083,15 +16860,6 @@ exports[`<RoomListView /> > renders WithActiveFilter story 1`] = `
|
||||
>
|
||||
Rooms
|
||||
</button>
|
||||
<button
|
||||
aria-hidden="false"
|
||||
aria-selected="true"
|
||||
class="_chat-filter_5qdp0_8"
|
||||
role="option"
|
||||
tabindex="0"
|
||||
>
|
||||
Favourites
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+27
-29
@@ -131,35 +131,33 @@ export function MoreOptionContent({ vm }: MoreOptionContentProps): JSX.Element {
|
||||
hideChevron={true}
|
||||
/>
|
||||
)}
|
||||
{snapshot.canMoveToSection && (
|
||||
<SubMenu
|
||||
trigger={
|
||||
<MenuItem
|
||||
Icon={ArrowRightIcon}
|
||||
label={_t("room_list|more_options|move_to_section")}
|
||||
onSelect={null}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{snapshot.sections.map((section) => (
|
||||
<MenuItem
|
||||
key={section.tag}
|
||||
label={section.name}
|
||||
labelProps={{ className: styles.sectionLabel }}
|
||||
onSelect={() => vm.onToggleSection(section.tag)}
|
||||
onClick={(evt) => evt.stopPropagation()}
|
||||
hideChevron={true}
|
||||
aria-checked={section.isSelected}
|
||||
>
|
||||
{section.isSelected && (
|
||||
<CheckIcon color="var(--cpd-color-icon-tertiary)" width="24px" height="24px" />
|
||||
)}
|
||||
</MenuItem>
|
||||
))}
|
||||
{hasSections && <Separator />}
|
||||
<MenuItem label={_t("action|new_section")} onSelect={vm.onCreateSection} hideChevron={true} />
|
||||
</SubMenu>
|
||||
)}
|
||||
<SubMenu
|
||||
trigger={
|
||||
<MenuItem
|
||||
Icon={ArrowRightIcon}
|
||||
label={_t("room_list|more_options|move_to_section")}
|
||||
onSelect={null}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{snapshot.sections.map((section) => (
|
||||
<MenuItem
|
||||
key={section.tag}
|
||||
label={section.name}
|
||||
labelProps={{ className: styles.sectionLabel }}
|
||||
onSelect={() => vm.onToggleSection(section.tag)}
|
||||
onClick={(evt) => evt.stopPropagation()}
|
||||
hideChevron={true}
|
||||
aria-checked={section.isSelected}
|
||||
>
|
||||
{section.isSelected && (
|
||||
<CheckIcon color="var(--cpd-color-icon-tertiary)" width="24px" height="24px" />
|
||||
)}
|
||||
</MenuItem>
|
||||
))}
|
||||
{hasSections && <Separator />}
|
||||
<MenuItem label={_t("action|new_section")} onSelect={vm.onCreateSection} hideChevron={true} />
|
||||
</SubMenu>
|
||||
{isInSection && (
|
||||
<MenuItem
|
||||
Icon={MinusIcon}
|
||||
|
||||
-2
@@ -92,8 +92,6 @@ export interface RoomListItemViewSnapshot {
|
||||
canMarkAsUnread: boolean;
|
||||
/** The room's notification state */
|
||||
roomNotifState: RoomNotifState;
|
||||
/** Whether the room can be moved to a section */
|
||||
canMoveToSection: boolean;
|
||||
/** Available sections the room can be assigned to */
|
||||
sections: Section[];
|
||||
}
|
||||
|
||||
-1
@@ -36,7 +36,6 @@ export const defaultSnapshot: RoomListItemViewSnapshot = {
|
||||
canMarkAsRead: false,
|
||||
canMarkAsUnread: true,
|
||||
roomNotifState: RoomNotifState.AllMessages,
|
||||
canMoveToSection: true,
|
||||
sections: [
|
||||
{
|
||||
tag: "m.favourite",
|
||||
|
||||
@@ -105,7 +105,6 @@ export const createMockRoomSnapshot = (id: string, name: string, index: number):
|
||||
canMarkAsRead: false,
|
||||
canMarkAsUnread: true,
|
||||
roomNotifState: RoomNotifState.AllMessages,
|
||||
canMoveToSection: true,
|
||||
sections: [],
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user