Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: refactoring openlink dialog

Ilian Sapundshievdf7d03aa5e36
diff --git a/app/components/dialogs/OpenLinkDialog.tsx b/app/components/dialogs/OpenLinkDialog.tsx
index fd8c7c53e..8660e0dba 100644
--- a/app/components/dialogs/OpenLinkDialog.tsx
+++ b/app/components/dialogs/OpenLinkDialog.tsx
@@ -17,8 +17,6 @@
*/
import React, { useState, useEffect } from 'react';
-import { connect } from 'react-redux';
-import { bindActionCreators } from 'redux';
import Button from '@mui/material/Button';
import TextField from '@mui/material/TextField';
import DialogActions from '@mui/material/DialogActions';
@@ -28,10 +26,9 @@ import FormControl from '@mui/material/FormControl';
import InputAdornment from '@mui/material/InputAdornment';
import Dialog from '@mui/material/Dialog';
import i18n from '-/services/i18n';
-import { actions as AppActions } from '-/reducers/app';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import useTheme from '@mui/styles/useTheme';
-import useMediaQuery from '@mui/material/useMediaQuery';
+// import useMediaQuery from '@mui/material/useMediaQuery';
import InfoIcon from '-/components/InfoIcon';
interface Props {
@@ -87,7 +84,7 @@ function OpenLinkDialog(props: Props) {
}
const theme = useTheme();
- const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
+ // const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
return (
<Dialog
open={open}
@@ -99,9 +96,7 @@ function OpenLinkDialog(props: Props) {
event.preventDefault();
event.stopPropagation();
onConfirm();
- } /*else if (event.key === 'Escape') {
- onClose();
- }*/
+ }
}}
>
<DialogTitle>
@@ -125,7 +120,7 @@ function OpenLinkDialog(props: Props) {
InputProps={{
endAdornment: (
<InputAdornment position="start">
- <InfoIcon tooltip="TagSpace links begin with ts:? and are used for internal sharing of files and folders" />
+ <InfoIcon tooltip="TagSpace links begin with ts://? and are used for internal sharing of files and folders" />
</InputAdornment>
)
}}
@@ -149,13 +144,4 @@ function OpenLinkDialog(props: Props) {
);
}
-function mapActionCreatorsToProps(dispatch) {
- return bindActionCreators(
- {
- openLink: AppActions.openLink
- },
- dispatch
- );
-}
-
-export default connect(undefined, mapActionCreatorsToProps)(OpenLinkDialog);
+export default OpenLinkDialog;
diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsx
index bdc02a16d..3127ba5e4 100644
--- a/app/containers/MainPage.tsx
+++ b/app/containers/MainPage.tsx
@@ -157,6 +157,7 @@ interface Props {
toggleEditTagDialog: (tag: TS.Tag) => void;
setEntryFullWidth: (isFullWidth: boolean) => void;
loadParentDirectoryContent: () => void;
+ openLink: (linkURL: string, options: any) => void;
saveFile: () => void; // needed by electron-menus
setZoomResetApp: () => void; // needed by electron-menus
setZoomInApp: () => void; // needed by electron-menus
@@ -549,6 +550,7 @@ function MainPage(props: Props) {
directoryPath,
mainSplitSize,
openedFiles,
+ openLink,
classes
} = props;
const { FILE } = NativeTypes;
@@ -692,6 +694,7 @@ function MainPage(props: Props) {
<OpenLinkDialogAsync
open={props.isOpenLinkDialogOpened}
onClose={toggleOpenLinkDialog}
+ openLink={openLink}
/>
)}
{props.isProTeaserVisible && (
@@ -898,6 +901,7 @@ function mapDispatchToProps(dispatch) {
toggleEditTagDialog: AppActions.toggleEditTagDialog,
onUploadProgress: AppActions.onUploadProgress,
saveFile: AppActions.saveFile,
+ openLink: AppActions.openLink,
setZoomResetApp: SettingsActions.setZoomResetApp,
setZoomInApp: SettingsActions.setZoomInApp,
setZoomOutApp: SettingsActions.setZoomOutApp,