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 <andy.balaam@matrix.org>
This commit is contained in:
Kerry 2023-02-22 23:53:12 +13:00 committed by GitHub
parent c29e5f18ff
commit c07cd2462e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 63 deletions

View file

@ -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 { Icon as PollIcon } from "../../../../res/img/element-icons/room/composer/poll.svg";
import MatrixClientContext from "../../../contexts/MatrixClientContext"; import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { _t } from "../../../languageHandler";
import { textForEvent } from "../../../TextForEvent"; import { textForEvent } from "../../../TextForEvent";
import { Caption } from "../typography/Caption";
import { IBodyProps } from "./IBodyProps"; import { IBodyProps } from "./IBodyProps";
import MPollBody from "./MPollBody"; import MPollBody from "./MPollBody";
@ -105,5 +107,10 @@ export const MPollEndBody = React.forwardRef<any, IBodyProps>(({ mxEvent, ...pro
); );
} }
return <MPollBody mxEvent={pollStartEvent} {...props} />; return (
<div>
<Caption>{_t("Ended a poll")}</Caption>
<MPollBody mxEvent={pollStartEvent} {...props} />
</div>
);
}); });

View file

@ -2415,6 +2415,7 @@
"Based on %(count)s votes|other": "Based on %(count)s votes", "Based on %(count)s votes|other": "Based on %(count)s votes",
"Based on %(count)s votes|one": "Based on %(count)s vote", "Based on %(count)s votes|one": "Based on %(count)s vote",
"edited": "edited", "edited": "edited",
"Ended a poll": "Ended a poll",
"Error decrypting video": "Error decrypting video", "Error decrypting video": "Error decrypting video",
"Error processing voice message": "Error processing voice message", "Error processing voice message": "Error processing voice message",
"Add reaction": "Add reaction", "Add reaction": "Add reaction",

View file

@ -10,97 +10,104 @@ exports[`<MPollEndBody /> when poll start event does not exist in current timeli
exports[`<MPollEndBody /> when poll start event exists in current timeline renders an ended poll 1`] = ` exports[`<MPollEndBody /> when poll start event exists in current timeline renders an ended poll 1`] = `
<div> <div>
<div <div>
class="mx_MPollBody" <span
> class="mx_Caption"
<h2
data-testid="pollQuestion"
> >
Question? Ended a poll
</h2> </span>
<div <div
class="mx_MPollBody_allOptions" class="mx_MPollBody"
> >
<h2
data-testid="pollQuestion"
>
Question?
</h2>
<div <div
class="mx_PollOption mx_PollOption_ended" class="mx_MPollBody_allOptions"
data-testid="pollOption-socks"
> >
<div <div
class="mx_PollOption_endedOption" class="mx_PollOption mx_PollOption_ended"
data-value="socks" data-testid="pollOption-socks"
> >
<div <div
class="mx_PollOption_content" class="mx_PollOption_endedOption"
data-value="socks"
> >
<div <div
class="mx_PollOption_optionText" class="mx_PollOption_content"
> >
Socks <div
class="mx_PollOption_optionText"
>
Socks
</div>
<div
class="mx_PollOption_optionVoteCount"
>
0 votes
</div>
</div> </div>
</div>
<div
class="mx_PollOption_popularityBackground"
>
<div <div
class="mx_PollOption_optionVoteCount" class="mx_PollOption_popularityAmount"
> style="width: 0%;"
0 votes />
</div>
</div> </div>
</div> </div>
<div <div
class="mx_PollOption_popularityBackground" class="mx_PollOption mx_PollOption_ended"
data-testid="pollOption-shoes"
> >
<div <div
class="mx_PollOption_popularityAmount" class="mx_PollOption_endedOption"
style="width: 0%;" data-value="shoes"
/>
</div>
</div>
<div
class="mx_PollOption mx_PollOption_ended"
data-testid="pollOption-shoes"
>
<div
class="mx_PollOption_endedOption"
data-value="shoes"
>
<div
class="mx_PollOption_content"
> >
<div <div
class="mx_PollOption_optionText" class="mx_PollOption_content"
> >
Shoes <div
</div> class="mx_PollOption_optionText"
<div >
class="mx_PollOption_optionVoteCount" Shoes
> </div>
0 votes <div
class="mx_PollOption_optionVoteCount"
>
0 votes
</div>
</div> </div>
</div> </div>
</div>
<div
class="mx_PollOption_popularityBackground"
>
<div <div
class="mx_PollOption_popularityAmount" class="mx_PollOption_popularityBackground"
style="width: 0%;" >
/> <div
class="mx_PollOption_popularityAmount"
style="width: 0%;"
/>
</div>
</div> </div>
</div> </div>
</div>
<div
class="mx_MPollBody_totalVotes"
data-testid="totalVotes"
>
Final result based on 0 votes
<div <div
class="mx_Spinner" class="mx_MPollBody_totalVotes"
data-testid="totalVotes"
> >
Final result based on 0 votes
<div <div
aria-label="Loading…" class="mx_Spinner"
class="mx_Spinner_icon" >
data-testid="spinner" <div
role="progressbar" aria-label="Loading…"
style="width: 16px; height: 16px;" class="mx_Spinner_icon"
/> data-testid="spinner"
role="progressbar"
style="width: 16px; height: 16px;"
/>
</div>
</div> </div>
</div> </div>
</div> </div>