Relabel lower hand

This commit is contained in:
Half-Shot
2024-11-08 13:30:35 +00:00
parent caf2d6bb5e
commit d6d6efdff2
5 changed files with 17 additions and 7 deletions

View File

@@ -9,9 +9,11 @@
"edit": "Edit", "edit": "Edit",
"go": "Go", "go": "Go",
"invite": "Invite", "invite": "Invite",
"lower_hand": "Lower hand",
"no": "No", "no": "No",
"open_search": "Open search", "open_search": "Open search",
"pick_reaction": "Pick reaction", "pick_reaction": "Pick reaction",
"raise_hand": "Raise hand",
"raise_hand_or_send_reaction": "Raise hand or send reaction", "raise_hand_or_send_reaction": "Raise hand or send reaction",
"register": "Register", "register": "Register",
"remove": "Remove", "remove": "Remove",
@@ -53,14 +55,12 @@
"error": "Error", "error": "Error",
"home": "Home", "home": "Home",
"loading": "Loading…", "loading": "Loading…",
"lower_hand": "Lower hand",
"microphone": "Microphone", "microphone": "Microphone",
"next": "Next", "next": "Next",
"options": "Options", "options": "Options",
"password": "Password", "password": "Password",
"preferences": "Preferences", "preferences": "Preferences",
"profile": "Profile", "profile": "Profile",
"raise_hand": "Raise hand",
"search": "Search", "search": "Search",
"settings": "Settings", "settings": "Settings",
"something_went_wrong": "Something went wrong", "something_went_wrong": "Something went wrong",

View File

@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
Please see LICENSE in the repository root for full details. Please see LICENSE in the repository root for full details.
*/ */
import { fireEvent, getByLabelText, render } from "@testing-library/react"; import { fireEvent, render } from "@testing-library/react";
import { act } from "react"; import { act } from "react";
import { expect, test } from "vitest"; import { expect, test } from "vitest";
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc";
@@ -66,7 +66,7 @@ test("Can raise hand", async () => {
<TestComponent rtcSession={rtcSession} room={room} />, <TestComponent rtcSession={rtcSession} room={room} />,
); );
await user.click(getByLabelText("action.raise_hand_or_send_reaction")); await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
await user.click(getByLabelText("common.raise_hand")); await user.click(getByLabelText("action.raise_hand"));
expect(room.testSentEvents).toEqual([ expect(room.testSentEvents).toEqual([
[ [
undefined, undefined,
@@ -92,7 +92,7 @@ test("Can lower hand", async () => {
); );
const reactionEvent = room.testSendHandRaise(memberEventAlice, membership); const reactionEvent = room.testSendHandRaise(memberEventAlice, membership);
await user.click(getByLabelText("action.raise_hand_or_send_reaction")); await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
await user.click(getByLabelText("common.lower_hand")); await user.click(getByLabelText("action.lower_hand"));
expect(room.testRedactedEvents).toEqual([[undefined, reactionEvent]]); expect(room.testRedactedEvents).toEqual([[undefined, reactionEvent]]);
expect(container).toMatchSnapshot(); expect(container).toMatchSnapshot();
}); });

View File

@@ -60,6 +60,7 @@ const InnerButton: FC<InnerButtonProps> = ({ raised, open, ...props }) => {
<CpdButton <CpdButton
className={classNames(raised && styles.raisedButton)} className={classNames(raised && styles.raisedButton)}
aria-expanded={open} aria-expanded={open}
aria-haspopup
aria-label={t("action.raise_hand_or_send_reaction")} aria-label={t("action.raise_hand_or_send_reaction")}
kind={raised || open ? "primary" : "secondary"} kind={raised || open ? "primary" : "secondary"}
iconOnly iconOnly
@@ -122,7 +123,7 @@ export function ReactionPopupMenu({
}, },
[sendReaction, filteredReactionSet, canReact, setIsSearching], [sendReaction, filteredReactionSet, canReact, setIsSearching],
); );
const label = isHandRaised ? t("common.lower_hand") : t("common.raise_hand"); const label = isHandRaised ? t("action.lower_hand") : t("action.raise_hand");
return ( return (
<> <>
{errorText && ( {errorText && (

View File

@@ -8,6 +8,7 @@ exports[`Can close search 1`] = `
<button <button
aria-disabled="false" aria-disabled="false"
aria-expanded="true" aria-expanded="true"
aria-haspopup="true"
aria-label="action.raise_hand_or_send_reaction" aria-label="action.raise_hand_or_send_reaction"
aria-labelledby=":rec:" aria-labelledby=":rec:"
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59" class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
@@ -40,6 +41,7 @@ exports[`Can close search with the escape key 1`] = `
<button <button
aria-disabled="false" aria-disabled="false"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true"
aria-label="action.raise_hand_or_send_reaction" aria-label="action.raise_hand_or_send_reaction"
aria-labelledby=":rhh:" aria-labelledby=":rhh:"
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59" class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
@@ -72,6 +74,7 @@ exports[`Can lower hand 1`] = `
<button <button
aria-disabled="false" aria-disabled="false"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true"
aria-label="action.raise_hand_or_send_reaction" aria-label="action.raise_hand_or_send_reaction"
aria-labelledby=":r3i:" aria-labelledby=":r3i:"
class="_button_i91xf_17 raisedButton _has-icon_i91xf_66 _icon-only_i91xf_59" class="_button_i91xf_17 raisedButton _has-icon_i91xf_66 _icon-only_i91xf_59"
@@ -104,6 +107,7 @@ exports[`Can open menu 1`] = `
<button <button
aria-disabled="false" aria-disabled="false"
aria-expanded="true" aria-expanded="true"
aria-haspopup="true"
aria-label="action.raise_hand_or_send_reaction" aria-label="action.raise_hand_or_send_reaction"
aria-labelledby=":r0:" aria-labelledby=":r0:"
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59" class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
@@ -136,6 +140,7 @@ exports[`Can raise hand 1`] = `
<button <button
aria-disabled="false" aria-disabled="false"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true"
aria-label="action.raise_hand_or_send_reaction" aria-label="action.raise_hand_or_send_reaction"
aria-labelledby=":r1p:" aria-labelledby=":r1p:"
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59" class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
@@ -171,6 +176,7 @@ exports[`Can search for and send emoji 1`] = `
<button <button
aria-disabled="false" aria-disabled="false"
aria-expanded="true" aria-expanded="true"
aria-haspopup="true"
aria-label="action.raise_hand_or_send_reaction" aria-label="action.raise_hand_or_send_reaction"
aria-labelledby=":r74:" aria-labelledby=":r74:"
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59" class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
@@ -206,6 +212,7 @@ exports[`Can search for and send emoji with the keyboard 1`] = `
<button <button
aria-disabled="false" aria-disabled="false"
aria-expanded="true" aria-expanded="true"
aria-haspopup="true"
aria-label="action.raise_hand_or_send_reaction" aria-label="action.raise_hand_or_send_reaction"
aria-labelledby=":ra3:" aria-labelledby=":ra3:"
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59" class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"

View File

@@ -16,6 +16,7 @@ import "@formatjs/intl-durationformat/polyfill";
import { DurationFormat } from "@formatjs/intl-durationformat"; import { DurationFormat } from "@formatjs/intl-durationformat";
import { ReactionIndicator } from "./ReactionIndicator"; import { ReactionIndicator } from "./ReactionIndicator";
import { useTranslation } from "react-i18next";
const durationFormatter = new DurationFormat(undefined, { const durationFormatter = new DurationFormat(undefined, {
minutesDisplay: "always", minutesDisplay: "always",
@@ -35,6 +36,7 @@ export function RaisedHandIndicator({
showTimer?: boolean; showTimer?: boolean;
onClick?: () => void; onClick?: () => void;
}): ReactNode { }): ReactNode {
const { t } = useTranslation();
const [raisedHandDuration, setRaisedHandDuration] = useState(""); const [raisedHandDuration, setRaisedHandDuration] = useState("");
const clickCallback = useCallback<MouseEventHandler<HTMLButtonElement>>( const clickCallback = useCallback<MouseEventHandler<HTMLButtonElement>>(
@@ -83,7 +85,7 @@ export function RaisedHandIndicator({
if (onClick) { if (onClick) {
return ( return (
<button <button
aria-label="lower raised hand" aria-label={t("action.lower_hand")}
style={{ style={{
display: "contents", display: "contents",
background: "none", background: "none",