♻️(frontend) get rid of the ListItemActionButton
Use the primitive Button component, avoid maintaining two button components.
This commit is contained in:
committed by
aleb_the_flash
parent
053c4a40e9
commit
1b48fa256e
@@ -8,8 +8,8 @@ import { getParticipantColor } from '@/features/rooms/utils/getParticipantColor'
|
|||||||
import { Participant } from 'livekit-client'
|
import { Participant } from 'livekit-client'
|
||||||
import { isLocal } from '@/utils/livekit'
|
import { isLocal } from '@/utils/livekit'
|
||||||
import { RiHand } from '@remixicon/react'
|
import { RiHand } from '@remixicon/react'
|
||||||
import { ListItemActionButton } from '@/features/rooms/livekit/components/controls/Participants/ListItemActionButton'
|
|
||||||
import { useLowerHandParticipant } from '@/features/rooms/livekit/api/lowerHandParticipant.ts'
|
import { useLowerHandParticipant } from '@/features/rooms/livekit/api/lowerHandParticipant.ts'
|
||||||
|
import { Button } from '@/primitives'
|
||||||
|
|
||||||
type HandRaisedListItemProps = {
|
type HandRaisedListItemProps = {
|
||||||
participant: Participant
|
participant: Participant
|
||||||
@@ -67,12 +67,15 @@ export const HandRaisedListItem = ({
|
|||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</HStack>
|
</HStack>
|
||||||
<ListItemActionButton
|
<Button
|
||||||
|
square
|
||||||
|
invisible
|
||||||
|
size="sm"
|
||||||
onPress={() => lowerHandParticipant(participant)}
|
onPress={() => lowerHandParticipant(participant)}
|
||||||
tooltip={t('participants.lowerParticipantHand', { name })}
|
tooltip={t('participants.lowerParticipantHand', { name })}
|
||||||
>
|
>
|
||||||
<RiHand color="gray" />
|
<RiHand />
|
||||||
</ListItemActionButton>
|
</Button>
|
||||||
</HStack>
|
</HStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
import { styled } from '@/styled-system/jsx'
|
|
||||||
import {
|
|
||||||
Button as RACButton,
|
|
||||||
ButtonProps as RACButtonsProps,
|
|
||||||
} from 'react-aria-components'
|
|
||||||
import {
|
|
||||||
TooltipWrapper,
|
|
||||||
TooltipWrapperProps,
|
|
||||||
} from '@/primitives/TooltipWrapper'
|
|
||||||
|
|
||||||
const StyledButton = styled(RACButton, {
|
|
||||||
base: {
|
|
||||||
padding: '10px',
|
|
||||||
minWidth: '24px',
|
|
||||||
minHeight: '24px',
|
|
||||||
borderRadius: '50%',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
transition: 'background 200ms',
|
|
||||||
'&[data-hovered]': {
|
|
||||||
backgroundColor: '#f5f5f5',
|
|
||||||
},
|
|
||||||
'&[data-focused]': {
|
|
||||||
backgroundColor: '#f5f5f5',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export const ListItemActionButton = ({
|
|
||||||
tooltip,
|
|
||||||
tooltipType = 'instant',
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: RACButtonsProps & TooltipWrapperProps) => {
|
|
||||||
return (
|
|
||||||
<TooltipWrapper tooltip={tooltip} tooltipType={tooltipType}>
|
|
||||||
<StyledButton {...props}>{children}</StyledButton>
|
|
||||||
</TooltipWrapper>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,6 @@ import { RiMicOffLine } from '@remixicon/react'
|
|||||||
import { Button, Dialog, P } from '@/primitives'
|
import { Button, Dialog, P } from '@/primitives'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useMuteParticipant } from '@/features/rooms/livekit/api/muteParticipant'
|
import { useMuteParticipant } from '@/features/rooms/livekit/api/muteParticipant'
|
||||||
import { ListItemActionButton } from '@/features/rooms/livekit/components/controls/Participants/ListItemActionButton'
|
|
||||||
|
|
||||||
const MuteAlertDialog = ({
|
const MuteAlertDialog = ({
|
||||||
isOpen,
|
isOpen,
|
||||||
@@ -66,7 +65,10 @@ const MicIndicator = ({ participant }: MicIndicatorProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ListItemActionButton
|
<Button
|
||||||
|
square
|
||||||
|
invisible
|
||||||
|
size="sm"
|
||||||
tooltip={t('participants.muteParticipant', {
|
tooltip={t('participants.muteParticipant', {
|
||||||
name,
|
name,
|
||||||
})}
|
})}
|
||||||
@@ -78,7 +80,7 @@ const MicIndicator = ({ participant }: MicIndicatorProps) => {
|
|||||||
) : (
|
) : (
|
||||||
<ActiveSpeaker isSpeaking={isSpeaking} />
|
<ActiveSpeaker isSpeaking={isSpeaking} />
|
||||||
)}
|
)}
|
||||||
</ListItemActionButton>
|
</Button>
|
||||||
<MuteAlertDialog
|
<MuteAlertDialog
|
||||||
isOpen={isAlertOpen}
|
isOpen={isAlertOpen}
|
||||||
onSubmit={() =>
|
onSubmit={() =>
|
||||||
|
|||||||
Reference in New Issue
Block a user