diff --git a/src/app/atoms/button/IconButton.jsx b/src/app/atoms/button/IconButton.jsx index a06c136c..f6a8730e 100644 --- a/src/app/atoms/button/IconButton.jsx +++ b/src/app/atoms/button/IconButton.jsx @@ -11,11 +11,12 @@ const IconButton = React.forwardRef(({ variant, size, type, tooltip, tooltipPlacement, src, onClick, tabIndex, disabled, isImage, + className, }, ref) => { const btn = ( toggleRoomSettings(tabText.SEARCH)} tooltip="Search" src={SearchIC} /> - + } + */ + const navWrapperRef = useRef(null); + /** + * @type {React.MutableRefObject} + */ + const roomWrapperRef = useRef(null); + + // #region Liston on events for compact screen sizes + function onRoomSelected() { + // setActiveView(viewPossibilities.room); + navWrapperRef.current.classList.add(classNameHidden); + roomWrapperRef.current.classList.remove(classNameHidden); + } + function onNavigationSelected() { + // setActiveView(viewPossibilities.nav); + navWrapperRef.current.classList.remove(classNameHidden); + roomWrapperRef.current.classList.add(classNameHidden); + } + + useEffect(() => { + navigation.on(cons.events.navigation.ROOM_SELECTED, onRoomSelected); + navigation.on(cons.events.navigation.NAVIGATION_OPENED, onNavigationSelected); + + return (() => { + navigation.removeListener(cons.events.navigation.ROOM_SELECTED, onRoomSelected); + navigation.removeListener(cons.events.navigation.NAVIGATION_OPENED, onNavigationSelected); + }); + }, []); + // #endregion + useEffect(() => { let counter = 0; const iId = setInterval(() => { @@ -64,6 +98,7 @@ function Client() { ); } + // #region drag and drop function dragContainsFiles(e) { if (!e.dataTransfer.types) return false; @@ -119,6 +154,7 @@ function Client() { initMatrix.roomsInput.setAttachment(roomId, file); initMatrix.roomsInput.emit(cons.events.roomsInput.ATTACHMENT_SET, file); } + // #endregion return (
-
+
-
+
diff --git a/src/app/templates/client/Client.scss b/src/app/templates/client/Client.scss index 45a50527..67d5dfd5 100644 --- a/src/app/templates/client/Client.scss +++ b/src/app/templates/client/Client.scss @@ -1,3 +1,5 @@ +@use '../../partials/screen'; + .client-container { display: flex; height: 100%; @@ -5,12 +7,22 @@ .navigation__wrapper { width: var(--navigation-width); + + @include screen.smallerThan(mobileBreakpoint) { + width: 100%; + } } + .room__wrapper { flex: 1; min-width: 0; } +@include screen.smallerThan(mobileBreakpoint) { + .client__item-hidden { + display: none; + } +} .loading-display { position: absolute; @@ -41,4 +53,4 @@ .text { color: var(--tc-link); } -} \ No newline at end of file +} diff --git a/src/client/action/navigation.js b/src/client/action/navigation.js index e16d25d2..8876732e 100644 --- a/src/client/action/navigation.js +++ b/src/client/action/navigation.js @@ -23,6 +23,15 @@ export function selectRoom(roomId, eventId) { }); } +/** + * Open navigation on compact screen sizes + */ +export function openNavigation() { + appDispatcher.dispatch({ + type: cons.actions.navigation.OPEN_NAVIGATION, + }); +} + export function openSpaceSettings(roomId, tabText) { appDispatcher.dispatch({ type: cons.actions.navigation.OPEN_SPACE_SETTINGS, diff --git a/src/client/state/cons.js b/src/client/state/cons.js index 4e258ac3..34a3a928 100644 --- a/src/client/state/cons.js +++ b/src/client/state/cons.js @@ -47,6 +47,7 @@ const cons = { CLICK_REPLY_TO: 'CLICK_REPLY_TO', OPEN_SEARCH: 'OPEN_SEARCH', OPEN_REUSABLE_CONTEXT_MENU: 'OPEN_REUSABLE_CONTEXT_MENU', + OPEN_NAVIGATION: 'OPEN_NAVIGATION', OPEN_REUSABLE_DIALOG: 'OPEN_REUSABLE_DIALOG', }, room: { @@ -93,6 +94,7 @@ const cons = { REPLY_TO_CLICKED: 'REPLY_TO_CLICKED', SEARCH_OPENED: 'SEARCH_OPENED', REUSABLE_CONTEXT_MENU_OPENED: 'REUSABLE_CONTEXT_MENU_OPENED', + NAVIGATION_OPENED: 'NAVIGATION_OPENED', REUSABLE_DIALOG_OPENED: 'REUSABLE_DIALOG_OPENED', }, roomList: { diff --git a/src/client/state/navigation.js b/src/client/state/navigation.js index eb59e7a2..bbecb2e1 100644 --- a/src/client/state/navigation.js +++ b/src/client/state/navigation.js @@ -131,6 +131,9 @@ class Navigation extends EventEmitter { [cons.actions.navigation.OPEN_SETTINGS]: () => { this.emit(cons.events.navigation.SETTINGS_OPENED, action.tabText); }, + [cons.actions.navigation.OPEN_NAVIGATION]: () => { + this.emit(cons.events.navigation.NAVIGATION_OPENED); + }, [cons.actions.navigation.OPEN_EMOJIBOARD]: () => { this.emit( cons.events.navigation.EMOJIBOARD_OPENED,