Skip to content

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

chore: improving usability of the entry tabs

Ilian Sapundshiev57a37e07f9b0
diff --git a/src/renderer/components/EntryContainerTabs.tsx b/src/renderer/components/EntryContainerTabs.tsx
index c0991bc43..1bfecd6c4 100644
--- a/src/renderer/components/EntryContainerTabs.tsx
+++ b/src/renderer/components/EntryContainerTabs.tsx
@@ -19,6 +19,7 @@
import AppConfig from '-/AppConfig';
import EntryContainerButtons from '-/components/EntryContainerButtons';
import LoadingLazy from '-/components/LoadingLazy';
+import TooltipTS from '-/components/Tooltip';
import TsTabPanel from '-/components/TsTabPanel';
import { TabItem, TabNames } from '-/hooks/EntryPropsTabsContextProvider';
import { useChatContext } from '-/hooks/useChatContext';
@@ -192,17 +193,19 @@ function EntryContainerTabs(props: EntryContainerTabsProps) {
key={'key' + tab.name + index}
data-tid={tab.name + 'TID'}
icon={
- <Badge
- color="primary"
- variant="dot"
- invisible={!tab.showBadge}
- anchorOrigin={{
- vertical: 'top',
- horizontal: 'right',
- }}
- >
- {tab.icon}
- </Badge>
+ <TooltipTS arrow={false} title={tab.badgeTooltip}>
+ <Badge
+ color="primary"
+ variant="dot"
+ invisible={!tab.showBadge || selectedTabIndex === index}
+ anchorOrigin={{
+ vertical: 'top',
+ horizontal: 'right',
+ }}
+ >
+ {tab.icon}
+ </Badge>
+ </TooltipTS>
}
label={tab.title}
sx={{
diff --git a/src/renderer/components/Tooltip.tsx b/src/renderer/components/Tooltip.tsx
index eac664a53..1ad6408ae 100644
--- a/src/renderer/components/Tooltip.tsx
+++ b/src/renderer/components/Tooltip.tsx
@@ -26,6 +26,7 @@ interface Props {
children: any;
classes?: any;
placeCloser?: boolean;
+ arrow?: boolean;
placement?:
| 'bottom-end'
| 'bottom-start'
@@ -47,6 +48,7 @@ function TooltipTS(props: Props) {
placement = 'top',
keyBinding,
placeCloser = false,
+ arrow = true,
...restProps
} = props;
let tooltipText = title;
@@ -55,7 +57,7 @@ function TooltipTS(props: Props) {
}
return (
<Tooltip
- arrow={true}
+ arrow={arrow}
title={tooltipText}
disableInteractive
placement={placement}
diff --git a/src/renderer/hooks/EntryPropsTabsContextProvider.tsx b/src/renderer/hooks/EntryPropsTabsContextProvider.tsx
index 4a58babcc..39900c1bc 100644
--- a/src/renderer/hooks/EntryPropsTabsContextProvider.tsx
+++ b/src/renderer/hooks/EntryPropsTabsContextProvider.tsx
@@ -20,7 +20,6 @@ import AppConfig from '-/AppConfig';
import {
AIIcon,
DescriptionIcon,
- EditDescriptionIcon,
EntryPropertiesIcon,
RevisionIcon,
} from '-/components/CommonIcons';
@@ -39,6 +38,7 @@ export type TabItem = {
icon: React.ReactNode;
title: string;
showBadge: boolean;
+ badgeTooltip?: string;
name: (typeof TabNames)[keyof typeof TabNames];
};
@@ -117,13 +117,15 @@ export const EntryPropsTabsContextProvider = ({
name: TabNames.propertiesTab,
};
const tab2: TabItem = {
- icon:
- oEntry && oEntry.meta && oEntry.meta.description ? (
- <EditDescriptionIcon />
- ) : (
- <DescriptionIcon />
- ),
+ // icon:
+ // oEntry && oEntry.meta && oEntry.meta.description ? (
+ // <EditDescriptionIcon />
+ // ) : (
+ // <DescriptionIcon />
+ // ),
+ icon: <DescriptionIcon />,
showBadge: Boolean(oEntry && oEntry.meta && oEntry.meta.description),
+ badgeTooltip: t('core:descriptionAvailable'),
title: t('core:filePropertiesDescription'),
name: TabNames.descriptionTab,
};
@@ -146,6 +148,7 @@ export const EntryPropsTabsContextProvider = ({
showBadge: aiChatAvailable,
icon: <AIIcon />,
title: oEntry.isFile ? t('core:aiSettingsTab') : t('core:aiChatTab'),
+ badgeTooltip: t('core:aiChatAvailable'),
name: TabNames.aiTab,
};
tabsArray.push(tab4);
diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.json
index 74420012f..2bd7e5ce8 100644
--- a/src/renderer/locales/en/core.json
+++ b/src/renderer/locales/en/core.json
@@ -1145,5 +1145,7 @@
"toggleEdgeShape": "Toggle Edge Shape",
"diskUsage": "Disk Usage",
"hideToolbox": "Hide Toolbox\nUseful for making screenshots",
+ "descriptionAvailable": "Description available",
+ "aiChatAvailable": "AI Chat available",
"-": "-"
}