rename watchModal to watchFolder
This commit is contained in:
parent
283797dd4a
commit
6b9ed0c622
|
@ -59,7 +59,7 @@ export default function FullScreenDropZone(props: Props) {
|
|||
|
||||
useEffect(() => {
|
||||
const handleWatchFolderDrop = (e: DragEvent) => {
|
||||
if (!appContext.watchModalView) {
|
||||
if (!appContext.watchFolderView) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ export default function FullScreenDropZone(props: Props) {
|
|||
e.stopPropagation();
|
||||
const files = e.dataTransfer.files;
|
||||
if (files.length > 0) {
|
||||
appContext.setWatchModalFiles(files);
|
||||
appContext.setWatchFolderFiles(files);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -75,14 +75,14 @@ export default function FullScreenDropZone(props: Props) {
|
|||
return () => {
|
||||
removeEventListener('drop', handleWatchFolderDrop);
|
||||
};
|
||||
}, [appContext.watchModalView]);
|
||||
}, [appContext.watchFolderView]);
|
||||
|
||||
return (
|
||||
<DropDiv
|
||||
{...props.getRootProps({
|
||||
onDragEnter,
|
||||
})}>
|
||||
{!appContext.watchModalView ? (
|
||||
{!appContext.watchFolderView ? (
|
||||
<input {...props.getInputProps()} />
|
||||
) : null}
|
||||
{isDragActive && (
|
||||
|
@ -90,7 +90,7 @@ export default function FullScreenDropZone(props: Props) {
|
|||
<CloseButtonWrapper onClick={onDragLeave}>
|
||||
<CloseIcon />
|
||||
</CloseButtonWrapper>
|
||||
{appContext.watchModalView
|
||||
{appContext.watchFolderView
|
||||
? constants.WATCH_FOLDER_DROPZONE_MESSAGE
|
||||
: constants.UPLOAD_DROPZONE_MESSAGE}
|
||||
</Overlay>
|
||||
|
|
|
@ -9,15 +9,15 @@ import { useRouter } from 'next/router';
|
|||
import { AppContext } from 'pages/_app';
|
||||
import isElectron from 'is-electron';
|
||||
import { downloadApp } from 'utils/common';
|
||||
import WatchFolderModal from 'components/WatchFolder';
|
||||
import WatchFolder from 'components/WatchFolder';
|
||||
|
||||
export default function UtilitySection({ closeSidebar }) {
|
||||
const router = useRouter();
|
||||
const {
|
||||
setDialogMessage,
|
||||
startLoading,
|
||||
watchModalView,
|
||||
setWatchModalView,
|
||||
watchFolderView: watchModalView,
|
||||
setWatchFolderView: setWatchModalView,
|
||||
} = useContext(AppContext);
|
||||
|
||||
const [recoverModalView, setRecoveryModalView] = useState(false);
|
||||
|
@ -71,7 +71,7 @@ export default function UtilitySection({ closeSidebar }) {
|
|||
close: { variant: 'danger' },
|
||||
});
|
||||
|
||||
const closeWatchFolderModal = () => setWatchModalView(false);
|
||||
const closeWatchFolder = () => setWatchModalView(false);
|
||||
return (
|
||||
<>
|
||||
<SidebarButton onClick={openRecoveryKeyModal}>
|
||||
|
@ -108,10 +108,7 @@ export default function UtilitySection({ closeSidebar }) {
|
|||
closeSidebar={closeSidebar}
|
||||
setLoading={startLoading}
|
||||
/>
|
||||
<WatchFolderModal
|
||||
open={watchModalView}
|
||||
onClose={closeWatchFolderModal}
|
||||
/>
|
||||
<WatchFolder open={watchModalView} onClose={closeWatchFolder} />
|
||||
|
||||
{/* <FixLargeThumbnails
|
||||
isOpen={fixLargeThumbsView}
|
||||
|
|
|
@ -45,13 +45,10 @@ export default function UploadProgress({
|
|||
const [expanded, setExpanded] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
appContext.watchServiceIsRunning &&
|
||||
watchService.isUploadRunning()
|
||||
) {
|
||||
if (appContext.isFolderSyncRunning && watchService.isUploadRunning()) {
|
||||
setExpanded(false);
|
||||
}
|
||||
}, [appContext.watchServiceIsRunning]);
|
||||
}, [appContext.isFolderSyncRunning]);
|
||||
|
||||
function confirmCancelUpload() {
|
||||
appContext.setDialogMessage({
|
||||
|
|
|
@ -14,7 +14,7 @@ interface Iprops {
|
|||
onClose: () => void;
|
||||
}
|
||||
|
||||
export default function WatchFolderModal({ open, onClose }: Iprops) {
|
||||
export default function WatchFolder({ open, onClose }: Iprops) {
|
||||
const [mappings, setMappings] = useState<WatchMapping[]>([]);
|
||||
const appContext = useContext(AppContext);
|
||||
|
||||
|
@ -24,12 +24,12 @@ export default function WatchFolderModal({ open, onClose }: Iprops) {
|
|||
|
||||
useEffect(() => {
|
||||
if (
|
||||
appContext.watchModalFiles &&
|
||||
appContext.watchModalFiles.length > 0
|
||||
appContext.watchModalFolderFiles &&
|
||||
appContext.watchModalFolderFiles.length > 0
|
||||
) {
|
||||
handleFolderDrop(appContext.watchModalFiles);
|
||||
handleFolderDrop(appContext.watchModalFolderFiles);
|
||||
}
|
||||
}, [appContext.watchModalFiles]);
|
||||
}, [appContext.watchModalFolderFiles]);
|
||||
|
||||
const handleFolderDrop = async (folders: FileList) => {
|
||||
for (let i = 0; i < folders.length; i++) {
|
||||
|
|
|
@ -15,7 +15,7 @@ export function EntryHeading({ mapping }) {
|
|||
}}>
|
||||
<>
|
||||
{mapping.collectionName}
|
||||
{appContext.watchServiceIsRunning &&
|
||||
{appContext.isFolderSyncRunning &&
|
||||
watchService.currentEvent?.collectionName ===
|
||||
mapping.collectionName && <SyncProgressIcon />}
|
||||
</>
|
||||
|
|
|
@ -19,8 +19,8 @@ export function MappingEntry({
|
|||
const appContext = React.useContext(AppContext);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(appContext.watchServiceIsRunning);
|
||||
}, [appContext.watchServiceIsRunning]);
|
||||
console.log(appContext.isFolderSyncRunning);
|
||||
}, [appContext.isFolderSyncRunning]);
|
||||
|
||||
const confirmStopWatching = () => {
|
||||
appContext.setDialogMessage({
|
||||
|
|
|
@ -132,7 +132,7 @@ export default function Upload(props: Props) {
|
|||
props.setElectronFiles,
|
||||
setCollectionName,
|
||||
props.syncWithRemote,
|
||||
appContext.setWatchServiceIsRunning
|
||||
appContext.setIsFolderSyncRunning
|
||||
);
|
||||
}
|
||||
}, []);
|
||||
|
|
|
@ -52,12 +52,12 @@ type AppContextType = {
|
|||
finishLoading: () => void;
|
||||
closeMessageDialog: () => void;
|
||||
setDialogMessage: SetDialogBoxAttributes;
|
||||
watchServiceIsRunning: boolean;
|
||||
setWatchServiceIsRunning: (isRunning: boolean) => void;
|
||||
watchModalView: boolean;
|
||||
setWatchModalView: (isOpen: boolean) => void;
|
||||
watchModalFiles: FileList;
|
||||
setWatchModalFiles: (files: FileList) => void;
|
||||
isFolderSyncRunning: boolean;
|
||||
setIsFolderSyncRunning: (isRunning: boolean) => void;
|
||||
watchFolderView: boolean;
|
||||
setWatchFolderView: (isOpen: boolean) => void;
|
||||
watchModalFolderFiles: FileList;
|
||||
setWatchFolderFiles: (files: FileList) => void;
|
||||
};
|
||||
|
||||
export enum FLASH_MESSAGE_TYPE {
|
||||
|
@ -92,9 +92,9 @@ export default function App({ Component, err }) {
|
|||
const loadingBar = useRef(null);
|
||||
const [dialogMessage, setDialogMessage] = useState<DialogBoxAttributes>();
|
||||
const [messageDialogView, setMessageDialogView] = useState(false);
|
||||
const [watchServiceIsRunning, setWatchServiceIsRunning] = useState(false);
|
||||
const [watchModalView, setWatchModalView] = useState(false);
|
||||
const [watchModalFiles, setWatchModalFiles] = useState<FileList>(null);
|
||||
const [isFolderSyncRunning, setIsFolderSyncRunning] = useState(false);
|
||||
const [watchFolderView, setWatchFolderView] = useState(false);
|
||||
const [watchFolderFiles, setWatchFolderFiles] = useState<FileList>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
|
@ -283,12 +283,12 @@ export default function App({ Component, err }) {
|
|||
finishLoading,
|
||||
closeMessageDialog,
|
||||
setDialogMessage,
|
||||
watchServiceIsRunning,
|
||||
setWatchServiceIsRunning,
|
||||
watchModalView,
|
||||
setWatchModalView,
|
||||
watchModalFiles,
|
||||
setWatchModalFiles,
|
||||
isFolderSyncRunning: isFolderSyncRunning,
|
||||
setIsFolderSyncRunning: setIsFolderSyncRunning,
|
||||
watchFolderView: watchFolderView,
|
||||
setWatchFolderView: setWatchFolderView,
|
||||
watchModalFolderFiles: watchFolderFiles,
|
||||
setWatchFolderFiles: setWatchFolderFiles,
|
||||
}}>
|
||||
{loading ? (
|
||||
<VerticallyCentered>
|
||||
|
|
|
@ -280,7 +280,7 @@ export default function Gallery() {
|
|||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!appContext.watchModalView) {
|
||||
if (!appContext.watchFolderView) {
|
||||
setDroppedFiles(acceptedFiles);
|
||||
}
|
||||
}, [acceptedFiles]);
|
||||
|
|
Loading…
Reference in a new issue