From 57a7523cc41c58c19985a2d439ae9509a76f9831 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 31 Dec 2025 22:53:33 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(frontend)=20extract=20record?= =?UTF-8?q?ing=20row=20layout=20in=20reusable=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that screen recording and transcription share the same UI presentation, extract the row logic into a reusable component to avoid code duplication and improve code maintainability. --- .../recording/components/RowWrapper.tsx | 60 +++++++ .../components/ScreenRecordingSidePanel.tsx | 64 +------- .../components/TranscriptSidePanel.tsx | 155 +++++------------- 3 files changed, 104 insertions(+), 175 deletions(-) create mode 100644 src/frontend/src/features/recording/components/RowWrapper.tsx diff --git a/src/frontend/src/features/recording/components/RowWrapper.tsx b/src/frontend/src/features/recording/components/RowWrapper.tsx new file mode 100644 index 00000000..05704991 --- /dev/null +++ b/src/frontend/src/features/recording/components/RowWrapper.tsx @@ -0,0 +1,60 @@ +import { css } from '@/styled-system/css' +import { ReactNode } from 'react' + +type RowPosition = 'first' | 'middle' | 'last' | 'single' + +const BORDER_RADIUS_MAP: Record = { + first: '4px 4px 0 0', + middle: '0', + last: '0 0 4px 4px', + single: '4px', +} as const + +interface RowWrapperProps { + iconName: string + children: ReactNode + position?: RowPosition +} + +export const RowWrapper = ({ + iconName, + children, + position = 'middle', +}: RowWrapperProps) => { + return ( +
+
+ {/* fixme - doesn't handle properly material-symbols */} + {iconName} +
+
+ {children} +
+
+ ) +} diff --git a/src/frontend/src/features/recording/components/ScreenRecordingSidePanel.tsx b/src/frontend/src/features/recording/components/ScreenRecordingSidePanel.tsx index ce69c763..00310f55 100644 --- a/src/frontend/src/features/recording/components/ScreenRecordingSidePanel.tsx +++ b/src/frontend/src/features/recording/components/ScreenRecordingSidePanel.tsx @@ -27,6 +27,7 @@ import { useConfig } from '@/api/useConfig' import { FeatureFlags } from '@/features/analytics/enums' import { NoAccessView } from './NoAccessView' import { HStack, VStack } from '@/styled-system/jsx' +import { RowWrapper } from './RowWrapper' import { Checkbox } from '@/primitives/Checkbox' import { useTranscriptionLanguage } from '@/features/settings' @@ -188,63 +189,12 @@ export const ScreenRecordingSidePanel = () => { -
-
- cloud_download -
-
- {t('details.destination')} -
-
-
-
- mail -
-
- {t('details.receiver')} -
-
+ + {t('details.destination')} + + + {t('details.receiver')} +
diff --git a/src/frontend/src/features/recording/components/TranscriptSidePanel.tsx b/src/frontend/src/features/recording/components/TranscriptSidePanel.tsx index d72442e9..61975e12 100644 --- a/src/frontend/src/features/recording/components/TranscriptSidePanel.tsx +++ b/src/frontend/src/features/recording/components/TranscriptSidePanel.tsx @@ -25,7 +25,7 @@ import posthog from 'posthog-js' import { useSnapshot } from 'valtio/index' import { Spinner } from '@/primitives/Spinner' import { useConfig } from '@/api/useConfig' -import { HStack, VStack } from '@/styled-system/jsx' +import { VStack } from '@/styled-system/jsx' import { Checkbox } from '@/primitives/Checkbox.tsx' import { @@ -34,6 +34,7 @@ import { useTranscriptionLanguage, } from '@/features/settings' import { NoAccessView } from './NoAccessView' +import { RowWrapper } from './RowWrapper' export const TranscriptSidePanel = () => { const { data } = useConfig() @@ -214,123 +215,41 @@ export const TranscriptSidePanel = () => { -
-
- article -
-
- - {data?.transcription_destination ? ( - <> - {t('details.destination')}{' '} - - {data.transcription_destination.replace('https://', '')} - - - ) : ( - t('details.destinationUnknown') - )} - -
-
-
-
- mail -
-
- {t('details.receiver')} -
-
-
-
- language -
-
- {t('details.language')} - - - -
-
- + + + {data?.transcription_destination ? ( + <> + {t('details.destination')}{' '} + + {data.transcription_destination.replace('https://', '')} + + + ) : ( + t('details.destinationUnknown') + )} + + + + {t('details.receiver')} + + + {t('details.language')} + + + +