Skip to content

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

chore: small ui improvement for hovering elements

Ilian Sapundshiev3a84118d18ad
diff --git a/src/renderer/components/EntryContainerTabs.tsx b/src/renderer/components/EntryContainerTabs.tsx
index fa4800cfb..57216f46e 100644
--- a/src/renderer/components/EntryContainerTabs.tsx
+++ b/src/renderer/components/EntryContainerTabs.tsx
@@ -16,6 +16,7 @@
*
*/
+import AppConfig from '-/AppConfig';
import EntryContainerButtons from '-/components/EntryContainerButtons';
import LoadingLazy from '-/components/LoadingLazy';
import TsTabPanel from '-/components/TsTabPanel';
@@ -34,20 +35,20 @@ import { styled, useTheme } from '@mui/material/styles';
import React, { useEffect, useReducer, useRef } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-const TabContent1 = React.lazy(
+const TabProperties = React.lazy(
() => import(/* webpackChunkName: "EntryProperties" */ './EntryProperties'),
);
-const TabContent2 = React.lazy(
+const TabDescription = React.lazy(
() => import(/* webpackChunkName: "EditDescription" */ './EditDescription'),
);
-const TabContent3 = React.lazy(
+const TabRevisions = React.lazy(
() => import(/* webpackChunkName: "Revisions" */ './Revisions'),
);
-const TabContent4 = React.lazy(
+const TabAI = React.lazy(
() => import(/* webpackChunkName: "AiPropertiesTab" */ './AiPropertiesTab'),
);
-const TabContent5 = React.lazy(
- () => import(/* webpackChunkName: "AiPropertiesTab" */ './LinksTab'),
+const TabLinks = React.lazy(
+ () => import(/* webpackChunkName: "LinksTab" */ './LinksTab'),
);
interface EntryContainerTabsProps {
@@ -145,15 +146,15 @@ function EntryContainerTabs(props: EntryContainerTabsProps) {
function getTabContainer(tabName: string) {
if (tabName === TabNames.propertiesTab) {
- return <TabContent1 key={openedEntry.path} tileServer={tileServer} />;
+ return <TabProperties key={openedEntry.path} tileServer={tileServer} />;
} else if (tabName === TabNames.descriptionTab) {
- return <TabContent2 />;
+ return <TabDescription />;
} else if (tabName === TabNames.revisionsTab) {
- return <TabContent3 />;
+ return <TabRevisions />;
} else if (tabName === TabNames.aiTab) {
- return <TabContent4 />;
+ return <TabAI />;
} else if (tabName === TabNames.linksTab) {
- return <TabContent5 />;
+ return <TabLinks />;
}
}
if (tabsArray.current.length === 0) {
@@ -202,8 +203,12 @@ function EntryContainerTabs(props: EntryContainerTabsProps) {
paddingTop: '0px',
paddingBottom: '0px',
minHeight: '60px', // 68px
- marginLeft: '-8px',
+ // marginLeft: '-8px',
marginRight: '-8px',
+ borderRadius: AppConfig.defaultCSSRadius,
+ '&:hover': {
+ backgroundColor: theme.palette.action.hover,
+ },
}}
id={`tab-${index}`}
aria-controls={`simple-tabpanel-${index}`}
diff --git a/src/renderer/components/MainSearchField.tsx b/src/renderer/components/MainSearchField.tsx
index 7ce798cb7..70bebd4c0 100644
--- a/src/renderer/components/MainSearchField.tsx
+++ b/src/renderer/components/MainSearchField.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { styled } from '@mui/material/styles';
import TextField from '@mui/material/TextField';
@@ -45,7 +44,7 @@ const MainSearchField = styled(TextField)(({ theme }) => ({
// boxShadow: '0 0 0 4px rgba(21, 156, 228, 0.4)'
// },
'&:hover': {
- backgroundColor: theme.palette.background.paper,
+ backgroundColor: theme.palette.action.hover,
// boxShadow: `${alpha(theme.palette.primary.main, 0.25)} 0 0 0 0.2rem`
},
}));
diff --git a/src/renderer/components/TagGroupTitleDnD.tsx b/src/renderer/components/TagGroupTitleDnD.tsx
index b96983afb..6b1e8efd0 100644
--- a/src/renderer/components/TagGroupTitleDnD.tsx
+++ b/src/renderer/components/TagGroupTitleDnD.tsx
@@ -29,7 +29,7 @@ import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { Pro } from '-/pro';
import { TS } from '-/tagspaces.namespace';
import { CommonLocation } from '-/utils/CommonLocation';
-import { Box, emphasize, useTheme } from '@mui/material';
+import { Box, useTheme } from '@mui/material';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import { useContext, useRef } from 'react';
@@ -153,7 +153,7 @@ function TagGroupTitleDnD(props: Props) {
height: '100%',
borderRadius: AppConfig.defaultCSSRadius,
'&:hover, &:focus': {
- backgroundColor: emphasize(theme.palette.background.default, 0.06),
+ backgroundColor: theme.palette.action.hover,
},
}}
>
diff --git a/src/renderer/hooks/EntryPropsTabsContextProvider.tsx b/src/renderer/hooks/EntryPropsTabsContextProvider.tsx
index 839352687..fad140efd 100644
--- a/src/renderer/hooks/EntryPropsTabsContextProvider.tsx
+++ b/src/renderer/hooks/EntryPropsTabsContextProvider.tsx
@@ -36,7 +36,6 @@ import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
export type TabItem = {
- //dataTid: string;
icon: React.ReactNode;
title: string;
name: (typeof TabNames)[keyof typeof TabNames];
@@ -54,22 +53,11 @@ export const TabNames = {
type EntryPropsTabsContextData = {
getTabsArray: (openedEntry: TS.OpenedEntry) => Promise<TabItem[]>;
isEditable: (openedEntry: TS.OpenedEntry) => boolean;
- /*setOpenedTab: (
- tabName: (typeof TabNames)[keyof typeof TabNames],
- openedEntry: TS.OpenedEntry,
- ) => Promise<number>;*/
- /*isTabOpened: (
- tabName: (typeof TabNames)[keyof typeof TabNames],
- openedEntry: TS.OpenedEntry,
- selectedTabIndex: number,
- ) => Promise<boolean>;*/
};
export const EntryPropsTabsContext = createContext<EntryPropsTabsContextData>({
getTabsArray: undefined,
isEditable: undefined,
- //setOpenedTab: undefined,
- //isTabOpened: undefined,
});
export type EntryPropsTabsContextProviderProps = {
@@ -82,28 +70,16 @@ export const EntryPropsTabsContextProvider = ({
const { t } = useTranslation();
const { findLocation } = useCurrentLocationContext();
- // const dispatch: AppDispatch = useDispatch();
const devMode: boolean = useSelector(isDevMode);
- //const haveRevisions = useRef<boolean>(isEditable());
- //const tabsArray = useRef<TabItem[]>(getTabsArray(openedEntry));
- //const [ignored, forceUpdate] = React.useReducer((x) => x + 1, 0, undefined);
-
function haveRevisions(openedEntry: TS.OpenedEntry): Promise<boolean> {
- //if (isEditable(openedEntry)) {
const location: CommonLocation = findLocation(openedEntry.locationID);
const backupPath = getBackupDir(openedEntry);
return location?.checkDirExist(backupPath);
- //}
- //return Promise.resolve(false);
}
function isEditable(openedEntry: TS.OpenedEntry): boolean {
if (openedEntry) {
- /* const fileExtension = extractFileExtension(
- openedEntry.path,
- currentLocation?.getDirSeparator(),
- );*/
const location: CommonLocation = findLocation(openedEntry.locationID);
return (
!location.isReadOnly &&
@@ -162,44 +138,10 @@ export const EntryPropsTabsContextProvider = ({
return tabsArray;
}
- /**
- * @param tabName
- * @param openedEntry
- * return tabIndex or -1 if not tab exist with tabName
- */
- /*async function setOpenedTab(
- tabName: (typeof TabNames)[keyof typeof TabNames],
- openedEntry: TS.OpenedEntry,
- ): Promise<number> {
- const allTabs = await getTabsArray(openedEntry);
- const tabIndex = allTabs.findIndex((tab) => tab.name === tabName);
- if (tabIndex > -1) {
- dispatch(SettingsActions.setEntryContainerTab(tabIndex));
- } else {
- console.log('no tab with name:' + tabName + ' exist!');
- }
- return tabIndex;
- }*/
-
- /*async function isTabOpened(
- tabName: (typeof TabNames)[keyof typeof TabNames],
- openedEntry: TS.OpenedEntry,
- selectedTabIndex: number,
- ): Promise<boolean> {
- const allTabs = await getTabsArray(openedEntry);
- const tabIndex = allTabs.findIndex((tab) => tab.name === tabName);
- const maxTabIndex = allTabs.length - 1;
- const currentOpenedTab =
- selectedTabIndex > maxTabIndex ? maxTabIndex : selectedTabIndex;
- return tabIndex !== -1 && tabIndex === currentOpenedTab;
- }*/
-
const context = useMemo(() => {
return {
getTabsArray,
isEditable,
- //setOpenedTab,
- //isTabOpened,
};
}, []);
diff --git a/src/renderer/perspectives/list/components/RowCell.tsx b/src/renderer/perspectives/list/components/RowCell.tsx
index 77a66f43b..1dea19403 100644
--- a/src/renderer/perspectives/list/components/RowCell.tsx
+++ b/src/renderer/perspectives/list/components/RowCell.tsx
@@ -319,7 +319,7 @@ function RowCell(props: Props) {
borderRadius: AppConfig.defaultCSSRadius,
backgroundColor,
'&:hover': {
- backgroundColor: `${theme.palette.divider} !important`,
+ backgroundColor: theme.palette.action.hover,
},
}}
>