🚸(frontend) add subtle indicator for active tools

Implement discreet visual notification that appears when tools are active.
Helps users locate and return to active tools they may have closed
during their session.
This commit is contained in:
lebaudantoine
2025-04-16 19:42:07 +02:00
committed by aleb_the_flash
parent 7021272075
commit b4484540f7
3 changed files with 51 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
import { useSnapshot } from 'valtio'
import { RecordingStatus, recordingStore } from '@/stores/recording'
import { RecordingMode } from '@/features/recording'
export const useIsRecordingActive = (mode: RecordingMode) => {
const recordingSnap = useSnapshot(recordingStore)
switch (mode) {
case RecordingMode.Transcript:
return [
RecordingStatus.TRANSCRIPT_STARTED,
RecordingStatus.TRANSCRIPT_STARTING,
RecordingStatus.TRANSCRIPT_STOPPING,
].includes(recordingSnap.status)
case RecordingMode.ScreenRecording:
return [
RecordingStatus.SCREEN_RECORDING_STARTED,
RecordingStatus.SCREEN_RECORDING_STARTING,
RecordingStatus.SCREEN_RECORDING_STOPPING,
].includes(recordingSnap.status)
}
}

View File

@@ -2,6 +2,7 @@
export { useIsRecordingModeEnabled } from './hooks/useIsRecordingModeEnabled' export { useIsRecordingModeEnabled } from './hooks/useIsRecordingModeEnabled'
export { useIsRecordingTransitioning } from './hooks/useIsRecordingTransitioning' export { useIsRecordingTransitioning } from './hooks/useIsRecordingTransitioning'
export { useHasRecordingAccess } from './hooks/useHasRecordingAccess' export { useHasRecordingAccess } from './hooks/useHasRecordingAccess'
export { useIsRecordingActive } from './hooks/useIsRecordingActive'
// api // api
export { useStartRecording } from './api/startRecording' export { useStartRecording } from './api/startRecording'

View File

@@ -10,10 +10,9 @@ import {
useIsRecordingModeEnabled, useIsRecordingModeEnabled,
RecordingMode, RecordingMode,
useHasRecordingAccess, useHasRecordingAccess,
} from '@/features/recording'
import {
TranscriptSidePanel, TranscriptSidePanel,
ScreenRecordingSidePanel, ScreenRecordingSidePanel,
useIsRecordingActive,
} from '@/features/recording' } from '@/features/recording'
import { FeatureFlags } from '@/features/analytics/enums' import { FeatureFlags } from '@/features/analytics/enums'
@@ -23,6 +22,7 @@ export interface ToolsButtonProps {
description: string description: string
onPress: () => void onPress: () => void
isBetaFeature?: boolean isBetaFeature?: boolean
isActive?: boolean
} }
const ToolButton = ({ const ToolButton = ({
@@ -31,6 +31,7 @@ const ToolButton = ({
description, description,
onPress, onPress,
isBetaFeature = false, isBetaFeature = false,
isActive = false,
}: ToolsButtonProps) => { }: ToolsButtonProps) => {
return ( return (
<RACButton <RACButton
@@ -85,8 +86,23 @@ const ToolButton = ({
)} )}
</div> </div>
<div> <div>
<Text margin={false} as="h3"> <Text
margin={false}
as="h3"
className={css({ display: 'flex', gap: 0.25 })}
>
{title} {title}
{isActive && (
<div
className={css({
backgroundColor: 'primary.500',
height: '10px',
width: '10px',
marginTop: '5px',
borderRadius: '100%',
})}
/>
)}
</Text> </Text>
<Text as="p" variant="smNote" wrap="pretty"> <Text as="p" variant="smNote" wrap="pretty">
{description} {description}
@@ -100,15 +116,22 @@ export const Tools = () => {
const { openTranscript, openScreenRecording, activeSubPanelId } = const { openTranscript, openScreenRecording, activeSubPanelId } =
useSidePanel() useSidePanel()
const { t } = useTranslation('rooms', { keyPrefix: 'moreTools' }) const { t } = useTranslation('rooms', { keyPrefix: 'moreTools' })
const isTranscriptEnabled = useIsRecordingModeEnabled( const isTranscriptEnabled = useIsRecordingModeEnabled(
RecordingMode.Transcript RecordingMode.Transcript
) )
const isTranscriptActive = useIsRecordingActive(RecordingMode.Transcript)
const hasScreenRecordingAccess = useHasRecordingAccess( const hasScreenRecordingAccess = useHasRecordingAccess(
RecordingMode.ScreenRecording, RecordingMode.ScreenRecording,
FeatureFlags.ScreenRecording FeatureFlags.ScreenRecording
) )
const isScreenRecordingActive = useIsRecordingActive(
RecordingMode.ScreenRecording
)
switch (activeSubPanelId) { switch (activeSubPanelId) {
case SubPanelId.TRANSCRIPT: case SubPanelId.TRANSCRIPT:
return <TranscriptSidePanel /> return <TranscriptSidePanel />
@@ -149,6 +172,7 @@ export const Tools = () => {
description={t('tools.transcript.body')} description={t('tools.transcript.body')}
onPress={() => openTranscript()} onPress={() => openTranscript()}
isBetaFeature isBetaFeature
isActive={isTranscriptActive}
/> />
)} )}
{hasScreenRecordingAccess && ( {hasScreenRecordingAccess && (
@@ -158,6 +182,7 @@ export const Tools = () => {
description={t('tools.screenRecording.body')} description={t('tools.screenRecording.body')}
onPress={() => openScreenRecording()} onPress={() => openScreenRecording()}
isBetaFeature isBetaFeature
isActive={isScreenRecordingActive}
/> />
)} )}
</Div> </Div>