diff --git a/res/css/structures/_RoomStatusBar.pcss b/res/css/structures/_RoomStatusBar.pcss index a54ceae49e..51fea7a49a 100644 --- a/res/css/structures/_RoomStatusBar.pcss +++ b/res/css/structures/_RoomStatusBar.pcss @@ -138,7 +138,7 @@ limitations under the License. mask-image: url('$(res)/img/element-icons/trashcan.svg'); } - &.mx_RoomStatusBar_unsentResendAllBtn { + &.mx_RoomStatusBar_unsentRetry { padding-left: 34px; // 28px from above, but +6px to account for the wider icon &::before { diff --git a/src/components/structures/RoomStatusBar.tsx b/src/components/structures/RoomStatusBar.tsx index a89f205a88..d46ad12b50 100644 --- a/src/components/structures/RoomStatusBar.tsx +++ b/src/components/structures/RoomStatusBar.tsx @@ -24,11 +24,11 @@ import Resend from '../../Resend'; import dis from '../../dispatcher/dispatcher'; import { messageForResourceLimitError } from '../../utils/ErrorUtils'; import { Action } from "../../dispatcher/actions"; -import NotificationBadge from "../views/rooms/NotificationBadge"; import { StaticNotificationState } from "../../stores/notifications/StaticNotificationState"; import AccessibleButton from "../views/elements/AccessibleButton"; import InlineSpinner from "../views/elements/InlineSpinner"; import MatrixClientContext from "../../contexts/MatrixClientContext"; +import { RoomStatusBarUnsentMessages } from './RoomStatusBarUnsentMessages'; const STATUS_BAR_HIDDEN = 0; const STATUS_BAR_EXPANDED = 1; @@ -240,7 +240,7 @@ export default class RoomStatusBar extends React.PureComponent { { _t("Delete all") } - + { _t("Retry all") } ; @@ -252,28 +252,12 @@ export default class RoomStatusBar extends React.PureComponent { ; } - return <> -
-
-
- -
-
-
- { title } -
-
- { _t("You can select all or individual messages to retry or delete") } -
-
-
- { buttonRow } -
-
-
- ; + return ; } public render(): JSX.Element { diff --git a/src/components/structures/RoomStatusBarUnsentMessages.tsx b/src/components/structures/RoomStatusBarUnsentMessages.tsx new file mode 100644 index 0000000000..4c8f9fe35b --- /dev/null +++ b/src/components/structures/RoomStatusBarUnsentMessages.tsx @@ -0,0 +1,55 @@ +/* +Copyright 2022 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. +*/ + +import React, { ReactElement } from "react"; + +import { StaticNotificationState } from "../../stores/notifications/StaticNotificationState"; +import NotificationBadge from "../views/rooms/NotificationBadge"; + +interface RoomStatusBarUnsentMessagesProps { + title: string; + description?: string; + notificationState: StaticNotificationState; + buttons: ReactElement; +} + +export const RoomStatusBarUnsentMessages = (props: RoomStatusBarUnsentMessagesProps): ReactElement => { + return ( +
+
+
+ +
+
+
+ { props.title } +
+ { + props.description && +
+ { props.description } +
+ } +
+
+ { props.buttons } +
+
+
+ ); +}; diff --git a/test/components/structures/RoomStatusBarUnsentMessages-test.tsx b/test/components/structures/RoomStatusBarUnsentMessages-test.tsx new file mode 100644 index 0000000000..432687218e --- /dev/null +++ b/test/components/structures/RoomStatusBarUnsentMessages-test.tsx @@ -0,0 +1,47 @@ +/* +Copyright 2022 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. +*/ + +import React from "react"; +import { render, screen } from "@testing-library/react"; + +import { RoomStatusBarUnsentMessages } from "../../../src/components/structures/RoomStatusBarUnsentMessages"; +import { StaticNotificationState } from "../../../src/stores/notifications/StaticNotificationState"; + +describe("RoomStatusBarUnsentMessages", () => { + const title = "test title"; + const description = "test description"; + const buttonsText = "test buttons"; + const buttons =
{ buttonsText }
; + + beforeEach(() => { + render( + , + ); + }); + + it("should render the values passed as props", () => { + screen.getByText(title); + screen.getByText(description); + screen.getByText(buttonsText); + // notification state + screen.getByText("!"); + }); +});