diff --git a/playwright/e2e/spotlight/spotlight.spec.ts b/playwright/e2e/spotlight/spotlight.spec.ts index e07643c193..c1eb2b5923 100644 --- a/playwright/e2e/spotlight/spotlight.spec.ts +++ b/playwright/e2e/spotlight/spotlight.spec.ts @@ -345,10 +345,10 @@ test.describe("Spotlight", () => { await expect(resultLocator).toHaveCount(1); await expect(resultLocator.first()).toContainText(bot2.credentials.displayName); - await expect(spotlight.dialog.locator(".mx_SpotlightDialog_startGroupChat")).toContainText( + await expect(spotlight.dialog.locator("#mx_SpotlightDialog_button_startGroupChat")).toContainText( "Start a group chat", ); - await spotlight.dialog.locator(".mx_SpotlightDialog_startGroupChat").click(); + await spotlight.dialog.locator("#mx_SpotlightDialog_button_startGroupChat").click(); await expect(page.getByRole("dialog")).toContainText("Direct Messages"); }); diff --git a/playwright/snapshots/composer/CIDER.spec.ts/emoji-picker-linux.png b/playwright/snapshots/composer/CIDER.spec.ts/emoji-picker-linux.png index 939ab008e0..d19b078c2b 100644 Binary files a/playwright/snapshots/composer/CIDER.spec.ts/emoji-picker-linux.png and b/playwright/snapshots/composer/CIDER.spec.ts/emoji-picker-linux.png differ diff --git a/playwright/snapshots/composer/CIDER.spec.ts/emoji-picker-small-linux.png b/playwright/snapshots/composer/CIDER.spec.ts/emoji-picker-small-linux.png index 75bb1b4172..33ec8f7b32 100644 Binary files a/playwright/snapshots/composer/CIDER.spec.ts/emoji-picker-small-linux.png and b/playwright/snapshots/composer/CIDER.spec.ts/emoji-picker-small-linux.png differ diff --git a/res/css/views/dialogs/_SpotlightDialog.pcss b/res/css/views/dialogs/_SpotlightDialog.pcss index c75b07e884..dcb2247688 100644 --- a/res/css/views/dialogs/_SpotlightDialog.pcss +++ b/res/css/views/dialogs/_SpotlightDialog.pcss @@ -79,12 +79,8 @@ Please see LICENSE files in the repository root for full details. position: relative; padding: $spacing-4 $spacing-8 $spacing-4 37px; - &::before { - background-color: $secondary-content; - content: ""; - mask-repeat: no-repeat; - mask-position: center; - mask-size: contain; + > svg { + color: $secondary-content; width: 18px; height: 18px; position: absolute; @@ -93,23 +89,11 @@ Please see LICENSE files in the repository root for full details. transform: translateY(-50%); } - &.mx_SpotlightDialog_filterPeople::before { - mask-image: url("@vector-im/compound-design-tokens/icons/user-profile.svg"); - } - - &.mx_SpotlightDialog_filterPublicRooms::before { - mask-image: url("@vector-im/compound-design-tokens/icons/room.svg"); - } - - &.mx_SpotlightDialog_filterPublicSpaces::before { - mask-image: url("@vector-im/compound-design-tokens/icons/space.svg"); - } - .mx_SpotlightDialog_filter--close { - position: relative; display: inline-block; - width: 16px; - height: 16px; + width: 14px; + height: 14px; + padding: 1px; background: $system; border-radius: 8px; margin-left: $spacing-8; @@ -117,17 +101,10 @@ Please see LICENSE files in the repository root for full details. line-height: 16px; color: $secondary-content; - &::before { - background-color: $secondary-content; - content: ""; - mask-repeat: no-repeat; - mask-position: center; - mask-size: 14px; + svg { + color: $secondary-content; width: inherit; height: inherit; - position: absolute; - left: 0; - mask-image: url("@vector-im/compound-design-tokens/icons/close.svg"); } } } @@ -386,45 +363,24 @@ Please see LICENSE files in the repository root for full details. margin: 0; padding: 3px $spacing-8 3px $spacing-28; - &::before { - content: ""; + svg { display: block; position: absolute; - mask-repeat: no-repeat; - mask-position: center; - mask-size: contain; left: $spacing-8; width: 16px; height: 16px; - background: var(--cpd-color-icon-primary); + color: var(--cpd-color-icon-primary); } } } - .mx_SpotlightDialog_inviteLink .mx_AccessibleButton::before { - mask-image: url("@vector-im/compound-design-tokens/icons/link.svg"); - } - - .mx_SpotlightDialog_createRoom .mx_AccessibleButton::before { - mask-image: url("@vector-im/compound-design-tokens/icons/room.svg"); - } - .mx_SpotlightDialog_otherSearches { - .mx_SpotlightDialog_startChat, - .mx_SpotlightDialog_joinRoomAlias, - .mx_SpotlightDialog_explorePublicRooms, - .mx_SpotlightDialog_explorePublicSpaces, - .mx_SpotlightDialog_startGroupChat, - .mx_SpotlightDialog_searchMessages { + .mx_SpotlightDialog_option { padding-left: $spacing-32; position: relative; - &::before { - background-color: $secondary-content; - content: ""; - mask-repeat: no-repeat; - mask-position: center; - mask-size: contain; + svg { + color: $secondary-content; width: 24px; height: 24px; position: absolute; @@ -434,30 +390,6 @@ Please see LICENSE files in the repository root for full details. } } - .mx_SpotlightDialog_startChat::before { - mask-image: url("@vector-im/compound-design-tokens/icons/user-profile.svg"); - } - - .mx_SpotlightDialog_joinRoomAlias::before { - mask-image: url("@vector-im/compound-design-tokens/icons/room.svg"); - } - - .mx_SpotlightDialog_explorePublicRooms::before { - mask-image: url("@vector-im/compound-design-tokens/icons/room.svg"); - } - - .mx_SpotlightDialog_explorePublicSpaces::before { - mask-image: url("@vector-im/compound-design-tokens/icons/space.svg"); - } - - .mx_SpotlightDialog_startGroupChat::before { - mask-image: url("@vector-im/compound-design-tokens/icons/group.svg"); - } - - .mx_SpotlightDialog_searchMessages::before { - mask-image: url("@vector-im/compound-design-tokens/icons/chat.svg"); - } - .mx_SpotlightDialog_otherSearches_messageSearchText { font-size: $font-15px; line-height: $font-24px; @@ -496,27 +428,10 @@ Please see LICENSE files in the repository root for full details. display: none; } - .mx_SpotlightDialog_metaspaceResult { - background-color: $secondary-content; - mask-position: center; - mask-repeat: no-repeat; - mask-size: contain; - - &.mx_SpotlightDialog_metaspaceResult_home-space { - mask-image: url("@vector-im/compound-design-tokens/icons/home.svg"); - } - - &.mx_SpotlightDialog_metaspaceResult_favourites-space { - mask-image: url("@vector-im/compound-design-tokens/icons/favourite.svg"); - } - - &.mx_SpotlightDialog_metaspaceResult_people-space { - mask-image: url("@vector-im/compound-design-tokens/icons/user-profile.svg"); - } - - &.mx_SpotlightDialog_metaspaceResult_orphans-space { - mask-image: url("@vector-im/compound-design-tokens/icons/room.svg"); - } + .mx_SpotlightDialog_metaspaceResult svg { + color: $secondary-content; + width: inherit; + height: inherit; } } } diff --git a/res/css/views/emojipicker/_EmojiPicker.pcss b/res/css/views/emojipicker/_EmojiPicker.pcss index d1fb8d91d6..582ef7b1d9 100644 --- a/res/css/views/emojipicker/_EmojiPicker.pcss +++ b/res/css/views/emojipicker/_EmojiPicker.pcss @@ -87,34 +87,24 @@ Please see LICENSE files in the repository root for full details. align-self: center; width: 32px; height: 32px; + cursor: pointer; + + svg { + width: 100%; + height: 100%; + } } } -.mx_EmojiPicker_search_clear { - cursor: pointer; -} - .mx_EmojiPicker_search_icon { - width: 20px; + width: 18px; margin: 8px; -} -.mx_EmojiPicker_search_icon:not(.mx_EmojiPicker_search_clear) { - pointer-events: none; -} - -.mx_EmojiPicker_search_icon::after { - mask: url("@vector-im/compound-design-tokens/icons/search.svg") no-repeat; - mask-size: 100%; - background-color: $primary-content; - content: ""; - display: inline-block; - width: 100%; - height: 100%; -} - -.mx_EmojiPicker_search_clear::after { - mask-image: url("@vector-im/compound-design-tokens/icons/close.svg"); + svg { + width: 100%; + height: 100%; + color: $primary-content; + } } .mx_EmojiPicker_category { diff --git a/res/css/views/right_panel/_ExtensionsCard.pcss b/res/css/views/right_panel/_ExtensionsCard.pcss index 10a9cb2d56..cda7541bf4 100644 --- a/res/css/views/right_panel/_ExtensionsCard.pcss +++ b/res/css/views/right_panel/_ExtensionsCard.pcss @@ -58,7 +58,13 @@ Please see LICENSE files in the repository root for full details. width: 24px; padding: var(--cpd-space-3x) var(--cpd-space-1x); box-sizing: border-box; - min-width: 24px; /* prevent flexbox crushing */ + flex-shrink: 0; + + svg { + width: 16px; + height: 16px; + color: $icon-button-color; + } &:hover { &::after { @@ -72,32 +78,14 @@ Please see LICENSE files in the repository root for full details. background-color: rgb(141, 151, 165, 0.1); } } - - &::before { - content: ""; - position: absolute; - height: 16px; - width: 16px; - mask-repeat: no-repeat; - mask-position: center; - mask-size: 16px; - background-color: $icon-button-color; - } } .mx_ExtensionsCard_app_pinToggle { right: 8px; - - &::before { - mask-image: url("@vector-im/compound-design-tokens/icons/pin-solid.svg"); - } } .mx_ExtensionsCard_app_options { right: 32px; /* 24 + 8 */ - &::before { - mask-image: url("@vector-im/compound-design-tokens/icons/overflow-horizontal.svg"); - } } &.mx_ExtensionsCard_Button_pinned { @@ -105,8 +93,8 @@ Please see LICENSE files in the repository root for full details. opacity: 0.2; } - .mx_ExtensionsCard_app_pinToggle::before { - background-color: $accent; + .mx_ExtensionsCard_app_pinToggle svg { + color: $accent; } } diff --git a/res/themes/light-high-contrast/css/_light-high-contrast.pcss b/res/themes/light-high-contrast/css/_light-high-contrast.pcss index 94774bc5b8..ada87d7a33 100644 --- a/res/themes/light-high-contrast/css/_light-high-contrast.pcss +++ b/res/themes/light-high-contrast/css/_light-high-contrast.pcss @@ -160,12 +160,8 @@ $accent-1400: var(--cpd-color-green-1400); background-color: $quinary-content !important; color: $background !important; - &.mx_SpotlightDialog_startChat::before, - &.mx_SpotlightDialog_joinRoomAlias::before, - &.mx_SpotlightDialog_explorePublicRooms::before, - &.mx_SpotlightDialog_startGroupChat::before, - &.mx_SpotlightDialog_searchMessages::before { - background-color: $background !important; + svg { + color: $background !important; } .mx_DecoratedRoomAvatar_icon::before { diff --git a/src/components/views/dialogs/spotlight/SpotlightDialog.tsx b/src/components/views/dialogs/spotlight/SpotlightDialog.tsx index f4e33ce155..204c404fde 100644 --- a/src/components/views/dialogs/spotlight/SpotlightDialog.tsx +++ b/src/components/views/dialogs/spotlight/SpotlightDialog.tsx @@ -7,22 +7,21 @@ Please see LICENSE files in the repository root for full details. */ import { type WebSearch as WebSearchEvent } from "@matrix-org/analytics-events/types/typescript/WebSearch"; -import classNames from "classnames"; import { capitalize, sum } from "lodash"; import { + type HierarchyRoom, type IPublicRoomsChunkRoom, + JoinRule, type MatrixClient, + type Room, RoomMember, RoomType, - type Room, - type HierarchyRoom, - JoinRule, } from "matrix-js-sdk/src/matrix"; import { KnownMembership } from "matrix-js-sdk/src/types"; import { normalize } from "matrix-js-sdk/src/utils"; import React, { - type JSX, type ChangeEvent, + type JSX, useCallback, useContext, useEffect, @@ -31,6 +30,17 @@ import React, { useState, } from "react"; import sanitizeHtml from "sanitize-html"; +import { + ChatIcon, + RoomIcon, + SpaceIcon, + UserProfileIcon, + FavouriteIcon, + HomeIcon, + GroupIcon, + CloseIcon, + LinkIcon, +} from "@vector-im/compound-design-tokens/assets/web/icons"; import { KeyBindingAction } from "../../../../accessibility/KeyboardShortcuts"; import { @@ -62,7 +72,7 @@ import { type RoomNotificationState } from "../../../../stores/notifications/Roo import { RoomNotificationStateStore } from "../../../../stores/notifications/RoomNotificationStateStore"; import { RecentAlgorithm } from "../../../../stores/room-list/algorithms/tag-sorting/RecentAlgorithm"; import { SdkContextClass } from "../../../../contexts/SDKContext"; -import { getMetaSpaceName } from "../../../../stores/spaces"; +import { getMetaSpaceName, MetaSpace } from "../../../../stores/spaces"; import SpaceStore from "../../../../stores/spaces/SpaceStore"; import { DirectoryMember, type Member, startDmOnFirstMessage } from "../../../../utils/direct-messages"; import DMRoomMap from "../../../../utils/DMRoomMap"; @@ -131,6 +141,30 @@ function filterToLabel(filter: Filter): string { } } +function filterToIcon(filter: Filter): JSX.Element { + switch (filter) { + case Filter.People: + return ; + case Filter.PublicRooms: + return ; + case Filter.PublicSpaces: + return ; + } +} + +function metaspaceToIcon(key: MetaSpace): JSX.Element | undefined { + switch (key) { + case MetaSpace.Home: + return ; + case MetaSpace.Favourites: + return ; + case MetaSpace.People: + return ; + case MetaSpace.Orphans: + return ; + } +} + interface IBaseResult { section: Section; filter: Filter[]; @@ -396,14 +430,7 @@ const SpotlightDialog: React.FC = ({ initialText = "", initialFilter = n ...SpaceStore.instance.enabledMetaSpaces.map((spaceKey) => ({ section: Section.Spaces, filter: [] as Filter[], - avatar: ( -
- ), + avatar:
{metaspaceToIcon(spaceKey)}
, name: getMetaSpaceName(spaceKey, SpaceStore.instance.allRoomsInHome), onClick() { SpaceStore.instance.setActiveSpace(spaceKey); @@ -584,34 +611,30 @@ const SpotlightDialog: React.FC = ({ initialText = "", initialFilter = n {filter !== Filter.PublicSpaces && supportsSpaceFiltering && ( )} {filter !== Filter.PublicRooms && ( )} {filter !== Filter.People && ( - )} {filter === null && ( )} @@ -919,7 +943,6 @@ const SpotlightDialog: React.FC = ({ initialText = "", initialFilter = n
@@ -1003,9 +1029,9 @@ const SpotlightDialog: React.FC = ({ initialText = "", initialFilter = n

{_t("spotlight_dialog|group_chat_section_title")}

@@ -1244,13 +1270,8 @@ const SpotlightDialog: React.FC = ({ initialText = "", initialFilter = n >
{filter !== null && ( -
+
+ {filterToIcon(filter)} {filterToLabel(filter)} = ({ initialText = "", initialFilter = n })} className="mx_SpotlightDialog_filter--close" onClick={() => setFilter(null)} - /> + > + +
)} { rightButton = ( ); } else { - rightButton = ; + rightButton = ( + + + + ); } return ( diff --git a/src/components/views/right_panel/ExtensionsCard.tsx b/src/components/views/right_panel/ExtensionsCard.tsx index 448917290a..5fb5a033ec 100644 --- a/src/components/views/right_panel/ExtensionsCard.tsx +++ b/src/components/views/right_panel/ExtensionsCard.tsx @@ -10,8 +10,12 @@ import React, { type JSX, useEffect, useMemo, useState } from "react"; import { type Room } from "matrix-js-sdk/src/matrix"; import classNames from "classnames"; import { Button, Link, Separator, Text } from "@vector-im/compound-web"; -import PlusIcon from "@vector-im/compound-design-tokens/assets/web/icons/plus"; -import ExtensionsIcon from "@vector-im/compound-design-tokens/assets/web/icons/extensions"; +import { + PlusIcon, + ExtensionsIcon, + OverflowHorizontalIcon, + PinSolidIcon, +} from "@vector-im/compound-design-tokens/assets/web/icons"; import BaseCard from "./BaseCard"; import WidgetUtils, { useWidgets } from "../../../utils/WidgetUtils"; @@ -124,7 +128,9 @@ const AppRow: React.FC = ({ app, room }) => { isExpanded={menuDisplayed} onClick={openMenu} title={_t("common|options")} - /> + > + + )} = ({ app, room }) => { onClick={togglePin} title={pinTitle} disabled={cannotPin} - /> + > + + {contextMenu}
diff --git a/test/unit-tests/components/views/dialogs/SpotlightDialog-test.tsx b/test/unit-tests/components/views/dialogs/SpotlightDialog-test.tsx index 2cf9511686..1cbb5b3e03 100644 --- a/test/unit-tests/components/views/dialogs/SpotlightDialog-test.tsx +++ b/test/unit-tests/components/views/dialogs/SpotlightDialog-test.tsx @@ -33,6 +33,8 @@ import { SettingLevel } from "../../../../../src/settings/SettingLevel"; import defaultDispatcher from "../../../../../src/dispatcher/dispatcher"; import SdkConfig from "../../../../../src/SdkConfig"; import { Action } from "../../../../../src/dispatcher/actions"; +import { MetaSpace } from "../../../../../src/stores/spaces"; +import SpaceStore from "../../../../../src/stores/spaces/SpaceStore.ts"; jest.useFakeTimers(); @@ -699,4 +701,29 @@ describe("Spotlight Dialog", () => { expect(keyboardPrompt?.textContent).not.toContain("→"); }); }); + + describe("metaspaces", () => { + beforeEach(() => { + jest.spyOn(SpaceStore.instance, "enabledMetaSpaces", "get").mockReturnValue([ + MetaSpace.Home, + MetaSpace.Favourites, + MetaSpace.People, + MetaSpace.Orphans, + ]); + }); + + it.each([MetaSpace.Home, MetaSpace.Favourites, MetaSpace.People])( + "should show metaspace %s", + async (metaSpace) => { + const onFinished = jest.fn(); + const { asFragment, container } = render( + , + ); + await waitFor(() => + expect(container.querySelector(".mx_SpotlightDialog_metaspaceResult")).toBeInTheDocument(), + ); + expect(asFragment()).toMatchSnapshot(); + }, + ); + }); }); diff --git a/test/unit-tests/components/views/dialogs/__snapshots__/SpotlightDialog-test.tsx.snap b/test/unit-tests/components/views/dialogs/__snapshots__/SpotlightDialog-test.tsx.snap new file mode 100644 index 0000000000..c66af206da --- /dev/null +++ b/test/unit-tests/components/views/dialogs/__snapshots__/SpotlightDialog-test.tsx.snap @@ -0,0 +1,759 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`Spotlight Dialog metaspaces should show metaspace favourites-space 1`] = ` + +
+ + Use + + ↓ + + + ↑ + + to scroll + +
+
+