♻️(frontend) refactor keyprefix in translation
Factorized translations' prefix.
This commit is contained in:
committed by
aleb_the_flash
parent
178278235e
commit
c0ad98eb34
@@ -5,7 +5,7 @@ import { css } from '@/styled-system/css'
|
|||||||
import { useWidgetInteraction } from '../../hooks/useWidgetInteraction'
|
import { useWidgetInteraction } from '../../hooks/useWidgetInteraction'
|
||||||
|
|
||||||
export const ChatToggle = () => {
|
export const ChatToggle = () => {
|
||||||
const { t } = useTranslation('rooms')
|
const { t } = useTranslation('rooms', { keyPrefix: 'controls.chat' })
|
||||||
|
|
||||||
const { isChatOpen, unreadMessages, toggleChat } = useWidgetInteraction()
|
const { isChatOpen, unreadMessages, toggleChat } = useWidgetInteraction()
|
||||||
const tooltipLabel = isChatOpen ? 'open' : 'closed'
|
const tooltipLabel = isChatOpen ? 'open' : 'closed'
|
||||||
@@ -20,8 +20,8 @@ export const ChatToggle = () => {
|
|||||||
<ToggleButton
|
<ToggleButton
|
||||||
square
|
square
|
||||||
legacyStyle
|
legacyStyle
|
||||||
aria-label={t(`controls.chat.${tooltipLabel}`)}
|
aria-label={t(tooltipLabel)}
|
||||||
tooltip={t(`controls.chat.${tooltipLabel}`)}
|
tooltip={t(tooltipLabel)}
|
||||||
isSelected={isChatOpen}
|
isSelected={isChatOpen}
|
||||||
onPress={() => toggleChat()}
|
onPress={() => toggleChat()}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -7,16 +7,14 @@ import { useRaisedHand } from '@/features/rooms/livekit/hooks/useRaisedHand'
|
|||||||
import { NotificationType } from '@/features/notifications/NotificationType'
|
import { NotificationType } from '@/features/notifications/NotificationType'
|
||||||
|
|
||||||
export const HandToggle = () => {
|
export const HandToggle = () => {
|
||||||
const { t } = useTranslation('rooms')
|
const { t } = useTranslation('rooms', { keyPrefix: 'controls.hand' })
|
||||||
|
|
||||||
const room = useRoomContext()
|
const room = useRoomContext()
|
||||||
const { isHandRaised, toggleRaisedHand } = useRaisedHand({
|
const { isHandRaised, toggleRaisedHand } = useRaisedHand({
|
||||||
participant: room.localParticipant,
|
participant: room.localParticipant,
|
||||||
})
|
})
|
||||||
|
|
||||||
const label = isHandRaised
|
const tooltipLabel = isHandRaised ? 'lower' : 'raise'
|
||||||
? t('controls.hand.lower')
|
|
||||||
: t('controls.hand.raise')
|
|
||||||
|
|
||||||
const notifyOtherParticipants = (isHandRaised: boolean) => {
|
const notifyOtherParticipants = (isHandRaised: boolean) => {
|
||||||
room.localParticipant.publishData(
|
room.localParticipant.publishData(
|
||||||
@@ -39,8 +37,8 @@ export const HandToggle = () => {
|
|||||||
<ToggleButton
|
<ToggleButton
|
||||||
square
|
square
|
||||||
legacyStyle
|
legacyStyle
|
||||||
aria-label={label}
|
aria-label={t(tooltipLabel)}
|
||||||
tooltip={label}
|
tooltip={t(tooltipLabel)}
|
||||||
isSelected={isHandRaised}
|
isSelected={isHandRaised}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
notifyOtherParticipants(isHandRaised)
|
notifyOtherParticipants(isHandRaised)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { LowerAllHandsButton } from '@/features/rooms/livekit/components/control
|
|||||||
|
|
||||||
// TODO: Optimize rendering performance, especially for longer participant lists, even though they are generally short.
|
// TODO: Optimize rendering performance, especially for longer participant lists, even though they are generally short.
|
||||||
export const ParticipantsList = () => {
|
export const ParticipantsList = () => {
|
||||||
const { t } = useTranslation('rooms')
|
const { t } = useTranslation('rooms', { keyPrefix: 'participants' })
|
||||||
|
|
||||||
// Preferred using the 'useParticipants' hook rather than the separate remote and local hooks,
|
// Preferred using the 'useParticipants' hook rather than the separate remote and local hooks,
|
||||||
// because the 'useLocalParticipant' hook does not update the participant's information when their
|
// because the 'useLocalParticipant' hook does not update the participant's information when their
|
||||||
@@ -65,15 +65,15 @@ export const ParticipantsList = () => {
|
|||||||
paddingTop: '1rem',
|
paddingTop: '1rem',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('participants.heading')}
|
{t('heading')}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Div position="absolute" top="5" right="5">
|
<Div position="absolute" top="5" right="5">
|
||||||
<Button
|
<Button
|
||||||
invisible
|
invisible
|
||||||
size="xs"
|
size="xs"
|
||||||
onPress={() => (participantsStore.showParticipants = false)}
|
onPress={() => (participantsStore.showParticipants = false)}
|
||||||
aria-label={t('participants.closeButton')}
|
aria-label={t('closeButton')}
|
||||||
tooltip={t('participants.closeButton')}
|
tooltip={t('closeButton')}
|
||||||
>
|
>
|
||||||
<RiCloseLine />
|
<RiCloseLine />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -89,12 +89,12 @@ export const ParticipantsList = () => {
|
|||||||
marginBottom: '0.83em',
|
marginBottom: '0.83em',
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{t('participants.subheading').toUpperCase()}
|
{t('subheading').toUpperCase()}
|
||||||
</H>
|
</H>
|
||||||
{raisedHandParticipants.length > 0 && (
|
{raisedHandParticipants.length > 0 && (
|
||||||
<Div marginBottom=".9375rem">
|
<Div marginBottom=".9375rem">
|
||||||
<ParticipantsCollapsableList
|
<ParticipantsCollapsableList
|
||||||
heading={t('participants.raisedHands')}
|
heading={t('raisedHands')}
|
||||||
participants={raisedHandParticipants}
|
participants={raisedHandParticipants}
|
||||||
renderParticipant={(participant) => (
|
renderParticipant={(participant) => (
|
||||||
<HandRaisedListItem participant={participant} />
|
<HandRaisedListItem participant={participant} />
|
||||||
@@ -106,7 +106,7 @@ export const ParticipantsList = () => {
|
|||||||
</Div>
|
</Div>
|
||||||
)}
|
)}
|
||||||
<ParticipantsCollapsableList
|
<ParticipantsCollapsableList
|
||||||
heading={t('participants.contributors')}
|
heading={t('contributors')}
|
||||||
participants={sortedParticipants}
|
participants={sortedParticipants}
|
||||||
renderParticipant={(participant) => (
|
renderParticipant={(participant) => (
|
||||||
<ParticipantListItem participant={participant} />
|
<ParticipantListItem participant={participant} />
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useParticipants } from '@livekit/components-react'
|
|||||||
import { useWidgetInteraction } from '../../../hooks/useWidgetInteraction'
|
import { useWidgetInteraction } from '../../../hooks/useWidgetInteraction'
|
||||||
|
|
||||||
export const ParticipantsToggle = () => {
|
export const ParticipantsToggle = () => {
|
||||||
const { t } = useTranslation('rooms')
|
const { t } = useTranslation('rooms', { keyPrefix: 'controls.participants' })
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context could not be used due to inconsistent refresh behavior.
|
* Context could not be used due to inconsistent refresh behavior.
|
||||||
@@ -30,8 +30,8 @@ export const ParticipantsToggle = () => {
|
|||||||
<ToggleButton
|
<ToggleButton
|
||||||
square
|
square
|
||||||
legacyStyle
|
legacyStyle
|
||||||
aria-label={t(`controls.participants.${tooltipLabel}`)}
|
aria-label={t(tooltipLabel)}
|
||||||
tooltip={t(`controls.participants.${tooltipLabel}`)}
|
tooltip={t(tooltipLabel)}
|
||||||
isSelected={isParticipantsOpen}
|
isSelected={isParticipantsOpen}
|
||||||
onPress={() => toggleParticipants()}
|
onPress={() => toggleParticipants()}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user