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

Commit 4ff307b

Browse files
authored
Iterate io.element.late_event decoration (#11760)
* Update copy Signed-off-by: Michael Telatynski <[email protected]> * Add icon to late event timestamp Signed-off-by: Michael Telatynski <[email protected]> * Update snapshot Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent fd08e74 commit 4ff307b

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

res/css/views/messages/_MessageTimestamp.pcss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ limitations under the License.
2929
white-space: nowrap;
3030
user-select: none;
3131
}
32+
33+
.mx_MessageTimestamp_lateIcon {
34+
position: absolute;
35+
right: 100%;
36+
top: 50%;
37+
transform: translateY(-50%);
38+
color: inherit;
39+
}

res/img/sensor.svg

Lines changed: 3 additions & 0 deletions
Loading

src/components/views/messages/MessageTimestamp.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
1717

18-
import React from "react";
18+
import React, { ReactNode } from "react";
1919
import { Tooltip } from "@vector-im/compound-web";
2020

2121
import { formatFullDate, formatTime, formatFullTime, formatRelativeTime } from "../../../DateUtils";
2222
import { _t } from "../../../languageHandler";
23+
import { Icon as LateIcon } from "../../../../res/img/sensor.svg";
2324

2425
interface IProps {
2526
ts: number;
@@ -49,17 +50,20 @@ export default class MessageTimestamp extends React.Component<IProps> {
4950

5051
let label = formatFullDate(date, this.props.showTwelveHour);
5152
let caption: string | undefined;
53+
let icon: ReactNode | undefined;
5254
if (this.props.receivedTs !== undefined) {
5355
label = _t("timeline|message_timestamp_sent_at", { dateTime: label });
5456
const receivedDate = new Date(this.props.receivedTs);
5557
caption = _t("timeline|message_timestamp_received_at", {
5658
dateTime: formatFullDate(receivedDate, this.props.showTwelveHour),
5759
});
60+
icon = <LateIcon className="mx_MessageTimestamp_lateIcon" width="16" height="16" />;
5861
}
5962

6063
return (
6164
<Tooltip label={label} caption={caption}>
6265
<span className="mx_MessageTimestamp" aria-hidden={true} aria-live="off">
66+
{icon}
6367
{timestamp}
6468
</span>
6569
</Tooltip>

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3418,7 +3418,7 @@
34183418
"label": "Message Actions",
34193419
"view_in_room": "View in room"
34203420
},
3421-
"message_timestamp_received_at": "Recovered at: %(dateTime)s",
3421+
"message_timestamp_received_at": "Received at: %(dateTime)s",
34223422
"message_timestamp_sent_at": "Sent at: %(dateTime)s",
34233423
"mjolnir": {
34243424
"changed_rule_glob": "%(senderName)s updated a ban rule that was matching %(oldGlob)s to matching %(newGlob)s for %(reason)s",

test/components/views/messages/MessageTimestamp-test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("MessageTimestamp", () => {
5757
);
5858
await userEvent.hover(container.querySelector(".mx_MessageTimestamp")!);
5959
expect((await screen.findByRole("tooltip")).textContent).toMatchInlineSnapshot(
60-
`"Sent at: Fri, Dec 17, 2021, 08:09:00Recovered at: Sat, Dec 18, 2021, 08:09:00"`,
60+
`"Sent at: Fri, Dec 17, 2021, 08:09:00Received at: Sat, Dec 18, 2021, 08:09:00"`,
6161
);
6262
});
6363
});

0 commit comments

Comments
 (0)