From 26ca1be6290fb17a06b8eb11e9b0d61cd6551ce0 Mon Sep 17 00:00:00 2001 From: Eric Doughty-Papassideris Date: Mon, 11 Nov 2024 00:52:16 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=E2=9A=B0=EF=B8=8F=20front:=20Remov?= =?UTF-8?q?e=20unused=20references?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connection-indicator.tsx | 4 +-- .../download-app-banner.tsx | 25 ++++++++----------- .../app/components/mobile-redirect/index.tsx | 1 - .../popup-component/popup-component.jsx | 2 +- .../search-popup/parts/drive-item-result.tsx | 6 +---- .../app/components/uploads/file-tree-utils.ts | 1 + .../src/app/deprecated/user/CurrentUser.ts | 2 +- .../hooks/use-company-applications.ts | 1 - .../state/company-applications.ts | 1 - .../app/features/companies/state/companies.ts | 2 -- .../console/services/console-service.ts | 1 - .../app/features/dragndrop/hook/draggable.tsx | 4 +-- .../drive/hooks/use-drive-actions.tsx | 2 +- .../features/drive/hooks/use-drive-item.tsx | 5 ++-- .../features/drive/hooks/use-drive-preview.ts | 5 +--- .../drive/state/shared-with-me-filter.tsx | 1 - .../search/hooks/use-search-drive-items.tsx | 2 +- .../features/users/hooks/use-current-user.ts | 3 +-- .../workspaces/state/workspace-list.ts | 2 -- .../app/views/client/body/drive/browser.tsx | 14 ++++------- .../views/client/body/drive/context-menu.tsx | 19 +++++--------- .../client/body/drive/documents/common.tsx | 1 - .../body/drive/documents/document-row.tsx | 6 ++--- .../views/client/body/drive/drive-item.tsx | 2 +- .../src/app/views/client/body/drive/index.tsx | 1 - .../drive/modals/create/create-folder.tsx | 4 +-- .../body/drive/modals/create/create-link.tsx | 1 - .../client/body/drive/modals/create/index.tsx | 4 --- .../body/drive/modals/manage-users/common.tsx | 2 -- .../body/drive/modals/manage-users/index.tsx | 4 +-- .../body/drive/modals/selector/index.tsx | 6 ++--- .../body/drive/modals/update-access/index.tsx | 2 +- .../client/body/drive/modals/upload/index.tsx | 7 ------ .../src/app/views/client/common/account.tsx | 2 +- .../src/app/views/client/side-bar/actions.tsx | 4 +-- .../src/app/views/client/side-bar/index.tsx | 2 +- .../src/app/views/client/viewer/viewer.tsx | 4 +-- 37 files changed, 52 insertions(+), 103 deletions(-) diff --git a/tdrive/frontend/src/app/components/connection-indicator/connection-indicator.tsx b/tdrive/frontend/src/app/components/connection-indicator/connection-indicator.tsx index fe9161ef..7da21911 100644 --- a/tdrive/frontend/src/app/components/connection-indicator/connection-indicator.tsx +++ b/tdrive/frontend/src/app/components/connection-indicator/connection-indicator.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React from 'react'; import './connection-indicator.scss'; import ErrorOutlinedIcon from '@material-ui/icons/ErrorOutlined'; import HourglassEmpty from '@material-ui/icons/HourglassEmpty'; @@ -9,7 +9,7 @@ import { useRecoilState } from 'recoil'; // import WebSocket, { WebsocketEvents } from '@features/global/types/websocket-types'; export default () => { - const [{ connected, reconnecting }, setState] = useRecoilState(ConnectedState); + const [{ connected, reconnecting }] = useRecoilState(ConnectedState); return (
diff --git a/tdrive/frontend/src/app/components/download-app-banner/download-app-banner.tsx b/tdrive/frontend/src/app/components/download-app-banner/download-app-banner.tsx index 98b3d94d..0b69ddd8 100644 --- a/tdrive/frontend/src/app/components/download-app-banner/download-app-banner.tsx +++ b/tdrive/frontend/src/app/components/download-app-banner/download-app-banner.tsx @@ -1,24 +1,21 @@ import React, { useEffect, useState } from 'react'; -import InitService from '../../features/global/services/init-service'; +// import InitService from '../../features/global/services/init-service'; import LocalStorage from '../../features/global/framework/local-storage-service'; -import DownloadBanner from '@molecules/download-banner'; import { detectDesktopAppPresence } from '../../../utils/browser-detect'; export default (): React.ReactElement => { - const [showBanner, setShowBanner] = useState(false); + const [ , setShowBanner] = useState(false); - const download = (): void => { - const appDownloadUrl = InitService?.server_infos?.configuration?.app_download_url; + // const download = (): void => { + // const appDownloadUrl = InitService?.server_infos?.configuration?.app_download_url; + // if (appDownloadUrl) + // window.open(appDownloadUrl, '_blank'); + // }; - if (appDownloadUrl) { - window.open(appDownloadUrl, '_blank'); - } - }; - - const removeBanner = (): void => { - LocalStorage.setItem('show_app_banner', 'false'); - setShowBanner(false); - }; + // const removeBanner = (): void => { + // LocalStorage.setItem('show_app_banner', 'false'); + // setShowBanner(false); + // }; useEffect(() => { if (LocalStorage.getItem('show_app_banner') === 'false') { diff --git a/tdrive/frontend/src/app/components/mobile-redirect/index.tsx b/tdrive/frontend/src/app/components/mobile-redirect/index.tsx index 83e21886..d34f7060 100644 --- a/tdrive/frontend/src/app/components/mobile-redirect/index.tsx +++ b/tdrive/frontend/src/app/components/mobile-redirect/index.tsx @@ -1,5 +1,4 @@ import React, { ReactNode } from 'react'; -import { getDevice } from '../../features/global/utils/device'; import configuration from '../../environment/environment'; import { Smartphone, X } from 'react-feather'; import './style.scss'; diff --git a/tdrive/frontend/src/app/components/popup-component/popup-component.jsx b/tdrive/frontend/src/app/components/popup-component/popup-component.jsx index 5862874f..12510d78 100755 --- a/tdrive/frontend/src/app/components/popup-component/popup-component.jsx +++ b/tdrive/frontend/src/app/components/popup-component/popup-component.jsx @@ -29,7 +29,7 @@ export default class PopupComponent extends React.Component { {this.state.popupManager.canClose() && (
this.state.popupManager.close()}> - +
)} diff --git a/tdrive/frontend/src/app/components/search-popup/parts/drive-item-result.tsx b/tdrive/frontend/src/app/components/search-popup/parts/drive-item-result.tsx index 1e404b7d..7ab2bda8 100644 --- a/tdrive/frontend/src/app/components/search-popup/parts/drive-item-result.tsx +++ b/tdrive/frontend/src/app/components/search-popup/parts/drive-item-result.tsx @@ -1,6 +1,6 @@ import { FolderIcon } from '@heroicons/react/solid'; import Highlighter from 'react-highlight-words'; -import { useRecoilState, useRecoilValue } from 'recoil'; +import { useRecoilValue } from 'recoil'; import { onDriveItemDownloadClick } from '../common'; import ResultContext from './result-context'; import { Button } from '@atoms/button/button'; @@ -15,18 +15,14 @@ import { SearchInputState } from '@features/search/state/search-input'; import { UserType } from '@features/users/types/user'; import { useDrivePreview } from '@features/drive/hooks/use-drive-preview'; import Media from '@molecules/media'; -import { DriveCurrentFolderAtom } from '@views/client/body/drive/browser'; import { useHistory } from 'react-router-dom'; import RouterServices from '@features/router/services/router-service'; -import { useCurrentUser } from 'app/features/users/hooks/use-current-user'; import useRouterCompany from 'app/features/router/hooks/use-router-company'; import { DocumentIcon } from '@views/client/body/drive/documents/document-icon'; export default (props: { driveItem: DriveItem & { user?: UserType }}) => { const history = useHistory(); const input = useRecoilValue(SearchInputState); - const { user } = useCurrentUser(); - const [_, setParentId] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id })); const file = props.driveItem; const name = file?.name; const extension = name?.split('.').pop(); diff --git a/tdrive/frontend/src/app/components/uploads/file-tree-utils.ts b/tdrive/frontend/src/app/components/uploads/file-tree-utils.ts index 7292f10b..d23fa5c0 100644 --- a/tdrive/frontend/src/app/components/uploads/file-tree-utils.ts +++ b/tdrive/frontend/src/app/components/uploads/file-tree-utils.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ type TreeItem = { [key: string]: File | TreeItem }; export type FileTreeObject = { diff --git a/tdrive/frontend/src/app/deprecated/user/CurrentUser.ts b/tdrive/frontend/src/app/deprecated/user/CurrentUser.ts index 66aa34b9..aa59d910 100755 --- a/tdrive/frontend/src/app/deprecated/user/CurrentUser.ts +++ b/tdrive/frontend/src/app/deprecated/user/CurrentUser.ts @@ -10,7 +10,6 @@ import AlertManager from '@features/global/services/alert-manager-service'; import Languages from '@features/global/services/languages-service'; import JWTStorage from '@features/auth/jwt-storage-service'; import Globals from '@features/global/services/globals-tdrive-app-service'; -import { useCurrentUser } from '@features/users/hooks/use-current-user'; import UserAPIClient from '../../features/users/api/user-api-client'; import { getUser } from '@features/users/hooks/use-user-list'; @@ -68,6 +67,7 @@ class CurrentUser extends Observable { const data = { status: user.tutorial_status, }; + // eslint-disable-next-line @typescript-eslint/no-empty-function Api.post('/ajax/users/account/set_tutorial_status', data, () => {}); } diff --git a/tdrive/frontend/src/app/features/applications/hooks/use-company-applications.ts b/tdrive/frontend/src/app/features/applications/hooks/use-company-applications.ts index 81e142e1..0416e4c0 100644 --- a/tdrive/frontend/src/app/features/applications/hooks/use-company-applications.ts +++ b/tdrive/frontend/src/app/features/applications/hooks/use-company-applications.ts @@ -8,7 +8,6 @@ import { onChangeCompanyApplications, } from '../state/company-applications'; import CompanyApplicationsAPIClient from 'app/features/applications/api/company-applications-api-client'; -import { useCurrentCompany } from '../../companies/hooks/use-companies'; import { Application } from 'app/features/applications/types/application'; import { LoadingState } from 'app/features/global/state/atoms/Loading'; import useRouterWorkspace from 'app/features/router/hooks/use-router-workspace'; diff --git a/tdrive/frontend/src/app/features/applications/state/company-applications.ts b/tdrive/frontend/src/app/features/applications/state/company-applications.ts index 40784289..8d513930 100644 --- a/tdrive/frontend/src/app/features/applications/state/company-applications.ts +++ b/tdrive/frontend/src/app/features/applications/state/company-applications.ts @@ -1,7 +1,6 @@ import { atomFamily, selectorFamily } from 'recoil'; import { Application } from 'app/features/applications/types/application'; -import Collections from 'app/deprecated/CollectionsV1/Collections/Collections'; import _ from 'lodash'; //Retro compatibility diff --git a/tdrive/frontend/src/app/features/companies/state/companies.ts b/tdrive/frontend/src/app/features/companies/state/companies.ts index 0595066d..1e0ed41a 100644 --- a/tdrive/frontend/src/app/features/companies/state/companies.ts +++ b/tdrive/frontend/src/app/features/companies/state/companies.ts @@ -1,9 +1,7 @@ import { atomFamily } from 'recoil'; -import Collections from '@deprecated/CollectionsV1/Collections/Collections'; import { CompanyType } from '@features/companies/types/company'; import CompanyAPIClient from '@features/companies/api/company-api-client'; -import _ from 'lodash'; const companies: { [key: string]: CompanyType } = {}; diff --git a/tdrive/frontend/src/app/features/console/services/console-service.ts b/tdrive/frontend/src/app/features/console/services/console-service.ts index af47d1bd..8f7e332b 100644 --- a/tdrive/frontend/src/app/features/console/services/console-service.ts +++ b/tdrive/frontend/src/app/features/console/services/console-service.ts @@ -5,7 +5,6 @@ import Languages from '@features/global/services/languages-service'; import { ToasterService as Toaster } from '@features/global/services/toaster-service'; import { ConsoleMemberRole } from '@features/console/types/types'; import Logger from '@features/global/framework/logger-service'; -import { JWTDataType } from '@features/auth/jwt-storage-service'; class ConsoleService { logger: Logger.Logger; diff --git a/tdrive/frontend/src/app/features/dragndrop/hook/draggable.tsx b/tdrive/frontend/src/app/features/dragndrop/hook/draggable.tsx index 00014552..1beca1bc 100644 --- a/tdrive/frontend/src/app/features/dragndrop/hook/draggable.tsx +++ b/tdrive/frontend/src/app/features/dragndrop/hook/draggable.tsx @@ -1,4 +1,4 @@ -import React, { MouseEventHandler } from 'react'; +import React from 'react'; import {useDraggable} from '@dnd-kit/core'; type DraggableProps={ @@ -7,7 +7,7 @@ type DraggableProps={ } export function Draggable(props:DraggableProps) { - const {attributes, listeners, setNodeRef, transform} = useDraggable({ + const { attributes, listeners, setNodeRef } = useDraggable({ id: `draggable-${props.id+1}`, data: { child: props.children diff --git a/tdrive/frontend/src/app/features/drive/hooks/use-drive-actions.tsx b/tdrive/frontend/src/app/features/drive/hooks/use-drive-actions.tsx index 337187f0..7fb47244 100644 --- a/tdrive/frontend/src/app/features/drive/hooks/use-drive-actions.tsx +++ b/tdrive/frontend/src/app/features/drive/hooks/use-drive-actions.tsx @@ -17,7 +17,7 @@ export const useDriveActions = (inPublicSharing?: boolean) => { const companyId = useRouterCompany(); const sharedFilter = useRecoilValue(SharedWithMeFilterState); const sortItem = useRecoilValue(DriveItemSort); - const [paginateItem, _] = useRecoilState(DriveItemPagination); + const [ paginateItem ] = useRecoilState(DriveItemPagination); const { getQuota } = useUserQuota(); const refresh = useRecoilCallback( diff --git a/tdrive/frontend/src/app/features/drive/hooks/use-drive-item.tsx b/tdrive/frontend/src/app/features/drive/hooks/use-drive-item.tsx index dde7d72e..bb8c9167 100644 --- a/tdrive/frontend/src/app/features/drive/hooks/use-drive-item.tsx +++ b/tdrive/frontend/src/app/features/drive/hooks/use-drive-item.tsx @@ -1,7 +1,7 @@ import { ToasterService } from '@features/global/services/toaster-service'; import { LoadingStateInitTrue } from '@features/global/state/atoms/Loading'; import useRouterCompany from '@features/router/hooks/use-router-company'; -import { useCallback, useState } from 'react'; +import { useCallback } from 'react'; import { useRecoilCallback, useRecoilState, useRecoilValue } from 'recoil'; import { DriveItemAtom, DriveItemChildrenAtom, DriveItemPagination } from '../state/store'; import { DriveItem } from '../types'; @@ -20,7 +20,7 @@ export const useDriveItem = (id: string) => { // const children = useRecoilValue(DriveItemChildrenAtom(id)); const [children, setChildren] = useRecoilState(DriveItemChildrenAtom(id)); const [loading, setLoading] = useRecoilState(LoadingStateInitTrue('useDriveItem-' + id)); - const [_, setPaginateItem] = useRecoilState(DriveItemPagination); + const [, setPaginateItem] = useRecoilState(DriveItemPagination); const { refresh: refreshItem, create, @@ -171,6 +171,7 @@ export const useDriveItem = (id: string) => { updateLevel, remove, refresh, + restore, loadNextPage, }; }; diff --git a/tdrive/frontend/src/app/features/drive/hooks/use-drive-preview.ts b/tdrive/frontend/src/app/features/drive/hooks/use-drive-preview.ts index 2b84c8fe..a9f08e2c 100644 --- a/tdrive/frontend/src/app/features/drive/hooks/use-drive-preview.ts +++ b/tdrive/frontend/src/app/features/drive/hooks/use-drive-preview.ts @@ -6,18 +6,15 @@ import { useRecoilState } from 'recoil'; import { DriveApiClient } from '../api-client/api-client'; import { DriveViewerState } from '../state/viewer'; import { DriveItem } from '../types'; -import { useHistory } from 'react-router-dom'; -import RouterServices from '@features/router/services/router-service'; import useRouterCompany from '@features/router/hooks/use-router-company'; import { DriveCurrentFolderAtom } from 'app/views/client/body/drive/browser'; import { useCurrentUser } from 'app/features/users/hooks/use-current-user'; export const useDrivePreviewModal = () => { - const history = useHistory(); const company = useRouterCompany(); const [status, setStatus] = useRecoilState(DriveViewerState); const { user } = useCurrentUser(); - const [ parentId, setParentId ] = useRecoilState( + const [ , setParentId ] = useRecoilState( DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id }), ); diff --git a/tdrive/frontend/src/app/features/drive/state/shared-with-me-filter.tsx b/tdrive/frontend/src/app/features/drive/state/shared-with-me-filter.tsx index 3e37e16b..119cea7e 100644 --- a/tdrive/frontend/src/app/features/drive/state/shared-with-me-filter.tsx +++ b/tdrive/frontend/src/app/features/drive/state/shared-with-me-filter.tsx @@ -1,4 +1,3 @@ -import { string } from 'prop-types'; import { atom } from 'recoil'; export type SharedWithMeFilter = { diff --git a/tdrive/frontend/src/app/features/search/hooks/use-search-drive-items.tsx b/tdrive/frontend/src/app/features/search/hooks/use-search-drive-items.tsx index 5c96b2fa..1807f3e8 100644 --- a/tdrive/frontend/src/app/features/search/hooks/use-search-drive-items.tsx +++ b/tdrive/frontend/src/app/features/search/hooks/use-search-drive-items.tsx @@ -23,7 +23,7 @@ export const useSearchDriveItems = () => { const [loading, setLoading] = useRecoilState(LoadingState('useSearchDriveItems')); const [searched, setSearched] = useRecoilState(SearchDriveItemsResultsState(companyId)); - const [recent, setRecent] = useRecoilState(RecentDriveItemsState(companyId)); + const [, setRecent] = useRecoilState(RecentDriveItemsState(companyId)); const opt = _.omitBy( { diff --git a/tdrive/frontend/src/app/features/users/hooks/use-current-user.ts b/tdrive/frontend/src/app/features/users/hooks/use-current-user.ts index e659ef7f..b1ef3c33 100644 --- a/tdrive/frontend/src/app/features/users/hooks/use-current-user.ts +++ b/tdrive/frontend/src/app/features/users/hooks/use-current-user.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { useEffect, useRef } from "react"; +import { useEffect } from "react"; import LoginService from '@features/auth/login-service'; -import UserAPIClient from '@features/users/api/user-api-client'; import { useRecoilState } from 'recoil'; import { CurrentUserState } from '../state/atoms/current-user'; import Languages from '@features/global/services/languages-service'; diff --git a/tdrive/frontend/src/app/features/workspaces/state/workspace-list.ts b/tdrive/frontend/src/app/features/workspaces/state/workspace-list.ts index fd29d9e8..6a25199f 100644 --- a/tdrive/frontend/src/app/features/workspaces/state/workspace-list.ts +++ b/tdrive/frontend/src/app/features/workspaces/state/workspace-list.ts @@ -4,8 +4,6 @@ import { atomFamily, selectorFamily, useSetRecoilState } from 'recoil'; import { WorkspaceType } from '@features/workspaces/types/workspace'; import WorkspaceAPIClient from '@features/workspaces/api/workspace-api-client'; import Logger from '@features/global/framework/logger-service'; -import _ from 'lodash'; -import Collections from '@deprecated/CollectionsV1/Collections/Collections'; const logger = Logger.getLogger('WorkspaceListState'); diff --git a/tdrive/frontend/src/app/views/client/body/drive/browser.tsx b/tdrive/frontend/src/app/views/client/body/drive/browser.tsx index cc555c55..3dd05a4b 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/browser.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/browser.tsx @@ -10,9 +10,9 @@ import { useDriveUpload } from '@features/drive/hooks/use-drive-upload'; import { DriveItemSelectedList, DriveItemSort } from '@features/drive/state/store'; import { formatBytes } from '@features/drive/utils'; import useRouterCompany from '@features/router/hooks/use-router-company'; -import _, { set } from 'lodash'; +import _ from 'lodash'; import { memo, Suspense, useCallback, useEffect, useRef, useState } from 'react'; -import { atomFamily, useRecoilState, useSetRecoilState, useRecoilValue } from 'recoil'; +import { atomFamily, useRecoilState, useSetRecoilState } from 'recoil'; import { DrivePreview } from '../../viewer/drive-preview'; import { useOnBuildContextMenu, @@ -40,7 +40,7 @@ import useRouteState from 'app/features/router/hooks/use-route-state'; import { SharedWithMeFilterState } from '@features/drive/state/shared-with-me-filter'; import MenusManager from '@components/menus/menus-manager.jsx'; import Languages from 'features/global/services/languages-service'; -import {DndContext, useSensors, useSensor, PointerSensor, DragOverlay} from '@dnd-kit/core'; +import { DndContext, useSensors, useSensor, PointerSensor, DragOverlay } from '@dnd-kit/core'; import { Droppable } from 'app/features/dragndrop/hook/droppable'; import { Draggable } from 'app/features/dragndrop/hook/draggable'; import { useDriveActions } from '@features/drive/hooks/use-drive-actions'; @@ -49,7 +49,6 @@ import { useCurrentUser } from 'app/features/users/hooks/use-current-user'; import { ConfirmModal } from './modals/confirm-move'; import { useHistory } from 'react-router-dom'; import { SortIcon } from 'app/atoms/icons-agnostic'; -import { useDrivePreview, useDrivePreviewLoading } from 'app/features/drive/hooks/use-drive-preview'; export const DriveCurrentFolderAtom = atomFamily< string, @@ -78,12 +77,9 @@ export default memo( ? (user?.companies || []).find(company => company?.company.id === companyId)?.role : 'member'; setTdriveTabToken(tdriveTabContextToken || null); - const [filter, __] = useRecoilState(SharedWithMeFilterState); - const { viewId, dirId, itemId } = useRouteState(); - const { status } = useDrivePreview(); - const { openWithId, close } = useDrivePreview(); + const [ filter ] = useRecoilState(SharedWithMeFilterState); + const { viewId, dirId } = useRouteState(); const [sortLabel] = useRecoilState(DriveItemSort) - const { loading: isModalLoading } = useDrivePreviewLoading(); const [parentId, _setParentId] = useRecoilState( DriveCurrentFolderAtom({ context: context, diff --git a/tdrive/frontend/src/app/views/client/body/drive/context-menu.tsx b/tdrive/frontend/src/app/views/client/body/drive/context-menu.tsx index ec6655dc..0ffa72c1 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/context-menu.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/context-menu.tsx @@ -22,9 +22,7 @@ import { copyToClipboard } from '@features/global/utils/CopyClipboard'; import { SharedWithMeFilterState } from '@features/drive/state/shared-with-me-filter'; import { getCurrentUserList } from '@features/users/hooks/use-user-list'; import useRouteState from 'app/features/router/hooks/use-route-state'; -import RouterServices from '@features/router/services/router-service'; -import useRouterCompany from '@features/router/hooks/use-router-company'; -import _, { set } from 'lodash'; +import _ from 'lodash'; import Languages from 'features/global/services/languages-service'; import { hasAnyPublicLinkAccess } from '@features/files/utils/access-info-helpers'; import FeatureTogglesService, { @@ -42,7 +40,7 @@ export const useOnBuildContextMenu = ( const [checkedIds, setChecked] = useRecoilState(DriveItemSelectedList); const checked = children.filter(c => checkedIds[c.id]); - const [_, setParentId] = useRecoilState( + const [setParentId] = useRecoilState( DriveCurrentFolderAtom({ initialFolderId: initialParentId || 'root' }), ); @@ -59,11 +57,6 @@ export const useOnBuildContextMenu = ( const setUsersModalState = useSetRecoilState(UsersModalAtom); const { open: preview } = useDrivePreview(); const { viewId } = useRouteState(); - const company = useRouterCompany(); - - function getIdsFromArray(arr: DriveItem[]): string[] { - return arr.map(obj => obj.id); - } return useCallback( async (parent?: Partial | null, item?: DriveItem) => { @@ -378,7 +371,7 @@ export const useOnBuildContextMenu = ( }; export const useOnBuildFileTypeContextMenu = () => { - const [filter, setFilter] = useRecoilState(SharedWithMeFilterState); + const [, setFilter] = useRecoilState(SharedWithMeFilterState); const mimeTypes = [ { key: Languages.t('components.item_context_menu.all'), value: '' }, { key: 'CSV', value: 'text/csv' }, @@ -414,8 +407,8 @@ export const useOnBuildFileTypeContextMenu = () => { }; export const useOnBuildPeopleContextMenu = () => { - const [filter, setFilter] = useRecoilState(SharedWithMeFilterState); - const [_userList, setUserList] = useState(getCurrentUserList()); + const [, setFilter] = useRecoilState(SharedWithMeFilterState); + const [_userList] = useState(getCurrentUserList()); let userList = _userList; userList = _.uniqBy(userList, 'id'); return useCallback(() => { @@ -439,7 +432,7 @@ export const useOnBuildPeopleContextMenu = () => { }; export const useOnBuildDateContextMenu = () => { - const [filter, setFilter] = useRecoilState(SharedWithMeFilterState); + const [, setFilter] = useRecoilState(SharedWithMeFilterState); return useCallback(() => { const menuItems = [ { diff --git a/tdrive/frontend/src/app/views/client/body/drive/documents/common.tsx b/tdrive/frontend/src/app/views/client/body/drive/documents/common.tsx index 9a26b9d4..fc438413 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/documents/common.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/documents/common.tsx @@ -9,7 +9,6 @@ export type DriveItemProps = { checked: boolean; onClick?: () => void; onBuildContextMenu: () => Promise; - inPublicSharing?: boolean; }; export type DriveItemOverlayProps = { diff --git a/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx b/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx index e8ad0f88..68b68e11 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/documents/document-row.tsx @@ -5,13 +5,12 @@ import Menu from '@components/menus/menu'; import useRouterCompany from '@features/router/hooks/use-router-company'; import { useDrivePreview } from '@features/drive/hooks/use-drive-preview'; import { formatBytes } from '@features/drive/utils'; -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { PublicIcon } from '../components/public-icon'; import { CheckableIcon, DriveItemOverlayProps, DriveItemProps } from './common'; import './style.scss'; import { useHistory } from 'react-router-dom'; import RouterServices from '@features/router/services/router-service'; -import useRouteState from 'app/features/router/hooks/use-route-state'; import { DocumentIcon } from './document-icon'; import { hasAnyPublicLinkAccess } from '@features/files/utils/access-info-helpers'; import { formatDateShort } from 'app/features/global/utils/Numbers'; @@ -23,11 +22,10 @@ export const DocumentRow = ({ checked, onClick, onBuildContextMenu, - inPublicSharing, }: DriveItemProps) => { const history = useHistory(); const [hover, setHover] = useState(false); - const { open, close, isOpen } = useDrivePreview(); + const {open} = useDrivePreview(); const company = useRouterCompany(); const preview = () => { diff --git a/tdrive/frontend/src/app/views/client/body/drive/drive-item.tsx b/tdrive/frontend/src/app/views/client/body/drive/drive-item.tsx index de1f0877..05cc37a6 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/drive-item.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/drive-item.tsx @@ -1,7 +1,7 @@ import { DesktopComputerIcon } from '@heroicons/react/solid'; import { Base } from '@atoms/text'; -export const DriveItem = ({ className, onClick }: { className?: string; onClick: Function }) => { +export const DriveItem = ({ className, onClick }: { className?: string; onClick: () => void }) => { return (
{ const [name, setName] = useState(''); - const [loading, _] = useState(false); + const [loading] = useState(false); const [state, setState] = useRecoilState(CreateModalAtom); const { create } = useDriveActions(); const inputRef = useRef(null); diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/create/create-link.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/create/create-link.tsx index c15ac182..e8350776 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/create/create-link.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/create/create-link.tsx @@ -1,6 +1,5 @@ import { Button } from '@atoms/button/button'; import { Input } from '@atoms/input/input-text'; -import { Info } from '@atoms/text'; import { useDriveActions } from '@features/drive/hooks/use-drive-actions'; import { useState } from 'react'; import { useRecoilState } from 'recoil'; diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/create/index.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/create/index.tsx index c3a3bbc5..11dc578e 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/create/index.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/create/index.tsx @@ -7,9 +7,7 @@ import { Application } from '@features/applications/types/application'; import { Transition } from '@headlessui/react'; import { ChevronLeftIcon, - DocumentDownloadIcon, FolderAddIcon, - FolderDownloadIcon, LinkIcon, } from '@heroicons/react/outline'; import { ReactNode } from 'react'; @@ -35,8 +33,6 @@ export const CreateModalAtom = atom({ }); export const CreateModal = ({ - selectFromDevice, - selectFolderFromDevice, addFromUrl, }: { selectFromDevice: () => void; diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/manage-users/common.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/manage-users/common.tsx index e4da7c1a..a1f597dc 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/manage-users/common.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/manage-users/common.tsx @@ -5,14 +5,12 @@ import Languages from 'features/global/services/languages-service'; export const AccessLevel = ({ level, onChange, - canRemove, hiddenLevels, className, }: { disabled?: boolean; level: DriveFileAccessLevel | null; onChange: (level: DriveFileAccessLevel & 'remove') => void; - canRemove?: boolean; className?: string; hiddenLevels?: string[]; }) => { diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/manage-users/index.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/manage-users/index.tsx index d7d0dbc6..d9d114fc 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/manage-users/index.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/manage-users/index.tsx @@ -4,7 +4,6 @@ import Avatar from '@atoms/avatar'; import { Base, Info } from '@atoms/text'; import { atom, useRecoilState } from 'recoil'; import { useDriveItem } from '@features/drive/hooks/use-drive-item'; -import AlertManager from '@features/global/services/alert-manager-service'; import { useCurrentUser } from '@features/users/hooks/use-current-user'; import { useUser } from '@features/users/hooks/use-user'; import currentUserService from '@features/users/services/current-user-service'; @@ -55,7 +54,7 @@ const UserAccessLevel = ({ }) => { const user = useUser(userId); const { user: currentUser } = useCurrentUser(); - const { item, loading, updateLevel } = useDriveItem(id); + const { updateLevel } = useDriveItem(id); const [level, setLevel] = useState(role == "admin" ? "manage" : "read"); //const level = role == "admin" ? "manage" : "read"; @@ -78,7 +77,6 @@ const UserAccessLevel = ({ { setLevel(level); updateLevel(userId || '', level); diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/selector/index.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/selector/index.tsx index c278b38f..0853fe2d 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/selector/index.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/selector/index.tsx @@ -39,7 +39,7 @@ export const SelectorModal = () => { ); }; -const SelectorModalContent = (key:any,showfiles:boolean) => { +const SelectorModalContent = (key: any) => { const [state, setState] = useRecoilState(SelectorModalAtom); const [selected, setSelected] = useState([]); const [loading, setLoading] = useState(false); @@ -91,8 +91,8 @@ const SelectorModalContent = (key:any,showfiles:boolean) => {
))} - - {key.showfiles && ( + + {key.showfiles && ( <> {files.map(file => (
void, }) => { const { id } = props; - const { item, access, loading, update, refresh } = useDriveItem(id); + const { item, access, loading, refresh } = useDriveItem(id); const { refresh: refreshCompany } = useCurrentCompany(); useEffect(() => { refresh(id); diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/upload/index.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/upload/index.tsx index 34b63cba..f3817033 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/upload/index.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/upload/index.tsx @@ -1,16 +1,11 @@ -import Avatar from '@atoms/avatar'; import A from '@atoms/link'; import { Modal, ModalContent } from '@atoms/modal'; import { Base } from '@atoms/text'; -import { useCompanyApplications } from '@features/applications/hooks/use-company-applications'; -import { Application } from '@features/applications/types/application'; import { Transition } from '@headlessui/react'; import { ChevronLeftIcon, DocumentDownloadIcon, - FolderAddIcon, FolderDownloadIcon, - LinkIcon, } from '@heroicons/react/outline'; import { ReactNode } from 'react'; import { atom, useRecoilState } from 'recoil'; @@ -34,14 +29,12 @@ export const UploadModelAtom = atom({ export const UploadModal = ({ selectFromDevice, selectFolderFromDevice, - addFromUrl, }: { selectFromDevice: () => void; selectFolderFromDevice: () => void; addFromUrl: (url: string, name: string) => void; }) => { const [state, setState] = useRecoilState(UploadModelAtom); - const { applications } = useCompanyApplications(); return ( { +export default (): JSX.Element => { const { user } = useCurrentUser(); if (!user) return <>; diff --git a/tdrive/frontend/src/app/views/client/side-bar/actions.tsx b/tdrive/frontend/src/app/views/client/side-bar/actions.tsx index fed67e49..587e3816 100644 --- a/tdrive/frontend/src/app/views/client/side-bar/actions.tsx +++ b/tdrive/frontend/src/app/views/client/side-bar/actions.tsx @@ -24,7 +24,7 @@ export const CreateModalWithUploadZones = ({ initialParentId }: { initialParentI const setUploadModalState = useSetRecoilState(UploadModelAtom); const { uploadTree, uploadFromUrl } = useDriveUpload(); const { user } = useCurrentUser(); - const [parentId, _] = useRecoilState( + const [ parentId ] = useRecoilState( DriveCurrentFolderAtom({ initialFolderId: initialParentId || 'user_'+user?.id }), ); @@ -96,7 +96,7 @@ export const CreateModalWithUploadZones = ({ initialParentId }: { initialParentI export default () => { const { user } = useCurrentUser(); const { viewId, dirId } = useRouteState(); - const [parentId, _] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: dirId || viewId || 'user_'+user?.id })); + const [ parentId ] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: dirId || viewId || 'user_'+user?.id })); const { access, item } = useDriveItem(parentId); const { children: trashChildren } = useDriveItem(viewId === 'trash' ? 'trash' : 'trash_'+user?.id); const uploadZoneRef = useRef(null); diff --git a/tdrive/frontend/src/app/views/client/side-bar/index.tsx b/tdrive/frontend/src/app/views/client/side-bar/index.tsx index 3dbd0b00..deb00da4 100644 --- a/tdrive/frontend/src/app/views/client/side-bar/index.tsx +++ b/tdrive/frontend/src/app/views/client/side-bar/index.tsx @@ -53,7 +53,7 @@ export default () => {
- +
diff --git a/tdrive/frontend/src/app/views/client/viewer/viewer.tsx b/tdrive/frontend/src/app/views/client/viewer/viewer.tsx index 050cdcae..671a4577 100644 --- a/tdrive/frontend/src/app/views/client/viewer/viewer.tsx +++ b/tdrive/frontend/src/app/views/client/viewer/viewer.tsx @@ -12,7 +12,6 @@ import { Modal } from '@atoms/modal'; import * as Text from '@atoms/text'; import { addShortcut, removeShortcut } from '@features/global/services/shortcut-service'; import { formatSize } from '@features/global/utils/format-file-size'; -import useRouterWorkspace from '@features/router/hooks/use-router-workspace'; import currentUserService from '@features/users/services/current-user-service'; import { UserType } from '@features/users/types/user'; import { @@ -125,13 +124,12 @@ const Navigation = () => { }; const Footer = () => { - const { status, close } = useFileViewer(); + const { status } = useFileViewer(); const { download } = useViewerDisplayData(); const { type = '' } = useViewerDisplayData(); const user = status?.details?.user as UserType; const name = status.details?.metadata?.name; const extension = name?.split('.').pop(); - const workspaceId = useRouterWorkspace(); return ( <>