variant, size, type,
tooltip, tooltipPlacement, src,
onClick, tabIndex, disabled, isImage,
+ className,
}, ref) => {
const btn = (
<button
ref={ref}
- className={`ic-btn ic-btn-${variant}`}
+ className={`ic-btn ic-btn-${variant} ${className}`}
onMouseUp={(e) => blurOnBubbling(e, `.ic-btn-${variant}`)}
onClick={onClick}
// eslint-disable-next-line react/button-has-type
tabIndex: 0,
disabled: false,
isImage: false,
+ className: '',
};
IconButton.propTypes = {
tabIndex: PropTypes.number,
disabled: PropTypes.bool,
isImage: PropTypes.bool,
+ className: PropTypes.string,
};
export default IconButton;
@use '../../partials/text';
@use '../../partials/dir';
+@use '../../partials/screen';
.header {
@include dir.side(padding, var(--sp-normal), var(--sp-extra-tight));
display: -webkit-box;
}
}
+
+ @include screen.smallerThan(mobileBreakpoint) {
+ @include dir.side(padding, calc(var(--sp-normal) - 10px), var(--sp-extra-tight));
+ }
}
\ No newline at end of file
@include dir.side(margin, 0, var(--sp-tight));
}
}
-}
\ No newline at end of file
+}
import { twemojify } from '../../../util/twemojify';
import initMatrix from '../../../client/initMatrix';
-import { openInviteUser } from '../../../client/action/navigation';
+import { openInviteUser, openNavigation } from '../../../client/action/navigation';
import * as roomActions from '../../../client/action/room';
import { markAsRead } from '../../../client/action/notifications';
if (confirm('Are you sure that you want to leave this room?')) {
roomActions.leave(roomId);
afterOptionSelect();
+ openNavigation();
}
};
--emoji-board-height: 390px;
--emoji-board-width: 286px;
display: flex;
+ max-width: 90vw;
+ max-height: 90vh;
&__content {
@extend .cp-fx__item-one;
import initMatrix from '../../../client/initMatrix';
import cons from '../../../client/state/cons';
import * as roomActions from '../../../client/action/room';
-import { selectRoom, selectTab } from '../../../client/action/navigation';
+import { selectRoom, selectTab, openNavigation } from '../../../client/action/navigation';
import Text from '../../atoms/text/Text';
import Button from '../../atoms/button/Button';
procInvite.add(roomId);
changeProcInvite(new Set(Array.from(procInvite)));
roomActions.leave(roomId, isDM);
+ openNavigation();
}
function updateInviteList(roomId) {
if (procInvite.has(roomId)) procInvite.delete(roomId);
import initMatrix from '../../../client/initMatrix';
import cons from '../../../client/state/cons';
-import navigation from '../../../client/state/navigation';
import settings from '../../../client/state/settings';
import RoomTimeline from '../../../client/state/RoomTimeline';
+import navigation from '../../../client/state/navigation';
import Welcome from '../welcome/Welcome';
import RoomView from './RoomView';
<RoomSettings roomId={roomTimeline.roomId} />
<RoomView roomTimeline={roomTimeline} eventId={eventId} />
</div>
- { isDrawer && <PeopleDrawer roomId={roomTimeline.roomId} />}
+ {isDrawer && <PeopleDrawer roomId={roomTimeline.roomId} />}
</div>
);
}
@use '../../partials/flex';
+@use '../../partials/screen';
.room {
@extend .cp-fx__row;
position: relative;
overflow: hidden;
}
-}
\ No newline at end of file
+}
+
+.room .people-drawer {
+ @include screen.smallerThan(tabletBreakpoint) {
+ display: none;
+ }
+}
import initMatrix from '../../../client/initMatrix';
import cons from '../../../client/state/cons';
import navigation from '../../../client/state/navigation';
-import { openInviteUser, toggleRoomSettings } from '../../../client/action/navigation';
+import { openInviteUser, toggleRoomSettings, openNavigation } from '../../../client/action/navigation';
import * as roomActions from '../../../client/action/room';
import Text from '../../atoms/text/Text';
onClick={() => {
if (confirm('Are you sure that you want to leave this room?')) {
roomActions.leave(roomId);
+ openNavigation();
}
}}
iconSrc={LeaveArrowIC}
openCreateRoom,
openPublicRooms,
openInviteUser,
+ openNavigation,
} from '../../../client/action/navigation';
import { getEmojiForCompletion } from '../emoji-board/custom-emoji';
import AsyncSearch from '../../../util/AsyncSearch';
}, {
name: 'leave',
description: 'Leave current room',
- exe: (roomId) => roomActions.leave(roomId),
+ exe: (roomId) => {
+ roomActions.leave(roomId);
+ openNavigation();
+ },
}, {
name: 'invite',
isOptions: true,
-import React, { useEffect, useRef } from 'react';
+import React, { useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import './RoomViewHeader.scss';
import SearchIC from '../../../../public/res/ic/outlined/search.svg';
import UserIC from '../../../../public/res/ic/outlined/user.svg';
import VerticalMenuIC from '../../../../public/res/ic/outlined/vertical-menu.svg';
+import BackArrowIC from '../../../../public/res/ic/outlined/chevron-left.svg';
import { useForceUpdate } from '../../hooks/useForceUpdate';
return (
<Header>
+ <IconButton
+ src={BackArrowIC}
+ className="room-header__back-btn"
+ tooltip="Return to navigation"
+ onClick={() => navigation.emit(cons.events.navigation.NAVIGATION_OPENED)}
+ />
<button
ref={roomHeaderBtnRef}
className="room-header__btn"
<RawIcon src={ChevronBottomIC} />
</button>
<IconButton onClick={() => toggleRoomSettings(tabText.SEARCH)} tooltip="Search" src={SearchIC} />
- <IconButton onClick={togglePeopleDrawer} tooltip="People" src={UserIC} />
+ <IconButton className="room-header__drawer-btn" onClick={togglePeopleDrawer} tooltip="People" src={UserIC} />
<IconButton
onClick={openRoomOptions}
tooltip="Options"
@use '../../partials/flex';
@use '../../partials/dir';
+@use '../../partials/screen';
.room-header__btn {
min-width: 0;
box-shadow: var(--bs-surface-outline);
outline: none;
}
-}
\ No newline at end of file
+}
+
+.header .room-header__drawer-btn {
+ @include screen.smallerThan(tabletBreakpoint) {
+ display: none;
+ }
+}
+
+.header .room-header__back-btn {
+ @include dir.side(margin, 0, 5px);
+
+ @include screen.biggerThan(mobileBreakpoint) {
+ display: none;
+ }
+}
@use '../../partials/flex';
@use '../../partials/dir';
+@use '../../partials/screen';
.settings-window {
& .pw {
margin: var(--sp-extra-tight) 0;
}
}
-}
\ No newline at end of file
+}
+
+.settings-window {
+ @include screen.smallerThan(mobileBreakpoint) {
+ .pw__drawer p, .pw__drawer .header h4 {
+ display: none;
+ width: 0;
+ }
+
+ .pw__drawer {
+ width: fit-content;
+ }
+ }
+}
--- /dev/null
+
+$breakpoint-tablet: 900px;
+$breakpoint-mobile: 750px;
+
+@mixin smallerThan($deviceBreakpoint) {
+ @if $deviceBreakpoint==mobileBreakpoint {
+ @media screen and (max-width: $breakpoint-mobile) {
+ @content;
+ }
+ }
+ @else if $deviceBreakpoint==tabletBreakpoint {
+ @media screen and (max-width: $breakpoint-tablet) {
+ @content;
+ }
+ }
+}
+
+@mixin biggerThan($deviceBreakpoint) {
+ @if $deviceBreakpoint==mobileBreakpoint {
+ @media screen and (min-width: $breakpoint-mobile) {
+ @content;
+ }
+ } @else if $deviceBreakpoint==tabletBreakpoint {
+ @media screen and (min-width: $breakpoint-tablet) {
+ @content;
+ }
+ }
+}
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useRef } from 'react';
import './Client.scss';
import { initHotkeys } from '../../../client/event/hotkeys';
import cons from '../../../client/state/cons';
import DragDrop from '../../organisms/drag-drop/DragDrop';
+const classNameHidden = 'client__item-hidden';
+
function Client() {
const [isLoading, changeLoading] = useState(true);
const [loadingMsg, setLoadingMsg] = useState('Heating up');
const [dragCounter, setDragCounter] = useState(0);
+ /**
+ * @type {React.MutableRefObject<HTMLDivElement>}
+ */
+ const navWrapperRef = useRef(null);
+ /**
+ * @type {React.MutableRefObject<HTMLDivElement>}
+ */
+ 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(() => {
);
}
+ // #region drag and drop
function dragContainsFiles(e) {
if (!e.dataTransfer.types) return false;
initMatrix.roomsInput.setAttachment(roomId, file);
initMatrix.roomsInput.emit(cons.events.roomsInput.ATTACHMENT_SET, file);
}
+ // #endregion
return (
<div
onDragLeave={handleDragLeave}
onDrop={handleDrop}
>
- <div className="navigation__wrapper">
+ <div className="navigation__wrapper" ref={navWrapperRef}>
<Navigation />
</div>
- <div className="room__wrapper">
+ <div className={`room__wrapper ${classNameHidden}`} ref={roomWrapperRef}>
<Room />
</div>
<Windows />
+@use '../../partials/screen';
+
.client-container {
display: flex;
height: 100%;
.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;
.text {
color: var(--tc-link);
}
-}
\ No newline at end of file
+}
});
}
+/**
+ * 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,
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: {
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: {
[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,