Skip to content

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

chore: adding hover effect for locations

Ilian Sapundshievddd4075fa519
diff --git a/src/renderer/components/DirectoryTreeView.tsx b/src/renderer/components/DirectoryTreeView.tsx
index ea796964f..ad3133f40 100644
--- a/src/renderer/components/DirectoryTreeView.tsx
+++ b/src/renderer/components/DirectoryTreeView.tsx
@@ -25,20 +25,20 @@ import TargetTableMoveFileBox from '-/components/TargetTableMoveFileBox';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
import { getShowUnixHiddenEntries } from '-/reducers/settings';
+import { resolveRelativePath } from '-/services/utils-io';
+import { TS } from '-/tagspaces.namespace';
import { alpha, useTheme } from '@mui/material/styles';
import { locationType } from '@tagspaces/tagspaces-common/misc';
import Table from 'rc-table';
import {
Ref,
forwardRef,
+ useEffect,
useImperativeHandle,
useState,
- useEffect,
} from 'react';
import { NativeTypes } from 'react-dnd-html5-backend';
import { useSelector } from 'react-redux';
-import { TS } from '-/tagspaces.namespace';
-import { resolveRelativePath } from '-/services/utils-io';
interface Props {
location: SubFolder;
@@ -438,7 +438,7 @@ const DirectoryTreeView = forwardRef(
style={{
borderRadius: AppConfig.defaultCSSRadius,
backgroundColor: alpha(theme.palette.grey.A400, 0.2),
- marginTop: 5,
+ marginTop: 0,
marginBottom: 5,
}}
components={{
diff --git a/src/renderer/components/LocationView.tsx b/src/renderer/components/LocationView.tsx
index ffc1d715d..88a9fd984 100644
--- a/src/renderer/components/LocationView.tsx
+++ b/src/renderer/components/LocationView.tsx
@@ -32,6 +32,7 @@ import TargetFileBox from '-/components/TargetFileBox';
import Tooltip from '-/components/Tooltip';
import TsIconButton from '-/components/TsIconButton';
import { useFileUploadDialogContext } from '-/components/dialogs/hooks/useFileUploadDialogContext';
+import { useMenuContext } from '-/components/dialogs/hooks/useMenuContext';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
import { useIOActionsContext } from '-/hooks/useIOActionsContext';
@@ -39,8 +40,10 @@ import { useNotificationContext } from '-/hooks/useNotificationContext';
import { usePerspectiveActionsContext } from '-/hooks/usePerspectiveActionsContext';
import { useSelectedEntriesContext } from '-/hooks/useSelectedEntriesContext';
import { TS } from '-/tagspaces.namespace';
+import { CommonLocation } from '-/utils/CommonLocation';
import { Box, ListItemText } from '@mui/material';
import ListItem from '@mui/material/ListItem';
+import ListItemButton from '@mui/material/ListItemButton';
import ListItemIcon from '@mui/material/ListItemIcon';
import Typography from '@mui/material/Typography';
import { useTheme } from '@mui/material/styles';
@@ -52,8 +55,6 @@ import { useDispatch } from 'react-redux';
import { actions as AppActions, AppDispatch } from '../reducers/app';
import DragItemTypes from './DragItemTypes';
import TargetMoveFileBox from './TargetMoveFileBox';
-import { useMenuContext } from '-/components/dialogs/hooks/useMenuContext';
-import { CommonLocation } from '-/utils/CommonLocation';
interface Props {
location: SubFolder;
@@ -238,78 +239,85 @@ function LocationView(props: Props) {
>
<CustomDragLayer />
<ListItem
- data-tid={'location_' + location.name.replace(/ /g, '_')}
+ disablePadding
style={{
- padding: 0,
- paddingRight: 15,
borderRadius: AppConfig.defaultCSSRadius,
backgroundColor: isLocationSelected
? theme.palette.primary.light
: 'inherit',
}}
- onClick={handleLocationClick}
- onContextMenu={(event) =>
- handleLocationContextMenuClick(event, subFolderLocation)
- }
>
- <ListItemIcon
+ <ListItemButton
+ data-tid={'location_' + location.name.replace(/ /g, '_')}
+ onClick={handleLocationClick}
+ onContextMenu={(event) =>
+ handleLocationContextMenuClick(event, subFolderLocation)
+ }
style={{
- minWidth: 'auto',
- cursor: 'pointer',
+ padding: 0,
+ paddingRight: 15,
+ borderRadius: AppConfig.defaultCSSRadius,
}}
- onClick={handleLocationIconClick}
>
- <Tooltip title={t('clickToExpand')}>
- {isCloudLocation ? (
- <CloudLocationIcon
- style={{
- cursor: 'pointer',
- margin: theme.spacing(1),
- }}
- />
+ <ListItemIcon
+ style={{
+ minWidth: 'auto',
+ cursor: 'pointer',
+ }}
+ onClick={handleLocationIconClick}
+ >
+ <Tooltip title={t('clickToExpand')}>
+ {isCloudLocation ? (
+ <CloudLocationIcon
+ style={{
+ cursor: 'pointer',
+ margin: theme.spacing(1),
+ }}
+ />
+ ) : (
+ <LocalLocationIcon
+ style={{
+ cursor: 'pointer',
+ margin: theme.spacing(1),
+ }}
+ />
+ )}
+ </Tooltip>
+ </ListItemIcon>
+ <ListItemText>
+ {isCloudLocation && !AppConfig.isElectron ? (
+ <>{LocationTitle}</>
) : (
- <LocalLocationIcon
- style={{
- cursor: 'pointer',
- margin: theme.spacing(1),
- }}
- />
+ <TargetMoveFileBox
+ accepts={[DragItemTypes.FILE]}
+ onDrop={handleFileMoveDrop}
+ targetPath={currentLocationPath}
+ targetLocation={location}
+ >
+ {LocationTitle}
+ </TargetMoveFileBox>
)}
- </Tooltip>
- </ListItemIcon>
- <ListItemText>
- {isCloudLocation && !AppConfig.isElectron ? (
- <>{LocationTitle}</>
- ) : (
- <TargetMoveFileBox
- accepts={[DragItemTypes.FILE]}
- onDrop={handleFileMoveDrop}
- targetPath={currentLocationPath}
- targetLocation={location}
- >
- {LocationTitle}
- </TargetMoveFileBox>
+ </ListItemText>
+ {subFolderLocation?.isDefault && (
+ <Tooltip title={t('core:thisIsStartupLocation')}>
+ <DefaultLocationIcon data-tid="startupIndication" />
+ </Tooltip>
)}
- </ListItemText>
- {subFolderLocation?.isDefault && (
- <Tooltip title={t('core:thisIsStartupLocation')}>
- <DefaultLocationIcon data-tid="startupIndication" />
- </Tooltip>
- )}
- <TsIconButton
- aria-label={t('core:options')}
- aria-haspopup="true"
- edge="end"
- data-tid={'locationMoreButton_' + location.name}
- onClick={(event) =>
- handleLocationContextMenuClick(event, subFolderLocation)
- }
- onContextMenu={(event) =>
- handleLocationContextMenuClick(event, subFolderLocation)
- }
- >
- <MoreMenuIcon />
- </TsIconButton>
+ <TsIconButton
+ aria-label={t('core:options')}
+ aria-haspopup="true"
+ edge="end"
+ data-tid={'locationMoreButton_' + location.name}
+ onClick={(event) =>
+ handleLocationContextMenuClick(event, subFolderLocation)
+ }
+ onContextMenu={(event) =>
+ handleLocationContextMenuClick(event, subFolderLocation)
+ }
+ >
+ <MoreMenuIcon />
+ </TsIconButton>
+ </ListItemButton>
</ListItem>
</TargetFileBox>
<DirectoryTreeView