Skip to content

Commit

Permalink
Update publish-alpha (#2881)
Browse files Browse the repository at this point in the history
* fix: role change UI (#2877)

* fix: design parity

* fix: border

* fix: handle role change for single role scenario (#2880)

---------

Co-authored-by: Kaustubh Kumar <[email protected]>
  • Loading branch information
github-actions[bot] and KaustubhKumar05 authored May 7, 2024
1 parent d1f3685 commit 57edd58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
HMSPeer,
HMSPeerType,
HMSRoleName,
selectAvailableRoleNames,
selectHandRaisedPeers,
selectHasPeerHandRaised,
selectIsLargeRoom,
Expand Down Expand Up @@ -372,6 +373,7 @@ const ParticipantMoreActions = ({ peerId, role }: { peerId: string; role: string
} = usePeerOnStageActions({ peerId, role });
const canChangeRole = !!useHMSStore(selectPermissions)?.changeRole;
const [openRoleChangeModal, setOpenRoleChangeModal] = useState(false);
const roles = useHMSStore(selectAvailableRoleNames);

return (
<>
Expand Down Expand Up @@ -409,7 +411,7 @@ const ParticipantMoreActions = ({ peerId, role }: { peerId: string; role: string
</Dropdown.Item>
) : null}

{canChangeRole ? (
{canChangeRole && roles.length > 1 ? (
<Dropdown.Item css={{ bg: '$surface_default' }} onClick={() => setOpenRoleChangeModal(true)}>
<PersonSettingsIcon />
<Text variant="sm" css={{ ml: '$4', fontWeight: '$semiBold', c: '$on_surface_high' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
HMSSimulcastLayerDefinition,
HMSTrackID,
HMSVideoTrack,
selectAvailableRoleNames,
selectPermissions,
selectSessionStore,
selectTrackByID,
Expand Down Expand Up @@ -247,6 +248,7 @@ export const TileMenuContent = ({
const canChangeRole = !!permissions?.changeRole;
const removeOthers = !!permissions?.removeOthers;
const { userName } = useHMSPrebuiltContext();
const roles = useHMSStore(selectAvailableRoleNames);

const { isAudioEnabled, isVideoEnabled, setVolume, toggleAudio, toggleVideo, volume } = useRemoteAVToggle(
audioTrackID,
Expand Down Expand Up @@ -315,7 +317,7 @@ export const TileMenuContent = ({
</StyledMenuTile.ItemButton>
) : null}

{canChangeRole ? (
{canChangeRole && roles.length > 1 ? (
<StyledMenuTile.ItemButton
className={dragClassName}
css={spacingCSS}
Expand Down

0 comments on commit 57edd58

Please sign in to comment.