diff --git a/frontend/src/components/MeetingRoom/ArchivingButton/ArchivingButton.tsx b/frontend/src/components/MeetingRoom/ArchivingButton/ArchivingButton.tsx index 4c2b6083..fa6d0712 100644 --- a/frontend/src/components/MeetingRoom/ArchivingButton/ArchivingButton.tsx +++ b/frontend/src/components/MeetingRoom/ArchivingButton/ArchivingButton.tsx @@ -6,6 +6,7 @@ import ToolbarButton from '../ToolbarButton'; import PopupDialog, { DialogTexts } from '../PopupDialog'; import { startArchiving, stopArchiving } from '../../../api/archiving'; import useSessionContext from '../../../hooks/useSessionContext'; +import useIsSmallViewport from '../../../hooks/useIsSmallViewport'; /** * ArchivingButton Component @@ -67,6 +68,7 @@ const ArchivingButton = (): ReactElement => { handleDialogClick(isRecording ? 'stop' : 'start'); }; + const isSmallViewport = useIsSmallViewport(); return ( <> @@ -78,6 +80,10 @@ const ArchivingButton = (): ReactElement => { style={{ color: `${isRecording ? 'rgb(239 68 68)' : 'white'}` }} /> } + sx={{ + marginTop: isSmallViewport ? '0px' : '4px', + }} + isSmallViewPort={isSmallViewport} /> { + const isSmallViewport = useIsSmallViewport(); return ( } + isSmallViewPort={isSmallViewport} /> diff --git a/frontend/src/components/MeetingRoom/EmojiGridButton/EmojiGridButton.tsx b/frontend/src/components/MeetingRoom/EmojiGridButton/EmojiGridButton.tsx index 30ee0152..9eaa1114 100644 --- a/frontend/src/components/MeetingRoom/EmojiGridButton/EmojiGridButton.tsx +++ b/frontend/src/components/MeetingRoom/EmojiGridButton/EmojiGridButton.tsx @@ -3,6 +3,7 @@ import { EmojiEmotions } from '@mui/icons-material'; import { Dispatch, ReactElement, SetStateAction, useRef } from 'react'; import ToolbarButton from '../ToolbarButton'; import EmojiGrid from '../EmojiGrid/EmojiGrid'; +import useIsSmallViewport from '../../../hooks/useIsSmallViewport'; export type EmojiGridProps = { isEmojiGridOpen: boolean; @@ -29,7 +30,7 @@ const EmojiGridButton = ({ const handleToggle = () => { setIsEmojiGridOpen((prevOpen) => !prevOpen); }; - + const isSmallViewport = useIsSmallViewport(); return ( <> @@ -42,6 +43,10 @@ const EmojiGridButton = ({ } ref={anchorRef} data-testid="emoji-grid-button" + sx={{ + marginTop: isSmallViewport ? '0px' : '4px', + }} + isSmallViewPort={isSmallViewport} /> diff --git a/frontend/src/components/MeetingRoom/LayoutButton/LayoutButton.tsx b/frontend/src/components/MeetingRoom/LayoutButton/LayoutButton.tsx index 219a810c..fc500061 100644 --- a/frontend/src/components/MeetingRoom/LayoutButton/LayoutButton.tsx +++ b/frontend/src/components/MeetingRoom/LayoutButton/LayoutButton.tsx @@ -4,6 +4,7 @@ import WindowIcon from '@mui/icons-material/Window'; import { ReactElement } from 'react'; import useSessionContext from '../../../hooks/useSessionContext'; import ToolbarButton from '../ToolbarButton'; +import useIsSmallViewport from '../../../hooks/useIsSmallViewport'; type LayoutButtonProps = { isScreenSharePresent: boolean; @@ -34,6 +35,8 @@ const LayoutButton = ({ isScreenSharePresent }: LayoutButtonProps): ReactElement return isGrid ? 'Switch to Active Speaker layout' : 'Switch to Grid layout'; }; + const isSmallViewport = useIsSmallViewport(); + return ( ); diff --git a/frontend/src/components/MeetingRoom/ParticipantListButton/ParticipantListButton.tsx b/frontend/src/components/MeetingRoom/ParticipantListButton/ParticipantListButton.tsx index d1b07c24..3e3eb01a 100644 --- a/frontend/src/components/MeetingRoom/ParticipantListButton/ParticipantListButton.tsx +++ b/frontend/src/components/MeetingRoom/ParticipantListButton/ParticipantListButton.tsx @@ -4,6 +4,7 @@ import { blue } from '@mui/material/colors'; import { Badge } from '@mui/material'; import { ReactElement } from 'react'; import ToolbarButton from '../ToolbarButton'; +import useIsSmallViewport from '../../../hooks/useIsSmallViewport'; export type ParticipantListButtonProps = { handleClick: () => void; @@ -26,6 +27,7 @@ const ParticipantListButton = ({ isOpen, participantCount, }: ParticipantListButtonProps): ReactElement => { + const isSmallViewport = useIsSmallViewport(); return (
} + isSmallViewPort={isSmallViewport} /> diff --git a/frontend/src/components/MeetingRoom/ReportIssueButton/ReportIssueButton.tsx b/frontend/src/components/MeetingRoom/ReportIssueButton/ReportIssueButton.tsx index a8ef9bf8..65e9b3e4 100644 --- a/frontend/src/components/MeetingRoom/ReportIssueButton/ReportIssueButton.tsx +++ b/frontend/src/components/MeetingRoom/ReportIssueButton/ReportIssueButton.tsx @@ -2,7 +2,7 @@ import { Tooltip } from '@mui/material'; import { ReactElement, useRef } from 'react'; import FeedbackIcon from '@mui/icons-material/Feedback'; import ToolbarButton from '../ToolbarButton'; -import displayOnDesktop from '../../../utils/displayOnDesktop'; +import useIsSmallViewport from '../../../hooks/useIsSmallViewport'; export type ReportIssueButtonProps = { handleClick: () => void; @@ -18,8 +18,9 @@ export type ReportIssueButtonProps = { */ const ReportIssueButton = ({ handleClick, isOpen }: ReportIssueButtonProps): ReactElement => { const anchorRef = useRef(null); + const isSmallViewport = useIsSmallViewport(); return ( -
+
} ref={anchorRef} + isSmallViewPort={isSmallViewport} />
diff --git a/frontend/src/components/MeetingRoom/ToolbarButton/ToolbarButton.tsx b/frontend/src/components/MeetingRoom/ToolbarButton/ToolbarButton.tsx index b970a0c6..556c3b53 100644 --- a/frontend/src/components/MeetingRoom/ToolbarButton/ToolbarButton.tsx +++ b/frontend/src/components/MeetingRoom/ToolbarButton/ToolbarButton.tsx @@ -8,6 +8,7 @@ export type ToolbarButtonProps = { icon: ReactElement; sx?: SxProps; id?: string; + isSmallViewPort?: boolean; }; /** @@ -16,14 +17,16 @@ export type ToolbarButtonProps = { * @param {ToolbarButtonProps} props - props for the component * @property {Function} onClick - on click handler * @property {ReactElement} icon - MUI Icon for button - * @property {SxProps} sx- optional MUI style object + * @property {SxProps} sx - (optional) MUI style object + * @property {string} id - (optional) the data-testid used in unit tests + * @property {boolean} isSmallViewPort - (optional) indicates whether the device is a small view port. * @returns {ReactElement} */ const ToolbarButton = forwardRef(function ToolbarButton( props: ToolbarButtonProps, ref: ForwardedRef ) { - const { icon: Icon, sx = {}, ...rest } = props; + const { icon: Icon, sx = {}, isSmallViewPort, ...rest } = props; return ( { expect(screen.queryByTestId('toolbar-overflow-menu')).not.toBeInTheDocument(); }); + + it('renders all the available buttons including the Report Issue button if enabled', () => { + vi.stubEnv('VITE_ENABLE_REPORT_ISSUE', 'true'); + render(); + expect(screen.getByTestId('layout-button')).toBeVisible(); + expect(screen.getByTestId('archiving-button')).toBeVisible(); + expect(screen.getByTestId('emoji-grid-button')).toBeVisible(); + expect(screen.getByTestId('report-issue-button')).toBeVisible(); + expect(screen.getByTestId('participant-list-button')).toBeVisible(); + expect(screen.getByTestId('chat-button')).toBeVisible(); + }); + + it('does not render Report Issue button in overflow menu if it was disabled', () => { + vi.stubEnv('VITE_ENABLE_REPORT_ISSUE', 'false'); + render(); + expect(screen.getByTestId('layout-button')).toBeVisible(); + expect(screen.getByTestId('archiving-button')).toBeVisible(); + expect(screen.getByTestId('emoji-grid-button')).toBeVisible(); + expect(screen.queryByTestId('report-issue-button')).not.toBeInTheDocument(); + expect(screen.getByTestId('participant-list-button')).toBeVisible(); + expect(screen.getByTestId('chat-button')).toBeVisible(); + }); }); diff --git a/frontend/src/components/MeetingRoom/ToolbarOverflowMenu/ToolbarOverflowMenu.tsx b/frontend/src/components/MeetingRoom/ToolbarOverflowMenu/ToolbarOverflowMenu.tsx index 31c6a6e0..c7a4dcd6 100644 --- a/frontend/src/components/MeetingRoom/ToolbarOverflowMenu/ToolbarOverflowMenu.tsx +++ b/frontend/src/components/MeetingRoom/ToolbarOverflowMenu/ToolbarOverflowMenu.tsx @@ -3,6 +3,9 @@ import { Grow, Paper, Popper } from '@mui/material'; import { Dispatch, ReactElement, RefObject, SetStateAction } from 'react'; import ArchivingButton from '../ArchivingButton'; import EmojiGridButton from '../EmojiGridButton'; +import ParticipantListButton from '../ParticipantListButton'; +import ChatButton from '../ChatButton'; +import ReportIssueButton from '../ReportIssueButton'; import LayoutButton from '../LayoutButton'; import useSessionContext from '../../../hooks/useSessionContext'; @@ -33,9 +36,17 @@ const ToolbarOverflowMenu = ({ anchorRef, handleClickAway, }: ToolbarOverflowMenuProps): ReactElement => { - const { subscriberWrappers } = useSessionContext(); + const { + subscriberWrappers, + rightPanelActiveTab, + toggleParticipantList, + toggleChat, + toggleReportIssue, + } = useSessionContext(); const isViewingScreenShare = subscriberWrappers.some((subWrapper) => subWrapper.isScreenshare); - + const participantCount = + subscriberWrappers.filter(({ isScreenshare }) => !isScreenshare).length + 1; + const isReportIssueEnabled = import.meta.env.VITE_ENABLE_REPORT_ISSUE === 'true'; return ( + {isReportIssueEnabled && ( + + )} + +