From 695ac47014538b00aed15821d2dc796d55dc25ee Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Thu, 10 Apr 2025 18:16:23 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(frontend)=20extract=20record?= =?UTF-8?q?ing=20hooks=20into=20a=20dedicated=20folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extract code elements related to recording into a dedicated folder. --- .../hooks/useHasRecordingAccess.ts} | 2 +- .../hooks/useIsRecordingModeEnabled.ts | 0 .../livekit => recording}/hooks/useIsRecordingStarted.ts | 0 .../hooks/useIsRecordingTransitioning.ts | 0 src/frontend/src/features/recording/index.ts | 7 +++++++ .../features/rooms/livekit/components/ScreenRecording.tsx | 4 ++-- .../src/features/rooms/livekit/components/Tools.tsx | 2 +- .../src/features/rooms/livekit/components/Transcript.tsx | 6 +++--- 8 files changed, 14 insertions(+), 7 deletions(-) rename src/frontend/src/features/{rooms/livekit/hooks/useHasScreenRecordingAccess.ts => recording/hooks/useHasRecordingAccess.ts} (89%) rename src/frontend/src/features/{rooms/livekit => recording}/hooks/useIsRecordingModeEnabled.ts (100%) rename src/frontend/src/features/{rooms/livekit => recording}/hooks/useIsRecordingStarted.ts (100%) rename src/frontend/src/features/{rooms/livekit => recording}/hooks/useIsRecordingTransitioning.ts (100%) create mode 100644 src/frontend/src/features/recording/index.ts diff --git a/src/frontend/src/features/rooms/livekit/hooks/useHasScreenRecordingAccess.ts b/src/frontend/src/features/recording/hooks/useHasRecordingAccess.ts similarity index 89% rename from src/frontend/src/features/rooms/livekit/hooks/useHasScreenRecordingAccess.ts rename to src/frontend/src/features/recording/hooks/useHasRecordingAccess.ts index 0f578b2e..50db91c9 100644 --- a/src/frontend/src/features/rooms/livekit/hooks/useHasScreenRecordingAccess.ts +++ b/src/frontend/src/features/recording/hooks/useHasRecordingAccess.ts @@ -2,7 +2,7 @@ import { useFeatureFlagEnabled } from 'posthog-js/react' import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled' import { RecordingMode } from '@/features/rooms/api/startRecording' import { useIsRecordingModeEnabled } from './useIsRecordingModeEnabled' -import { useIsAdminOrOwner } from './useIsAdminOrOwner' +import { useIsAdminOrOwner } from '@/features/rooms/livekit/hooks/useIsAdminOrOwner' export const useHasRecordingAccess = ( mode: RecordingMode, diff --git a/src/frontend/src/features/rooms/livekit/hooks/useIsRecordingModeEnabled.ts b/src/frontend/src/features/recording/hooks/useIsRecordingModeEnabled.ts similarity index 100% rename from src/frontend/src/features/rooms/livekit/hooks/useIsRecordingModeEnabled.ts rename to src/frontend/src/features/recording/hooks/useIsRecordingModeEnabled.ts diff --git a/src/frontend/src/features/rooms/livekit/hooks/useIsRecordingStarted.ts b/src/frontend/src/features/recording/hooks/useIsRecordingStarted.ts similarity index 100% rename from src/frontend/src/features/rooms/livekit/hooks/useIsRecordingStarted.ts rename to src/frontend/src/features/recording/hooks/useIsRecordingStarted.ts diff --git a/src/frontend/src/features/rooms/livekit/hooks/useIsRecordingTransitioning.ts b/src/frontend/src/features/recording/hooks/useIsRecordingTransitioning.ts similarity index 100% rename from src/frontend/src/features/rooms/livekit/hooks/useIsRecordingTransitioning.ts rename to src/frontend/src/features/recording/hooks/useIsRecordingTransitioning.ts diff --git a/src/frontend/src/features/recording/index.ts b/src/frontend/src/features/recording/index.ts new file mode 100644 index 00000000..83ac83ed --- /dev/null +++ b/src/frontend/src/features/recording/index.ts @@ -0,0 +1,7 @@ +export { useIsRecordingModeEnabled } from './hooks/useIsRecordingModeEnabled' +export { + useIsScreenRecordingStarted, + useIsTranscriptStarted, +} from './hooks/useIsRecordingStarted' +export { useIsRecordingTransitioning } from './hooks/useIsRecordingTransitioning' +export { useHasRecordingAccess } from './hooks/useHasRecordingAccess' diff --git a/src/frontend/src/features/rooms/livekit/components/ScreenRecording.tsx b/src/frontend/src/features/rooms/livekit/components/ScreenRecording.tsx index ff2cb2ff..1ea2fb6b 100644 --- a/src/frontend/src/features/rooms/livekit/components/ScreenRecording.tsx +++ b/src/frontend/src/features/rooms/livekit/components/ScreenRecording.tsx @@ -16,11 +16,11 @@ import { NotificationPayload } from '@/features/notifications/NotificationPayloa import { NotificationType } from '@/features/notifications/NotificationType' import { RecordingStatus, recordingStore } from '@/stores/recording' import { CRISP_HELP_ARTICLE_RECORDING } from '@/utils/constants' -import { useIsRecordingTransitioning } from '../hooks/useIsRecordingTransitioning' import { + useIsRecordingTransitioning, useIsScreenRecordingStarted, useIsTranscriptStarted, -} from '../hooks/useIsRecordingStarted' +} from '@/features/recording' export const ScreenRecording = () => { const [isLoading, setIsLoading] = useState(false) diff --git a/src/frontend/src/features/rooms/livekit/components/Tools.tsx b/src/frontend/src/features/rooms/livekit/components/Tools.tsx index 6ed14a16..d162397e 100644 --- a/src/frontend/src/features/rooms/livekit/components/Tools.tsx +++ b/src/frontend/src/features/rooms/livekit/components/Tools.tsx @@ -5,11 +5,11 @@ import { useTranslation } from 'react-i18next' import { CRISP_HELP_ARTICLE_MORE_TOOLS } from '@/utils/constants' import { ReactNode } from 'react' import { Transcript } from './Transcript' -import { useIsRecordingModeEnabled } from '../hooks/useIsRecordingModeEnabled' import { RiFileTextFill, RiLiveFill } from '@remixicon/react' import { SubPanelId, useSidePanel } from '../hooks/useSidePanel' import { ScreenRecording } from './ScreenRecording' import { RecordingMode } from '@/features/rooms/api/startRecording' +import { useIsRecordingModeEnabled } from '@/features/recording' export interface ToolsButtonProps { icon: ReactNode diff --git a/src/frontend/src/features/rooms/livekit/components/Transcript.tsx b/src/frontend/src/features/rooms/livekit/components/Transcript.tsx index 66f0ddd4..26252a0f 100644 --- a/src/frontend/src/features/rooms/livekit/components/Transcript.tsx +++ b/src/frontend/src/features/rooms/livekit/components/Transcript.tsx @@ -15,16 +15,16 @@ import { useTranslation } from 'react-i18next' import { NotificationPayload } from '@/features/notifications/NotificationPayload' import { NotificationType } from '@/features/notifications/NotificationType' import { RecordingStatus, recordingStore } from '@/stores/recording' -import { useHasRecordingAccess } from '../hooks/useHasScreenRecordingAccess' import { BETA_USERS_FORM_URL, CRISP_HELP_ARTICLE_TRANSCRIPT, } from '@/utils/constants' -import { useIsRecordingTransitioning } from '../hooks/useIsRecordingTransitioning' import { useIsScreenRecordingStarted, useIsTranscriptStarted, -} from '../hooks/useIsRecordingStarted' + useIsRecordingTransitioning, + useHasRecordingAccess, +} from '@/features/recording' export const Transcript = () => { const [isLoading, setIsLoading] = useState(false)