Skip to content

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

chore: exchanging sidepanels css with component

Ilian Sapundshiev8dab00b7f641
diff --git a/src/renderer/components/HelpFeedbackPanel.tsx b/src/renderer/components/HelpFeedbackPanel.tsx
index e0efd88eb..a9bc61935 100644
--- a/src/renderer/components/HelpFeedbackPanel.tsx
+++ b/src/renderer/components/HelpFeedbackPanel.tsx
@@ -32,13 +32,13 @@ import {
WebClipperIcon,
XIcon,
} from '-/components/CommonIcons';
-import { SidePanel, classes } from '-/components/SidePanels.css';
import { useAboutDialogContext } from '-/components/dialogs/hooks/useAboutDialogContext';
import { useKeyboardDialogContext } from '-/components/dialogs/hooks/useKeyboardDialogContext';
import { useOnboardingDialogContext } from '-/components/dialogs/hooks/useOnboardingDialogContext';
import { useProTeaserDialogContext } from '-/components/dialogs/hooks/useProTeaserDialogContext';
import { Pro } from '-/pro';
import { openURLExternally } from '-/services/utils-io';
+import { Box } from '@mui/material';
import Divider from '@mui/material/Divider';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
@@ -47,6 +47,7 @@ import Typography from '@mui/material/Typography';
import { useTheme } from '@mui/material/styles';
import Links from 'assets/links';
import { useTranslation } from 'react-i18next';
+import SidePanelTitle from './SidePanelTitle';
interface Props {
style?: any;
@@ -63,22 +64,17 @@ function HelpFeedbackPanel(props: Props) {
const { reduceHeightBy } = props;
return (
- <SidePanel
+ <Box
style={{
display: 'flex',
flexDirection: 'column',
- marginLeft: 5,
+ //marginLeft: 5,
+ paddingLeft: 5,
+ paddingRight: 0,
+ height: '100%',
}}
>
- <div style={{ display: 'flex' }}>
- <Typography
- className={classes.panelTitle}
- variant="subtitle1"
- style={{ paddingLeft: 0 }}
- >
- {t('core:helpFeedback')}
- </Typography>
- </div>
+ <SidePanelTitle title={t('core:helpFeedback')} />
<List
dense={false}
component="nav"
@@ -234,7 +230,7 @@ function HelpFeedbackPanel(props: Props) {
</Typography>
</ListItem>
</List>
- </SidePanel>
+ </Box>
);
}
diff --git a/src/renderer/components/LocationManager.tsx b/src/renderer/components/LocationManager.tsx
index c51b21b46..3a8d6eaa7 100644
--- a/src/renderer/components/LocationManager.tsx
+++ b/src/renderer/components/LocationManager.tsx
@@ -17,14 +17,13 @@
*/
import LocationView from '-/components/LocationView';
-import { SidePanel, classes } from '-/components/SidePanels.css';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import { useCreateEditLocationDialogContext } from '-/components/dialogs/hooks/useCreateEditLocationDialogContext';
import LocationContextMenu from '-/components/menus/LocationContextMenu';
import LocationManagerMenu from '-/components/menus/LocationManagerMenu';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { Pro } from '-/pro';
-import { List } from '@mui/material';
+import { Box, List } from '@mui/material';
import { useRef, useState } from 'react';
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
import { useTranslation } from 'react-i18next';
@@ -105,10 +104,13 @@ function LocationManager(props: Props) {
const { reduceHeightBy, show } = props;
const currentLocation = findLocation();
return (
- <SidePanel
+ <Box
style={{
display: show ? 'flex' : 'none',
flexDirection: 'column',
+ height: '100%',
+ paddingLeft: 5,
+ paddingRight: 0,
}}
>
{
@@ -147,9 +149,7 @@ function LocationManager(props: Props) {
importLocations={() => {
fileInputRef.current.click();
}}
- // importLocations={() => setImportLocationsDialogOpened(true)}
exportLocations={() => setExportLocationsDialogOpened(true)}
- classes={classes}
showCreateLocationDialog={() => {
setSelectedLocation(undefined);
openCreateEditLocationDialog();
@@ -260,7 +260,7 @@ function LocationManager(props: Props) {
locations={locations}
/>
)}
- </SidePanel>
+ </Box>
);
}
diff --git a/src/renderer/components/LocationView.tsx b/src/renderer/components/LocationView.tsx
index c7c924f57..c6c32f4ef 100644
--- a/src/renderer/components/LocationView.tsx
+++ b/src/renderer/components/LocationView.tsx
@@ -27,12 +27,11 @@ import CustomDragLayer from '-/components/CustomDragLayer';
import DirectoryTreeView, {
DirectoryTreeViewRef,
} from '-/components/DirectoryTreeView';
-import { SidePanel } from '-/components/SidePanels.css';
import TargetFileBox from '-/components/TargetFileBox';
import Tooltip from '-/components/Tooltip';
import TsIconButton from '-/components/TsIconButton';
-import { useEntryExistDialogContext } from '-/components/dialogs/hooks/useEntryExistDialogContext';
import { useFileUploadDialogContext } from '-/components/dialogs/hooks/useFileUploadDialogContext';
+import { useMoveOrCopyFilesDialogContext } from '-/components/dialogs/hooks/useMoveOrCopyFilesDialogContext';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
import { useIOActionsContext } from '-/hooks/useIOActionsContext';
@@ -41,7 +40,7 @@ import { usePerspectiveActionsContext } from '-/hooks/usePerspectiveActionsConte
import { useSelectedEntriesContext } from '-/hooks/useSelectedEntriesContext';
import { TS } from '-/tagspaces.namespace';
import { CommonLocation } from '-/utils/CommonLocation';
-import { ListItemText } from '@mui/material';
+import { Box, ListItemText } from '@mui/material';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import Typography from '@mui/material/Typography';
@@ -54,7 +53,6 @@ import { useDispatch } from 'react-redux';
import { actions as AppActions, AppDispatch } from '../reducers/app';
import DragItemTypes from './DragItemTypes';
import TargetMoveFileBox from './TargetMoveFileBox';
-import { useMoveOrCopyFilesDialogContext } from '-/components/dialogs/hooks/useMoveOrCopyFilesDialogContext';
interface Props {
location: CommonLocation;
@@ -218,7 +216,13 @@ function LocationView(props: Props) {
const isLocationSelected =
currentLocation && currentLocation.uuid === location.uuid;
return (
- <SidePanel>
+ <Box
+ style={{
+ paddingLeft: 5,
+ paddingRight: 0,
+ height: '100%',
+ }}
+ >
<TargetFileBox
accepts={[FILE]}
directoryPath={location.path}
@@ -304,7 +308,7 @@ function LocationView(props: Props) {
location={location}
handleFileMoveDrop={handleFileMoveDrop}
/>
- </SidePanel>
+ </Box>
);
}
diff --git a/src/renderer/components/SearchPopover.tsx b/src/renderer/components/SearchPopover.tsx
index aa48b2166..cfa2fe0ff 100644
--- a/src/renderer/components/SearchPopover.tsx
+++ b/src/renderer/components/SearchPopover.tsx
@@ -19,7 +19,6 @@
import AppConfig from '-/AppConfig';
import { CloseIcon, CreateFileIcon, EditIcon } from '-/components/CommonIcons';
import EditSearchQuery from '-/components/EditSearchQuery';
-import { SidePanel } from '-/components/SidePanels.css';
import TooltipTS from '-/components/Tooltip';
import TsButton from '-/components/TsButton';
import TsIconButton from '-/components/TsIconButton';
@@ -89,10 +88,12 @@ function SearchPopover(props: Props) {
? '(' + getIndex().length + ' indexed entries)'
: t('core:indexEmpty');
return (
- <SidePanel
+ <div
style={{
maxWidth: 400,
height: '100%',
+ paddingLeft: 5,
+ paddingRight: 0,
// @ts-ignore
WebkitAppRegion: 'no-drag',
}}
@@ -234,7 +235,7 @@ function SearchPopover(props: Props) {
</TsButton>
</div>
</div>
- </SidePanel>
+ </div>
);
}
diff --git a/src/renderer/components/SidePanelTitle.tsx b/src/renderer/components/SidePanelTitle.tsx
new file mode 100644
index 000000000..49b80f79f
--- /dev/null
+++ b/src/renderer/components/SidePanelTitle.tsx
@@ -0,0 +1,58 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2025-present TagSpaces GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License (version 3) as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+import { Typography } from '@mui/material';
+import { ButtonProps } from '@mui/material/Button';
+import React from 'react';
+import TooltipTS from './Tooltip';
+
+export type TSButtonProps = ButtonProps & {
+ title: string;
+ tooltip?: string;
+ menuButton?: React.ReactNode;
+};
+
+function SidePanelTitle(props: TSButtonProps) {
+ const { title, tooltip, menuButton, ...rest } = props;
+ return (
+ <div
+ style={{
+ display: 'flex',
+ paddingRight: 5, //AppConfig.defaultSpaceBetweenButtons,
+ }}
+ >
+ <TooltipTS title={tooltip}>
+ <Typography
+ variant="subtitle1"
+ style={{
+ textTransform: 'uppercase',
+ fontSize: '0.9rem',
+ flex: 1,
+ paddingLeft: 7,
+ paddingTop: 12,
+ }}
+ >
+ {title}
+ </Typography>
+ </TooltipTS>
+ {menuButton && menuButton}
+ </div>
+ );
+}
+
+export default SidePanelTitle;
diff --git a/src/renderer/components/SidePanels.css.tsx b/src/renderer/components/SidePanels.css.tsx
deleted file mode 100644
index d89826063..000000000
--- a/src/renderer/components/SidePanels.css.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * TagSpaces - universal file and folder organizer
- * Copyright (C) 2017-present TagSpaces GmbH
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License (version 3) as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-import { styled } from '@mui/material/styles';
-
-const PREFIX = 'SidePanel';
-export const classes = {
- panelTitle: `${PREFIX}-panelTitle`,
-};
-
-export const SidePanel = styled('div')(({ theme }) => ({
- height: '100%',
- paddingLeft: 5,
- paddingRight: 0,
- [`& .${classes.panelTitle}`]: {
- textTransform: 'uppercase',
- fontSize: '0.9rem',
- flex: 1,
- paddingLeft: 7,
- paddingTop: 12,
- },
-}));
diff --git a/src/renderer/components/StoredSearches.tsx b/src/renderer/components/StoredSearches.tsx
index 593724244..3ca2cbd03 100644
--- a/src/renderer/components/StoredSearches.tsx
+++ b/src/renderer/components/StoredSearches.tsx
@@ -16,6 +16,7 @@
*
*/
+import AppConfig from '-/AppConfig';
import {
EditIcon,
MoreMenuIcon,
@@ -24,12 +25,13 @@ import {
SmallArrowRightIcon,
} from '-/components/CommonIcons';
import RenderHistory from '-/components/RenderHistory';
-import { SidePanel, classes } from '-/components/SidePanels.css';
import TsButton from '-/components/TsButton';
import TsIconButton from '-/components/TsIconButton';
import BookmarksMenu from '-/components/menus/BookmarksMenu';
import HistoryMenu from '-/components/menus/HistoryMenu';
import SearchMenu from '-/components/menus/SearchMenu';
+import { historyKeys } from '-/hooks/HistoryContextProvider';
+import { useHistoryContext } from '-/hooks/useHistoryContext';
import { useSavedSearchesContext } from '-/hooks/useSavedSearchesContext';
import { useSearchQueryContext } from '-/hooks/useSearchQueryContext';
import {
@@ -42,6 +44,7 @@ import {
getStoredSearchesVisible,
} from '-/reducers/settings';
import { TS } from '-/tagspaces.namespace';
+import { Box } from '@mui/material';
import Grid from '@mui/material/Grid2';
import Typography from '@mui/material/Typography';
import React, { useContext, useReducer, useRef, useState } from 'react';
@@ -49,8 +52,7 @@ import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { Pro } from '../pro';
-import { useHistoryContext } from '-/hooks/useHistoryContext';
-import { historyKeys } from '-/hooks/HistoryContextProvider';
+import SidePanelTitle from './SidePanelTitle';
interface Props {
style?: any;
@@ -134,25 +136,18 @@ function StoredSearches(props: Props) {
folderOpenHistory && folderOpenHistory.length > 0;
return (
- <SidePanel
+ <Box
data-tid="quickAccessArea"
style={{
display: 'flex',
flexDirection: 'column',
- borderRadius: 5,
+ height: '100%',
+ borderRadius: AppConfig.defaultCSSRadius,
marginLeft: 5,
marginRight: 0,
}}
>
- <div style={{ display: 'flex' }}>
- <Typography
- className={classes.panelTitle}
- variant="subtitle1"
- style={{ paddingLeft: 0 }}
- >
- {t('core:quickAccess')}
- </Typography>
- </div>
+ <SidePanelTitle title={t('core:quickAccess')} />
<div
style={{
paddingTop: 0,
@@ -515,7 +510,7 @@ function StoredSearches(props: Props) {
searches={searches}
/>
)}
- </SidePanel>
+ </Box>
);
}
diff --git a/src/renderer/components/TagGroupTitleDnD.tsx b/src/renderer/components/TagGroupTitleDnD.tsx
index 918b3a6f4..f245fc25f 100644
--- a/src/renderer/components/TagGroupTitleDnD.tsx
+++ b/src/renderer/components/TagGroupTitleDnD.tsx
@@ -23,11 +23,11 @@ import {
SmallArrowRightIcon,
} from '-/components/CommonIcons';
import DragItemTypes from '-/components/DragItemTypes';
-import { SidePanel } from '-/components/SidePanels.css';
import TsIconButton from '-/components/TsIconButton';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { TS } from '-/tagspaces.namespace';
import { CommonLocation } from '-/utils/CommonLocation';
+import { Box } from '@mui/material';
import Grid from '@mui/material/Grid2';
import Typography from '@mui/material/Typography';
import React, { useRef } from 'react';
@@ -126,11 +126,11 @@ function TagGroupTitleDnD(props: Props) {
}
const tagGroupTitle = (
- <SidePanel
+ <Box
data-tid={'tagLibraryTagGroupTitle_' + tagGroup.title}
style={{
padding: 0,
- paddingRight: 0,
+ height: '100%',
borderRadius: AppConfig.defaultCSSRadius,
}}
title={'Number of tags in this tag group: ' + tagGroup.children.length}
@@ -202,7 +202,7 @@ function TagGroupTitleDnD(props: Props) {
)}
</Grid>
</Grid>
- </SidePanel>
+ </Box>
);
if (tagGroup.readOnly) {
return tagGroupTitle;
diff --git a/src/renderer/components/TagLibrary.tsx b/src/renderer/components/TagLibrary.tsx
index b64d58e06..c73e2209d 100644
--- a/src/renderer/components/TagLibrary.tsx
+++ b/src/renderer/components/TagLibrary.tsx
@@ -18,7 +18,7 @@
import AppConfig from '-/AppConfig';
import { MoreMenuIcon } from '-/components/CommonIcons';
-import { SidePanel, classes } from '-/components/SidePanels.css';
+import SidePanelTitle from '-/components/SidePanelTitle';
import TagContainer from '-/components/TagContainer';
import TagContainerDnd from '-/components/TagContainerDnd';
import TagGroupContainer from '-/components/TagGroupContainer';
@@ -51,8 +51,8 @@ import { getAllTags, getTagLibrary } from '-/services/taglibrary-utils';
import { TS } from '-/tagspaces.namespace';
import { CommonLocation } from '-/utils/CommonLocation';
import useFirstRender from '-/utils/useFirstRender';
+import { Box } from '@mui/material';
import Collapse from '@mui/material/Collapse';
-import Typography from '@mui/material/Typography';
import React, { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
@@ -293,35 +293,35 @@ function TagLibrary(props: Props) {
const allTags = getAllTags(tagGroups);
return (
- <SidePanel
+ <Box
style={{
+ height: '100%',
+ paddingLeft: 5,
+ paddingRight: 0,
display: 'flex',
flexDirection: 'column',
}}
>
- <div style={{ display: 'flex' }}>
- <Typography
- className={classes.panelTitle}
- title={
- 'Your tag library contains ' +
- allTags.length +
- ' tags \ndistributed in ' +
- tagGroups.length +
- ' tag groups'
- }
- variant="subtitle1"
- >
- {t('core:tagLibrary')}
- </Typography>
- {!isTagLibraryReadOnly && (
- <TsIconButton
- data-tid="tagLibraryMenu"
- onClick={handleTagLibraryMenu}
- >
- <MoreMenuIcon />
- </TsIconButton>
- )}
- </div>
+ <SidePanelTitle
+ title={t('core:tagLibrary')}
+ tooltip={
+ 'Your tag library contains ' +
+ allTags.length +
+ ' tags \ndistributed in ' +
+ tagGroups.length +
+ ' tag groups'
+ }
+ menuButton={
+ !isTagLibraryReadOnly && (
+ <TsIconButton
+ data-tid="tagLibraryMenu"
+ onClick={handleTagLibraryMenu}
+ >
+ <MoreMenuIcon />
+ </TsIconButton>
+ )
+ }
+ />
{isDeleteTagGroupDialogOpened && (
<ConfirmDialog
open={isDeleteTagGroupDialogOpened}
@@ -444,7 +444,7 @@ function TagLibrary(props: Props) {
)}
<div style={{ paddingTop: 0 }}>{tagGroups.map(renderTagGroup)}</div>
</div>
- </SidePanel>
+ </Box>
);
}
diff --git a/src/renderer/components/menus/LocationManagerMenu.tsx b/src/renderer/components/menus/LocationManagerMenu.tsx
index e2cfb9161..b3ceeeac9 100644
--- a/src/renderer/components/menus/LocationManagerMenu.tsx
+++ b/src/renderer/components/menus/LocationManagerMenu.tsx
@@ -39,25 +39,19 @@ import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import Menu from '@mui/material/Menu';
import MenuItem from '@mui/material/MenuItem';
-import Typography from '@mui/material/Typography';
import Links from 'assets/links';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
+import SidePanelTitle from '../SidePanelTitle';
interface Props {
- classes: any;
exportLocations: () => void;
importLocations: () => void;
showCreateLocationDialog: () => void;
}
function LocationManagerMenu(props: Props) {
- const {
- classes,
- exportLocations,
- importLocations,
- showCreateLocationDialog,
- } = props;
+ const { exportLocations, importLocations, showCreateLocationDialog } = props;
const { t } = useTranslation();
const { createLocationsIndexes } = useLocationIndexContext();
@@ -186,19 +180,19 @@ function LocationManagerMenu(props: Props) {
return (
<>
- <div style={{ display: 'flex' }}>
- <Typography className={classes.panelTitle} variant="subtitle1">
- {t('core:locationManager')}
- </Typography>
- <TsIconButton
- data-tid="locationManagerMenu"
- onClick={(event) =>
- setLocationManagerMenuAnchorEl(event.currentTarget)
- }
- >
- <MoreMenuIcon />
- </TsIconButton>
- </div>
+ <SidePanelTitle
+ title={t('core:locationManager')}
+ menuButton={
+ <TsIconButton
+ data-tid="locationManagerMenu"
+ onClick={(event) =>
+ setLocationManagerMenuAnchorEl(event.currentTarget)
+ }
+ >
+ <MoreMenuIcon />
+ </TsIconButton>
+ }
+ />
<Menu
anchorEl={locationManagerMenuAnchorEl}
open={Boolean(locationManagerMenuAnchorEl)}