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 fc438413f..efe0ed115 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 @@ -15,7 +15,6 @@ export type DriveItemOverlayProps = { item: DriveItem|null; className: string; }; -export const menuBuilder = async () => {}; export const CheckableIcon = ({ show, diff --git a/tdrive/frontend/src/app/views/client/body/drive/modals/confirm-move/index.tsx b/tdrive/frontend/src/app/views/client/body/drive/modals/confirm-move/index.tsx index 6e13a8ab2..6ac965344 100644 --- a/tdrive/frontend/src/app/views/client/body/drive/modals/confirm-move/index.tsx +++ b/tdrive/frontend/src/app/views/client/body/drive/modals/confirm-move/index.tsx @@ -11,7 +11,7 @@ export type ConfirmModalType = { parent_id: string; mode: 'move' | 'select-file' | 'select-files'; title: string; - onSelected: (ids: string[]) => Promise; + onSelected?: (ids: string[]) => Promise; }; export const ConfirmModalAtom = atom({ @@ -21,7 +21,6 @@ export const ConfirmModalAtom = atom({ parent_id: '', mode: 'move', title: '', - onSelected: async () => {}, }, }); @@ -40,7 +39,7 @@ const ConfirmModalContent = () => { const handleClose = async () => { setLoading(true); - await state.onSelected(selected.map((i) => i.id)); + state.onSelected && await state.onSelected(selected.map((i) => i.id)); setState({ ...state, open: false }); setLoading(false); }; 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 0853fe2d3..8afdd75aa 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 @@ -15,7 +15,7 @@ export type SelectorModalType = { parent_id: string; mode: 'move' | 'select-file' | 'select-files'; title: string; - onSelected: (ids: string[]) => Promise; + onSelected?: (ids: string[]) => Promise; }; export const SelectorModalAtom = atom({ @@ -25,7 +25,6 @@ export const SelectorModalAtom = atom({ parent_id: '', mode: 'move', title: '', - onSelected: async () => {}, }, }); @@ -135,7 +134,7 @@ const SelectorModalContent = (key: any) => { className="float-right" onClick={async () => { setLoading(true); - await state.onSelected(selected.map(i => i.id)); + state.onSelected && await state.onSelected(selected.map(i => i.id)); setState({ ...state, open: false }); setLoading(false); }} diff --git a/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx b/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx index 06904f5b6..e98c194c0 100644 --- a/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx +++ b/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from 'react'; +import PropTypes from 'prop-types'; import { useHistory } from 'react-router-dom'; import { Transition } from '@headlessui/react'; import { fadeTransition } from 'src/utils/transitions'; @@ -24,7 +25,6 @@ import Controls from './controls'; interface DrivePreviewProps { items: DriveItem[]; } - export const DrivePreview: React.FC = ({ items }) => { const history = useHistory(); const company = useRouterCompany(); @@ -64,6 +64,7 @@ export const DrivePreview: React.FC = ({ items }) => { useEffect(() => { if (items.length < 2) + // eslint-disable-next-line @typescript-eslint/no-empty-function return () => {}; addShortcut({ shortcut: 'Right', handler: handleSwitchRight }); addShortcut({ shortcut: 'Left', handler: handleSwitchLeft }); @@ -183,4 +184,7 @@ export const DrivePreview: React.FC = ({ items }) => { ); -}; \ No newline at end of file +}; +DrivePreview.propTypes = { + items: PropTypes.any.isRequired, +}