-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️(frontend) extract menu items into individual components
Each menu item is now a standalone component, improving: - Code organization & reusability - Maintainability by reducing OptionsMenuItems complexity This breaks down large components.
- Loading branch information
1 parent
a44b6e8
commit 1b52d76
Showing
5 changed files
with
103 additions
and
61 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/frontend/src/features/rooms/livekit/components/controls/Options/EffectsMenuItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { RiAccountBoxLine } from '@remixicon/react' | ||
import { MenuItem } from 'react-aria-components' | ||
import { useTranslation } from 'react-i18next' | ||
import { menuRecipe } from '@/primitives/menuRecipe' | ||
import { useSidePanel } from '../../../hooks/useSidePanel' | ||
|
||
export const EffectsMenuItem = () => { | ||
const { t } = useTranslation('rooms', { keyPrefix: 'options.items' }) | ||
const { toggleEffects } = useSidePanel() | ||
|
||
return ( | ||
<MenuItem | ||
onAction={() => toggleEffects()} | ||
className={menuRecipe({ icon: true, variant: 'dark' }).item} | ||
> | ||
<RiAccountBoxLine size={20} /> | ||
{t('effects')} | ||
</MenuItem> | ||
) | ||
} |
20 changes: 20 additions & 0 deletions
20
src/frontend/src/features/rooms/livekit/components/controls/Options/FeedbackMenuItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { RiMegaphoneLine } from '@remixicon/react' | ||
import { MenuItem } from 'react-aria-components' | ||
import { useTranslation } from 'react-i18next' | ||
import { menuRecipe } from '@/primitives/menuRecipe' | ||
import { GRIST_FORM } from '@/utils/constants' | ||
|
||
export const FeedbackMenuItem = () => { | ||
const { t } = useTranslation('rooms', { keyPrefix: 'options.items' }) | ||
|
||
return ( | ||
<MenuItem | ||
href={GRIST_FORM} | ||
target="_blank" | ||
className={menuRecipe({ icon: true, variant: 'dark' }).item} | ||
> | ||
<RiMegaphoneLine size={20} /> | ||
{t('feedback')} | ||
</MenuItem> | ||
) | ||
} |
34 changes: 34 additions & 0 deletions
34
src/frontend/src/features/rooms/livekit/components/controls/Options/FullScreenMenuItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { RiFullscreenExitLine, RiFullscreenLine } from '@remixicon/react' | ||
import { MenuItem } from 'react-aria-components' | ||
import { useTranslation } from 'react-i18next' | ||
import { menuRecipe } from '@/primitives/menuRecipe' | ||
import { useFullScreen } from '../../../hooks/useFullScreen' | ||
|
||
export const FullScreenMenuItem = () => { | ||
const { t } = useTranslation('rooms', { keyPrefix: 'options.items' }) | ||
const { toggleFullScreen, isCurrentlyFullscreen, isFullscreenAvailable } = | ||
useFullScreen() | ||
|
||
if (!isFullscreenAvailable) { | ||
return null | ||
} | ||
|
||
return ( | ||
<MenuItem | ||
onAction={() => toggleFullScreen()} | ||
className={menuRecipe({ icon: true, variant: 'dark' }).item} | ||
> | ||
{isCurrentlyFullscreen ? ( | ||
<> | ||
<RiFullscreenExitLine size={20} /> | ||
{t('fullscreen.exit')} | ||
</> | ||
) : ( | ||
<> | ||
<RiFullscreenLine size={20} /> | ||
{t('fullscreen.enter')} | ||
</> | ||
)} | ||
</MenuItem> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/frontend/src/features/rooms/livekit/components/controls/Options/SettingsMenuItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { RiSettings3Line } from '@remixicon/react' | ||
import { MenuItem } from 'react-aria-components' | ||
import { useTranslation } from 'react-i18next' | ||
import { menuRecipe } from '@/primitives/menuRecipe' | ||
import { useSettingsDialog } from '../SettingsDialogContext' | ||
|
||
export const SettingsMenuItem = () => { | ||
const { t } = useTranslation('rooms', { keyPrefix: 'options.items' }) | ||
const { setDialogOpen } = useSettingsDialog() | ||
|
||
return ( | ||
<MenuItem | ||
className={menuRecipe({ icon: true, variant: 'dark' }).item} | ||
onAction={() => setDialogOpen(true)} | ||
> | ||
<RiSettings3Line size={20} /> | ||
{t('settings')} | ||
</MenuItem> | ||
) | ||
} |