From 27ecd388fa7704b3f237ecf9474435ce69c0aa73 Mon Sep 17 00:00:00 2001 From: Tasso Date: Wed, 3 Sep 2025 14:57:59 -0300 Subject: [PATCH] chore: Move `AppLayout` hooks --- apps/meteor/client/views/root/AppLayout.tsx | 20 +++++++++---------- .../views/root/MainLayout/LoginPage.tsx | 2 +- .../{ => views/root}/hooks/useAnalytics.ts | 0 .../root}/hooks/useAnalyticsEventTracking.ts | 2 +- .../root}/hooks/useAutoupdate.spec.ts | 0 .../{ => views/root}/hooks/useAutoupdate.tsx | 2 +- .../views/root/hooks}/useCorsSSLConfig.ts | 0 .../views/root}/hooks/useEmojiOne.ts | 6 +++--- .../iframe => views/root/hooks}/useIframe.ts | 0 .../root/hooks}/useIframeLoginListener.ts | 0 .../root}/hooks/useLivechatEnterprise.ts | 10 +++++----- .../useLoadRoomForAllowedAnonymousRead.ts | 2 +- .../root/hooks}/useNotificationPermission.ts | 2 +- .../root/hooks}/useRedirectToSetupWizard.ts | 0 14 files changed, 23 insertions(+), 23 deletions(-) rename apps/meteor/client/{ => views/root}/hooks/useAnalytics.ts (100%) rename apps/meteor/client/{ => views/root}/hooks/useAnalyticsEventTracking.ts (99%) rename apps/meteor/client/{ => views/root}/hooks/useAutoupdate.spec.ts (100%) rename apps/meteor/client/{ => views/root}/hooks/useAutoupdate.tsx (90%) rename apps/meteor/{app/cors/client => client/views/root/hooks}/useCorsSSLConfig.ts (100%) rename apps/meteor/{app/emoji-emojione/client => client/views/root}/hooks/useEmojiOne.ts (88%) rename apps/meteor/client/{hooks/iframe => views/root/hooks}/useIframe.ts (100%) rename apps/meteor/client/{hooks/iframe => views/root/hooks}/useIframeLoginListener.ts (100%) rename apps/meteor/{app/livechat-enterprise => client/views/root}/hooks/useLivechatEnterprise.ts (54%) rename apps/meteor/client/{ => views/root}/hooks/useLoadRoomForAllowedAnonymousRead.ts (87%) rename apps/meteor/client/{hooks/notification => views/root/hooks}/useNotificationPermission.ts (89%) rename apps/meteor/client/{startup => views/root/hooks}/useRedirectToSetupWizard.ts (100%) diff --git a/apps/meteor/client/views/root/AppLayout.tsx b/apps/meteor/client/views/root/AppLayout.tsx index 198616b40c9ce..6daac59b4f863 100644 --- a/apps/meteor/client/views/root/AppLayout.tsx +++ b/apps/meteor/client/views/root/AppLayout.tsx @@ -11,26 +11,26 @@ import { useGitLabOAuth } from './hooks/customOAuth/useGitLabOAuth'; import { useNextcloudOAuth } from './hooks/customOAuth/useNextcloudOAuth'; import { useTokenpassOAuth } from './hooks/customOAuth/useTokenpassOAuth'; import { useWordPressOAuth } from './hooks/customOAuth/useWordPressOAuth'; +import { useAnalytics } from './hooks/useAnalytics'; +import { useAnalyticsEventTracking } from './hooks/useAnalyticsEventTracking'; +import { useAutoupdate } from './hooks/useAutoupdate'; import { useCodeHighlight } from './hooks/useCodeHighlight'; +import { useCorsSSLConfig } from './hooks/useCorsSSLConfig'; import { useDesktopFavicon } from './hooks/useDesktopFavicon'; import { useDesktopTitle } from './hooks/useDesktopTitle'; +import { useEmojiOne } from './hooks/useEmojiOne'; import { useEscapeKeyStroke } from './hooks/useEscapeKeyStroke'; import { useGoogleTagManager } from './hooks/useGoogleTagManager'; +import { useIframeLoginListener } from './hooks/useIframeLoginListener'; +import { useLivechatEnterprise } from './hooks/useLivechatEnterprise'; import { useLoadMissedMessages } from './hooks/useLoadMissedMessages'; +import { useLoadRoomForAllowedAnonymousRead } from './hooks/useLoadRoomForAllowedAnonymousRead'; import { useLoginViaQuery } from './hooks/useLoginViaQuery'; import { useMessageLinkClicks } from './hooks/useMessageLinkClicks'; +import { useNotificationPermission } from './hooks/useNotificationPermission'; +import { useRedirectToSetupWizard } from './hooks/useRedirectToSetupWizard'; import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl'; -import { useCorsSSLConfig } from '../../../app/cors/client/useCorsSSLConfig'; -import { useEmojiOne } from '../../../app/emoji-emojione/client/hooks/useEmojiOne'; -import { useLivechatEnterprise } from '../../../app/livechat-enterprise/hooks/useLivechatEnterprise'; -import { useIframeLoginListener } from '../../hooks/iframe/useIframeLoginListener'; -import { useNotificationPermission } from '../../hooks/notification/useNotificationPermission'; -import { useAnalytics } from '../../hooks/useAnalytics'; -import { useAnalyticsEventTracking } from '../../hooks/useAnalyticsEventTracking'; -import { useAutoupdate } from '../../hooks/useAutoupdate'; -import { useLoadRoomForAllowedAnonymousRead } from '../../hooks/useLoadRoomForAllowedAnonymousRead'; import { appLayout } from '../../lib/appLayout'; -import { useRedirectToSetupWizard } from '../../startup/useRedirectToSetupWizard'; const AppLayout = () => { useEffect(() => { diff --git a/apps/meteor/client/views/root/MainLayout/LoginPage.tsx b/apps/meteor/client/views/root/MainLayout/LoginPage.tsx index 65d0f3d048cf9..d270bcba6c465 100644 --- a/apps/meteor/client/views/root/MainLayout/LoginPage.tsx +++ b/apps/meteor/client/views/root/MainLayout/LoginPage.tsx @@ -6,7 +6,7 @@ import { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import LoggedOutBanner from '../../../components/deviceManagement/LoggedOutBanner'; -import { useIframe } from '../../../hooks/iframe/useIframe'; +import { useIframe } from '../hooks/useIframe'; const LoginPage = ({ defaultRoute, children }: { defaultRoute?: LoginRoutes; children?: ReactNode }): ReactElement => { const { t } = useTranslation(); diff --git a/apps/meteor/client/hooks/useAnalytics.ts b/apps/meteor/client/views/root/hooks/useAnalytics.ts similarity index 100% rename from apps/meteor/client/hooks/useAnalytics.ts rename to apps/meteor/client/views/root/hooks/useAnalytics.ts diff --git a/apps/meteor/client/hooks/useAnalyticsEventTracking.ts b/apps/meteor/client/views/root/hooks/useAnalyticsEventTracking.ts similarity index 99% rename from apps/meteor/client/hooks/useAnalyticsEventTracking.ts rename to apps/meteor/client/views/root/hooks/useAnalyticsEventTracking.ts index 9d1acf7b43182..dd443b97e750b 100644 --- a/apps/meteor/client/hooks/useAnalyticsEventTracking.ts +++ b/apps/meteor/client/views/root/hooks/useAnalyticsEventTracking.ts @@ -1,7 +1,7 @@ import { useRouter, useSetting, useUserId } from '@rocket.chat/ui-contexts'; import { useEffect } from 'react'; -import { callbacks } from '../../lib/callbacks'; +import { callbacks } from '../../../../lib/callbacks'; function trackEvent(category: string, action: string, label?: unknown) { const { _paq, ga } = window; diff --git a/apps/meteor/client/hooks/useAutoupdate.spec.ts b/apps/meteor/client/views/root/hooks/useAutoupdate.spec.ts similarity index 100% rename from apps/meteor/client/hooks/useAutoupdate.spec.ts rename to apps/meteor/client/views/root/hooks/useAutoupdate.spec.ts diff --git a/apps/meteor/client/hooks/useAutoupdate.tsx b/apps/meteor/client/views/root/hooks/useAutoupdate.tsx similarity index 90% rename from apps/meteor/client/hooks/useAutoupdate.tsx rename to apps/meteor/client/views/root/hooks/useAutoupdate.tsx index 6d73dee356089..28bd29ad88bf8 100644 --- a/apps/meteor/client/hooks/useAutoupdate.tsx +++ b/apps/meteor/client/views/root/hooks/useAutoupdate.tsx @@ -2,7 +2,7 @@ import { useToastMessageDispatch } from '@rocket.chat/ui-contexts'; import { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; -import { AutoupdateToastMessage } from '../components/AutoupdateToastMessage'; +import { AutoupdateToastMessage } from '../../../components/AutoupdateToastMessage'; export const useAutoupdate = () => { const toast = useToastMessageDispatch(); diff --git a/apps/meteor/app/cors/client/useCorsSSLConfig.ts b/apps/meteor/client/views/root/hooks/useCorsSSLConfig.ts similarity index 100% rename from apps/meteor/app/cors/client/useCorsSSLConfig.ts rename to apps/meteor/client/views/root/hooks/useCorsSSLConfig.ts diff --git a/apps/meteor/app/emoji-emojione/client/hooks/useEmojiOne.ts b/apps/meteor/client/views/root/hooks/useEmojiOne.ts similarity index 88% rename from apps/meteor/app/emoji-emojione/client/hooks/useEmojiOne.ts rename to apps/meteor/client/views/root/hooks/useEmojiOne.ts index bf8919d200175..8c6d94b7ab753 100644 --- a/apps/meteor/app/emoji-emojione/client/hooks/useEmojiOne.ts +++ b/apps/meteor/client/views/root/hooks/useEmojiOne.ts @@ -1,9 +1,9 @@ import { useUserPreference } from '@rocket.chat/ui-contexts'; import { useEffect, useLayoutEffect } from 'react'; -import { emoji } from '../../../emoji/client'; -import { getEmojiConfig } from '../../lib/getEmojiConfig'; -import { isSetNotNull } from '../../lib/isSetNotNull'; +import { emoji } from '../../../../app/emoji/client'; +import { getEmojiConfig } from '../../../../app/emoji-emojione/lib/getEmojiConfig'; +import { isSetNotNull } from '../../../../app/emoji-emojione/lib/isSetNotNull'; const config = getEmojiConfig(); diff --git a/apps/meteor/client/hooks/iframe/useIframe.ts b/apps/meteor/client/views/root/hooks/useIframe.ts similarity index 100% rename from apps/meteor/client/hooks/iframe/useIframe.ts rename to apps/meteor/client/views/root/hooks/useIframe.ts diff --git a/apps/meteor/client/hooks/iframe/useIframeLoginListener.ts b/apps/meteor/client/views/root/hooks/useIframeLoginListener.ts similarity index 100% rename from apps/meteor/client/hooks/iframe/useIframeLoginListener.ts rename to apps/meteor/client/views/root/hooks/useIframeLoginListener.ts diff --git a/apps/meteor/app/livechat-enterprise/hooks/useLivechatEnterprise.ts b/apps/meteor/client/views/root/hooks/useLivechatEnterprise.ts similarity index 54% rename from apps/meteor/app/livechat-enterprise/hooks/useLivechatEnterprise.ts rename to apps/meteor/client/views/root/hooks/useLivechatEnterprise.ts index e9bb5a5f35f78..0e3763232d837 100644 --- a/apps/meteor/app/livechat-enterprise/hooks/useLivechatEnterprise.ts +++ b/apps/meteor/client/views/root/hooks/useLivechatEnterprise.ts @@ -1,11 +1,11 @@ import { useSetting } from '@rocket.chat/ui-contexts'; import { useEffect } from 'react'; -import { useHasLicenseModule } from '../../../client/hooks/useHasLicenseModule'; -import { businessHourManager } from '../../livechat/client/views/app/business-hours/BusinessHours'; -import type { IBusinessHourBehavior } from '../../livechat/client/views/app/business-hours/IBusinessHourBehavior'; -import { SingleBusinessHourBehavior } from '../../livechat/client/views/app/business-hours/Single'; -import { MultipleBusinessHoursBehavior } from '../client/views/business-hours/Multiple'; +import { businessHourManager } from '../../../../app/livechat/client/views/app/business-hours/BusinessHours'; +import type { IBusinessHourBehavior } from '../../../../app/livechat/client/views/app/business-hours/IBusinessHourBehavior'; +import { SingleBusinessHourBehavior } from '../../../../app/livechat/client/views/app/business-hours/Single'; +import { MultipleBusinessHoursBehavior } from '../../../../app/livechat-enterprise/client/views/business-hours/Multiple'; +import { useHasLicenseModule } from '../../../hooks/useHasLicenseModule'; const businessHours: Record = { multiple: new MultipleBusinessHoursBehavior(), diff --git a/apps/meteor/client/hooks/useLoadRoomForAllowedAnonymousRead.ts b/apps/meteor/client/views/root/hooks/useLoadRoomForAllowedAnonymousRead.ts similarity index 87% rename from apps/meteor/client/hooks/useLoadRoomForAllowedAnonymousRead.ts rename to apps/meteor/client/views/root/hooks/useLoadRoomForAllowedAnonymousRead.ts index 444721517775a..a66cbed2d38ca 100644 --- a/apps/meteor/client/hooks/useLoadRoomForAllowedAnonymousRead.ts +++ b/apps/meteor/client/views/root/hooks/useLoadRoomForAllowedAnonymousRead.ts @@ -1,7 +1,7 @@ import { useSetting, useUserId } from '@rocket.chat/ui-contexts'; import { useEffect } from 'react'; -import { RoomsCachedStore, SubscriptionsCachedStore } from '../cachedStores'; +import { RoomsCachedStore, SubscriptionsCachedStore } from '../../../cachedStores'; export const useLoadRoomForAllowedAnonymousRead = () => { const userId = useUserId(); diff --git a/apps/meteor/client/hooks/notification/useNotificationPermission.ts b/apps/meteor/client/views/root/hooks/useNotificationPermission.ts similarity index 89% rename from apps/meteor/client/hooks/notification/useNotificationPermission.ts rename to apps/meteor/client/views/root/hooks/useNotificationPermission.ts index abd6c95be9f71..e5e3faeb8ee71 100644 --- a/apps/meteor/client/hooks/notification/useNotificationPermission.ts +++ b/apps/meteor/client/views/root/hooks/useNotificationPermission.ts @@ -1,6 +1,6 @@ import { useEffectEvent } from '@rocket.chat/fuselage-hooks'; -import { notificationManager } from '../../lib/notificationManager'; +import { notificationManager } from '../../../lib/notificationManager'; export const useNotificationPermission = () => { const requestPermission = useEffectEvent(async () => { diff --git a/apps/meteor/client/startup/useRedirectToSetupWizard.ts b/apps/meteor/client/views/root/hooks/useRedirectToSetupWizard.ts similarity index 100% rename from apps/meteor/client/startup/useRedirectToSetupWizard.ts rename to apps/meteor/client/views/root/hooks/useRedirectToSetupWizard.ts