From 367f7abba21998248a0c968f60d87fb64209e8e8 Mon Sep 17 00:00:00 2001 From: Tasso Date: Tue, 3 Sep 2024 02:51:58 -0300 Subject: [PATCH] Replace some hooks --- .../modals/PlaceChatOnHoldModal.tsx | 4 +- .../messageBox/AddLinkComposerActionModal.tsx | 4 +- .../NavBarItemOmniChannelCallDialPad.tsx | 4 +- .../NavBarItemOmnichannelCallToggleError.tsx | 4 +- ...NavBarItemOmnichannelCallToggleLoading.tsx | 4 +- .../NavBarItemOmnichannelCallToggleReady.tsx | 4 +- .../UserMenu/UserMenu.tsx | 4 +- .../apps/gameCenter/GameCenterContainer.tsx | 4 +- .../GameCenterInvitePlayersModal.tsx | 4 +- .../components/ActionManagerBusyState.tsx | 4 +- .../components/AutoCompleteDepartment.tsx | 4 +- .../AutoCompleteDepartmentMultiple.tsx | 4 +- .../components/ConfirmOwnerChangeModal.tsx | 4 +- .../Contextualbar/ContextualbarBack.tsx | 4 +- .../Contextualbar/ContextualbarClose.tsx | 4 +- .../meteor/client/components/FilterByText.tsx | 4 +- .../components/FingerprintChangeModal.tsx | 4 +- .../FingerprintChangeModalConfirmation.tsx | 4 +- .../components/GenericError/GenericError.tsx | 4 +- .../components/GenericMenu/GenericMenu.tsx | 10 ++-- .../components/GenericModal/GenericModal.tsx | 4 +- .../GenericNoResults/GenericNoResults.tsx | 4 +- .../hooks/useItemsPerPageLabel.ts | 4 +- .../hooks/useShowingResultsLabel.ts | 10 ++-- .../GenericUpsellModal/GenericUpsellModal.tsx | 4 +- .../components/ImageGallery/ImageGallery.tsx | 4 +- .../ImageGallery/ImageGalleryError.tsx | 4 +- .../ImageGallery/ImageGalleryLoading.tsx | 4 +- .../InfoPanel/RetentionPolicyCallout.tsx | 4 +- apps/meteor/client/components/LocalTime.tsx | 4 +- .../meteor/client/components/MarkdownText.tsx | 4 +- .../modals/ReturnChatQueueModal.tsx | 4 +- .../Omnichannel/modals/TranscriptModal.tsx | 4 +- .../client/components/Sidebar/Header.tsx | 4 +- .../Sidebar/SidebarItemsAssembler.tsx | 6 +-- .../SidebarToggler/SidebarTogglerButton.tsx | 4 +- apps/meteor/client/components/TextCopy.tsx | 4 +- .../TwoFactorModal/TwoFactorPasswordModal.tsx | 4 +- .../TwoFactorModal/TwoFactorTotpModal.tsx | 4 +- .../client/components/UrlChangeModal.tsx | 9 ++-- .../client/components/UserCard/UserCard.tsx | 4 +- .../client/components/UserInfo/UserInfo.tsx | 4 +- .../meteor/client/components/WarningModal.tsx | 4 +- .../components/dashboards/PeriodSelector.tsx | 6 +-- .../client/components/dashboards/periods.ts | 23 ++++------ .../components/dashboards/usePeriodLabel.ts | 6 +-- .../DeviceManagementTable.tsx | 4 +- .../deviceManagement/LoggedOutBanner.tsx | 4 +- .../components/message/IgnoredContent.tsx | 4 +- .../components/message/MessageHeader.tsx | 4 +- .../message/ReadReceiptIndicator.tsx | 4 +- .../message/content/BroadcastMetrics.tsx | 4 +- .../message/content/DiscussionMetrics.tsx | 4 +- .../components/message/content/Reactions.tsx | 4 +- .../message/content/actions/MessageAction.tsx | 4 +- .../structure/AttachmentDownloadBase.tsx | 4 +- .../attachments/structure/image/Load.tsx | 4 +- .../attachments/structure/image/Retry.tsx | 4 +- .../collapsible/CollapsibleContent.tsx | 4 +- .../content/location/MapViewFallback.tsx | 4 +- .../message/content/location/MapViewImage.tsx | 4 +- .../content/reactions/ReactionTooltip.tsx | 4 +- .../content/urlPreviews/OEmbedCollapsible.tsx | 4 +- .../message/header/MessageRoles.tsx | 4 +- .../notification/MessageNotification.tsx | 4 +- .../message/toolbar/MessageActionMenu.tsx | 4 +- .../message/variants/SystemMessage.tsx | 4 +- .../message/variants/ThreadMessagePreview.tsx | 4 +- .../ThreadMessagePreviewBody.tsx | 4 +- .../components/voip/room/VoipRoomForeword.tsx | 4 +- .../client/hooks/useDecryptedMessage.ts | 4 +- apps/meteor/client/hooks/useFormatDuration.ts | 4 +- .../meteor/client/hooks/useHighlightedCode.ts | 4 +- .../additionalForms/BusinessHoursMultiple.tsx | 4 +- .../additionalForms/ContactManager.js | 4 +- .../CustomFieldsAdditionalForm.tsx | 4 +- .../additionalForms/DepartmentForwarding.tsx | 4 +- .../additionalForms/MaxChatsPerAgent.tsx | 4 +- .../MaxChatsPerAgentDisplay.tsx | 4 +- .../additionalForms/PrioritiesSelect.tsx | 4 +- .../CannedResponseEditWithDepartmentData.tsx | 4 +- .../cannedResponses/CannedResponseFilter.tsx | 4 +- .../InsertPlaceholderDropdown.tsx | 4 +- .../CannedResponse/CannedResponse.tsx | 4 +- .../CannedResponse/CannedResponseList.tsx | 4 +- .../contextualBar/CannedResponse/Item.tsx | 4 +- .../components/RoomActivityIcon/index.tsx | 4 +- .../client/omnichannel/hooks/useScopeDict.ts | 4 +- .../omnichannel/monitors/MonitorsPage.tsx | 4 +- .../priorities/PrioritiesResetModal.tsx | 4 +- .../priorities/PrioritiesTable.tsx | 4 +- .../priorities/PriorityEditFormWithData.tsx | 4 +- .../omnichannel/priorities/PriorityIcon.tsx | 4 +- .../omnichannel/priorities/PriorityList.tsx | 4 +- .../reports/components/AgentsTable.tsx | 4 +- .../components/ReportCardEmptyState.tsx | 4 +- .../components/ReportCardErrorState.tsx | 4 +- .../reports/hooks/useAgentsSection.tsx | 5 +- .../reports/hooks/useChannelsSection.tsx | 12 +++-- .../reports/hooks/useDefaultDownload.tsx | 4 +- .../reports/hooks/useDepartmentsSection.tsx | 5 +- .../reports/hooks/useStatusSection.tsx | 10 ++-- .../reports/hooks/useTagsSection.tsx | 5 +- .../reports/sections/AgentsSection.tsx | 4 +- .../reports/utils/formatPeriodDescription.tsx | 6 +-- .../tags/AutoCompleteTagsMultiple.tsx | 4 +- .../sidebar/RoomList/RoomListWrapper.tsx | 4 +- .../sidebar/footer/SidebarFooterWatermark.tsx | 4 +- .../client/sidebar/footer/voip/VoipFooter.tsx | 4 +- .../FederatedRoomListEmptyPlaceholder.tsx | 4 +- .../FederatedRoomListErrorBoundary.tsx | 4 +- .../FederatedRoomListItem.tsx | 4 +- .../MatrixFederationSearch.tsx | 4 +- .../meteor/client/sidebar/header/UserMenu.tsx | 4 +- .../sidebar/header/actions/Administration.tsx | 4 +- .../sidebar/header/actions/CreateRoom.tsx | 4 +- .../client/sidebar/header/actions/Sort.tsx | 4 +- .../actions/hooks/useAdministrationMenu.tsx | 4 +- .../hooks/useMatrixFederationItems.tsx.tsx | 4 +- .../header/actions/hooks/useSortMenu.tsx | 4 +- .../sidebar/sections/OverMacLimitSection.tsx | 4 +- .../sections/StatusDisabledSection.tsx | 4 +- .../actions/OmnichannelCallDialPad.tsx | 4 +- .../actions/OmnichannelCallToggleError.tsx | 4 +- .../actions/OmnichannelCallToggleLoading.tsx | 4 +- .../actions/OmnichannelCallToggleReady.tsx | 4 +- .../sidebarv2/RoomList/RoomListWrapper.tsx | 4 +- .../footer/SidebarFooterWatermark.tsx | 4 +- .../sidebarv2/footer/voip/VoipFooter.tsx | 4 +- .../FederatedRoomListEmptyPlaceholder.tsx | 4 +- .../FederatedRoomListErrorBoundary.tsx | 4 +- .../FederatedRoomListItem.tsx | 4 +- .../MatrixFederationSearch.tsx | 4 +- .../sidebarv2/header/actions/CreateRoom.tsx | 4 +- .../client/sidebarv2/header/actions/Sort.tsx | 4 +- .../actions/hooks/useMatrixFederationItems.ts | 4 +- .../header/actions/hooks/useSortMenu.tsx | 4 +- .../sections/StatusDisabledSection.tsx | 4 +- .../DeviceManagementAccountPage.tsx | 4 +- .../DeviceManagementAccountRow.tsx | 4 +- .../DeviceManagementAccountTable.tsx | 4 +- .../AccountFeaturePreviewBadge.tsx | 4 +- .../omnichannel/PreferencesGeneral.tsx | 4 +- .../views/account/preferences/MyDataModal.tsx | 4 +- .../PreferencesHighlightsSection.tsx | 4 +- .../PreferencesMessagesSection.tsx | 4 +- .../PreferencesUserPresenceSection.tsx | 4 +- .../account/profile/ActionConfirmModal.tsx | 4 +- .../account/security/BackupCodesModal.tsx | 4 +- .../account/tokens/AccountTokensPage.tsx | 4 +- .../AccountTokensTable/AccountTokensRow.tsx | 4 +- .../admin/customEmoji/AddCustomEmoji.tsx | 4 +- .../CustomUserActiveConnections.tsx | 4 +- .../CustomUserStatusDisabledModal.tsx | 4 +- .../DeviceManagementAdminTable.tsx | 4 +- .../DeviceManagementInfoWithData.tsx | 4 +- .../EngagementDashboardCardErrorBoundary.tsx | 4 +- .../EngagementDashboardPage.tsx | 4 +- .../channels/ChannelsOverview.tsx | 9 ++-- .../messages/MessagesPerChannelSection.tsx | 4 +- .../messages/MessagesSentSection.tsx | 4 +- .../messages/MessagesTab.tsx | 4 +- .../users/ActiveUsersSection.tsx | 4 +- .../users/BusiestChatTimesSection.tsx | 4 +- .../users/ContentForHours.tsx | 4 +- .../users/NewUsersSection.tsx | 4 +- .../users/UsersByTimeOfTheDaySection.tsx | 4 +- .../engagementDashboard/users/UsersTab.tsx | 4 +- .../FederationDashboardPage.tsx | 4 +- .../views/admin/import/PrepareChannels.tsx | 10 ++-- .../views/admin/import/PrepareUsers.tsx | 10 ++-- .../views/admin/integrations/NewBot.tsx | 4 +- .../views/admin/integrations/NewZapier.tsx | 4 +- .../outgoing/OutgoingWebhookForm.tsx | 14 ++++-- .../outgoing/history/HistoryContent.tsx | 4 +- .../admin/moderation/MessageContextFooter.tsx | 4 +- .../moderation/ModerationConsoleActions.tsx | 4 +- .../UserReports/ModConsoleUserActions.tsx | 4 +- .../UserReports/UserContextFooter.tsx | 4 +- .../moderation/helpers/DateRangePicker.tsx | 4 +- .../moderation/helpers/ModerationFilter.tsx | 4 +- .../helpers/ReportReasonCollapsible.tsx | 4 +- .../permissions/CustomRoleUpsellModal.tsx | 4 +- .../PermissionsTable/PermissionRow.tsx | 7 +-- .../PermissionsTableFilter.tsx | 4 +- .../views/admin/permissions/RoleForm.tsx | 4 +- .../UsersInRoleTable/UsersInRoleTableRow.tsx | 4 +- .../views/admin/rooms/RoomsTableFilters.tsx | 4 +- .../ResetSettingButton/ResetSettingButton.tsx | 4 +- .../inputs/CodeMirror/CodeMirrorBox.tsx | 4 +- .../Setting/inputs/ColorSettingInput.tsx | 4 +- .../inputs/MultiSelectSettingInput.tsx | 4 +- .../Setting/inputs/SelectSettingInput.tsx | 4 +- .../Setting/inputs/TimespanSettingInput.tsx | 8 ++-- .../SettingsSection/SettingsSection.tsx | 4 +- .../OAuthGroupPage/CreateOAuthModal.tsx | 4 +- .../admin/settings/groups/TabbedGroupPage.tsx | 4 +- .../admin/users/AdminUserFormWithData.tsx | 4 +- .../AdminUserSetRandomPasswordRadios.tsx | 4 +- .../users/SeatsCapUsage/SeatsCapUsage.tsx | 4 +- .../admin/users/UsersTable/UsersTableRow.tsx | 4 +- .../views/admin/viewLogs/AnalyticsReports.tsx | 4 +- .../views/admin/viewLogs/ViewLogsPage.tsx | 4 +- .../InstancesModal/InstancesModal.tsx | 4 +- .../MessagesRoomsCard/MessagesRoomsCard.tsx | 4 +- .../views/admin/workspace/WorkspacePage.tsx | 4 +- .../client/views/audit/AuditLogPage.tsx | 4 +- apps/meteor/client/views/audit/AuditPage.tsx | 4 +- .../audit/components/AuditFiltersDisplay.tsx | 4 +- .../views/audit/components/AuditForm.tsx | 4 +- .../views/audit/components/AuditLogEntry.tsx | 4 +- .../components/forms/DateRangePicker.tsx | 4 +- .../views/audit/components/tabs/DirectTab.tsx | 4 +- .../audit/components/tabs/OmnichannelTab.tsx | 4 +- .../views/audit/components/tabs/RoomsTab.tsx | 4 +- .../views/audit/components/tabs/UsersTab.tsx | 4 +- .../AudioMessageRecorder.tsx | 4 +- .../composer/EmojiPicker/EmojiCategoryRow.tsx | 4 +- .../EmojiPicker/EmojiPickerCategoryItem.tsx | 4 +- .../composer/EmojiPicker/SearchingResult.tsx | 4 +- .../client/views/directory/RoomTags.tsx | 4 +- .../views/e2e/EnterE2EPasswordModal.tsx | 4 +- .../client/views/e2e/SaveE2EPasswordModal.tsx | 4 +- .../views/home/cards/DesktopAppsCard.tsx | 4 +- .../views/home/cards/DocumentationCard.tsx | 4 +- .../views/home/cards/MobileAppsCard.tsx | 4 +- .../AppDetailsPage/AppDetailsPageHeader.tsx | 4 +- .../tabs/AppDetails/AppDetails.tsx | 4 +- .../AppDetailsPage/tabs/AppLogs/AppLogs.tsx | 4 +- .../tabs/AppLogs/AppLogsItem.tsx | 4 +- .../tabs/AppLogs/AppLogsItemEntry.tsx | 4 +- .../tabs/AppReleases/AppReleasesItem.tsx | 4 +- .../tabs/AppSecurity/AppSecurity.tsx | 4 +- .../tabs/AppSettings/AppSettings.tsx | 4 +- .../tabs/AppStatus/AppStatusPriceDisplay.tsx | 6 +-- .../client/views/marketplace/AppMenu.tsx | 4 +- .../marketplace/AppPermissionsReviewModal.tsx | 4 +- .../views/marketplace/AppUpdateModal.tsx | 4 +- .../marketplace/AppsPage/AppsFilters.tsx | 4 +- .../AppsPage/AppsPageConnectionError.tsx | 4 +- .../AppsPage/AppsPageContentBody.tsx | 4 +- .../AppsPage/FeaturedAppsSections.tsx | 6 +-- .../AppsPage/NoAppRequestsEmptyState.tsx | 4 +- .../NoInstalledAppMatchesEmptyState.tsx | 4 +- .../AppsPage/NoInstalledAppsEmptyState.tsx | 4 +- ...etplaceOrInstalledAppMatchesEmptyState.tsx | 4 +- .../AppsPage/PrivateEmptyState.tsx | 4 +- .../client/views/marketplace/BundleChips.tsx | 4 +- .../client/views/marketplace/IframeModal.tsx | 4 +- .../marketplace/UnlimitedAppsUpsellModal.tsx | 4 +- .../AppInstallModal/AppInstallModal.tsx | 4 +- .../components/AppPermissionsList.tsx | 4 +- .../CategoryFilter/CategoryDropDownAnchor.tsx | 4 +- .../components/EnabledAppsCount.tsx | 4 +- .../UninstallGrandfatheredAppModal.tsx | 4 +- .../views/marketplace/hooks/useCategories.ts | 4 +- .../views/notAuthorized/NotAuthorizedPage.tsx | 4 +- .../client/views/notFound/NotFoundPage.tsx | 4 +- .../agents/AgentsTable/AgentsTable.tsx | 4 +- .../omnichannel/analytics/AnalyticsPage.tsx | 6 +-- .../omnichannel/analytics/DateRangePicker.tsx | 4 +- .../appearance/AppearanceFieldLabel.tsx | 4 +- .../omnichannel/appearance/AppearanceForm.tsx | 4 +- .../businessHours/BusinessHoursForm.tsx | 4 +- .../contactHistory/ContactHistoryItem.tsx | 4 +- .../contactHistory/ContactHistoryList.tsx | 4 +- .../MessageList/ContactHistoryMessage.tsx | 4 +- .../DepartmentAgentsTable/AgentRow.tsx | 4 +- .../DepartmentAgentsTable.tsx | 4 +- .../departments/DepartmentTags.tsx | 4 +- .../directory/calls/CallTableRow.tsx | 4 +- .../calls/contextualBar/VoipInfo.tsx | 4 +- .../contextualBar/VoipInfoCallButton.tsx | 4 +- .../chats/contextualBar/DepartmentField.tsx | 4 +- .../RoomEdit/RoomEditWithData.tsx | 4 +- .../chats/contextualBar/VisitorClientInfo.js | 4 +- .../components/CallDialpadButton.tsx | 4 +- .../directory/components/PriorityField.tsx | 4 +- .../directory/components/SlaField.tsx | 4 +- .../directory/components/SourceField.tsx | 4 +- .../contextualBar/ContactEditWithData.js | 4 +- .../omnichannel/queueList/QueueListFilter.tsx | 4 +- .../omnichannel/queueList/QueueListPage.tsx | 4 +- .../RealTimeMonitoringPage.js | 4 +- .../charts/AgentStatusChart.tsx | 9 ++-- .../charts/ChatDurationChart.js | 4 +- .../realTimeMonitoring/charts/ChatsChart.tsx | 9 ++-- .../charts/ChatsPerAgentChart.js | 4 +- .../charts/ChatsPerDepartmentChart.js | 4 +- .../charts/ResponseTimesChart.js | 4 +- .../charts/useUpdateChartData.ts | 6 +-- .../counter/CounterContainer.tsx | 4 +- .../omnichannel/triggers/ConditionForm.tsx | 4 +- .../triggers/actions/ActionForm.tsx | 4 +- .../triggers/actions/ActionSender.tsx | 4 +- .../actions/ExternalServiceActionForm.tsx | 4 +- .../actions/SendMessageActionForm.tsx | 4 +- .../OutlookSettingItem.tsx | 4 +- .../views/room/E2EESetup/RoomE2EESetup.tsx | 4 +- .../QuickActions/QuickActionOptions.tsx | 4 +- .../Omnichannel/QuickActions/QuickActions.tsx | 4 +- .../client/views/room/Header/RoomHeader.tsx | 4 +- .../RoomToolbox/RoomToolboxE2EESetup.tsx | 4 +- .../QuickActions/QuickActionOptions.tsx | 4 +- .../Omnichannel/QuickActions/QuickActions.tsx | 4 +- .../client/views/room/HeaderV2/RoomHeader.tsx | 4 +- .../client/views/room/HeaderV2/RoomLeader.tsx | 4 +- .../RoomToolbox/RoomToolboxE2EESetup.tsx | 4 +- .../MessageList/MessageListErrorBoundary.tsx | 4 +- .../room/MessageList/MessageListItem.tsx | 4 +- .../views/room/body/DropTargetOverlay.tsx | 4 +- .../body/ErroredUploadProgressIndicator.tsx | 4 +- .../client/views/room/body/LeaderBar.tsx | 4 +- .../room/body/RetentionPolicyWarning.tsx | 4 +- .../room/body/RoomForeword/RoomForeword.tsx | 4 +- .../room/body/UnreadMessagesIndicator.tsx | 4 +- .../room/body/UploadProgressIndicator.tsx | 4 +- .../views/room/composer/ComposerArchived.tsx | 4 +- .../views/room/composer/ComposerBlocked.tsx | 4 +- .../views/room/composer/ComposerBoxPopup.tsx | 4 +- .../composer/ComposerBoxPopupSlashCommand.tsx | 4 +- .../room/composer/ComposerBoxPopupUser.tsx | 4 +- .../ComposerFederationDisabled.tsx | 4 +- .../ComposerFederationJoinRoomDisabled.tsx | 4 +- .../ComposerOmnichannelOnHold.tsx | 4 +- .../ComposerUserActionIndicator.tsx | 4 +- .../views/room/composer/ComposerVoIP.tsx | 4 +- .../FormattingToolbarDropdown.tsx | 4 +- .../MessageBoxFormattingToolbar.tsx | 4 +- .../messageBox/hooks/useMediaActionTitle.ts | 4 +- .../AutoTranslate/AutoTranslate.tsx | 4 +- .../Discussions/DiscussionsListRow.tsx | 4 +- .../components/DiscussionsListItem.tsx | 4 +- .../ExportMessages/ExportMessages.tsx | 4 +- .../ExportMessages/FileExport.tsx | 4 +- .../ExportMessages/MailExportForm.tsx | 4 +- .../ChannelToTeamConfirmation.tsx | 4 +- .../ChannelToTeamSelection.tsx | 4 +- .../contextualBar/Info/RoomInfo/RoomInfo.tsx | 4 +- .../Info/hooks/useRoomActions.ts | 4 +- .../KeyboardShortcuts/KeyboardShortcuts.tsx | 4 +- .../MessageSearchTab/MessageSearchTab.tsx | 4 +- .../components/MessageSearchForm.tsx | 4 +- .../NotificationPreferences.tsx | 4 +- .../NotificationPreferencesForm.tsx | 4 +- .../views/room/contextualBar/OTR/OTR.tsx | 4 +- .../OTR/components/OTREstablished.tsx | 4 +- .../OTR/components/OTRStates.tsx | 4 +- .../PruneMessages/PruneMessages.tsx | 4 +- .../contextualBar/RoomFiles/RoomFiles.tsx | 4 +- .../InviteUsers/EditInviteLink.tsx | 4 +- .../RoomMembers/InviteUsers/InviteLink.tsx | 4 +- .../RoomMembers/InviteUsers/InviteUsers.tsx | 4 +- .../RoomMembers/RoomMembersActions.tsx | 4 +- .../Threads/components/ThreadListMessage.tsx | 4 +- .../Threads/components/ThreadMessageItem.tsx | 4 +- .../UserInfo/UserInfoActions.tsx | 4 +- .../VideoConference/VideoConfConfigModal.tsx | 4 +- .../VideoConfList/VideoConfList.tsx | 4 +- .../VideoConfPopup/IncomingPopup.tsx | 4 +- .../VideoConfPopup/OutgoingPopup.tsx | 4 +- .../VideoConfPopup/StartCallPopup.tsx | 4 +- .../modals/FileUploadModal/MediaPreview.tsx | 4 +- .../ReactionListModal/ReactionListModal.tsx | 4 +- .../FilePickerBreadcrumbs.tsx | 4 +- .../WebdavFilePickerTable.tsx | 4 +- .../ChannelDesertionTable.tsx | 4 +- .../ModalSteps/FirstStep.tsx | 4 +- .../ModalSteps/SecondStep.tsx | 4 +- .../channels/TeamsChannelItemMenu.tsx | 4 +- .../contextualBar/channels/TeamsChannels.tsx | 4 +- .../ChannelDeletionTable.tsx | 4 +- .../info/DeleteTeam/DeleteTeamChannels.tsx | 4 +- .../DeleteTeam/DeleteTeamConfirmation.tsx | 4 +- .../LeaveTeamModal/LeaveTeamModalChannels.tsx | 4 +- .../LeaveTeamModalConfirmation.tsx | 4 +- .../teams/contextualBar/info/TeamsInfo.tsx | 4 +- .../RemoveUsersModal/RemoveUsersFirstStep.js | 4 +- .../RemoveUsersModal/RemoveUsersSecondStep.js | 4 +- .../client/voip/modal/DialPad/DialInput.tsx | 4 +- .../voip/modal/DialPad/hooks/useDialPad.tsx | 4 +- packages/gazzodown/package.json | 46 ++++++++++--------- packages/gazzodown/src/elements/LinkSpan.tsx | 4 +- packages/gazzodown/src/elements/PlainSpan.tsx | 4 +- .../src/mentions/ChannelMentionElement.tsx | 4 +- .../src/mentions/UserMentionElement.tsx | 4 +- packages/i18n/src/index.mjs | 4 ++ packages/ui-client/package.json | 36 ++++++++------- .../src/components/CustomFieldsForm.tsx | 4 +- .../MultiSelectCustomAnchor.tsx | 4 +- .../MultiSelectCustomList.tsx | 4 +- .../MultiSelectCustom/useFilteredOptions.tsx | 4 +- .../src/components/UserStatus/UserStatus.tsx | 4 +- packages/web-ui-registration/package.json | 6 +-- .../src/SecretRegisterInvalidForm.tsx | 4 +- yarn.lock | 8 +++- 396 files changed, 909 insertions(+), 868 deletions(-) diff --git a/apps/meteor/app/livechat-enterprise/client/components/modals/PlaceChatOnHoldModal.tsx b/apps/meteor/app/livechat-enterprise/client/components/modals/PlaceChatOnHoldModal.tsx index 41af8a22b6bbc..58ede259fb458 100644 --- a/apps/meteor/app/livechat-enterprise/client/components/modals/PlaceChatOnHoldModal.tsx +++ b/apps/meteor/app/livechat-enterprise/client/components/modals/PlaceChatOnHoldModal.tsx @@ -1,6 +1,6 @@ import { Button, Modal } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React from 'react'; +import { useTranslation } from 'react-i18next'; type PlaceChatOnHoldModalProps = { onOnHoldChat: () => void; @@ -9,7 +9,7 @@ type PlaceChatOnHoldModalProps = { }; const PlaceChatOnHoldModal = ({ onCancel, onOnHoldChat, confirm = onOnHoldChat, ...props }: PlaceChatOnHoldModalProps) => { - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/app/ui-message/client/messageBox/AddLinkComposerActionModal.tsx b/apps/meteor/app/ui-message/client/messageBox/AddLinkComposerActionModal.tsx index 420bf93df66d5..21e502c90001a 100644 --- a/apps/meteor/app/ui-message/client/messageBox/AddLinkComposerActionModal.tsx +++ b/apps/meteor/app/ui-message/client/messageBox/AddLinkComposerActionModal.tsx @@ -1,8 +1,8 @@ import { Field, FieldGroup, TextInput, FieldLabel, FieldRow, Box } from '@rocket.chat/fuselage'; import { useUniqueId } from '@rocket.chat/fuselage-hooks'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React, { useEffect } from 'react'; import { useForm, Controller } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; import GenericModal from '../../../../client/components/GenericModal'; @@ -13,7 +13,7 @@ type AddLinkComposerActionModalProps = { }; const AddLinkComposerActionModal = ({ selectedText, onClose, onConfirm }: AddLinkComposerActionModalProps) => { - const t = useTranslation(); + const { t } = useTranslation(); const textField = useUniqueId(); const urlField = useUniqueId(); diff --git a/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmniChannelCallDialPad.tsx b/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmniChannelCallDialPad.tsx index af9b907df12e6..2693060578ed2 100644 --- a/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmniChannelCallDialPad.tsx +++ b/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmniChannelCallDialPad.tsx @@ -1,7 +1,7 @@ import { NavBarItem } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentPropsWithoutRef } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import { useVoipOutboundStates } from '../../contexts/CallContext'; import { useDialModal } from '../../hooks/useDialModal'; @@ -9,7 +9,7 @@ import { useDialModal } from '../../hooks/useDialModal'; type NavBarItemOmniChannelCallDialPadProps = ComponentPropsWithoutRef; const NavBarItemOmniChannelCallDialPad = (props: NavBarItemOmniChannelCallDialPadProps) => { - const t = useTranslation(); + const { t } = useTranslation(); const { openDialModal } = useDialModal(); diff --git a/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleError.tsx b/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleError.tsx index cf4e7ec240b41..7f2b6adc86919 100644 --- a/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleError.tsx +++ b/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleError.tsx @@ -1,12 +1,12 @@ import { NavBarItem } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentPropsWithoutRef } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; type NavBarItemOmnichannelCallToggleErrorProps = ComponentPropsWithoutRef; const NavBarItemOmnichannelCallToggleError = (props: NavBarItemOmnichannelCallToggleErrorProps) => { - const t = useTranslation(); + const { t } = useTranslation(); return ; }; diff --git a/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleLoading.tsx b/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleLoading.tsx index c4b53acefabbc..149500050402b 100644 --- a/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleLoading.tsx +++ b/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleLoading.tsx @@ -1,12 +1,12 @@ import { NavBarItem } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentPropsWithoutRef } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; type NavBarItemOmnichannelCallToggleLoadingProps = ComponentPropsWithoutRef; const NavBarItemOmnichannelCallToggleLoading = (props: NavBarItemOmnichannelCallToggleLoadingProps) => { - const t = useTranslation(); + const { t } = useTranslation(); return ; }; diff --git a/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleReady.tsx b/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleReady.tsx index 8b51fc6c5b579..82f1c28350cd7 100644 --- a/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleReady.tsx +++ b/apps/meteor/client/NavBarV2/NavBarOmnichannelToolbar/NavBarItemOmnichannelCallToggleReady.tsx @@ -1,14 +1,14 @@ import { NavBarItem } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentPropsWithoutRef } from 'react'; import React, { useCallback } from 'react'; +import { useTranslation } from 'react-i18next'; import { useCallerInfo, useCallRegisterClient, useCallUnregisterClient, useVoipNetworkStatus } from '../../contexts/CallContext'; type NavBarItemOmnichannelCallToggleReadyProps = ComponentPropsWithoutRef; const NavBarItemOmnichannelCallToggleReady = (props: NavBarItemOmnichannelCallToggleReadyProps) => { - const t = useTranslation(); + const { t } = useTranslation(); const caller = useCallerInfo(); const unregister = useCallUnregisterClient(); diff --git a/apps/meteor/client/NavBarV2/NavBarSettingsToolbar/UserMenu/UserMenu.tsx b/apps/meteor/client/NavBarV2/NavBarSettingsToolbar/UserMenu/UserMenu.tsx index 531ff8a74b663..343be9387a54b 100644 --- a/apps/meteor/client/NavBarV2/NavBarSettingsToolbar/UserMenu/UserMenu.tsx +++ b/apps/meteor/client/NavBarV2/NavBarSettingsToolbar/UserMenu/UserMenu.tsx @@ -1,7 +1,7 @@ import type { IUser } from '@rocket.chat/core-typings'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentProps } from 'react'; import React, { memo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import GenericMenu from '../../../components/GenericMenu/GenericMenu'; import type { GenericMenuItemProps } from '../../../components/GenericMenu/GenericMenuItem'; @@ -12,7 +12,7 @@ import { useUserMenu } from './hooks/useUserMenu'; type UserMenuProps = { user: IUser } & Omit, 'sections' | 'items' | 'title'>; const UserMenu = function UserMenu({ user, ...props }: UserMenuProps) { - const t = useTranslation(); + const { t } = useTranslation(); const [isOpen, setIsOpen] = useState(false); const sections = useUserMenu(user); diff --git a/apps/meteor/client/apps/gameCenter/GameCenterContainer.tsx b/apps/meteor/client/apps/gameCenter/GameCenterContainer.tsx index f589dd21ed502..dbaea02ace4a4 100644 --- a/apps/meteor/client/apps/gameCenter/GameCenterContainer.tsx +++ b/apps/meteor/client/apps/gameCenter/GameCenterContainer.tsx @@ -1,7 +1,7 @@ import { Avatar } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import { ContextualbarTitle, @@ -19,7 +19,7 @@ interface IGameCenterContainerProps { } const GameCenterContainer = ({ handleClose, handleBack, game }: IGameCenterContainerProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); return ( <> diff --git a/apps/meteor/client/apps/gameCenter/GameCenterInvitePlayersModal.tsx b/apps/meteor/client/apps/gameCenter/GameCenterInvitePlayersModal.tsx index d0dcc6fad4fee..871e82f3ff565 100644 --- a/apps/meteor/client/apps/gameCenter/GameCenterInvitePlayersModal.tsx +++ b/apps/meteor/client/apps/gameCenter/GameCenterInvitePlayersModal.tsx @@ -1,8 +1,8 @@ import type { IUser } from '@rocket.chat/core-typings'; import { Box } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import GenericModal from '../../components/GenericModal'; import UserAutoCompleteMultipleFederated from '../../components/UserAutoCompleteMultiple/UserAutoCompleteMultipleFederated'; @@ -19,7 +19,7 @@ interface IGameCenterInvitePlayersModalProps { } const GameCenterInvitePlayersModal = ({ game, onClose }: IGameCenterInvitePlayersModalProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); const [users, setUsers] = useState>([]); const { name } = game; diff --git a/apps/meteor/client/components/ActionManagerBusyState.tsx b/apps/meteor/client/components/ActionManagerBusyState.tsx index 1399c045271f7..932eb08ea5025 100644 --- a/apps/meteor/client/components/ActionManagerBusyState.tsx +++ b/apps/meteor/client/components/ActionManagerBusyState.tsx @@ -1,12 +1,12 @@ import { css } from '@rocket.chat/css-in-js'; import { Box } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React, { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { useUiKitActionManager } from '../uikit/hooks/useUiKitActionManager'; const ActionManagerBusyState = () => { - const t = useTranslation(); + const { t } = useTranslation(); const actionManager = useUiKitActionManager(); const [busy, setBusy] = useState(false); diff --git a/apps/meteor/client/components/AutoCompleteDepartment.tsx b/apps/meteor/client/components/AutoCompleteDepartment.tsx index 6217f1d996109..0c50f2254aace 100644 --- a/apps/meteor/client/components/AutoCompleteDepartment.tsx +++ b/apps/meteor/client/components/AutoCompleteDepartment.tsx @@ -1,8 +1,8 @@ import { PaginatedSelectFiltered } from '@rocket.chat/fuselage'; import { useDebouncedValue } from '@rocket.chat/fuselage-hooks'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentProps, ReactElement } from 'react'; import React, { memo, useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { useRecordList } from '../hooks/lists/useRecordList'; import { AsyncStatePhase } from '../hooks/useAsyncState'; @@ -28,7 +28,7 @@ const AutoCompleteDepartment = ({ showArchived = false, ...props }: AutoCompleteDepartmentProps): ReactElement | null => { - const t = useTranslation(); + const { t } = useTranslation(); const [departmentsFilter, setDepartmentsFilter] = useState(''); const debouncedDepartmentsFilter = useDebouncedValue(departmentsFilter, 500); diff --git a/apps/meteor/client/components/AutoCompleteDepartmentMultiple.tsx b/apps/meteor/client/components/AutoCompleteDepartmentMultiple.tsx index 99af9a1f6a2c2..c15d480f39001 100644 --- a/apps/meteor/client/components/AutoCompleteDepartmentMultiple.tsx +++ b/apps/meteor/client/components/AutoCompleteDepartmentMultiple.tsx @@ -1,9 +1,9 @@ import { CheckOption, PaginatedMultiSelectFiltered } from '@rocket.chat/fuselage'; import type { PaginatedMultiSelectOption } from '@rocket.chat/fuselage'; import { useDebouncedValue } from '@rocket.chat/fuselage-hooks'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentProps } from 'react'; import React, { memo, useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { useRecordList } from '../hooks/lists/useRecordList'; import { AsyncStatePhase } from '../hooks/useAsyncState'; @@ -24,7 +24,7 @@ const AutoCompleteDepartmentMultiple = ({ enabled = false, onChange = () => undefined, }: AutoCompleteDepartmentMultipleProps) => { - const t = useTranslation(); + const { t } = useTranslation(); const [departmentsFilter, setDepartmentsFilter] = useState(''); const debouncedDepartmentsFilter = useDebouncedValue(departmentsFilter, 500); diff --git a/apps/meteor/client/components/ConfirmOwnerChangeModal.tsx b/apps/meteor/client/components/ConfirmOwnerChangeModal.tsx index 349341baf0034..77135fad6230f 100644 --- a/apps/meteor/client/components/ConfirmOwnerChangeModal.tsx +++ b/apps/meteor/client/components/ConfirmOwnerChangeModal.tsx @@ -1,7 +1,7 @@ import { Box } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentPropsWithoutRef } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import GenericModal from './GenericModal'; import RawText from './RawText'; @@ -20,7 +20,7 @@ const ConfirmOwnerChangeModal = ({ onConfirm, onCancel, }: ConfirmOwnerChangeModalProps) => { - const t = useTranslation(); + const { t } = useTranslation(); let changeOwnerRooms = ''; if (shouldChangeOwner.length > 0) { diff --git a/apps/meteor/client/components/Contextualbar/ContextualbarBack.tsx b/apps/meteor/client/components/Contextualbar/ContextualbarBack.tsx index c8e17ab88d80c..dcac448b1e922 100644 --- a/apps/meteor/client/components/Contextualbar/ContextualbarBack.tsx +++ b/apps/meteor/client/components/Contextualbar/ContextualbarBack.tsx @@ -1,13 +1,13 @@ -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement, ComponentProps } from 'react'; import React, { memo } from 'react'; +import { useTranslation } from 'react-i18next'; import ContextualbarAction from './ContextualbarAction'; type ContextualbarBackProps = Partial>; const ContextualbarBack = (props: ContextualbarBackProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); return ; }; diff --git a/apps/meteor/client/components/Contextualbar/ContextualbarClose.tsx b/apps/meteor/client/components/Contextualbar/ContextualbarClose.tsx index 1670c9be58958..38db516476e3c 100644 --- a/apps/meteor/client/components/Contextualbar/ContextualbarClose.tsx +++ b/apps/meteor/client/components/Contextualbar/ContextualbarClose.tsx @@ -1,13 +1,13 @@ -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentProps, ReactElement } from 'react'; import React, { memo } from 'react'; +import { useTranslation } from 'react-i18next'; import ContextualbarAction from './ContextualbarAction'; type ContextualbarCloseProps = Partial>; const ContextualbarClose = (props: ContextualbarCloseProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); return ; }; diff --git a/apps/meteor/client/components/FilterByText.tsx b/apps/meteor/client/components/FilterByText.tsx index 5c5a3d599e2f9..25d8e225e3d82 100644 --- a/apps/meteor/client/components/FilterByText.tsx +++ b/apps/meteor/client/components/FilterByText.tsx @@ -1,8 +1,8 @@ import { Box, Icon, TextInput, Margins } from '@rocket.chat/fuselage'; import { useAutoFocus, useMergedRefs } from '@rocket.chat/fuselage-hooks'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ChangeEvent, FormEvent, HTMLAttributes } from 'react'; import React, { forwardRef, memo, useCallback, useState } from 'react'; +import { useTranslation } from 'react-i18next'; type FilterByTextProps = { onChange: (filter: string) => void; @@ -13,7 +13,7 @@ const FilterByText = forwardRef(function Fi { placeholder, onChange: setFilter, shouldAutoFocus = false, children, ...props }, ref, ) { - const t = useTranslation(); + const { t } = useTranslation(); const [text, setText] = useState(''); const autoFocusRef = useAutoFocus(shouldAutoFocus); const mergedRefs = useMergedRefs(ref, autoFocusRef); diff --git a/apps/meteor/client/components/FingerprintChangeModal.tsx b/apps/meteor/client/components/FingerprintChangeModal.tsx index db4c33654a926..a45a17db8ccc3 100644 --- a/apps/meteor/client/components/FingerprintChangeModal.tsx +++ b/apps/meteor/client/components/FingerprintChangeModal.tsx @@ -1,7 +1,7 @@ import { Box } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import GenericModal from './GenericModal'; @@ -12,7 +12,7 @@ type FingerprintChangeModalProps = { }; const FingerprintChangeModal = ({ onConfirm, onCancel, onClose }: FingerprintChangeModalProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); return ( { - const t = useTranslation(); + const { t } = useTranslation(); return ( { - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/client/components/GenericMenu/GenericMenu.tsx b/apps/meteor/client/components/GenericMenu/GenericMenu.tsx index 294a987705237..d20bd23da5b6d 100644 --- a/apps/meteor/client/components/GenericMenu/GenericMenu.tsx +++ b/apps/meteor/client/components/GenericMenu/GenericMenu.tsx @@ -1,7 +1,7 @@ import { IconButton, MenuItem, MenuSection, MenuV2 } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentProps, ReactNode } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import type { GenericMenuItemProps } from './GenericMenuItem'; import GenericMenuItem from './GenericMenuItem'; @@ -30,7 +30,7 @@ type GenericMenuConditionalProps = type GenericMenuProps = GenericMenuCommonProps & GenericMenuConditionalProps & Omit, 'children'>; const GenericMenu = ({ title, icon = 'menu', disabled, onAction, callbackAction, ...props }: GenericMenuProps) => { - const t = useTranslation(); + const { t, i18n } = useTranslation(); const sections = 'sections' in props && props.sections; const items = 'items' in props && props.items; @@ -55,14 +55,14 @@ const GenericMenu = ({ title, icon = 'menu', disabled, onAction, callbackAction, {sections && ( {sections.map(({ title, items }, key) => ( @@ -78,7 +78,7 @@ const GenericMenu = ({ title, icon = 'menu', disabled, onAction, callbackAction, {items && ( { - const t = useTranslation(); + const { t } = useTranslation(); const genericModalId = useUniqueId(); const dismissedRef = useRef(true); diff --git a/apps/meteor/client/components/GenericNoResults/GenericNoResults.tsx b/apps/meteor/client/components/GenericNoResults/GenericNoResults.tsx index 3fcfe2b0e0acf..d21023024fb3a 100644 --- a/apps/meteor/client/components/GenericNoResults/GenericNoResults.tsx +++ b/apps/meteor/client/components/GenericNoResults/GenericNoResults.tsx @@ -1,7 +1,7 @@ import { Box, States, StatesIcon, StatesLink, StatesTitle, StatesSubtitle, StatesActions, StatesAction } from '@rocket.chat/fuselage'; import type { Keys as IconName } from '@rocket.chat/icons'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React from 'react'; +import { useTranslation } from 'react-i18next'; type LinkProps = { linkText: string; linkHref: string } | { linkText?: never; linkHref?: never }; type ButtonProps = { buttonTitle: string; buttonAction: () => void } | { buttonTitle?: never; buttonAction?: never }; @@ -23,7 +23,7 @@ const GenericNoResults = ({ linkHref, linkText, }: GenericNoResultsProps) => { - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/client/components/GenericTable/hooks/useItemsPerPageLabel.ts b/apps/meteor/client/components/GenericTable/hooks/useItemsPerPageLabel.ts index 0a8a8deb8262a..4c390041497e0 100644 --- a/apps/meteor/client/components/GenericTable/hooks/useItemsPerPageLabel.ts +++ b/apps/meteor/client/components/GenericTable/hooks/useItemsPerPageLabel.ts @@ -1,7 +1,7 @@ -import { useTranslation } from '@rocket.chat/ui-contexts'; import { useCallback } from 'react'; +import { useTranslation } from 'react-i18next'; export const useItemsPerPageLabel = (): (() => string) => { - const t = useTranslation(); + const { t } = useTranslation(); return useCallback(() => t('Items_per_page:'), [t]); }; diff --git a/apps/meteor/client/components/GenericTable/hooks/useShowingResultsLabel.ts b/apps/meteor/client/components/GenericTable/hooks/useShowingResultsLabel.ts index c610340f28bda..8ff7d2ac18cfd 100644 --- a/apps/meteor/client/components/GenericTable/hooks/useShowingResultsLabel.ts +++ b/apps/meteor/client/components/GenericTable/hooks/useShowingResultsLabel.ts @@ -1,15 +1,19 @@ import type { Pagination } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentProps } from 'react'; import { useCallback } from 'react'; +import { useTranslation } from 'react-i18next'; type Props['showingResultsLabel'] = ComponentProps['showingResultsLabel']> = T extends (...args: any[]) => any ? Parameters : never; export const useShowingResultsLabel = (): ((...params: Props) => string) => { - const t = useTranslation(); + const { t } = useTranslation(); return useCallback( - ({ count, current, itemsPerPage }) => t('Showing_results_of', current + 1, Math.min(current + itemsPerPage, count), count), + ({ count, current, itemsPerPage }) => + t('Showing_results_of', { + postProcess: 'sprintf', + sprintf: [current + 1, Math.min(current + itemsPerPage, count), count], + }), [t], ); }; diff --git a/apps/meteor/client/components/GenericUpsellModal/GenericUpsellModal.tsx b/apps/meteor/client/components/GenericUpsellModal/GenericUpsellModal.tsx index 3d68e3f4b6d31..e7ce515ac4963 100644 --- a/apps/meteor/client/components/GenericUpsellModal/GenericUpsellModal.tsx +++ b/apps/meteor/client/components/GenericUpsellModal/GenericUpsellModal.tsx @@ -1,8 +1,8 @@ import { Box, Button, Modal } from '@rocket.chat/fuselage'; import type { Keys as IconName } from '@rocket.chat/icons'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactNode, ReactElement, ComponentProps } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; type GenericUpsellModalProps = { children?: ReactNode; @@ -35,7 +35,7 @@ const GenericUpsellModal = ({ annotation, ...props }: GenericUpsellModalProps) => { - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/client/components/ImageGallery/ImageGallery.tsx b/apps/meteor/client/components/ImageGallery/ImageGallery.tsx index 2cabfed460bd7..6db61b2ec910b 100644 --- a/apps/meteor/client/components/ImageGallery/ImageGallery.tsx +++ b/apps/meteor/client/components/ImageGallery/ImageGallery.tsx @@ -1,10 +1,10 @@ import type { IUpload } from '@rocket.chat/core-typings'; import { css } from '@rocket.chat/css-in-js'; import { Box, ButtonGroup, IconButton, Palette, Throbber } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React, { useRef, useState } from 'react'; import { FocusScope } from 'react-aria'; import { createPortal } from 'react-dom'; +import { useTranslation } from 'react-i18next'; import { Keyboard, Navigation, Zoom, A11y } from 'swiper'; import type { SwiperRef } from 'swiper/react'; import { type SwiperClass, Swiper, SwiperSlide } from 'swiper/react'; @@ -108,7 +108,7 @@ const swiperStyle = css` `; export const ImageGallery = ({ images, onClose, loadMore }: { images: IUpload[]; onClose: () => void; loadMore?: () => void }) => { - const t = useTranslation(); + const { t } = useTranslation(); const swiperRef = useRef(null); const [, setSwiperInst] = useState(); const [zoomScale, setZoomScale] = useState(1); diff --git a/apps/meteor/client/components/ImageGallery/ImageGalleryError.tsx b/apps/meteor/client/components/ImageGallery/ImageGalleryError.tsx index 97d91de95f62e..8dcc55a93a480 100644 --- a/apps/meteor/client/components/ImageGallery/ImageGalleryError.tsx +++ b/apps/meteor/client/components/ImageGallery/ImageGalleryError.tsx @@ -1,8 +1,8 @@ import { css } from '@rocket.chat/css-in-js'; import { IconButton, ModalBackdrop } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React from 'react'; import { createPortal } from 'react-dom'; +import { useTranslation } from 'react-i18next'; import GenericError from '../GenericError/GenericError'; @@ -14,7 +14,7 @@ const closeButtonStyle = css` `; export const ImageGalleryError = ({ onClose }: { onClose: () => void }) => { - const t = useTranslation(); + const { t } = useTranslation(); return createPortal( diff --git a/apps/meteor/client/components/ImageGallery/ImageGalleryLoading.tsx b/apps/meteor/client/components/ImageGallery/ImageGalleryLoading.tsx index 1c057584bd1f3..588605786664e 100644 --- a/apps/meteor/client/components/ImageGallery/ImageGalleryLoading.tsx +++ b/apps/meteor/client/components/ImageGallery/ImageGalleryLoading.tsx @@ -1,8 +1,8 @@ import { css } from '@rocket.chat/css-in-js'; import { IconButton, ModalBackdrop, Throbber } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React from 'react'; import { createPortal } from 'react-dom'; +import { useTranslation } from 'react-i18next'; const closeButtonStyle = css` position: absolute; @@ -12,7 +12,7 @@ const closeButtonStyle = css` `; export const ImageGalleryLoading = ({ onClose }: { onClose: () => void }) => { - const t = useTranslation(); + const { t } = useTranslation(); return createPortal( diff --git a/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.tsx b/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.tsx index cbefeb2c72c1c..6f94be4ebc901 100644 --- a/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.tsx +++ b/apps/meteor/client/components/InfoPanel/RetentionPolicyCallout.tsx @@ -1,14 +1,14 @@ import type { IRoom } from '@rocket.chat/core-typings'; import { Callout } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import { usePruneWarningMessage } from '../../hooks/usePruneWarningMessage'; import { withErrorBoundary } from '../withErrorBoundary'; const RetentionPolicyCallout = ({ room }: { room: IRoom }) => { const message = usePruneWarningMessage(room); - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/client/components/LocalTime.tsx b/apps/meteor/client/components/LocalTime.tsx index 100ba2ec6a62a..498b2da9711e6 100644 --- a/apps/meteor/client/components/LocalTime.tsx +++ b/apps/meteor/client/components/LocalTime.tsx @@ -1,6 +1,6 @@ -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React, { memo } from 'react'; +import { useTranslation } from 'react-i18next'; import { useUTCClock } from '../hooks/useUTCClock'; @@ -10,7 +10,7 @@ type LocalTimeProps = { const LocalTime = ({ utcOffset }: LocalTimeProps): ReactElement => { const time = useUTCClock(utcOffset); - const t = useTranslation(); + const { t } = useTranslation(); return <>{t('Local_Time_time', { time })}; }; diff --git a/apps/meteor/client/components/MarkdownText.tsx b/apps/meteor/client/components/MarkdownText.tsx index c9af942f6e1c2..6426b24810eef 100644 --- a/apps/meteor/client/components/MarkdownText.tsx +++ b/apps/meteor/client/components/MarkdownText.tsx @@ -1,10 +1,10 @@ import { Box } from '@rocket.chat/fuselage'; import { isExternal, getBaseURI } from '@rocket.chat/ui-client'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import dompurify from 'dompurify'; import { marked } from 'marked'; import type { ComponentProps } from 'react'; import React, { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; import { renderMessageEmoji } from '../lib/utils/renderMessageEmoji'; @@ -89,7 +89,7 @@ const MarkdownText = ({ ...props }: MarkdownTextProps) => { const sanitizer = dompurify.sanitize; - const t = useTranslation(); + const { t } = useTranslation(); let markedOptions: marked.MarkedOptions; const schemes = 'http,https,notes,ftp,ftps,tel,mailto,sms,cid'; diff --git a/apps/meteor/client/components/Omnichannel/modals/ReturnChatQueueModal.tsx b/apps/meteor/client/components/Omnichannel/modals/ReturnChatQueueModal.tsx index 04fcb29eed01d..b19ccfee1769c 100644 --- a/apps/meteor/client/components/Omnichannel/modals/ReturnChatQueueModal.tsx +++ b/apps/meteor/client/components/Omnichannel/modals/ReturnChatQueueModal.tsx @@ -1,6 +1,6 @@ import { Button, Modal } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React from 'react'; +import { useTranslation } from 'react-i18next'; type ReturnChatQueueModalProps = { onMoveChat: () => void; @@ -8,7 +8,7 @@ type ReturnChatQueueModalProps = { }; const ReturnChatQueueModal = ({ onCancel, onMoveChat, ...props }: ReturnChatQueueModalProps) => { - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/client/components/Omnichannel/modals/TranscriptModal.tsx b/apps/meteor/client/components/Omnichannel/modals/TranscriptModal.tsx index c06b6a1904654..502d0f9d1af78 100644 --- a/apps/meteor/client/components/Omnichannel/modals/TranscriptModal.tsx +++ b/apps/meteor/client/components/Omnichannel/modals/TranscriptModal.tsx @@ -1,8 +1,8 @@ import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; import { Field, Button, TextInput, Modal, Box, FieldGroup, FieldLabel, FieldRow, FieldError } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React, { useCallback, useEffect } from 'react'; import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; type TranscriptModalProps = { email: string; @@ -14,7 +14,7 @@ type TranscriptModalProps = { }; const TranscriptModal = ({ email: emailDefault = '', room, onRequest, onSend, onCancel, onDiscard, ...props }: TranscriptModalProps) => { - const t = useTranslation(); + const { t } = useTranslation(); const { register, diff --git a/apps/meteor/client/components/Sidebar/Header.tsx b/apps/meteor/client/components/Sidebar/Header.tsx index e4bf5a5e7041f..dcbf7f1cb505f 100644 --- a/apps/meteor/client/components/Sidebar/Header.tsx +++ b/apps/meteor/client/components/Sidebar/Header.tsx @@ -1,7 +1,7 @@ import { Box, IconButton } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactNode } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; type HeaderProps = { children?: ReactNode; @@ -10,7 +10,7 @@ type HeaderProps = { }; const Header = ({ title, onClose, children, ...props }: HeaderProps) => { - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/client/components/Sidebar/SidebarItemsAssembler.tsx b/apps/meteor/client/components/Sidebar/SidebarItemsAssembler.tsx index 45eb6094572a0..b588e223d922e 100644 --- a/apps/meteor/client/components/Sidebar/SidebarItemsAssembler.tsx +++ b/apps/meteor/client/components/Sidebar/SidebarItemsAssembler.tsx @@ -1,6 +1,6 @@ import { Divider } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React, { Fragment, memo } from 'react'; +import { useTranslation } from 'react-i18next'; import type { SidebarItem } from '../../lib/createSidebarItems'; import { isSidebarItem } from '../../lib/createSidebarItems'; @@ -12,7 +12,7 @@ type SidebarItemsAssemblerProps = { }; const SidebarItemsAssembler = ({ items, currentPath }: SidebarItemsAssemblerProps) => { - const t = useTranslation(); + const { t, i18n } = useTranslation(); return ( <> @@ -25,7 +25,7 @@ const SidebarItemsAssembler = ({ items, currentPath }: SidebarItemsAssemblerProp icon={props.icon} label={t((props.i18nLabel || props.name) as Parameters[0])} currentPath={currentPath} - tag={props.tag && t.has(props.tag) ? t(props.tag) : props.tag} + tag={props.tag && i18n.exists(props.tag) ? t(props.tag) : props.tag} externalUrl={props.externalUrl} badge={props.badge} /> diff --git a/apps/meteor/client/components/SidebarToggler/SidebarTogglerButton.tsx b/apps/meteor/client/components/SidebarToggler/SidebarTogglerButton.tsx index cd0c25f03d86f..1eefc50baabd9 100644 --- a/apps/meteor/client/components/SidebarToggler/SidebarTogglerButton.tsx +++ b/apps/meteor/client/components/SidebarToggler/SidebarTogglerButton.tsx @@ -1,6 +1,6 @@ import { Box, IconButton } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import SidebarTogglerBadge from './SidebarTogglerBadge'; @@ -10,7 +10,7 @@ type SideBarTogglerButtonProps = { }; const SideBarTogglerButton = ({ badge, onClick }: SideBarTogglerButtonProps) => { - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/client/components/TextCopy.tsx b/apps/meteor/client/components/TextCopy.tsx index 467e954ddd657..f9e2ffc622844 100644 --- a/apps/meteor/client/components/TextCopy.tsx +++ b/apps/meteor/client/components/TextCopy.tsx @@ -1,7 +1,7 @@ import { Box, Button, Scrollable } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ComponentProps, ReactElement } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import useClipboardWithToast from '../hooks/useClipboardWithToast'; @@ -17,7 +17,7 @@ type TextCopyProps = { } & ComponentProps; const TextCopy = ({ text, wrapper = defaultWrapperRenderer, ...props }: TextCopyProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); const { copy } = useClipboardWithToast(text); diff --git a/apps/meteor/client/components/TwoFactorModal/TwoFactorPasswordModal.tsx b/apps/meteor/client/components/TwoFactorModal/TwoFactorPasswordModal.tsx index 4c91e274de68c..4867d171aee88 100644 --- a/apps/meteor/client/components/TwoFactorModal/TwoFactorPasswordModal.tsx +++ b/apps/meteor/client/components/TwoFactorModal/TwoFactorPasswordModal.tsx @@ -1,8 +1,8 @@ import { Box, PasswordInput, FieldGroup, Field, FieldLabel, FieldRow, FieldError } from '@rocket.chat/fuselage'; import { useAutoFocus, useUniqueId } from '@rocket.chat/fuselage-hooks'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement, ChangeEvent, Ref, SyntheticEvent } from 'react'; import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import GenericModal from '../GenericModal'; import type { OnConfirm } from './TwoFactorModal'; @@ -15,7 +15,7 @@ type TwoFactorPasswordModalProps = { }; const TwoFactorPasswordModal = ({ onConfirm, onClose, invalidAttempt }: TwoFactorPasswordModalProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); const [code, setCode] = useState(''); const ref = useAutoFocus(); diff --git a/apps/meteor/client/components/TwoFactorModal/TwoFactorTotpModal.tsx b/apps/meteor/client/components/TwoFactorModal/TwoFactorTotpModal.tsx index 6f36c9c8ce26c..d6f167be8588d 100644 --- a/apps/meteor/client/components/TwoFactorModal/TwoFactorTotpModal.tsx +++ b/apps/meteor/client/components/TwoFactorModal/TwoFactorTotpModal.tsx @@ -1,8 +1,8 @@ import { Box, TextInput, Field, FieldGroup, FieldLabel, FieldRow, FieldError } from '@rocket.chat/fuselage'; import { useAutoFocus, useUniqueId } from '@rocket.chat/fuselage-hooks'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement, ChangeEvent, SyntheticEvent } from 'react'; import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import GenericModal from '../GenericModal'; import type { OnConfirm } from './TwoFactorModal'; @@ -15,7 +15,7 @@ type TwoFactorTotpModalProps = { }; const TwoFactorTotpModal = ({ onConfirm, onClose, invalidAttempt }: TwoFactorTotpModalProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); const [code, setCode] = useState(''); const ref = useAutoFocus(); diff --git a/apps/meteor/client/components/UrlChangeModal.tsx b/apps/meteor/client/components/UrlChangeModal.tsx index 13d0523c92aac..dbc152c7fbff2 100644 --- a/apps/meteor/client/components/UrlChangeModal.tsx +++ b/apps/meteor/client/components/UrlChangeModal.tsx @@ -1,7 +1,7 @@ import { Box } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import GenericModal from './GenericModal'; @@ -13,14 +13,17 @@ type UrlChangeModalProps = { }; const UrlChangeModal = ({ onConfirm, siteUrl, currentUrl, onClose }: UrlChangeModalProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); return (

diff --git a/apps/meteor/client/components/UserCard/UserCard.tsx b/apps/meteor/client/components/UserCard/UserCard.tsx index bf143229cf651..98e1cce2ab785 100644 --- a/apps/meteor/client/components/UserCard/UserCard.tsx +++ b/apps/meteor/client/components/UserCard/UserCard.tsx @@ -1,9 +1,9 @@ import { css } from '@rocket.chat/css-in-js'; import { Box, Button, IconButton } from '@rocket.chat/fuselage'; import { UserAvatar } from '@rocket.chat/ui-avatar'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactNode, ComponentProps } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import { useEmbeddedLayout } from '../../hooks/useEmbeddedLayout'; import MarkdownText from '../MarkdownText'; @@ -52,7 +52,7 @@ const UserCard = ({ nickname, ...props }: UserCardProps) => { - const t = useTranslation(); + const { t } = useTranslation(); const isLayoutEmbedded = useEmbeddedLayout(); return ( diff --git a/apps/meteor/client/components/UserInfo/UserInfo.tsx b/apps/meteor/client/components/UserInfo/UserInfo.tsx index a7f32f82f4546..ac879d21738bf 100644 --- a/apps/meteor/client/components/UserInfo/UserInfo.tsx +++ b/apps/meteor/client/components/UserInfo/UserInfo.tsx @@ -1,9 +1,9 @@ import type { IUser, Serialized } from '@rocket.chat/core-typings'; import { Box, Margins, Tag } from '@rocket.chat/fuselage'; import type { TranslationKey } from '@rocket.chat/ui-contexts'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement, ReactNode } from 'react'; import React, { memo } from 'react'; +import { useTranslation } from 'react-i18next'; import { useTimeAgo } from '../../hooks/useTimeAgo'; import { useUserCustomFields } from '../../hooks/useUserCustomFields'; @@ -72,7 +72,7 @@ const UserInfo = ({ reason, ...props }: UserInfoProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); const timeAgo = useTimeAgo(); const userDisplayName = useUserDisplayName({ name, username }); const userCustomFields = useUserCustomFields(customFields); diff --git a/apps/meteor/client/components/WarningModal.tsx b/apps/meteor/client/components/WarningModal.tsx index 00ae92e1d3bdc..db0697f78c0d9 100644 --- a/apps/meteor/client/components/WarningModal.tsx +++ b/apps/meteor/client/components/WarningModal.tsx @@ -1,7 +1,7 @@ import { Button, Modal } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement, ReactNode } from 'react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; type WarningModalProps = { text: ReactNode; @@ -13,7 +13,7 @@ type WarningModalProps = { }; const WarningModal = ({ text, confirmText, close, cancel, cancelText, confirm, ...props }: WarningModalProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); return ( diff --git a/apps/meteor/client/components/dashboards/PeriodSelector.tsx b/apps/meteor/client/components/dashboards/PeriodSelector.tsx index 6977e3334f4fb..d441fbf2f19ab 100644 --- a/apps/meteor/client/components/dashboards/PeriodSelector.tsx +++ b/apps/meteor/client/components/dashboards/PeriodSelector.tsx @@ -1,7 +1,7 @@ import { Select } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React, { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; import type { Period } from './periods'; import { getPeriod } from './periods'; @@ -14,9 +14,9 @@ type PeriodSelectorProps = { }; const PeriodSelector = ({ periods, value, name, onChange }: PeriodSelectorProps): ReactElement => { - const t = useTranslation(); + const { t } = useTranslation(); - const options = useMemo<[string, string][]>(() => periods.map((period) => [period, t(...getPeriod(period).label)]), [periods, t]); + const options = useMemo<[string, string][]>(() => periods.map((period) => [period, t(getPeriod(period).label)]), [periods, t]); return (