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

Commit 1cfe126

Browse files
authored
Fix icon on empty notification panel (#10817)
* Use custom properties for the empty panel icons on FilePanel and NotificationPanel * Create E2E test for the notification panel
1 parent d103d2e commit 1cfe126

File tree

5 files changed

+74
-1
lines changed

5 files changed

+74
-1
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
Copyright 2023 Suguru Hirahara
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
/// <reference types="cypress" />
18+
19+
import { HomeserverInstance } from "../../plugins/utils/homeserver";
20+
21+
const ROOM_NAME = "Test room";
22+
const NAME = "Alice";
23+
24+
describe("NotificationPanel", () => {
25+
let homeserver: HomeserverInstance;
26+
27+
beforeEach(() => {
28+
cy.startHomeserver("default").then((data) => {
29+
homeserver = data;
30+
cy.initTestUser(homeserver, NAME).then(() => {
31+
cy.createRoom({ name: ROOM_NAME });
32+
});
33+
});
34+
});
35+
36+
afterEach(() => {
37+
cy.stopHomeserver(homeserver);
38+
});
39+
40+
it("should render empty state", () => {
41+
cy.viewRoomByName(ROOM_NAME);
42+
cy.findByRole("button", { name: "Notifications" }).click();
43+
44+
// Wait until the information about the empty state is rendered
45+
cy.get(".mx_NotificationPanel_empty").should("exist");
46+
47+
// Take a snapshot of RightPanel
48+
cy.get(".mx_RightPanel").percySnapshotElement("Notification Panel - empty", {
49+
widths: [264], // Emulate the UI. The value is based on minWidth specified on MainSplit.tsx
50+
});
51+
});
52+
});

res/css/_components.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
@import "./structures/_MainSplit.pcss";
7070
@import "./structures/_MatrixChat.pcss";
7171
@import "./structures/_NonUrgentToastContainer.pcss";
72+
@import "./structures/_NotificationPanel.pcss";
7273
@import "./structures/_QuickSettingsButton.pcss";
7374
@import "./structures/_RightPanel.pcss";
7475
@import "./structures/_RoomSearch.pcss";

res/css/structures/_FilePanel.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,5 @@ limitations under the License.
113113
}
114114

115115
.mx_FilePanel_empty::before {
116-
mask-image: url("$(res)/img/element-icons/room/files.svg");
116+
--maskImage: url("$(res)/img/element-icons/room/files.svg"); /* See: _RightPanel.pcss */
117117
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
Copyright 2015, 2016 OpenMarket Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
.mx_NotificationPanel_empty::before {
18+
--maskImage: url("$(res)/img/element-icons/notifications.svg"); /* See: _RightPanel.pcss */
19+
}

res/css/structures/_RightPanel.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ $pulse-color: $alert;
179179
height: 42px;
180180
width: 42px;
181181
background-color: $header-panel-text-primary-color;
182+
mask-image: var(--maskImage);
182183
mask-repeat: no-repeat;
183184
mask-size: contain;
184185
mask-position: center;

0 commit comments

Comments
 (0)