From 29a46a413e0606058944f05072a53c5e2d811d9a Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Mon, 26 May 2025 17:07:58 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8(frontend)=20clarify=20transcriptio?= =?UTF-8?q?n/recording=20access=20restrictions=20in=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it explicit that non-owner/admin users cannot enable transcription. Beta feature behavior that may change in future versions. --- .../components/TranscriptSidePanel.tsx | 79 +++++++++++++------ .../hooks/useHasFeatureWithoutAdminRights.ts | 22 ++++++ src/frontend/src/features/recording/index.ts | 1 + src/frontend/src/locales/de/rooms.json | 10 +++ src/frontend/src/locales/en/rooms.json | 10 +++ src/frontend/src/locales/fr/rooms.json | 10 +++ src/frontend/src/locales/nl/rooms.json | 10 +++ 7 files changed, 118 insertions(+), 24 deletions(-) create mode 100644 src/frontend/src/features/recording/hooks/useHasFeatureWithoutAdminRights.ts diff --git a/src/frontend/src/features/recording/components/TranscriptSidePanel.tsx b/src/frontend/src/features/recording/components/TranscriptSidePanel.tsx index b3ce1e1d..ce6a5f2b 100644 --- a/src/frontend/src/features/recording/components/TranscriptSidePanel.tsx +++ b/src/frontend/src/features/recording/components/TranscriptSidePanel.tsx @@ -10,6 +10,7 @@ import { useIsRecordingTransitioning, useStartRecording, useStopRecording, + useHasFeatureWithoutAdminRights, } from '../index' import { useEffect, useMemo, useState } from 'react' import { ConnectionState, RoomEvent } from 'livekit-client' @@ -42,6 +43,12 @@ export const TranscriptSidePanel = () => { RecordingMode.Transcript, FeatureFlags.Transcript ) + + const hasFeatureWithoutAdminRights = useHasFeatureWithoutAdminRights( + RecordingMode.Transcript, + FeatureFlags.Transcript + ) + const roomId = useRoomId() const { mutateAsync: startRecordingRoom, isPending: isPendingToStart } = @@ -134,30 +141,54 @@ export const TranscriptSidePanel = () => { /> {!hasTranscriptAccess ? ( <> - {t('beta.heading')} - - {t('beta.body')}{' '} - - {t('start.linkMore')} - - - - {t('beta.button')} - + {hasFeatureWithoutAdminRights ? ( + <> + {t('notAdminOrOwner.heading')} + + {t('notAdminOrOwner.body')} +
+ + {t('notAdminOrOwner.linkMore')} + +
+ + ) : ( + <> + {t('beta.heading')} + + {t('beta.body')}{' '} + + {t('start.linkMore')} + + + + {t('beta.button')} + + + )} ) : ( <> diff --git a/src/frontend/src/features/recording/hooks/useHasFeatureWithoutAdminRights.ts b/src/frontend/src/features/recording/hooks/useHasFeatureWithoutAdminRights.ts new file mode 100644 index 00000000..4daef2ab --- /dev/null +++ b/src/frontend/src/features/recording/hooks/useHasFeatureWithoutAdminRights.ts @@ -0,0 +1,22 @@ +import { useFeatureFlagEnabled } from 'posthog-js/react' +import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled' +import { RecordingMode } from '../types' +import { useIsRecordingModeEnabled } from './useIsRecordingModeEnabled' +import { useIsAdminOrOwner } from '@/features/rooms/livekit/hooks/useIsAdminOrOwner' +import { FeatureFlags } from '@/features/analytics/enums' + +export const useHasFeatureWithoutAdminRights = ( + mode: RecordingMode, + featureFlag: FeatureFlags +) => { + const featureEnabled = useFeatureFlagEnabled(featureFlag) + const isAnalyticsEnabled = useIsAnalyticsEnabled() + const isRecordingModeEnabled = useIsRecordingModeEnabled(mode) + const isAdminOrOwner = useIsAdminOrOwner() + + return ( + (featureEnabled || !isAnalyticsEnabled) && + isRecordingModeEnabled && + !isAdminOrOwner + ) +} diff --git a/src/frontend/src/features/recording/index.ts b/src/frontend/src/features/recording/index.ts index 82784c78..757ecd96 100644 --- a/src/frontend/src/features/recording/index.ts +++ b/src/frontend/src/features/recording/index.ts @@ -3,6 +3,7 @@ export { useIsRecordingModeEnabled } from './hooks/useIsRecordingModeEnabled' export { useIsRecordingTransitioning } from './hooks/useIsRecordingTransitioning' export { useHasRecordingAccess } from './hooks/useHasRecordingAccess' export { useIsRecordingActive } from './hooks/useIsRecordingActive' +export { useHasFeatureWithoutAdminRights } from './hooks/useHasFeatureWithoutAdminRights' // api export { useStartRecording } from './api/startRecording' diff --git a/src/frontend/src/locales/de/rooms.json b/src/frontend/src/locales/de/rooms.json index 7ddfbe73..69c3a85d 100644 --- a/src/frontend/src/locales/de/rooms.json +++ b/src/frontend/src/locales/de/rooms.json @@ -223,6 +223,11 @@ "loading": "Transkription wird gestartet", "linkMore": "Mehr erfahren" }, + "notAdminOrOwner": { + "heading": "Zugriff eingeschränkt", + "body": "Aus Sicherheitsgründen kann nur der Ersteller oder ein Administrator des Meetings eine Transkription (Beta) starten.", + "linkMore": "Mehr erfahren" + }, "stop": { "heading": "Transkription läuft...", "body": "Die Transkription deines Meetings läuft. Du erhältst das Ergebnis per E-Mail, sobald das Meeting beendet ist.", @@ -254,6 +259,11 @@ "loading": "Aufzeichnung wird gestartet", "linkMore": "Mehr erfahren" }, + "notAdminOrOwner": { + "heading": "Zugriff eingeschränkt", + "body": "Aus Sicherheitsgründen kann nur der Ersteller oder ein Administrator des Meetings eine videoaufnahme (Beta) starten.", + "linkMore": "Mehr erfahren" + }, "stopping": { "heading": "Daten werden gespeichert…", "body": "Sie können das Meeting verlassen, wenn Sie möchten; die Aufzeichnung wird automatisch beendet." diff --git a/src/frontend/src/locales/en/rooms.json b/src/frontend/src/locales/en/rooms.json index bcd25ea6..4e200a95 100644 --- a/src/frontend/src/locales/en/rooms.json +++ b/src/frontend/src/locales/en/rooms.json @@ -223,6 +223,11 @@ "loading": "Transcription starting", "linkMore": "Learn more" }, + "notAdminOrOwner": { + "heading": "Restricted Access", + "body": "For security reasons, only the meeting creator or an admin can start a transcription (beta).", + "linkMore": "Learn more" + }, "stop": { "heading": "Transcription in progress...", "body": "The transcription of your meeting is in progress. You will receive the result by email once the meeting is finished.", @@ -254,6 +259,11 @@ "loading": "Recording starting", "linkMore": "Learn more" }, + "notAdminOrOwner": { + "heading": "Restricted Access", + "body": "For security reasons, only the meeting creator or an admin can start a recording (beta).", + "linkMore": "Learn more" + }, "stopping": { "heading": "Saving your data…", "body": "You can leave the meeting if you wish; the recording will finish automatically." diff --git a/src/frontend/src/locales/fr/rooms.json b/src/frontend/src/locales/fr/rooms.json index 4a7643d2..3164ecc3 100644 --- a/src/frontend/src/locales/fr/rooms.json +++ b/src/frontend/src/locales/fr/rooms.json @@ -223,6 +223,11 @@ "loading": "Démarrage de la transcription", "linkMore": "En savoir plus" }, + "notAdminOrOwner": { + "heading": "Accès restreint", + "body": "Pour des raisons de sécurité, seul le créateur ou un administrateur de la réunion peut lancer une transcription (beta).", + "linkMore": "En savoir plus" + }, "stop": { "heading": "Transcription en cours …", "body": "La transcription de votre réunion est en cours. Vous recevrez le resultat par email une fois la réunion terminée.", @@ -254,6 +259,11 @@ "loading": "Démarrage de l'enregistrement", "linkMore": "En savoir plus" }, + "notAdminOrOwner": { + "heading": "Accès restreint", + "body": "Pour des raisons de sécurité, seul le créateur ou un administrateur de la réunion peut lancer un enregistrement (beta).", + "linkMore": "En savoir plus" + }, "stopping": { "heading": "Sauvegarde de vos données…", "body": "Vous pouvez quitter la réunion si vous le souhaitez, la sauvegarde se terminera automatiquement." diff --git a/src/frontend/src/locales/nl/rooms.json b/src/frontend/src/locales/nl/rooms.json index 198ff4ea..37b24c5c 100644 --- a/src/frontend/src/locales/nl/rooms.json +++ b/src/frontend/src/locales/nl/rooms.json @@ -223,6 +223,11 @@ "loading": "Transcriptie begint", "linkMore": "Meer informatie" }, + "notAdminOrOwner": { + "heading": "Toegang beperkt", + "body": "Om veiligheidsredenen kan alleen de maker of een beheerder van de vergadering een transcriptie starten (beta).", + "linkMore": "Meer informatie" + }, "stop": { "heading": "Transcriptie bezig...", "body": "De transcriptie van uw vergadering is bezig. U ontvangt het resultaat per e-mail zodra de vergadering is afgelopen.", @@ -254,6 +259,11 @@ "loading": "Opname gestarten", "linkMore": "Meer informatie" }, + "notAdminOrOwner": { + "heading": "Toegang beperkt", + "body": "Om veiligheidsredenen kan alleen de maker of een beheerder van de vergadering een opname starten (beta).", + "linkMore": "Meer informatie" + }, "stopping": { "heading": "Uw gegevens worden opgeslagen…", "body": "U kunt de vergadering verlaten als u dat wilt; de opname wordt automatisch voltooid."