✨(frontend) move support options to menu for a clearer UI
Relocated support options to the menu to keep the interface concise and reduce visual clutter.
This commit is contained in:
committed by
aleb_the_flash
parent
7c9fc15359
commit
de3df889ba
@@ -4,6 +4,7 @@ import { FullScreenMenuItem } from './FullScreenMenuItem'
|
|||||||
import { SettingsMenuItem } from './SettingsMenuItem'
|
import { SettingsMenuItem } from './SettingsMenuItem'
|
||||||
import { FeedbackMenuItem } from './FeedbackMenuItem'
|
import { FeedbackMenuItem } from './FeedbackMenuItem'
|
||||||
import { EffectsMenuItem } from './EffectsMenuItem'
|
import { EffectsMenuItem } from './EffectsMenuItem'
|
||||||
|
import { SupportMenuItem } from './SupportMenuItem'
|
||||||
|
|
||||||
// @todo try refactoring it to use MenuList component
|
// @todo try refactoring it to use MenuList component
|
||||||
export const OptionsMenuItems = () => {
|
export const OptionsMenuItems = () => {
|
||||||
@@ -20,6 +21,7 @@ export const OptionsMenuItems = () => {
|
|||||||
</MenuSection>
|
</MenuSection>
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuSection>
|
<MenuSection>
|
||||||
|
<SupportMenuItem />
|
||||||
<FeedbackMenuItem />
|
<FeedbackMenuItem />
|
||||||
<SettingsMenuItem />
|
<SettingsMenuItem />
|
||||||
</MenuSection>
|
</MenuSection>
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { RiQuestionLine } from '@remixicon/react'
|
||||||
|
import { MenuItem } from 'react-aria-components'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import { menuRecipe } from '@/primitives/menuRecipe'
|
||||||
|
import { Crisp } from 'crisp-sdk-web'
|
||||||
|
import { useIsSupportEnabled } from '@/features/support/hooks/useSupport'
|
||||||
|
|
||||||
|
export const SupportMenuItem = () => {
|
||||||
|
const { t } = useTranslation('rooms', { keyPrefix: 'options.items' })
|
||||||
|
const isSupportEnabled = useIsSupportEnabled()
|
||||||
|
|
||||||
|
if (!isSupportEnabled || !Crisp) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
className={menuRecipe({ icon: true, variant: 'dark' }).item}
|
||||||
|
onAction={() => {
|
||||||
|
Crisp?.chat.open()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<RiQuestionLine size={20} />
|
||||||
|
{t('support')}
|
||||||
|
</MenuItem>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
import { ToggleButton } from '@/primitives'
|
|
||||||
import { RiQuestionLine } from '@remixicon/react'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
|
||||||
import { Crisp } from 'crisp-sdk-web'
|
|
||||||
import { useEffect, useState } from 'react'
|
|
||||||
import { ToggleButtonProps } from '@/primitives/ToggleButton'
|
|
||||||
import { useIsSupportEnabled } from '@/features/support/hooks/useSupport'
|
|
||||||
|
|
||||||
export const SupportToggle = ({ onPress, ...props }: ToggleButtonProps) => {
|
|
||||||
const { t } = useTranslation('rooms', { keyPrefix: 'controls' })
|
|
||||||
|
|
||||||
const [isOpened, setIsOpened] = useState(() => {
|
|
||||||
return window?.$crisp?.is?.('chat:opened') || false
|
|
||||||
})
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!Crisp) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Crisp.chat.onChatOpened(() => {
|
|
||||||
setIsOpened(true)
|
|
||||||
})
|
|
||||||
Crisp.chat.onChatClosed(() => {
|
|
||||||
setIsOpened(false)
|
|
||||||
})
|
|
||||||
return () => {
|
|
||||||
Crisp.chat.offChatOpened()
|
|
||||||
Crisp.chat.offChatClosed()
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const isSupportEnabled = useIsSupportEnabled()
|
|
||||||
|
|
||||||
if (!isSupportEnabled) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ToggleButton
|
|
||||||
square
|
|
||||||
variant="primaryTextDark"
|
|
||||||
tooltip={t('support')}
|
|
||||||
aria-label={t('support')}
|
|
||||||
isSelected={isOpened}
|
|
||||||
onPress={(e) => {
|
|
||||||
if (isOpened) {
|
|
||||||
Crisp.chat.close()
|
|
||||||
} else {
|
|
||||||
Crisp.chat.open()
|
|
||||||
}
|
|
||||||
onPress?.(e)
|
|
||||||
}}
|
|
||||||
data-attr="controls-support"
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<RiQuestionLine />
|
|
||||||
</ToggleButton>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,6 @@ import {
|
|||||||
import { ScreenShareToggle } from '../../components/controls/ScreenShareToggle'
|
import { ScreenShareToggle } from '../../components/controls/ScreenShareToggle'
|
||||||
import { ChatToggle } from '../../components/controls/ChatToggle'
|
import { ChatToggle } from '../../components/controls/ChatToggle'
|
||||||
import { ParticipantsToggle } from '../../components/controls/Participants/ParticipantsToggle'
|
import { ParticipantsToggle } from '../../components/controls/Participants/ParticipantsToggle'
|
||||||
import { SupportToggle } from '../../components/controls/SupportToggle'
|
|
||||||
import { useSidePanel } from '../../hooks/useSidePanel'
|
import { useSidePanel } from '../../hooks/useSidePanel'
|
||||||
import { LinkButton } from '@/primitives'
|
import { LinkButton } from '@/primitives'
|
||||||
import { useSettingsDialog } from '../../components/controls/SettingsDialogContext'
|
import { useSettingsDialog } from '../../components/controls/SettingsDialogContext'
|
||||||
@@ -138,10 +137,6 @@ export function MobileControlBar({
|
|||||||
description={true}
|
description={true}
|
||||||
onPress={() => setIsMenuOpened(false)}
|
onPress={() => setIsMenuOpened(false)}
|
||||||
/>
|
/>
|
||||||
<SupportToggle
|
|
||||||
description={true}
|
|
||||||
onPress={() => setIsMenuOpened(false)}
|
|
||||||
/>
|
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
toggleEffects()
|
toggleEffects()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { css } from '@/styled-system/css'
|
import { css } from '@/styled-system/css'
|
||||||
import { ChatToggle } from '../../components/controls/ChatToggle'
|
import { ChatToggle } from '../../components/controls/ChatToggle'
|
||||||
import { ParticipantsToggle } from '../../components/controls/Participants/ParticipantsToggle'
|
import { ParticipantsToggle } from '../../components/controls/Participants/ParticipantsToggle'
|
||||||
import { SupportToggle } from '../../components/controls/SupportToggle'
|
|
||||||
import { TranscriptToggle } from '../../components/controls/TranscriptToggle'
|
import { TranscriptToggle } from '../../components/controls/TranscriptToggle'
|
||||||
import { AdminToggle } from '../../components/AdminToggle'
|
import { AdminToggle } from '../../components/AdminToggle'
|
||||||
import { useSize } from '../../hooks/useResizeObserver'
|
import { useSize } from '../../hooks/useResizeObserver'
|
||||||
@@ -22,7 +21,6 @@ const NavigationControls = ({
|
|||||||
<ChatToggle onPress={onPress} tooltipType={tooltipType} />
|
<ChatToggle onPress={onPress} tooltipType={tooltipType} />
|
||||||
<ParticipantsToggle onPress={onPress} tooltipType={tooltipType} />
|
<ParticipantsToggle onPress={onPress} tooltipType={tooltipType} />
|
||||||
<TranscriptToggle onPress={onPress} tooltipType={tooltipType} />
|
<TranscriptToggle onPress={onPress} tooltipType={tooltipType} />
|
||||||
<SupportToggle onPress={onPress} tooltipType={tooltipType} />
|
|
||||||
<AdminToggle onPress={onPress} tooltipType={tooltipType} />
|
<AdminToggle onPress={onPress} tooltipType={tooltipType} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -112,7 +112,6 @@
|
|||||||
"open": "",
|
"open": "",
|
||||||
"closed": ""
|
"closed": ""
|
||||||
},
|
},
|
||||||
"support": "",
|
|
||||||
"moreOptions": "",
|
"moreOptions": "",
|
||||||
"reactions": {
|
"reactions": {
|
||||||
"button": "",
|
"button": "",
|
||||||
@@ -131,7 +130,8 @@
|
|||||||
"fullscreen": {
|
"fullscreen": {
|
||||||
"enter": "",
|
"enter": "",
|
||||||
"exit": ""
|
"exit": ""
|
||||||
}
|
},
|
||||||
|
"support": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"effects": {
|
"effects": {
|
||||||
|
|||||||
@@ -111,7 +111,6 @@
|
|||||||
"open": "Hide admin",
|
"open": "Hide admin",
|
||||||
"closed": "Open admin"
|
"closed": "Open admin"
|
||||||
},
|
},
|
||||||
"support": "Support",
|
|
||||||
"moreOptions": "More options",
|
"moreOptions": "More options",
|
||||||
"reactions": {
|
"reactions": {
|
||||||
"button": "Send reaction",
|
"button": "Send reaction",
|
||||||
@@ -130,7 +129,8 @@
|
|||||||
"fullscreen": {
|
"fullscreen": {
|
||||||
"enter": "Fullscreen",
|
"enter": "Fullscreen",
|
||||||
"exit": "Exit fullscreen mode"
|
"exit": "Exit fullscreen mode"
|
||||||
}
|
},
|
||||||
|
"support": "Contact support"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"effects": {
|
"effects": {
|
||||||
|
|||||||
@@ -111,7 +111,6 @@
|
|||||||
"open": "Masquer l'admin",
|
"open": "Masquer l'admin",
|
||||||
"closed": "Afficher l'admin"
|
"closed": "Afficher l'admin"
|
||||||
},
|
},
|
||||||
"support": "Support",
|
|
||||||
"moreOptions": "Plus d'options",
|
"moreOptions": "Plus d'options",
|
||||||
"reactions": {
|
"reactions": {
|
||||||
"button": "Envoyer une réaction",
|
"button": "Envoyer une réaction",
|
||||||
@@ -130,7 +129,8 @@
|
|||||||
"fullscreen": {
|
"fullscreen": {
|
||||||
"enter": "Plein écran",
|
"enter": "Plein écran",
|
||||||
"exit": "Quitter le mode plein écran"
|
"exit": "Quitter le mode plein écran"
|
||||||
}
|
},
|
||||||
|
"support": "Contacter l'aide"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"effects": {
|
"effects": {
|
||||||
|
|||||||
@@ -111,7 +111,6 @@
|
|||||||
"open": "Verberg beheerder",
|
"open": "Verberg beheerder",
|
||||||
"closed": "Toon beheerder"
|
"closed": "Toon beheerder"
|
||||||
},
|
},
|
||||||
"support": "Ondersteuning",
|
|
||||||
"moreOptions": "Meer opties",
|
"moreOptions": "Meer opties",
|
||||||
"reactions": {
|
"reactions": {
|
||||||
"button": "Stuur reactie",
|
"button": "Stuur reactie",
|
||||||
@@ -130,7 +129,8 @@
|
|||||||
"fullscreen": {
|
"fullscreen": {
|
||||||
"enter": "Volledig scherm",
|
"enter": "Volledig scherm",
|
||||||
"exit": "Stop volledig scherm stand"
|
"exit": "Stop volledig scherm stand"
|
||||||
}
|
},
|
||||||
|
"support": "Contact ondersteuning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"effects": {
|
"effects": {
|
||||||
|
|||||||
Reference in New Issue
Block a user