Skip to content

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

chore: mobile optimizations

Ilian Sapundshiev99f19483de7a
diff --git a/src/renderer/components/EntryContainerTitle.tsx b/src/renderer/components/EntryContainerTitle.tsx
index 99beb8948..521bcc1fb 100644
--- a/src/renderer/components/EntryContainerTitle.tsx
+++ b/src/renderer/components/EntryContainerTitle.tsx
@@ -166,9 +166,6 @@ function EntryContainerTitle(props: Props) {
style={{
// @ts-ignore
WebkitAppRegion: 'no-drag',
- // marginTop: 5,
- // marginLeft: 5,
- //float: 'left',
}}
data-tid="fileContainerCloseOpenedFile"
onClick={startClosingEntry}
diff --git a/src/renderer/components/dialogs/components/TsDialogTitle.tsx b/src/renderer/components/dialogs/components/TsDialogTitle.tsx
index 5a6ce2c92..d352c4f66 100644
--- a/src/renderer/components/dialogs/components/TsDialogTitle.tsx
+++ b/src/renderer/components/dialogs/components/TsDialogTitle.tsx
@@ -82,7 +82,11 @@ function TsDialogTitle(props: TSDialogTitle) {
<span style={{ alignSelf: 'center', margin: '0 auto' }}>
{title}
</span>
- {actionSlot && <span style={{ float: 'right' }}>{actionSlot}</span>}
+ {actionSlot && (
+ <span style={{ float: 'right', alignSelf: 'center' }}>
+ {actionSlot}
+ </span>
+ )}
</div>
<div style={{ textAlign: 'center' }}>{children}</div>
</>
diff --git a/src/renderer/containers/MainPage.tsx b/src/renderer/containers/MainPage.tsx
index 9f34b8e6f..933cfce1a 100644
--- a/src/renderer/containers/MainPage.tsx
+++ b/src/renderer/containers/MainPage.tsx
@@ -20,6 +20,7 @@ import React, { useEffect, useReducer, useRef, useState } from 'react';
import clsx from 'clsx';
import { bindActionCreators } from 'redux';
import { connect, useSelector } from 'react-redux';
+import { useMediaQuery } from '@mui/material';
import SwipeableDrawer from '@mui/material/SwipeableDrawer';
import Drawer from '@mui/material/Drawer';
import { HotKeys } from 'react-hotkeys';
@@ -43,7 +44,6 @@ import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';
import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
import { usePanelsContext } from '-/hooks/usePanelsContext';
import { useUserContext } from '-/hooks/useUserContext';
-import { useBrowserHistoryContext } from '-/hooks/useBrowserHistoryContext';
const drawerWidth = 320;
const body = document.getElementsByTagName('body')[0];
@@ -85,17 +85,15 @@ const Root = styled('div')(({ theme }) => ({
interface Props {
toggleShowUnixHiddenEntries: () => void;
setMainVerticalSplitSize: (splitSize: string) => void;
- /*isLocationManagerPanelOpened: boolean;
- isTagLibraryPanelOpened: boolean;
- isSearchPanelOpened: boolean;
- isHelpFeedbackPanelOpened: boolean;*/
- //user: CognitoUserInterface;
}
function MainPage(props: Props) {
const { openLink, openedEntry, isEntryInFullWidth, setEntryInFullWidth } =
useOpenedEntryContext();
+ const theme = useTheme();
+ const smallScreen = useMediaQuery(theme.breakpoints.down('md'));
+
const {
loadParentDirectoryContent,
enterSearchMode,
@@ -104,7 +102,6 @@ function MainPage(props: Props) {
} = useDirectoryContentContext();
const { showPanel } = usePanelsContext();
const { isLoggedIn } = useUserContext();
- const theme = useTheme();
const percent = useRef<number | undefined>(undefined);
const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);
@@ -134,19 +131,9 @@ function MainPage(props: Props) {
if (!AppConfig.isCordova) {
updateDimensions();
}
- /*listen({
- ...props,
- goBack,
- goForward,
- openFsEntry,
- openNextFile,
- openPrevFile,
- setSearchQuery,
- });*/
}, []);
useEffect(() => {
- // setPercent(undefined);
if (isEntryInFullWidth) {
setDrawerOpened(false); // !props.isEntryInFullWidth);
}
@@ -253,6 +240,13 @@ function MainPage(props: Props) {
return null;
};
}
+ if (smallScreen && openedEntry) {
+ return (
+ <FilePropertiesContextProvider>
+ <EntryContainer key="EntryContainerID" />
+ </FilePropertiesContextProvider>
+ );
+ }
return (
<Split
initialPrimarySize={initialPrimarySize}
@@ -362,16 +356,6 @@ function MainPage(props: Props) {
);
}
-function mapStateToProps(state) {
- return {
- /*isLocationManagerPanelOpened: isLocationManagerPanelOpened(state),
- isTagLibraryPanelOpened: isTagLibraryPanelOpened(state),
- isSearchPanelOpened: isSearchPanelOpened(state),
- isHelpFeedbackPanelOpened: isHelpFeedbackPanelOpened(state),*/
- //user: currentUser(state),
- };
-}
-
function mapDispatchToProps(dispatch) {
return bindActionCreators(
{
@@ -382,7 +366,4 @@ function mapDispatchToProps(dispatch) {
);
}
-export default connect(
- mapStateToProps,
- mapDispatchToProps,
-)(React.memo(MainPage));
+export default connect(undefined, mapDispatchToProps)(React.memo(MainPage));