From fcb0f993feb913f8de15ce227283e3ed8b47520c Mon Sep 17 00:00:00 2001 From: Romaric Mourgues Date: Fri, 24 Mar 2023 17:04:08 +0100 Subject: [PATCH] Cleaning --- .../config/custom-environment-variables.json | 5 + twake/backend/node/config/default.json | 3 +- .../components/search-popup/search-input.tsx | 26 +- .../components/search-popup/search-tabs.tsx | 88 +--- .../ChannelsApps/ChannelsApps.tsx | 132 ------ .../client/channels-bar/ChannelsBar.scss | 119 ----- .../views/client/channels-bar/ChannelsBar.tsx | 138 ------ .../ChannelsUser/ChannelsUser.tsx | 87 ---- .../ChannelsWorkspace/ChannelsWorkspace.tsx | 106 ----- .../ChannelsWorkspace/WorkspaceChannel.tsx | 85 ---- .../Modals/new-direct-channel-popup/index.tsx | 65 --- .../new-direct-channel-popup/select-users.tsx | 97 ----- .../new-direct-channel-popup/style.scss | 39 -- .../channels-bar/Parts/Channel/Channel.scss | 407 ------------------ .../channels-bar/Parts/Channel/Channel.tsx | 154 ------- .../Parts/Channel/ChannelCategory.tsx | 38 -- .../Parts/Channel/ChannelIntermediate.tsx | 76 ---- .../Parts/Channel/ChannelMenu.tsx | 87 ---- .../CompanyHeader/CompanyHeader.tsx | 4 - .../Parts/CurrentUser/CurrentUser.jsx | 24 -- .../Notifications/NotificationBell.tsx | 75 ---- .../Notifications/NotificationDelay.tsx | 10 - .../Parts/CurrentUser/SaveNewStatus.scss | 15 - .../Parts/CurrentUser/SaveNewStatus.tsx | 74 ---- .../client/channels-bar/Parts/Tutorial.jsx | 184 -------- .../channels-bar/Parts/Tutorial/Tutorial.jsx | 56 --- .../channels-bar/Parts/Tutorial/Tutorial.scss | 73 ---- twake/frontend/src/app/views/client/index.tsx | 6 +- .../client/main-view/AppView/AppView.tsx | 57 +-- .../client/main-view/AppView/ViewName.tsx | 30 -- .../views/client/main-view/MainContent.tsx | 46 +- .../ApplicationHeader/ApplicationHeader.tsx | 65 --- .../ChannelHeader/ChannelAvatars.tsx | 20 - .../ChannelHeader/ChannelHeader.tsx | 149 ------- .../ChannelHeader/ChannelUsersHeader.tsx | 66 --- .../main-view/MainHeader/MainHeader.tsx | 20 - .../app/views/client/main-view/MainView.tsx | 95 +--- .../src/app/views/client/side-bars.tsx | 29 +- 38 files changed, 51 insertions(+), 2799 deletions(-) delete mode 100755 twake/frontend/src/app/views/client/channels-bar/ChannelsApps/ChannelsApps.tsx delete mode 100755 twake/frontend/src/app/views/client/channels-bar/ChannelsBar.scss delete mode 100755 twake/frontend/src/app/views/client/channels-bar/ChannelsBar.tsx delete mode 100755 twake/frontend/src/app/views/client/channels-bar/ChannelsUser/ChannelsUser.tsx delete mode 100755 twake/frontend/src/app/views/client/channels-bar/ChannelsWorkspace/ChannelsWorkspace.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/ChannelsWorkspace/WorkspaceChannel.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Modals/new-direct-channel-popup/index.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Modals/new-direct-channel-popup/select-users.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Modals/new-direct-channel-popup/style.scss delete mode 100755 twake/frontend/src/app/views/client/channels-bar/Parts/Channel/Channel.scss delete mode 100755 twake/frontend/src/app/views/client/channels-bar/Parts/Channel/Channel.tsx delete mode 100755 twake/frontend/src/app/views/client/channels-bar/Parts/Channel/ChannelCategory.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Parts/Channel/ChannelIntermediate.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Parts/Channel/ChannelMenu.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Parts/CurrentUser/Notifications/NotificationBell.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Parts/CurrentUser/Notifications/NotificationDelay.tsx delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Parts/CurrentUser/SaveNewStatus.scss delete mode 100644 twake/frontend/src/app/views/client/channels-bar/Parts/CurrentUser/SaveNewStatus.tsx delete mode 100755 twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial.jsx delete mode 100755 twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial/Tutorial.jsx delete mode 100755 twake/frontend/src/app/views/client/channels-bar/Parts/Tutorial/Tutorial.scss delete mode 100644 twake/frontend/src/app/views/client/main-view/AppView/ViewName.tsx delete mode 100644 twake/frontend/src/app/views/client/main-view/MainHeader/ApplicationHeader/ApplicationHeader.tsx delete mode 100644 twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelAvatars.tsx delete mode 100644 twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelHeader.tsx delete mode 100644 twake/frontend/src/app/views/client/main-view/MainHeader/ChannelHeader/ChannelUsersHeader.tsx delete mode 100644 twake/frontend/src/app/views/client/main-view/MainHeader/MainHeader.tsx diff --git a/twake/backend/node/config/custom-environment-variables.json b/twake/backend/node/config/custom-environment-variables.json index 57896348..244d31c8 100644 --- a/twake/backend/node/config/custom-environment-variables.json +++ b/twake/backend/node/config/custom-environment-variables.json @@ -62,6 +62,11 @@ "flushInterval": "SEARCH_ES_FLUSHINTERVAL" } }, + "storage": { + "local": { + "path": "STORAGE_LOCAL_PATH" + } + }, "message-queue": { "type": "PUBSUB_TYPE", "amqp": { diff --git a/twake/backend/node/config/default.json b/twake/backend/node/config/default.json index 8e7c5a1c..9a0c6491 100644 --- a/twake/backend/node/config/default.json +++ b/twake/backend/node/config/default.json @@ -52,7 +52,7 @@ } }, "webserver": { - "port": 3000, + "port": 4000, "logger": { "level": "info" }, @@ -154,6 +154,7 @@ "api_key": "secret", "sender": "noreply@twake.app" }, + "applications": [], "services": [ "auth", "push", diff --git a/twake/frontend/src/app/components/search-popup/search-input.tsx b/twake/frontend/src/app/components/search-popup/search-input.tsx index 16c43d33..8b925982 100755 --- a/twake/frontend/src/app/components/search-popup/search-input.tsx +++ b/twake/frontend/src/app/components/search-popup/search-input.tsx @@ -34,7 +34,8 @@ export const SearchInput = () => { const mediasLoading = useSearchMessagesMediasLoading(); const driveItemsLoading = useSearchDriveItemsLoading(); - const loading = channelsLoading || messagesLoading || filesLoading || mediasLoading || driveItemsLoading; + const loading = + channelsLoading || messagesLoading || filesLoading || mediasLoading || driveItemsLoading; return (
@@ -54,32 +55,11 @@ export const SearchInput = () => { inputRef={inputElement} onChange={e => setInput({ ...input, query: e.target.value })} value={input.query} - className={className + ' rounded-tr-none rounded-br-none'} + className={className} placeholder={Languages.t('scenes.app.mainview.quick_search_placeholder')} /> )} /> -
); }; diff --git a/twake/frontend/src/app/components/search-popup/search-tabs.tsx b/twake/frontend/src/app/components/search-popup/search-tabs.tsx index bff1812a..46b98098 100755 --- a/twake/frontend/src/app/components/search-popup/search-tabs.tsx +++ b/twake/frontend/src/app/components/search-popup/search-tabs.tsx @@ -1,106 +1,24 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import Tabs from '@molecules/tabs'; -import Languages from 'app/features/global/services/languages-service'; -import { useSearchChannels } from 'app/features/search/hooks/use-search-channels'; -import { - useSearchMessagesFiles, - useSearchMessagesMedias, -} from 'app/features/search/hooks/use-search-files-or-medias'; -import { useSearchMessages } from 'app/features/search/hooks/use-search-messages'; -import { useSearchDriveItems } from 'app/features/search/hooks/use-search-drive-items'; -import { SearchInputState, SearchTabsState } from 'app/features/search/state/search-input'; +import { SearchInputState } from 'app/features/search/state/search-input'; import PerfectScrollbar from 'react-perfect-scrollbar'; -import { useRecoilState, useRecoilValue } from 'recoil'; -import SearchResultsAll from './tabs/all'; -import SearchResultsChannels from './tabs/channels'; -import SearchResultsFiles from './tabs/files'; -import SearchResultsMedias from './tabs/medias'; -import SearchResultsMessages from './tabs/messages'; +import { useRecoilValue } from 'recoil'; import SearchResulsDriveItems from './tabs/drive'; -const orderedTabs = ['all', 'messages', 'medias', 'files', 'channels', 'drive']; - export const SearchResultsIndex = () => { - const input = useRecoilValue(SearchInputState); - const hasInput = input?.query?.length > 0; - const [tab, setTab] = useRecoilState(SearchTabsState); - - const { messages } = useSearchMessages(); - const { files } = useSearchMessagesFiles(); - const { files: medias } = useSearchMessagesMedias(); - const { driveItems } = useSearchDriveItems(); - return ( <> - {Languages.t('components.searchpopup.all')}, -
-
- {Languages.t('components.searchpopup.messages')} - {hasInput && } -
-
, -
-
- {Languages.t('components.searchpopup.media')} - {hasInput && } -
-
, -
-
- {Languages.t('components.searchpopup.files')} - {hasInput && } -
-
, - .../*!input.channelId - ?*/ [ -
- -
, - ], - /*: []*/ -
-
- {Languages.t('components.searchpopup.drive')} - {hasInput && } -
-
, - ]} - selected={orderedTabs.indexOf(tab)} - onClick={idx => setTab(orderedTabs[idx] as any)} - /> - - {tab === 'all' && } - {tab === 'messages' && } - {tab === 'medias' && } - {tab === 'files' && } - {tab === 'channels' && } - {tab === 'drive' && } + ); }; -const ChannelsTab = () => { - const input = useRecoilValue(SearchInputState); - const hasInput = input?.query?.length > 0; - const { channels } = useSearchChannels(); - - return ( -
- {Languages.t('components.searchpopup.channels')} - {hasInput && } -
- ); -}; - const SearchCounterBadge = (props: { count: number }) => { const count = props.count < 100 ? props.count : '99+'; return ( diff --git a/twake/frontend/src/app/views/client/channels-bar/ChannelsApps/ChannelsApps.tsx b/twake/frontend/src/app/views/client/channels-bar/ChannelsApps/ChannelsApps.tsx deleted file mode 100755 index cb57dd7c..00000000 --- a/twake/frontend/src/app/views/client/channels-bar/ChannelsApps/ChannelsApps.tsx +++ /dev/null @@ -1,132 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ -import React, { Component } from 'react'; - -import Collections from 'app/deprecated/CollectionsV1/Collections/Collections.js'; -import Languages from 'app/features/global/services/languages-service'; -import Workspaces from 'app/deprecated/workspaces/workspaces.jsx'; -import WorkspacesApps from 'app/deprecated/workspaces/workspaces_apps.jsx'; -import ChannelUI from 'app/views/client/channels-bar/Parts/Channel/Channel'; -import { - useCompanyApplications, - useCompanyApplicationsRealtime, -} from 'app/features/applications/hooks/use-company-applications'; -import useRouterChannel from 'app/features/router/hooks/use-router-channel'; - -// This should be deleted -export default class ChannelsApps extends Component { - constructor(props: unknown) { - super(props); - - this.state = { - i18n: Languages, - }; - - Collections.get('channels').addSource( - { - http_base_url: 'channels', - http_options: { - workspace_id: Workspaces.currentWorkspaceId, - }, - websockets: [ - { - uri: 'channels/workspace/' + Workspaces.currentWorkspaceId, - options: { type: 'channels/workspace' }, - }, - ], - }, - 'channels_' + Workspaces.currentWorkspaceId, - ); - - Collections.get('channels').addListener(this); - Collections.get('applications').addListener(this); - Languages.addListener(this); - WorkspacesApps.addListener(this); - } - componentWillUnmount() { - Collections.get('channels').removeListener(this); - Collections.get('applications').removeListener(this); - Languages.removeListener(this); - WorkspacesApps.removeListener(this); - } - render() { - //@ts-ignore - const apps = WorkspacesApps.apps_by_group[Workspaces.currentGroupId] || {}; - - return ( -
- {Object.keys(apps).map(id => { - const groupApp = apps[id]; - if (!groupApp) { - return ''; - } - const app = groupApp.app; - if (groupApp && !(!app || !(app.display || {}).app)) { - const name = Languages.t( - 'app.identity?.name.' + app?.identity?.code, - [], - app.identity?.name, - ); - let icon = WorkspacesApps.getAppIcon(app); - if ((icon || '').indexOf('http') === 0) { - icon = ''; - } - - return ( - - ); - } - return ''; - })} -
- ); - } -} - -type PropsType = { - companyId: string; -}; - -export const CompanyApplications = ({ companyId }: PropsType) => { - const { applications: companyApplications } = useCompanyApplications(companyId); - useCompanyApplicationsRealtime(); - - const channelId = useRouterChannel(); - - return ( -
- {companyApplications - .filter(app => app.display?.twake?.standalone) - .map(app => ( - } - favorite={false} - visibility={'public'} - notificationLevel={'all'} - unreadMessages={0} - mentions={0} - replies={0} - unread={0} - /> - ))} -
- ); -}; diff --git a/twake/frontend/src/app/views/client/channels-bar/ChannelsBar.scss b/twake/frontend/src/app/views/client/channels-bar/ChannelsBar.scss deleted file mode 100755 index 83a92d52..00000000 --- a/twake/frontend/src/app/views/client/channels-bar/ChannelsBar.scss +++ /dev/null @@ -1,119 +0,0 @@ -.electron { - .channels_view { - padding-top: 24px; - } -} - -.channels_view { - background: var(--grey-background); - width: 220px; - padding-top: 16px; - border-radius: var(--border-radius-base) 0 0 8px; - - &.loading { - .applications_channels, - .workspace_channels, - .users_channels { - display: none; - } - } - - & > div { - display: flex; - flex-direction: column; - } - - .channel_small_text { - font-size: 12px; - margin: 0 16px; - color: var(--grey-dark); - font-weight: 500; - } - - .current_group { - line-height: 24px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - color: var(--grey-dark); - font-size: 14px; - background: var(--primary-background); - border-radius: var(--border-radius-large); - display: flex; - padding: 8px; - margin: 0px 14px; - box-sizing: border-box; - height: 40px; - - span { - flex: 1; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - } - - .group_image.invite { - margin-right: 4px; - width: auto; - background: var(--green); - border-radius: var(--border-radius-base); - color: var(--white); - padding-right: 4px; - white-space: nowrap; - display: flex; - font-weight: 600; - .group_switch { - margin-right: 4px; - } - } - - .group_switch { - margin-right: 8px; - height: 24px; - .current_company_logo.has_image { - font-size: 0px !important; - } - .current_company_logo { - font-size: 16px; - line-height: 24px; - color: var(--secondary); - width: 24px; - height: 24px; - border-radius: var(--border-radius-base); - } - } - } - - .scrollbar-container { - flex: 1; - } -} - -.channels_view_loader { - background: var(--grey-background); - width: 220px; - border-radius: var(--border-radius-base) 0 0 8px; - - .applications_channels_loader { - margin-top: 4px; - margin-bottom: 12px; - } -} - -.loading_render { - .channel_small_text { - display: none; - } - .current_group { - display: none; - } -} - -/* channel add */ -.channelUserAdd .flexDiv { - display: flex; - .flex1 { - flex: 1; - margin-left: 8px; - } -} diff --git a/twake/frontend/src/app/views/client/channels-bar/ChannelsBar.tsx b/twake/frontend/src/app/views/client/channels-bar/ChannelsBar.tsx deleted file mode 100755 index 3947b40a..00000000 --- a/twake/frontend/src/app/views/client/channels-bar/ChannelsBar.tsx +++ /dev/null @@ -1,138 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-use-before-define -import React, { Suspense, useEffect } from 'react'; -import classNames from 'classnames'; -import PerfectScrollbar from 'react-perfect-scrollbar'; -import { Layout, Skeleton } from 'antd'; - -import CurrentUser from './Parts/CurrentUser/CurrentUser'; -import { CompanyApplications } from './ChannelsApps/ChannelsApps'; -import ChannelsWorkspace from './ChannelsWorkspace/ChannelsWorkspace'; -import ChannelsUser from './ChannelsUser/ChannelsUser'; -import Footer from './Parts/Footer.jsx'; -import Shortcuts, { - defaultShortcutsMap, - ShortcutType, -} from 'app/features/global/services/shortcut-service'; -import AddUserButton from 'components/add-user-button/add-user-button'; -import Workspaces from 'app/deprecated/workspaces/workspaces'; -import ScrollWithHiddenComponents from 'app/components/scroll-hidden-components/scroll-with-hidden-components'; -import HiddenNotificationsButton from 'app/components/scroll-hidden-components/hidden-notifications-button'; -import AccessRightsService from 'app/features/workspace-members/services/workspace-members-access-rights-service'; -import useRouterCompany from 'app/features/router/hooks/use-router-company'; -import useRouterWorkspace from 'app/features/router/hooks/use-router-workspace'; -import { useCurrentWorkspace } from 'app/features/workspaces/hooks/use-workspaces'; -import useChannelWritingActivity from 'app/features/channels/hooks/use-channel-writing-activity'; -import { useChannelsBarLoader } from 'app/features/channels/hooks/use-channels-bar-loader'; -import { usePublicOrPrivateChannelsSetup } from 'app/features/channels/hooks/use-public-or-private-channels'; -import { useDirectChannelsSetup } from 'app/features/channels/hooks/use-direct-channels'; -import { useSetLastWorkspacePreference } from 'app/features/users/hooks/use-set-last-workspace-preferences'; -import { useAutoSelectChannel } from 'app/features/channels/hooks/use-autoselect-channel'; - -import './ChannelsBar.scss'; -import { useSearchModal } from 'app/features/search/hooks/use-search'; -import { useSetRecoilState } from 'recoil'; -import { SearchInputState } from 'app/features/search/state/search-input'; - -export default () => { - const companyId = useRouterCompany(); - const workspaceId = useRouterWorkspace(); - const { workspace } = useCurrentWorkspace(); - - useAutoSelectChannel(); - - useSetLastWorkspacePreference(); - - useChannelWritingActivity(); - const { loading } = useChannelsBarLoader({ companyId, workspaceId }); - - usePublicOrPrivateChannelsSetup(); - useDirectChannelsSetup(); - - const { setOpen: setSearchopen } = useSearchModal(); - const setSearchInput = useSetRecoilState(SearchInputState); - - useEffect(() => { - const openWorkspaceChannelList: ShortcutType = { - shortcut: defaultShortcutsMap.SEARCH_CHANNEL, - handler: event => { - event.preventDefault(); - setSearchopen(true); - setSearchInput({ query: '' }); - }, - }; - - Shortcuts.addShortcut(openWorkspaceChannelList); - return () => { - Shortcuts.removeShortcut(openWorkspaceChannelList); - }; - }, []); - - if (loading || !companyId || !workspaceId || !workspace) { - return ; - } - - return ( - - - - } - scrollBottomComponent={} - > - - }> - - - - - {AccessRightsService.hasLevel(workspaceId, 'moderator') && - (Workspaces.getCurrentWorkspace()?.stats?.total_members || 0) <= 5 && } - - -