();
-
- const save = useCallback(() => {
- updateStatus(status);
- MenusManager.closeMenu();
- }, [status, updateStatus]);
-
- const reset = useCallback(() => {
- updateStatus(['', '']);
- MenusManager.closeMenu();
- }, [updateStatus]);
-
- useEffect(() => {
- inputRef.current?.focus();
- }, []);
-
- return (
- {
- if (evt.key === 'Enter') save();
- }}
- >
-
node && (inputRef.current = node)}
- focusOnDidMount
- menu_level={level}
- placeholder={Languages.t(
- 'scenes.app.popup.appsparameters.pages.status_tilte',
- [],
- 'Status',
- )}
- value={status}
- onChange={(value: string[]) => {
- setStatus(value);
- inputRef.current?.focus();
- }}
- />
-
-
-
-
- );
-};
diff --git a/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial.jsx b/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial.jsx
deleted file mode 100755
index aef006ac..00000000
--- a/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial.jsx
+++ /dev/null
@@ -1,184 +0,0 @@
-/* eslint-disable react/jsx-key */
-import React, { Component } from 'react';
-
-import Languages from 'app/features/global/services/languages-service';
-import WorkspaceUserRights from 'app/features/workspaces/services/workspace-user-rights-service';
-import Emojione from 'components/emojione/emojione';
-import UserService from 'app/features/users/services/current-user-service';
-import CurrentUserService from 'app/deprecated/user/CurrentUser';
-import ElectronService from 'app/features/global/framework/electron-service';
-import AlertManager from 'app/features/global/services/alert-manager-service';
-
-import Workspaces from 'app/deprecated/workspaces/workspaces.jsx';
-import Collections from 'app/deprecated/CollectionsV1/Collections/Collections.js';
-import WorkspaceParameter from 'app/views/client/popup/WorkspaceParameter/WorkspaceParameter.js';
-import WorkspacesUsers from 'app/features/workspace-members/services/workspace-members-service';
-import UserParameter from 'app/views/client/popup/UserParameter/UserParameter.js';
-import popupManager from 'app/deprecated/popupManager/popupManager.js';
-
-import TutorialUI from 'app/views/client/channels-bar/Parts/Tutorial/Tutorial.js';
-
-import Globals from 'app/features/global/services/globals-twake-app-service';
-
-export default class Tutorial extends Component {
- constructor() {
- super();
-
- this.state = {
- i18n: Languages,
- };
-
- Languages.addListener(this);
- Collections.get('users').addListener(this);
- Collections.get('users').listenOnly(this, [UserService.getCurrentUser().front_id]);
- }
- componentWillUnmount() {
- Languages.removeListener(this);
- Collections.get('users').removeListener(this);
- }
- componentDidMount() {
- if (ElectronService.isElectron()) {
- CurrentUserService.updateTutorialStatus('has_desktop_app');
- }
- }
- removeTuto(tuto, evt) {
- evt.stopPropagation();
- evt.preventDefault();
- AlertManager.confirm(
- () => {
- CurrentUserService.updateTutorialStatus(tuto);
- },
- () => {},
- {
- text: Languages.t(
- 'scenes.app.channelsbar.tutorial_alert',
- [],
- 'Ne plus jamais afficher ce cadre ?',
- ),
- },
- );
- }
- render() {
- var tutorial_status = UserService.getCurrentUser().tutorial_status || {};
- var group = Collections.get('groups').find(Workspaces.currentGroupId);
-
- if (
- WorkspaceUserRights.hasWorkspacePrivilege() &&
- Object.keys(WorkspacesUsers.getUsersByWorkspace(Workspaces.currentWorkspaceId) || {}).length >
- 1
- ) {
- CurrentUserService.updateTutorialStatus('did_invite_collaborators');
- }
-
- if (
- ['openid', 'cas'].indexOf(CurrentUserService.get().identity_provider) >= 0 &&
- !tutorial_status.no_tuto
- ) {
- CurrentUserService.updateTutorialStatus('no_tuto');
- tutorial_status.no_tuto = true;
- }
-
- return (
-
- {WorkspaceUserRights.isInvite() && !tutorial_status.no_invite && false && (
- {group.name},
- ]}
- subtitle={
- // eslint-disable-next-line no-constant-condition
- true
- ? ''
- : Languages.t(
- 'scenes.app.channelsbar.company_invitation_alert_subtitle',
- [],
- 'Vous pouvez importer ces chaînes dans votre entreprise pour rester organisé en cliquant sur ce cadre.',
- )
- }
- onClickFrame={e => {
- /*window.open("https://twakeapp.com/")*/
- }}
- onClose={e => this.removeTuto('no_invite', e)}
- />
- )}
-
- {!WorkspaceUserRights.isInvite() && !tutorial_status.no_tuto && (
- ,
- ]}
- subtitle={Languages.t(
- 'scenes.app.channelsbar.welcoming_message_subtitle',
- [],
- 'Devenez un pro de Twake en seulement quelques clics !',
- )}
- blocks={[
- {
- text: Languages.t(
- 'scenes.app.channelsbar.initial_instructions_tutorial',
- [],
- 'Choisissez un prénom, un nom et une image de profil.',
- ),
- emoji: ':woman_juggling:',
- done: tutorial_status.has_identity,
- onClick: () => {
- popupManager.open();
- },
- },
- {
- text: Languages.t(
- 'scenes.app.channelsbar.sending_message_instruction',
- [],
- 'Envoyer un premier message dans une discussion',
- ),
- emoji: ':love_letter:',
- done: tutorial_status.first_message_sent,
- },
- /*{
- text: "Installer l'application mobile",
- emoji: ":iphone:",
- done: tutorial_status.has_mobile_app,
- onClick: ()=>{ Globals.window.open("https://twakeapp.com/download") }
- },*/
- {
- text: Languages.t(
- 'scenes.app.channelsbar.installation_desktop_tutorial',
- [],
- "Installer l'application desktop",
- ),
- emoji: ':desktop:',
- done: tutorial_status.has_desktop_app,
- onClick: () => {
- Globals.window.open('https://twakeapp.com/download');
- },
- },
- {
- text: Languages.t(
- 'scenes.app.channelsbar.invitation_collaboraors_tutorial',
- [],
- 'Invitez vos collaborateurs dans votre espace de travail.',
- ),
- emoji: ':handshake:',
- done: tutorial_status.did_invite_collaborators,
- onClick: () => {
- popupManager.open(
- ,
- true,
- 'workspace_parameters',
- );
- },
- },
- ]}
- onClose={e => this.removeTuto('no_tuto', e)}
- />
- )}
-
- );
- }
-}
diff --git a/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial/Tutorial.jsx b/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial/Tutorial.jsx
deleted file mode 100755
index 07f9cffb..00000000
--- a/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial/Tutorial.jsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import React, { Component } from 'react';
-
-import './Tutorial.scss';
-
-import Icon from 'app/components/icon/icon.jsx';
-import Emojione from 'components/emojione/emojione';
-
-export default class Tutorial extends React.Component {
- constructor(props) {
- super();
- }
- render() {
- return (
-
-
{
- evt.preventDefault();
- evt.stopPropagation();
- this.props.onClose && this.props.onClose(evt);
- }}
- >
-
-
-
- {this.props.title &&
{this.props.title}
}
- {this.props.subtitle &&
{this.props.subtitle}
}
-
- {this.props.blocks && this.props.blocks.length > 0 && (
-
- {(this.props.blocks || [])
- .sort((a, b) => (a.done ? 1 : -1))
- .map((item, i) => {
- return (
-
- {(item.emoji || item.done) && (
-
-
-
- )}
-
{item.text}
-
- );
- })}
-
- )}
-
- );
- }
-}
diff --git a/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial/Tutorial.scss b/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial/Tutorial.scss
deleted file mode 100755
index a1487e4c..00000000
--- a/twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial/Tutorial.scss
+++ /dev/null
@@ -1,73 +0,0 @@
-.tutorial {
- z-index: 5;
- box-sizing: border-box;
- width: 300px;
- height: auto;
- position: absolute;
- left: 16px;
- bottom: 4px;
- background: var(--secondary);
- color: #fff;
- border-radius: var(--border-radius-base);
- padding: 16px;
- box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.05), 0 0 20px 0 rgba(0, 0, 0, 0.15);
- position: relative;
-
- .close {
- background: var(--grey-dark);
- color: #fff;
- width: 16px;
- height: 16px;
- font-size: 10px;
- padding: 2px 1px;
- box-sizing: border-box;
- border-radius: var(--border-radius-large);
- line-height: 10px;
- position: absolute;
- right: 16px;
- top: 16px;
- cursor: pointer;
- &:hover {
- opacity: 0.8;
- }
- }
-
- .title {
- font-size: 16px;
- }
-
- .body {
- font-size: 12px;
- font-weight: 500;
- color: var(--white);
-
- .block {
- margin-top: 16px;
- display: flex;
- .icon {
- display: flex;
- align-items: center;
- padding-right: 8px;
- .emojione {
- width: 16px;
- height: 16px;
- }
- }
- &.done .text {
- text-decoration: line-through;
- }
- &.hoverable:not(.done) {
- cursor: pointer;
- &:hover {
- opacity: 0.8;
- }
- }
- }
- }
-}
-
-.loading_render {
- .tutorial {
- display: none;
- }
-}
diff --git a/twake/frontend/src/app/views/client/index.tsx b/twake/frontend/src/app/views/client/index.tsx
index 9afaea1d..574f3111 100755
--- a/twake/frontend/src/app/views/client/index.tsx
+++ b/twake/frontend/src/app/views/client/index.tsx
@@ -18,7 +18,7 @@ import ModalComponent from 'app/components/modal/modal-component';
import ConnectionIndicator from 'components/connection-indicator/connection-indicator';
import SearchPopup from 'components/search-popup/search-popup';
import NewVersionComponent from 'components/new-version/new-version-component';
-import SideBars, { LoadingSidebar } from './side-bars';
+import SideBars from './side-bars';
import CompanyStatusComponent from 'app/components/on-boarding/company-status-component';
import UserContext from 'app/features/users/state/integration/user-context';
import { useCurrentUser, useCurrentUserRealtime } from 'app/features/users/hooks/use-current-user';
@@ -60,13 +60,13 @@ export default React.memo((): JSX.Element => {
breakpoint="lg"
collapsedWidth="0"
theme="light"
- width={290}
+ width={70}
onCollapse={(collapsed, type) => {
if (type === 'responsive') return setTimeout(() => setMenuIsOpen(false), 0);
setTimeout(() => setMenuIsOpen(!collapsed), 0);
}}
>
- }>
+ >}>
diff --git a/twake/frontend/src/app/views/client/main-view/AppView/AppView.tsx b/twake/frontend/src/app/views/client/main-view/AppView/AppView.tsx
index bc1343de..4ab0ecd9 100644
--- a/twake/frontend/src/app/views/client/main-view/AppView/AppView.tsx
+++ b/twake/frontend/src/app/views/client/main-view/AppView/AppView.tsx
@@ -1,11 +1,8 @@
-import React, { FC } from 'react';
-import Messages from 'app/views/applications/messages';
-import Drive from 'app/views/applications/drive';
-import Calendar from 'app/views/applications/calendar/calendar-content';
-import Tasks from 'app/views/applications/tasks/tasks';
-import NoApp from '../NoApp';
+import useRouterCompany from 'app/features/router/hooks/use-router-company';
+import useRouterWorkspace from 'app/features/router/hooks/use-router-workspace';
import AppViewService from 'app/features/router/services/app-view-service';
-import { useChannel } from 'app/features/channels/hooks/use-channel';
+import Drive from 'app/views/applications/drive';
+import { FC } from 'react';
type PropsType = {
viewService: AppViewService;
@@ -13,42 +10,16 @@ type PropsType = {
};
const AppView: FC = props => {
- //Listen context and app_id changes
- props.viewService.useWatcher(() => {
- return [
- props.viewService.getConfiguration().app?.id,
- props.viewService.getConfiguration().context,
- ];
- });
+ const companyId = useRouterCompany();
+ const workspaceId = useRouterWorkspace();
- const configuration = props.viewService.getConfiguration();
-
- const { channel } = useChannel(props.id);
-
- const app = props.viewService.getConfiguration().app;
-
- if (!channel) return ;
-
- switch (app?.identity?.code) {
- case 'twake_drive':
- return (
-
- );
- case 'twake_calendar':
- return ;
- case 'twake_tasks':
- return ;
- case 'messages':
- return ;
- default:
- return ;
- }
+ return (
+
+ );
};
export default AppView;
diff --git a/twake/frontend/src/app/views/client/main-view/AppView/ViewName.tsx b/twake/frontend/src/app/views/client/main-view/AppView/ViewName.tsx
deleted file mode 100644
index a900b3fd..00000000
--- a/twake/frontend/src/app/views/client/main-view/AppView/ViewName.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import React, { FC } from 'react';
-import AppViewService from 'app/features/router/services/app-view-service';
-import Languages from 'app/features/global/services/languages-service';
-import { useWorkspace } from 'app/features/workspaces/hooks/use-workspaces';
-import { useChannel } from 'app/features/channels/hooks/use-channel';
-
-type PropsType = {
- id: string;
- viewService: AppViewService;
-};
-
-const ViewName: FC = props => {
- //Listen context and app_id changes
- props.viewService.useWatcher(() => [
- props.viewService.getConfiguration().app?.id,
- props.viewService.getConfiguration().context,
- ]);
-
- const { channel } = useChannel(props.id);
-
- const { workspace } = useWorkspace(channel?.workspace_id || '');
-
- let text = '';
- if (channel && workspace) {
- text = (workspace ? workspace.name + ' • ' : '') + (channel.name || '');
- }
-
- return {Languages.t('scenes.app.side_app.messages_thread_title', [text])};
-};
-export default ViewName;
diff --git a/twake/frontend/src/app/views/client/main-view/MainContent.tsx b/twake/frontend/src/app/views/client/main-view/MainContent.tsx
index b04c77f3..082d5e8d 100644
--- a/twake/frontend/src/app/views/client/main-view/MainContent.tsx
+++ b/twake/frontend/src/app/views/client/main-view/MainContent.tsx
@@ -1,12 +1,9 @@
import React, { FC, Suspense } from 'react';
import { Layout } from 'antd';
-import Tabs from './Tabs/Tabs';
-import AppView from './AppView/AppView';
-import SideViewService from 'app/features/router/services/side-view-service';
import MainViewService from 'app/features/router/services/main-view-service';
-import { X } from 'react-feather';
-import ViewName from './AppView/ViewName';
+import SideViewService from 'app/features/router/services/side-view-service';
+import AppView from './AppView/AppView';
export const ViewContext = React.createContext({ type: '', id: '' });
@@ -15,11 +12,6 @@ const MainContent: FC = () => {
MainViewService.getViewType(),
MainViewService.getId(),
]);
- const mainConfiguration = MainViewService.getConfiguration();
- const [sideType, sideId] = SideViewService.useWatcher(() => [
- SideViewService.getViewType(),
- SideViewService.getId(),
- ]);
// Put the sideview in full screen if screen has not a big width
const { innerWidth } = window;
@@ -31,11 +23,6 @@ const MainContent: FC = () => {
- {mainConfiguration.hasTabs && (
-
-
-
- )}
@@ -46,35 +33,6 @@ const MainContent: FC = () => {
-
-
- {!!sideType && (
-
-
-
- SideViewService.select('', { context: {} })} />
-
-
- >}>
-
-
-
-
- )}
-
-
diff --git a/twake/frontend/src/app/views/client/main-view/MainHeader/ApplicationHeader/ApplicationHeader.tsx b/twake/frontend/src/app/views/client/main-view/MainHeader/ApplicationHeader/ApplicationHeader.tsx
deleted file mode 100644
index c08df54e..00000000
--- a/twake/frontend/src/app/views/client/main-view/MainHeader/ApplicationHeader/ApplicationHeader.tsx
+++ /dev/null
@@ -1,65 +0,0 @@
-import React from 'react';
-import { Col, Typography } from 'antd';
-import { capitalize } from 'lodash';
-import Languages from 'app/features/global/services/languages-service';
-import SearchInput from '../Search';
-import MainViewService from 'app/features/router/services/main-view-service';
-import { Calendar, CheckSquare, Folder } from 'react-feather';
-import AvatarComponent from 'app/components/avatar/avatar';
-import { Application } from 'app/features/applications/types/application';
-
-export default (): JSX.Element => {
- const application = MainViewService.getConfiguration().app;
- if (!application) {
- return <>>;
- }
-
- const channel = {
- name: Languages.t(
- 'app.identity?.name.' + application?.identity?.code,
- [],
- application.identity?.name,
- ),
- };
-
- const getDefaultApplicationIcon = (app: Partial) => {
- switch (app?.identity?.code) {
- case 'twake_tasks':
- return ;
- case 'twake_calendar':
- return ;
- case 'twake_drive':
- return ;
-
- default:
- return (
-
- );
- }
- };
-
- return (
-
-
-
-
- {getDefaultApplicationIcon(application)}
-
-
- {capitalize(channel.name)}
-
-
-
-
-
-
-
- );
-};
diff --git a/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelAvatars.tsx b/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelAvatars.tsx
deleted file mode 100644
index 104d12fd..00000000
--- a/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelAvatars.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { getUserParts } from 'app/components/member/user-parts';
-import { useUsersListener } from 'app/features/users/hooks/use-users-listener';
-import useRouterCompany from 'app/features/router/hooks/use-router-company';
-import useRouterChannel from 'app/features/router/hooks/use-router-channel';
-import { useChannelMembers } from 'app/features/channel-members-search/hooks/members-hook';
-
-export default ({ workspaceId }: { workspaceId: string }): JSX.Element => {
- const companyId = useRouterCompany();
- const channelId = useRouterChannel();
-
- const { channelMembers } = useChannelMembers({ companyId, workspaceId, channelId });
-
- const members = channelMembers.filter((_m, i) => i < 10).map(m => m.user_id || '');
-
- useUsersListener(members);
-
- const { avatar } = getUserParts({ usersIds: members, keepMyself: true, max: 7 });
-
- return avatar;
-};
diff --git a/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelHeader.tsx b/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelHeader.tsx
deleted file mode 100644
index 7c8ab9ae..00000000
--- a/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelHeader.tsx
+++ /dev/null
@@ -1,149 +0,0 @@
-import { Button, Col, Row, Typography } from 'antd';
-import { File, Info, Lock, Users } from 'react-feather';
-
-import { useOpenChannelModal } from 'app/components/edit-channel';
-import Emojione from 'app/components/emojione/emojione';
-import { useUsersSearchModal } from 'app/features/channel-members-search/state/search-channel-member';
-import { useChannel } from 'app/features/channels/hooks/use-channel';
-import ChannelsBarService from 'app/features/channels/services/channels-bar-service';
-import { channelAttachmentListState } from 'app/features/channels/state/channel-attachment-list';
-import PseudoMarkdownCompiler from 'app/features/global/services/pseudo-markdown-compiler-service';
-import RouterServices from 'app/features/router/services/router-service';
-import { useUsersListener } from 'app/features/users/hooks/use-users-listener';
-import AccessRightsService from 'app/features/workspace-members/services/workspace-members-access-rights-service';
-import { useRecoilState } from 'recoil';
-import SearchInput from '../Search';
-import ChannelAvatars from './ChannelAvatars';
-import ChannelUsersHeader from './ChannelUsersHeader';
-import Avatar from 'app/atoms/avatar';
-
-export default (): JSX.Element => {
- const { companyId, workspaceId, channelId } = RouterServices.getStateFromRoute();
- const { channel } = useChannel(channelId || '');
- const members = channel?.members || [];
- const [, setChannelAttachmentState] = useRecoilState(channelAttachmentListState);
- const canAccessChannelParameters =
- AccessRightsService.hasLevel(workspaceId, 'member') &&
- AccessRightsService.getCompanyLevel(companyId) !== 'guest';
- const openChannelModal = useOpenChannelModal();
-
- const { setOpen: setParticipantsOpen } = useUsersSearchModal();
-
- useUsersListener(members);
-
- if (!channel) {
- return ;
- }
-
- if (!channel.user_member?.user_id) {
- ChannelsBarService.updateCurrentChannelId(companyId, workspaceId, '');
- }
-
- ChannelsBarService.updateCurrentChannelId(companyId, workspaceId, channelId);
-
- return (
-
- {
- // Temporary, it's for spacing when the hamburger menu is displayed
-
- }
- {channel.visibility === 'direct' && (
-
-
-
- )}
- {channel.visibility !== 'direct' && (
-
-
-
- ) : (
- false
- )
- }
- avatar={(channel?.icon?.length || 0) > 20 ? channel?.icon : ''}
- title={channel?.name || ''}
- />
-
- {channel.name}
-
- {channel.visibility === 'private' && }
-
- {PseudoMarkdownCompiler.compileToHTML(
- PseudoMarkdownCompiler.compileToJSON(
- (channel.description || '').replace(/\n/g, ' '),
- ),
- )}
-
-
-
- )}
-
-
- {!!channel.user_member?.user_id && (
-
- {channel.visibility !== 'direct' && channel.workspace_id && (
-
-
-
- )}
- {channel.visibility !== 'direct' && (
- <>
- {canAccessChannelParameters && (
-
- )}
-
- >
- )}
-
-
- )}
-
-
-
-
-
-
- );
-};
diff --git a/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelUsersHeader.tsx b/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelUsersHeader.tsx
deleted file mode 100644
index ecf14da9..00000000
--- a/twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelUsersHeader.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import { Col, Typography } from 'antd';
-
-import * as Text from 'app/atoms/text';
-import { getUserParts } from 'app/components/member/user-parts';
-import { ChannelType } from 'app/features/channels/types/channel';
-import Languages from 'app/features/global/services/languages-service';
-import { useCurrentUser } from 'app/features/users/hooks/use-current-user';
-import { useOnlineUser } from 'app/features/users/hooks/use-online-user';
-import { useUser } from 'app/features/users/hooks/use-user';
-import { useUsersListener } from 'app/features/users/hooks/use-users-listener';
-import moment from 'moment';
-
-type Props = {
- channel: ChannelType;
-};
-
-export default (props: Props) => {
- useUsersListener(props.channel.members);
- const { avatar, name } = getUserParts({
- usersIds: props.channel.members || [],
- });
-
- const { user: currentUser } = useCurrentUser();
-
- const otherMembers = (props.channel.members || []).filter(u => u !== currentUser?.id) || [];
- const user = useUser(otherMembers[0] || '');
- const userOnlineStatus = useOnlineUser(user?.id as string);
- const lastSeen = userOnlineStatus?.lastSeen || user?.last_seen || 0;
-
- return (
-
-
-
- {avatar}
-
-
- {name}
-
- {otherMembers.length === 1 &&
- lastSeen > 0 &&
- lastSeen > Date.now() - 1000 * 60 * 60 * 24 * 70 &&
- currentUser?.id !== user?.id && (
- <>
- {!userOnlineStatus.connected && (
-
- {Languages.t('general.user.connected')} {moment(lastSeen).fromNow()}
-
- )}
- {!!userOnlineStatus.connected && (
-
- {Languages.t('general.user.connected')}
-
- )}
- >
- )}
-
-
- );
-};
diff --git a/twake/frontend/src/app/views/client/main-view/MainHeader/MainHeader.tsx b/twake/frontend/src/app/views/client/main-view/MainHeader/MainHeader.tsx
deleted file mode 100644
index f4a84822..00000000
--- a/twake/frontend/src/app/views/client/main-view/MainHeader/MainHeader.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React, { FC } from 'react';
-import { Layout } from 'antd';
-import ChannelBar from './ChannelHeader/ChannelHeader';
-import MainViewService from 'app/features/router/services/main-view-service';
-import ApplicationBar from './ApplicationHeader/ApplicationHeader';
-import useRouterChannel from 'app/features/router/hooks/use-router-channel';
-
-const MainHeader: FC = () => {
- const channelId = useRouterChannel();
- const channelType = MainViewService.useWatcher(() => MainViewService.getViewType());
-
- return (
-
- {channelType === 'channel' && }
- {channelType === 'application' && }
-
- );
-};
-
-export default MainHeader;
diff --git a/twake/frontend/src/app/views/client/main-view/MainView.tsx b/twake/frontend/src/app/views/client/main-view/MainView.tsx
index 4effb899..6bc92526 100644
--- a/twake/frontend/src/app/views/client/main-view/MainView.tsx
+++ b/twake/frontend/src/app/views/client/main-view/MainView.tsx
@@ -1,23 +1,18 @@
// eslint-disable-next-line @typescript-eslint/no-use-before-define
-import React, { FC, useEffect, useState } from 'react';
import { Layout } from 'antd';
+import { FC, useEffect, useState } from 'react';
-import MainHeader from './MainHeader/MainHeader';
-import MainContent from './MainContent';
-import NoApp from './NoApp';
-import ChannelsBarService from 'app/features/channels/services/channels-bar-service';
-import { useWatcher } from 'app/deprecated/Observable/Observable';
import AccountStatusComponent from 'app/components/on-boarding/account-status-component';
import CompanyBillingBanner from 'app/components/on-boarding/company-billing-banner';
-import './MainView.scss';
+import useRouterChannel from 'app/features/router/hooks/use-router-channel';
import useRouterCompany from 'app/features/router/hooks/use-router-company';
import useRouterWorkspace from 'app/features/router/hooks/use-router-workspace';
-import useRouterChannel from 'app/features/router/hooks/use-router-channel';
-import MainViewService from 'app/features/router/services/main-view-service';
-import WindowState from 'app/features/global/utils/window';
-import { useCompanyApplications } from 'app/features/applications/hooks/use-company-applications';
-import { useChannel, useIsChannelMember } from 'app/features/channels/hooks/use-channel';
-import ContentRestricted from './ContentRestricted';
+import MainContent from './MainContent';
+import Search from './MainHeader/Search';
+import './MainView.scss';
+import CompanyHeader from '../channels-bar/Parts/CurrentUser/CompanyHeader/CompanyHeader';
+import CurrentUser from '../channels-bar/Parts/CurrentUser/CurrentUser';
+import Footer from '../channels-bar/Parts/Footer';
type PropsType = {
className?: string;
@@ -27,68 +22,17 @@ const MainView: FC = ({ className }) => {
const companyId = useRouterCompany();
const workspaceId = useRouterWorkspace();
const channelId = useRouterChannel();
- const { applications } = useCompanyApplications();
- const { channel, loading: channelLoading } = useChannel(channelId);
- const isChannelMember = useIsChannelMember(channelId);
-
- const loaded = useWatcher(ChannelsBarService, async () => {
- return (
- (await ChannelsBarService.isReady(companyId, workspaceId)) &&
- ChannelsBarService.isReady(companyId, 'direct')
- );
- });
- const ready = !(channelLoading && !channel) && loaded && !!companyId && !!workspaceId;
-
- const updateView = () => {
- if (channelId) {
- const app = applications.find(a => a.id === channelId);
- MainViewService.select(channelId, {
- app: app || {
- identity: {
- code: 'messages',
- name: '',
- icon: '',
- description: '',
- website: '',
- categories: [],
- compatibility: [],
- },
- },
- context: { type: app ? 'application' : 'channel' },
- hasTabs: channel?.visibility !== 'direct' && !app,
- });
- WindowState.setSuffix(channel?.name || app?.identity?.name);
- }
- };
-
- if (channelId && MainViewService.getId() !== channelId) updateView();
-
- if (
- ready &&
- !isChannelMember &&
- MainViewService.getViewType() === 'channel' &&
- channel?.visibility === 'private'
- ) {
- return (
- <>
-
-
-
- >
- );
- }
return (
- {!!channelId && ready && (
- <>
-
- {companyId && }
-
-
- >
- )}
- {!channelId && ready && }
+
+ {companyId && }
+
+
+
+
+
+
);
};
@@ -110,12 +54,5 @@ export const MainContentWrapper = () => {
};
export default ({ className }: PropsType) => {
- //This is a hack because main view is displayed before we detect the current "channel" is in fact an application
- const channelId = useRouterChannel();
- const { applications } = useCompanyApplications();
- const isChannelMember = useIsChannelMember(channelId);
-
- if (applications.length === 0 && !isChannelMember) return <>>;
-
return ;
};
diff --git a/twake/frontend/src/app/views/client/side-bars.tsx b/twake/frontend/src/app/views/client/side-bars.tsx
index 94f7ced0..f1801e87 100755
--- a/twake/frontend/src/app/views/client/side-bars.tsx
+++ b/twake/frontend/src/app/views/client/side-bars.tsx
@@ -1,47 +1,24 @@
// eslint-disable-next-line @typescript-eslint/no-use-before-define
-import React from 'react';
import { Layout } from 'antd';
-import ChannelsBar, { LoadingChannelBar } from './channels-bar/ChannelsBar';
-import WorkspacesBar, { LoadingWorkspaceBar } from './workspaces-bar';
+import WorkspacesBar from './workspaces-bar';
-import { useWorkspaceLoader } from 'app/features/workspaces/hooks/use-workspaces';
-import useRouterCompany from 'app/features/router/hooks/use-router-company';
-import useRouterWorkspace from 'app/features/router/hooks/use-router-workspace';
import { useCurrentCompanyRealtime } from '../../features/companies/hooks/use-companies';
-import './workspaces-bar/styles.scss';
-import { usePreloadSomeUsers } from 'app/features/users/hooks/use-user-list';
import { useNotifications } from 'app/features/users/hooks/use-notifications';
+import { usePreloadSomeUsers } from 'app/features/users/hooks/use-user-list';
+import './workspaces-bar/styles.scss';
export default () => {
- const companyId = useRouterCompany();
- const workspaceId = useRouterWorkspace();
- const { loading } = useWorkspaceLoader(companyId);
useCurrentCompanyRealtime();
// We call this hook here to be able to preload some users in user list state
usePreloadSomeUsers();
useNotifications();
- if (loading) {
- return ;
- }
-
return (
- {!!workspaceId && }
- {!workspaceId && }
-
- );
-};
-
-export const LoadingSidebar = () => {
- return (
-
-
-
);
};