- {(matches) =>
- matches ? (
-
+ {isMobile ? (
+ <>
+
+
+ {
+ setConsoleSize(size);
+ setIsOverlayVisible(true);
+ }}
+ onDragFinished={() => {
+ setIsOverlayVisible(false);
+ }}
+ allowResize={ide.consoleIsExpanded}
+ className="editor-preview-subpanel"
+ >
+
+
+
+
+
+
+ {
+ cmRef.current = ctl;
+ }}
+ />
+
+ >
+ ) : (
+
+ {
+ setSidebarSize(size);
+ }}
+ allowResize={ide.sidebarIsExpanded}
+ minSize={150}
+ >
+
+ {
+ setIsOverlayVisible(true);
+ }}
+ onDragFinished={() => {
+ setIsOverlayVisible(false);
+ }}
+ resizerStyle={{
+ borderLeftWidth: '2px',
+ borderRightWidth: '2px',
+ width: '2px',
+ margin: '0px 0px'
+ }}
+ >
{
- setSidebarSize(size);
+ setConsoleSize(size);
}}
- allowResize={ide.sidebarIsExpanded}
- minSize={150}
+ allowResize={ide.consoleIsExpanded}
+ className="editor-preview-subpanel"
>
-
- {
- setIsOverlayVisible(true);
- }}
- onDragFinished={() => {
- setIsOverlayVisible(false);
- }}
- resizerStyle={{
- borderLeftWidth: '2px',
- borderRightWidth: '2px',
- width: '2px',
- margin: '0px 0px'
+ {
+ cmRef.current = ctl;
}}
- >
- {
- setConsoleSize(size);
- }}
- allowResize={ide.consoleIsExpanded}
- className="editor-preview-subpanel"
- >
- {
- cmRef.current = ctl;
- }}
- />
-
-
-
-
-
- {t('Toolbar.Preview')}
-
-
-
-
-
+ />
+
-
- ) : (
- <>
-
-
- {
- setConsoleSize(size);
- setIsOverlayVisible(true);
- }}
- onDragFinished={() => {
- setIsOverlayVisible(false);
- }}
- allowResize={ide.consoleIsExpanded}
- className="editor-preview-subpanel"
- >
+
+
+
+ {t('Toolbar.Preview')}
+
+
+
-
-
-
-
-
- {
- cmRef.current = ctl;
- }}
- />
-
- >
- )
- }
-
+
+
+
+
+
+ )}
);
diff --git a/client/modules/User/components/DashboardTabSwitcher.jsx b/client/modules/User/components/DashboardTabSwitcher.jsx
index c3c288d3c8..6bfdb9bb22 100644
--- a/client/modules/User/components/DashboardTabSwitcher.jsx
+++ b/client/modules/User/components/DashboardTabSwitcher.jsx
@@ -1,7 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { useTranslation } from 'react-i18next';
-import MediaQuery from 'react-responsive';
import { useDispatch } from 'react-redux';
import styled from 'styled-components';
import { FilterIcon } from '../../../common/icons';
@@ -9,6 +8,7 @@ import IconButton from '../../../common/IconButton';
import RouterTab from '../../../common/RouterTab';
import { Options } from '../../IDE/components/Header/MobileNav';
import { toggleDirectionForField } from '../../IDE/actions/sorting';
+import useIsMobile from '../../IDE/hooks/useIsMobile';
export const TabKey = {
assets: 'assets',
@@ -26,6 +26,7 @@ const FilterOptions = styled(Options)`
`;
const DashboardTabSwitcher = ({ currentTab, isOwner, username }) => {
+ const isMobile = useIsMobile();
const { t } = useTranslation();
const dispatch = useDispatch();
@@ -44,56 +45,47 @@ const DashboardTabSwitcher = ({ currentTab, isOwner, username }) => {
)}
-
- {(mobile) =>
- mobile &&
- currentTab !== TabKey.assets && (
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- {currentTab === TabKey.collections && (
- -
-
-
- )}
-
-
-
- )
- }
-
+ {isMobile && currentTab !== TabKey.assets && (
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ {currentTab === TabKey.collections && (
+ -
+
+
+ )}
+
+
+
+ )}
);
};
diff --git a/client/modules/User/pages/DashboardView.jsx b/client/modules/User/pages/DashboardView.jsx
index f0b6d249b0..fcde949cd7 100644
--- a/client/modules/User/pages/DashboardView.jsx
+++ b/client/modules/User/pages/DashboardView.jsx
@@ -1,6 +1,5 @@
import React, { useState, useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-import MediaQuery from 'react-responsive';
import { useLocation, useParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
@@ -22,8 +21,10 @@ import CollectionCreate from '../components/CollectionCreate';
import DashboardTabSwitcherPublic, {
TabKey
} from '../components/DashboardTabSwitcher';
+import useIsMobile from '../../IDE/hooks/useIsMobile';
const DashboardView = () => {
+ const isMobile = useIsMobile();
const { t } = useTranslation();
const params = useParams();
@@ -134,9 +135,7 @@ const DashboardView = () => {
-
- {(mobile) => renderContent(currentTab, params.username, mobile)}
-
+ {renderContent(currentTab, params.username, isMobile)}
{collectionCreateVisible && (