From c07cd2462e523ee3dca5e8de3e31a4bd8f10c453 Mon Sep 17 00:00:00 2001 From: Kerry Date: Wed, 22 Feb 2023 23:53:12 +1300 Subject: [PATCH] Ended poll tiles: add ended the poll message (#10193) * add ended the poll message to ended poll tile * fussy import ordering --------- Co-authored-by: Andy Balaam --- .../views/messages/MPollEndBody.tsx | 9 +- src/i18n/strings/en_EN.json | 1 + .../__snapshots__/MPollEndBody-test.tsx.snap | 129 +++++++++--------- 3 files changed, 77 insertions(+), 62 deletions(-) diff --git a/src/components/views/messages/MPollEndBody.tsx b/src/components/views/messages/MPollEndBody.tsx index 2ae6a73e86f..bf8272a58f7 100644 --- a/src/components/views/messages/MPollEndBody.tsx +++ b/src/components/views/messages/MPollEndBody.tsx @@ -21,7 +21,9 @@ import { logger } from "matrix-js-sdk/src/logger"; import { Icon as PollIcon } from "../../../../res/img/element-icons/room/composer/poll.svg"; import MatrixClientContext from "../../../contexts/MatrixClientContext"; +import { _t } from "../../../languageHandler"; import { textForEvent } from "../../../TextForEvent"; +import { Caption } from "../typography/Caption"; import { IBodyProps } from "./IBodyProps"; import MPollBody from "./MPollBody"; @@ -105,5 +107,10 @@ export const MPollEndBody = React.forwardRef(({ mxEvent, ...pro ); } - return ; + return ( +
+ {_t("Ended a poll")} + +
+ ); }); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 02647da3ff8..3c3ff6c20a4 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2415,6 +2415,7 @@ "Based on %(count)s votes|other": "Based on %(count)s votes", "Based on %(count)s votes|one": "Based on %(count)s vote", "edited": "edited", + "Ended a poll": "Ended a poll", "Error decrypting video": "Error decrypting video", "Error processing voice message": "Error processing voice message", "Add reaction": "Add reaction", diff --git a/test/components/views/messages/__snapshots__/MPollEndBody-test.tsx.snap b/test/components/views/messages/__snapshots__/MPollEndBody-test.tsx.snap index e98ec1f4fcc..bad7c2d129d 100644 --- a/test/components/views/messages/__snapshots__/MPollEndBody-test.tsx.snap +++ b/test/components/views/messages/__snapshots__/MPollEndBody-test.tsx.snap @@ -10,99 +10,106 @@ exports[` when poll start event does not exist in current timeli exports[` when poll start event exists in current timeline renders an ended poll 1`] = `
-
-

+ - Question? -

+ Ended a poll +
+

+ Question? +

- Socks -
-
- 0 votes +
+ Socks +
+
+ 0 votes +
-
-
+ class="mx_PollOption_popularityBackground" + > +
+
-
-
- Shoes +
+ Shoes +
+
+ 0 votes +
+
+
- 0 votes -
+ class="mx_PollOption_popularityAmount" + style="width: 0%;" + />
+
+
+ Final result based on 0 votes
-
- Final result based on 0 votes -
-
-
-
`;