diff --git a/.changeset/strong-countries-dance.md b/.changeset/strong-countries-dance.md new file mode 100644 index 0000000000000..96dd8d70b2582 --- /dev/null +++ b/.changeset/strong-countries-dance.md @@ -0,0 +1,6 @@ +--- +'@rocket.chat/meteor': minor +--- + +feat: `Bubble` on new messages indicators +image \ No newline at end of file diff --git a/apps/meteor/app/theme/client/imports/general/base_old.css b/apps/meteor/app/theme/client/imports/general/base_old.css index 7f1ede6067fc5..6e36624432516 100644 --- a/apps/meteor/app/theme/client/imports/general/base_old.css +++ b/apps/meteor/app/theme/client/imports/general/base_old.css @@ -605,7 +605,7 @@ overflow: hidden; flex-direction: column; - margin: 5px 10px 0; + margin: 8px 10px 0; transition: transform 0.4s ease, visibility 0.3s ease, opacity 0.3s ease; transform: translateY(-10px); diff --git a/apps/meteor/client/views/room/body/JumpToRecentMessageButton.tsx b/apps/meteor/client/views/room/body/JumpToRecentMessageButton.tsx index d0b2c28000b4d..9e0f1ffd8c0ff 100644 --- a/apps/meteor/client/views/room/body/JumpToRecentMessageButton.tsx +++ b/apps/meteor/client/views/room/body/JumpToRecentMessageButton.tsx @@ -1,13 +1,13 @@ import { css } from '@rocket.chat/css-in-js'; -import { Box, Icon } from '@rocket.chat/fuselage'; -import type { ReactElement, UIEvent } from 'react'; +import { Box, Bubble } from '@rocket.chat/fuselage'; +import type { ReactElement } from 'react'; import React, { useState } from 'react'; import { isTruthy } from '../../../../lib/isTruthy'; type JumpToRecentMessageButtonProps = { visible: boolean; - onClick: (event: UIEvent) => void; + onClick: () => void; text: string; }; @@ -18,9 +18,6 @@ const buttonStyle = css` left: 50%; user-select: none; transform: translate(-50%, 0); - text-align: center; - border-radius: 20px; - cursor: pointer; &.not { visibility: hidden; @@ -47,21 +44,16 @@ const JumpToRecentMessageButton = ({ visible, onClick, text }: JumpToRecentMessa const [clicked, setClicked] = useState(false); return ( - { - onClick(e); - setClicked(true); - }} - > - {text} - + + { + onClick(); + setClicked(true); + }} + > + {text} + ); }; diff --git a/apps/meteor/client/views/room/body/RoomBody.tsx b/apps/meteor/client/views/room/body/RoomBody.tsx index 207c16e1d8057..d2722200b2df9 100644 --- a/apps/meteor/client/views/room/body/RoomBody.tsx +++ b/apps/meteor/client/views/room/body/RoomBody.tsx @@ -545,16 +545,7 @@ const RoomBody = (): ReactElement => {
-
- {unread && ( - - )} - +
{uploads.map((upload) => ( { /> ))}
+ {unread && ( + + )}
void; onMarkAsReadButtonClick: () => void; }; -const UnreadMessagesIndicator = ({ - count, - since, - onJumpButtonClick, - onMarkAsReadButtonClick, -}: UnreadMessagesIndicatorProps): ReactElement => { +const indicatorStyle = css` + position: absolute; + top: 8px; + left: 50%; + translate: -50%; + z-index: 1; +`; + +const UnreadMessagesIndicator = ({ count, onJumpButtonClick, onMarkAsReadButtonClick }: UnreadMessagesIndicatorProps): ReactElement => { const t = useTranslation(); - const formatTimeAgo = useTimeAgo(); return ( - - - {t('Jump_to_first_unread')} - - {t('S_new_messages_since_s', count, since ? formatTimeAgo(since) : undefined)} - - {t('Mark_as_read')} - - + + + {t('S_unread_messages', count)} + + ); }; diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index 4eff46efc579a..c16658c67ec26 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -4488,6 +4488,7 @@ "Running_Instances": "Running Instances", "Runtime_Environment": "Runtime Environment", "S_new_messages_since_s": "%s new messages since %s", + "S_new_messages": "%s new messages", "Same_As_Token_Sent_Via": "Same as \"Token Sent Via\"", "Same_Style_For_Mentions": "Same style for mentions", "SAML": "SAML", @@ -5363,6 +5364,7 @@ "Unread_Count_DM": "Unread Count for Direct Messages", "Unread_Count_Omni": "Unread Count for Omnichannel Chats", "Unread_Messages": "Unread Messages", + "S_unread_messages": "%s unread messages", "Unread_on_top": "Unread on top", "Unread_Rooms": "Unread Rooms", "Unread_Rooms_Mode": "Unread Rooms Mode", diff --git a/yarn.lock b/yarn.lock index 93ace4f75e010..5953649266f6b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9147,6 +9147,18 @@ __metadata: languageName: node linkType: hard +"@rocket.chat/fuselage-hooks@npm:^0.33.0": + version: 0.33.0 + resolution: "@rocket.chat/fuselage-hooks@npm:0.33.0" + dependencies: + use-sync-external-store: ~1.2.0 + peerDependencies: + "@rocket.chat/fuselage-tokens": "*" + react: ^17.0.2 + checksum: addf78db893c3185d4d5fc347e1aa81710e0939505a08db77e524740d05555c5e8556d2b6f0e6425270621bdd7230d13278add77ce38197c048af30207cce853 + languageName: node + linkType: hard + "@rocket.chat/fuselage-polyfills@npm:~0.31.25": version: 0.31.25 resolution: "@rocket.chat/fuselage-polyfills@npm:0.31.25"