(frontend) initialize transcript sidebar panel

Setup base structure and styling for transcript menu sidebar
This commit is contained in:
lebaudantoine
2024-12-03 22:00:31 +01:00
committed by aleb_the_flash
parent 94d18cffe4
commit 7ce4390740
8 changed files with 87 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ import { useSidePanel } from '../hooks/useSidePanel'
import { ReactNode } from 'react' import { ReactNode } from 'react'
import { Effects } from './Effects' import { Effects } from './Effects'
import { Chat } from '../prefabs/Chat' import { Chat } from '../prefabs/Chat'
import { Transcript } from './Transcript'
type StyledSidePanelProps = { type StyledSidePanelProps = {
title: string title: string
@@ -106,6 +107,7 @@ export const SidePanel = () => {
isEffectsOpen, isEffectsOpen,
isChatOpen, isChatOpen,
isSidePanelOpen, isSidePanelOpen,
isTranscriptOpen,
} = useSidePanel() } = useSidePanel()
const { t } = useTranslation('rooms', { keyPrefix: 'sidePanel' }) const { t } = useTranslation('rooms', { keyPrefix: 'sidePanel' })
@@ -127,6 +129,9 @@ export const SidePanel = () => {
<Panel isOpen={isChatOpen}> <Panel isOpen={isChatOpen}>
<Chat /> <Chat />
</Panel> </Panel>
<Panel isOpen={isTranscriptOpen}>
<Transcript />
</Panel>
</StyledSidePanel> </StyledSidePanel>
) )
} }

View File

@@ -0,0 +1,14 @@
import { Div } from '@/primitives'
export const Transcript = () => {
return (
<Div
overflowY="scroll"
padding={'0 1.5rem'}
flexGrow={1}
flexDirection={'column'}
>
wip
</Div>
)
}

View File

@@ -0,0 +1,32 @@
import { ToggleButton } from '@/primitives'
import { RiBardLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { useSidePanel } from '@/features/rooms/livekit/hooks/useSidePanel'
import { css } from '@/styled-system/css'
export const TranscriptToggle = () => {
const { t } = useTranslation('rooms', { keyPrefix: 'controls.transcript' })
const { isTranscriptOpen, toggleTranscript } = useSidePanel()
const tooltipLabel = isTranscriptOpen ? 'open' : 'closed'
return (
<div
className={css({
position: 'relative',
display: 'inline-block',
})}
>
<ToggleButton
square
variant="primaryTextDark"
aria-label={t(tooltipLabel)}
tooltip={t(tooltipLabel)}
isSelected={isTranscriptOpen}
onPress={() => toggleTranscript()}
>
<RiBardLine />
</ToggleButton>
</div>
)
}

View File

@@ -5,6 +5,7 @@ export enum PanelId {
PARTICIPANTS = 'participants', PARTICIPANTS = 'participants',
EFFECTS = 'effects', EFFECTS = 'effects',
CHAT = 'chat', CHAT = 'chat',
TRANSCRIPT = 'transcript',
} }
export const useSidePanel = () => { export const useSidePanel = () => {
@@ -14,6 +15,7 @@ export const useSidePanel = () => {
const isParticipantsOpen = activePanelId == PanelId.PARTICIPANTS const isParticipantsOpen = activePanelId == PanelId.PARTICIPANTS
const isEffectsOpen = activePanelId == PanelId.EFFECTS const isEffectsOpen = activePanelId == PanelId.EFFECTS
const isChatOpen = activePanelId == PanelId.CHAT const isChatOpen = activePanelId == PanelId.CHAT
const isTranscriptOpen = activePanelId == PanelId.TRANSCRIPT
const isSidePanelOpen = !!activePanelId const isSidePanelOpen = !!activePanelId
const toggleParticipants = () => { const toggleParticipants = () => {
@@ -28,14 +30,20 @@ export const useSidePanel = () => {
layoutStore.activePanelId = isEffectsOpen ? null : PanelId.EFFECTS layoutStore.activePanelId = isEffectsOpen ? null : PanelId.EFFECTS
} }
const toggleTranscript = () => {
layoutStore.activePanelId = isTranscriptOpen ? null : PanelId.TRANSCRIPT
}
return { return {
activePanelId, activePanelId,
toggleParticipants, toggleParticipants,
toggleChat, toggleChat,
toggleEffects, toggleEffects,
toggleTranscript,
isChatOpen, isChatOpen,
isParticipantsOpen, isParticipantsOpen,
isEffectsOpen, isEffectsOpen,
isSidePanelOpen, isSidePanelOpen,
isTranscriptOpen,
} }
} }

View File

@@ -13,8 +13,10 @@ import { HandToggle } from '../components/controls/HandToggle'
import { SelectToggleDevice } from '../components/controls/SelectToggleDevice' import { SelectToggleDevice } from '../components/controls/SelectToggleDevice'
import { LeaveButton } from '../components/controls/LeaveButton' import { LeaveButton } from '../components/controls/LeaveButton'
import { ScreenShareToggle } from '../components/controls/ScreenShareToggle' import { ScreenShareToggle } from '../components/controls/ScreenShareToggle'
import { SupportToggle } from '../components/controls/SupportToggle'
import { TranscriptToggle } from '../components/controls/TranscriptToggle'
import { css } from '@/styled-system/css' import { css } from '@/styled-system/css'
import { SupportToggle } from '@/features/rooms/livekit/components/controls/SupportToggle.tsx'
/** @public */ /** @public */
export type ControlBarControls = { export type ControlBarControls = {
@@ -156,6 +158,7 @@ export function ControlBar({
> >
<ChatToggle /> <ChatToggle />
<ParticipantsToggle /> <ParticipantsToggle />
<TranscriptToggle />
<SupportToggle /> <SupportToggle />
</div> </div>
</div> </div>

View File

@@ -71,6 +71,10 @@
"open": "", "open": "",
"closed": "" "closed": ""
}, },
"transcript": {
"open": "",
"closed": ""
},
"support": "" "support": ""
}, },
"options": { "options": {
@@ -102,12 +106,14 @@
"heading": { "heading": {
"participants": "", "participants": "",
"effects": "", "effects": "",
"chat": "" "chat": "",
"transcript": ""
}, },
"content": { "content": {
"participants": "", "participants": "",
"effects": "", "effects": "",
"chat": "" "chat": "",
"transcript": ""
}, },
"closeButton": "" "closeButton": ""
}, },

View File

@@ -70,6 +70,10 @@
"open": "Hide everyone", "open": "Hide everyone",
"closed": "See everyone" "closed": "See everyone"
}, },
"transcript": {
"open": "Hide AI assistant",
"closed": "Show AI assistant"
},
"support": "Support" "support": "Support"
}, },
"options": { "options": {
@@ -101,12 +105,14 @@
"heading": { "heading": {
"participants": "Participants", "participants": "Participants",
"effects": "Effects", "effects": "Effects",
"chat": "Messages in the chat" "chat": "Messages in the chat",
"transcript": "AI Assistant"
}, },
"content": { "content": {
"participants": "participants", "participants": "participants",
"effects": "effects", "effects": "effects",
"chat": "messages" "chat": "messages",
"transcript": "AI assistant"
}, },
"closeButton": "Hide {{content}}" "closeButton": "Hide {{content}}"
}, },

View File

@@ -70,6 +70,10 @@
"open": "Masquer les participants", "open": "Masquer les participants",
"closed": "Afficher les participants" "closed": "Afficher les participants"
}, },
"transcript": {
"open": "Masquer l'assistant IA",
"closed": "Afficher l'assistant IA"
},
"support": "Support" "support": "Support"
}, },
"options": { "options": {
@@ -101,12 +105,14 @@
"heading": { "heading": {
"participants": "Participants", "participants": "Participants",
"effects": "Effets", "effects": "Effets",
"chat": "Messages dans l'appel" "chat": "Messages dans l'appel",
"transcript": "Assistant IA"
}, },
"content": { "content": {
"participants": "les participants", "participants": "les participants",
"effects": "les effets", "effects": "les effets",
"chat": "les messages" "chat": "les messages",
"transcript": "l'assistant IA"
}, },
"closeButton": "Masquer {{content}}" "closeButton": "Masquer {{content}}"
}, },