Skip to content

Commit

Permalink
fix: conditions for showing more actions
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed Sep 24, 2023
1 parent 3ab202d commit aef5016
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ export const Participant = ({ peer, isConnected }) => {
const ParticipantActions = React.memo(({ peerId, role, isLocal }) => {
const isHandRaised = useHMSStore(selectHasPeerHandRaised(peerId));
const canChangeRole = useHMSStore(selectPermissions)?.changeRole;
const shouldShowMoreActions = canChangeRole;
const canRemoveOthers = useHMSStore(selectPermissions)?.removeOthers;
const { elements } = useRoomLayoutConferencingScreen();
const { on_stage_exp } = elements || {};
const shouldShowMoreActions = (on_stage_exp && canChangeRole) || canRemoveOthers;
const isAudioMuted = !useHMSStore(selectIsPeerAudioEnabled(peerId));

return (
Expand Down Expand Up @@ -212,15 +215,21 @@ const ParticipantActions = React.memo(({ peerId, role, isLocal }) => {
</Flex>
) : null}

{shouldShowMoreActions && !isLocal ? <ParticipantMoreActions peerId={peerId} role={role} /> : null}
{shouldShowMoreActions && !isLocal ? (
<ParticipantMoreActions
peerId={peerId}
role={role}
elements={elements}
canChangeRole={canChangeRole}
canRemoveOthers={canRemoveOthers}
/>
) : null}
</Flex>
);
});

const ParticipantMoreActions = ({ peerId, role }) => {
const ParticipantMoreActions = ({ peerId, role, elements, canChangeRole, canRemoveOthers }) => {
const hmsActions = useHMSActions();
const { changeRole: canChangeRole, removeOthers: canRemoveOthers } = useHMSStore(selectPermissions);
const { elements } = useRoomLayoutConferencingScreen();
const {
bring_to_stage_label,
remove_from_stage_label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const RoleAccordion = ({
icon={<AddCircleIcon />}
content="Load More"
onClick={loadNext}
backgroundColor="$secodary_default"
backgroundColor="$secondary_default"
css={{
w: 'max-content',
borderRadius: '$size$9',
Expand Down

0 comments on commit aef5016

Please sign in to comment.