bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/layout/utils.js
Anton Georgiev ef300cf28e
chore: Fix typo (found by typos) (port) #19834
Co-authored-by: Stefan Weil <sw@weilnetz.de>
2024-03-18 09:58:53 -04:00

70 lines
1.9 KiB
JavaScript

import { DEVICE_TYPE, LAYOUT_TYPE } from './enums';
const phoneUpperBoundary = 600;
const tabletPortraitUpperBoundary = 900;
const tabletLandscapeUpperBoundary = 1200;
const windowSize = () => window.document.documentElement.clientWidth;
const isMobile = () => windowSize() <= (phoneUpperBoundary - 1);
const isTabletPortrait = () => windowSize() >= phoneUpperBoundary
&& windowSize() <= (tabletPortraitUpperBoundary - 1);
const isTabletLandscape = () => windowSize() >= tabletPortraitUpperBoundary
&& windowSize() <= (tabletLandscapeUpperBoundary - 1);
const isTablet = () => windowSize() >= phoneUpperBoundary
&& windowSize() <= (tabletLandscapeUpperBoundary - 1);
const isDesktop = () => windowSize() >= tabletLandscapeUpperBoundary;
const device = {
isMobile, isTablet, isTabletPortrait, isTabletLandscape, isDesktop,
};
export default device;
export {
isMobile, isTablet, isTabletPortrait, isTabletLandscape, isDesktop,
};
// Array for select component to select different layout
const suportedLayouts = [
{
layoutKey: LAYOUT_TYPE.SMART_LAYOUT,
layoutName: 'Smart Layout',
suportedDevices: [
DEVICE_TYPE.MOBILE,
DEVICE_TYPE.TABLET,
DEVICE_TYPE.TABLET_PORTRAIT,
DEVICE_TYPE.TABLET_LANDSCAPE,
DEVICE_TYPE.DESKTOP,
],
},
{
layoutKey: LAYOUT_TYPE.VIDEO_FOCUS,
layoutName: 'Video Focus',
suportedDevices: [
DEVICE_TYPE.MOBILE,
DEVICE_TYPE.TABLET,
DEVICE_TYPE.TABLET_PORTRAIT,
DEVICE_TYPE.TABLET_LANDSCAPE,
DEVICE_TYPE.DESKTOP,
],
},
{
layoutKey: LAYOUT_TYPE.PRESENTATION_FOCUS,
layoutName: 'Presentation Focus',
suportedDevices: [
DEVICE_TYPE.MOBILE,
DEVICE_TYPE.TABLET,
DEVICE_TYPE.TABLET_PORTRAIT,
DEVICE_TYPE.TABLET_LANDSCAPE,
DEVICE_TYPE.DESKTOP,
],
},
{
layoutKey: LAYOUT_TYPE.CUSTOM_LAYOUT,
layoutName: 'Custom Layout',
suportedDevices: [
DEVICE_TYPE.DESKTOP,
],
},
];
export { suportedLayouts };