Skip to content

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

chore: optimize the layout in the mobile navigation

Ilian Sapundshiev0e0a16b8e28e
diff --git a/src/renderer/components/HelpFeedbackPanel.tsx b/src/renderer/components/HelpFeedbackPanel.tsx
index 7a99d3039..d0c4393cc 100644
--- a/src/renderer/components/HelpFeedbackPanel.tsx
+++ b/src/renderer/components/HelpFeedbackPanel.tsx
@@ -60,12 +60,7 @@ import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import SidePanelTitle from './SidePanelTitle';
-interface Props {
- style?: any;
- reduceHeightBy?: number;
-}
-
-function HelpFeedbackPanel(props: Props) {
+function HelpFeedbackPanel() {
const { t } = useTranslation();
const theme = useTheme();
const desktopMode = useSelector(isDesktopMode);
@@ -75,7 +70,6 @@ function HelpFeedbackPanel(props: Props) {
const { openOnboardingDialog } = useOnboardingDialogContext();
const { openKeyboardDialog } = useKeyboardDialogContext();
const { openProTeaserDialog } = useProTeaserDialogContext();
- const { reduceHeightBy } = props;
return (
<Box
@@ -84,7 +78,8 @@ function HelpFeedbackPanel(props: Props) {
flexDirection: 'column',
paddingLeft: '5px',
paddingRight: '5px',
- height: '100%',
+ flex: 1,
+ minHeight: 0,
}}
>
<SidePanelTitle title={t('core:helpFeedback')} />
@@ -93,7 +88,8 @@ function HelpFeedbackPanel(props: Props) {
component="nav"
aria-label="main help area"
sx={{
- height: 'calc(100% - ' + reduceHeightBy + 'px)',
+ flex: 1,
+ minHeight: 0,
overflowY: 'auto',
marginRight: '5px',
}}
diff --git a/src/renderer/components/LocationManager.tsx b/src/renderer/components/LocationManager.tsx
index 34a18e460..3043f4f47 100644
--- a/src/renderer/components/LocationManager.tsx
+++ b/src/renderer/components/LocationManager.tsx
@@ -38,7 +38,6 @@ import { useSelector } from 'react-redux';
interface Props {
style?: any;
- reduceHeightBy: number;
show: boolean;
}
@@ -101,7 +100,7 @@ function LocationManager(props: Props) {
moveLocation(result.draggableId, result.destination.index);
};
- const { reduceHeightBy, show } = props;
+ const { show } = props;
function getWorkSpace(l) {
if (l.workSpaceId) {
@@ -141,7 +140,8 @@ function LocationManager(props: Props) {
sx={{
display: show ? 'flex' : 'none',
flexDirection: 'column',
- height: '100%',
+ flex: 1,
+ minHeight: 0,
paddingLeft: '5px',
paddingRight: '5px',
position: 'relative',
@@ -167,7 +167,8 @@ function LocationManager(props: Props) {
{locationDirectoryContextMenuAnchorEl && <LocationContextMenu />}
<Box
sx={{
- height: `calc(100% - ${reduceHeightBy}px)`,
+ flex: 1,
+ minHeight: 0,
display: 'flex',
flexDirection: 'column',
}}
diff --git a/src/renderer/components/MobileNavigation.tsx b/src/renderer/components/MobileNavigation.tsx
index 87699f19a..564410084 100644
--- a/src/renderer/components/MobileNavigation.tsx
+++ b/src/renderer/components/MobileNavigation.tsx
@@ -212,6 +212,8 @@ function MobileNavigation(props: Props) {
backdropFilter: 'blur(5px)',
height: '100%',
overflow: 'hidden',
+ display: 'flex',
+ flexDirection: 'column',
width: widthValue,
maxWidth: widthValue,
// The drawer paper is position:fixed at the viewport top, so it ignores
@@ -226,10 +228,13 @@ function MobileNavigation(props: Props) {
<Box
sx={{
overflow: 'hidden',
- height: showProTeaser ? 'calc(100% - 190px)' : 'calc(100% - 55px)',
+ flex: 1,
+ minHeight: 0,
+ display: 'flex',
+ flexDirection: 'column',
}}
>
- <Box>
+ <Box sx={{ flexShrink: 0 }}>
<CustomLogo />
<Box
sx={{
@@ -625,26 +630,24 @@ function MobileNavigation(props: Props) {
)}
</Popper>
</ClickAwayListener>
- <LocationManager
- reduceHeightBy={desktopMode ? 150 : 180}
- show={currentOpenedPanel === 'locationManagerPanel'}
- />
- {currentOpenedPanel === 'tagLibraryPanel' && (
- <TagLibrary reduceHeightBy={desktopMode ? 140 : 170} />
- )}
- {currentOpenedPanel === 'searchPanel' && (
- <StoredSearches reduceHeightBy={desktopMode ? 140 : 165} />
- )}
- {currentOpenedPanel === 'helpFeedbackPanel' && (
- <HelpFeedbackPanel reduceHeightBy={desktopMode ? 150 : 175} />
- )}
+ <LocationManager show={currentOpenedPanel === 'locationManagerPanel'} />
+ {currentOpenedPanel === 'tagLibraryPanel' && <TagLibrary />}
+ {currentOpenedPanel === 'searchPanel' && <StoredSearches />}
+ {currentOpenedPanel === 'helpFeedbackPanel' && <HelpFeedbackPanel />}
</Box>
<Box
sx={{
display: 'flex',
flexDirection: 'column',
- marginTop: desktopMode ? '-10px' : '-25px',
+ flexShrink: 0,
backgroundColor: theme.palette.background.default,
+ paddingTop: '5px',
+ // Keep the bottom nav clear of the OS gesture bar / home indicator on
+ // iOS & Android; --sab falls back to env(safe-area-inset-bottom), and
+ // the 8px floor gives a small touch margin on web/desktop where the
+ // inset is 0.
+ paddingBottom:
+ 'max(9px, var(--sab, env(safe-area-inset-bottom, 0px)))',
}}
>
{showProTeaser && (
diff --git a/src/renderer/components/StoredSearches.tsx b/src/renderer/components/StoredSearches.tsx
index ef45f0f3a..7dc48208e 100644
--- a/src/renderer/components/StoredSearches.tsx
+++ b/src/renderer/components/StoredSearches.tsx
@@ -59,7 +59,6 @@ import SidePanelTitle from './SidePanelTitle';
interface Props {
style?: any;
showUnixHiddenEntries: boolean;
- reduceHeightBy: number;
storedSearchesVisible: boolean;
showBookmarks: boolean;
fileOpenHistory: boolean;
@@ -123,8 +122,6 @@ function StoredSearches(props: Props) {
const noSearchesFound = searches.length < 1;
- const { reduceHeightBy } = props;
-
const bookmarkItems: Array<TS.BookmarkItem> =
Pro && bookmarksContext
? bookmarksContext.bookmarks //getBookmarks()
@@ -142,7 +139,8 @@ function StoredSearches(props: Props) {
sx={{
display: 'flex',
flexDirection: 'column',
- height: '100%',
+ flex: 1,
+ minHeight: 0,
borderRadius: AppConfig.defaultCSSRadius,
marginLeft: '5px',
marginRight: '5px',
@@ -153,7 +151,8 @@ function StoredSearches(props: Props) {
sx={{
paddingTop: 0,
marginTop: 0,
- height: 'calc(100% - ' + reduceHeightBy + 'px)',
+ flex: 1,
+ minHeight: 0,
width: '100%',
overflowY: 'auto',
overflowX: 'hidden',
diff --git a/src/renderer/components/TagLibrary.tsx b/src/renderer/components/TagLibrary.tsx
index dbabed264..1d9b6bb0d 100644
--- a/src/renderer/components/TagLibrary.tsx
+++ b/src/renderer/components/TagLibrary.tsx
@@ -61,11 +61,7 @@ import React, {
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
-interface Props {
- reduceHeightBy: number;
-}
-
-function TagLibrary({ reduceHeightBy }: Props) {
+function TagLibrary() {
const { t } = useTranslation();
const {
createTagGroup,
@@ -277,7 +273,8 @@ function TagLibrary({ reduceHeightBy }: Props) {
return (
<Box
sx={{
- height: '100%',
+ flex: 1,
+ minHeight: 0,
paddingLeft: '5px',
paddingRight: '5px',
display: 'flex',
@@ -373,7 +370,8 @@ function TagLibrary({ reduceHeightBy }: Props) {
paddingTop: 0,
marginTop: 0,
borderRadius: '5px',
- height: `calc(100% - ${reduceHeightBy}px)`,
+ flex: 1,
+ minHeight: 0,
width: '100%',
overflowY: 'auto',
overflowX: 'hidden',