Skip to content

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

chore: integration of the tooltip in the buttons

Ilian Sapundshievef8f359602df
diff --git a/src/renderer/components/EntryContainerNav.tsx b/src/renderer/components/EntryContainerNav.tsx
index 6f8162857..cf082fa29 100644
--- a/src/renderer/components/EntryContainerNav.tsx
+++ b/src/renderer/components/EntryContainerNav.tsx
@@ -39,54 +39,44 @@ function EntryContainerNav(props: Props) {
>
{isFile && (
<>
- <Tooltip
- title={t('core:openPrevFileTooltip')}
+ <TsIconButton
+ tooltip={t('core:openPrevFileTooltip')}
keyBinding={keyBindings['prevDocument']}
+ aria-label={t('core:openPrevFileTooltip')}
+ data-tid="fileContainerPrevFile"
+ onClick={() => {
+ const action: TS.PerspectiveActions = {
+ action: 'openPrevious',
+ };
+ setActions(action);
+ }}
>
- <TsIconButton
- aria-label={t('core:openPrevFileTooltip')}
- data-tid="fileContainerPrevFile"
- onClick={() => {
- const action: TS.PerspectiveActions = {
- action: 'openPrevious',
- };
- setActions(action);
- //window.dispatchEvent(new Event('previous-file'));
- }}
- >
- <PrevDocumentIcon />
- </TsIconButton>
- </Tooltip>
- <Tooltip
- title={t('core:openNextFileTooltip')}
+ <PrevDocumentIcon />
+ </TsIconButton>
+
+ <TsIconButton
+ tooltip={t('core:openNextFileTooltip')}
keyBinding={keyBindings['nextDocument']}
+ aria-label={t('core:openNextFileTooltip')}
+ data-tid="fileContainerNextFile"
+ onClick={() => {
+ const action: TS.PerspectiveActions = { action: 'openNext' };
+ setActions(action);
+ }}
>
- <TsIconButton
- aria-label={t('core:openNextFileTooltip')}
- data-tid="fileContainerNextFile"
- onClick={() => {
- const action: TS.PerspectiveActions = { action: 'openNext' };
- setActions(action);
- //window.dispatchEvent(new Event('next-file'));
- }}
- >
- <NextDocumentIcon />
- </TsIconButton>
- </Tooltip>
+ <NextDocumentIcon />
+ </TsIconButton>
</>
)}
- <Tooltip
- title={t('core:closeEntry')}
+ <TsIconButton
+ tooltip={t('core:closeEntry')}
keyBinding={keyBindings['closeViewer']}
+ onClick={startClosingEntry}
+ aria-label={t('core:closeEntry')}
+ data-tid="fileContainerCloseOpenedFile"
>
- <TsIconButton
- onClick={startClosingEntry}
- aria-label={t('core:closeEntry')}
- data-tid="fileContainerCloseOpenedFile"
- >
- <CloseIcon />
- </TsIconButton>
- </Tooltip>
+ <CloseIcon />
+ </TsIconButton>
</div>
);
}
diff --git a/src/renderer/components/MobileNavigation.tsx b/src/renderer/components/MobileNavigation.tsx
index 1c162c769..5a9da951e 100644
--- a/src/renderer/components/MobileNavigation.tsx
+++ b/src/renderer/components/MobileNavigation.tsx
@@ -176,59 +176,57 @@ function MobileNavigation(props: Props) {
textAlign: 'center',
}}
>
- <Tooltip title={t('core:createNew')}>
- <TsButton
- aria-controls={
- openedCreateMenu ? 'split-button-menu' : undefined
- }
- aria-expanded={openedCreateMenu ? 'true' : undefined}
- aria-haspopup="menu"
- data-tid="createNewDropdownButtonTID"
- onClick={handleToggle}
- startIcon={<CreateFileIcon />}
+ <TsButton
+ //tooltip={t('core:createNew')}
+ aria-controls={
+ openedCreateMenu ? 'split-button-menu' : undefined
+ }
+ aria-expanded={openedCreateMenu ? 'true' : undefined}
+ aria-haspopup="menu"
+ data-tid="createNewDropdownButtonTID"
+ onClick={handleToggle}
+ startIcon={<CreateFileIcon />}
+ style={{
+ borderRadius: 'unset',
+ borderTopLeftRadius: AppConfig.defaultCSSRadius,
+ borderBottomLeftRadius: AppConfig.defaultCSSRadius,
+ }}
+ >
+ <Box
style={{
- borderRadius: 'unset',
- borderTopLeftRadius: AppConfig.defaultCSSRadius,
- borderBottomLeftRadius: AppConfig.defaultCSSRadius,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ overflow: 'hidden',
+ maxWidth: 100,
}}
>
- <Box
- style={{
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
- overflow: 'hidden',
- maxWidth: 100,
- }}
- >
- {t('core:createNew')}
- </Box>
- </TsButton>
- </Tooltip>
- <Tooltip title={t('core:openSharingLink')}>
- <TsButton
- data-tid="openLinkNavigationTID"
- onClick={() => {
- openLinkDialog();
- }}
+ {t('core:createNew')}
+ </Box>
+ </TsButton>
+ <TsButton
+ tooltip={t('core:openSharingLink')}
+ data-tid="openLinkNavigationTID"
+ onClick={() => {
+ openLinkDialog();
+ }}
+ style={{
+ borderRadius: 'unset',
+ borderTopRightRadius: AppConfig.defaultCSSRadius,
+ borderBottomRightRadius: AppConfig.defaultCSSRadius,
+ }}
+ startIcon={<OpenLinkIcon />}
+ >
+ <Box
style={{
- borderRadius: 'unset',
- borderTopRightRadius: AppConfig.defaultCSSRadius,
- borderBottomRightRadius: AppConfig.defaultCSSRadius,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ overflow: 'hidden',
+ maxWidth: 100,
}}
- startIcon={<OpenLinkIcon />}
>
- <Box
- style={{
- textOverflow: 'ellipsis',
- whiteSpace: 'nowrap',
- overflow: 'hidden',
- maxWidth: 100,
- }}
- >
- {t('core:openLink')}
- </Box>
- </TsButton>
- </Tooltip>
+ {t('core:openLink')}
+ </Box>
+ </TsButton>
</ButtonGroup>
</Box>
</Box>
@@ -463,19 +461,18 @@ function MobileNavigation(props: Props) {
{showProTeaser && (
<ProTeaser setShowTeaserBanner={setShowTeaserBanner} />
)}
- <Tooltip title={t('core:settings')}>
- <TsIconButton
- id="verticalNavButton"
- data-tid="settings"
- onClick={() => {
- openSettingsDialog();
- }}
- style={{ marginTop: -15, marginRight: 2 }}
- size="large"
- >
- <SettingsIcon />
- </TsIconButton>
- </Tooltip>
+ <TsIconButton
+ tooltip={t('core:settings')}
+ id="verticalNavButton"
+ data-tid="settings"
+ onClick={() => {
+ openSettingsDialog();
+ }}
+ style={{ marginTop: -15, marginRight: 2 }}
+ size="large"
+ >
+ <SettingsIcon />
+ </TsIconButton>
<ToggleButtonGroup exclusive>
<ToggleButton
onClick={() => showPanel('locationManagerPanel')}
@@ -542,18 +539,17 @@ function MobileNavigation(props: Props) {
</ToggleButtonGroup>
{currentUser ? (
<>
- <Tooltip title={t('core:userAccount')}>
- <TsIconButton
- data-tid="accountCircleIconTID"
- onClick={(event: React.MouseEvent<HTMLButtonElement>) =>
- setAnchorUser(event.currentTarget)
- }
- style={{ marginTop: -15, marginRight: 2 }}
- size="large"
- >
- <AccountIcon />
- </TsIconButton>
- </Tooltip>
+ <TsIconButton
+ tooltip={t('core:userAccount')}
+ data-tid="accountCircleIconTID"
+ onClick={(event: React.MouseEvent<HTMLButtonElement>) =>
+ setAnchorUser(event.currentTarget)
+ }
+ style={{ marginTop: -15, marginRight: 2 }}
+ size="large"
+ >
+ <AccountIcon />
+ </TsIconButton>
<Popover
open={Boolean(anchorUser)}
anchorEl={anchorUser}
@@ -571,16 +567,15 @@ function MobileNavigation(props: Props) {
</Popover>
</>
) : (
- <Tooltip title={t('core:switchTheme')}>
- <TsIconButton
- data-tid="switchTheme"
- onClick={switchTheme}
- style={{ marginTop: -15, marginRight: 2 }}
- size="large"
- >
- <ThemingIcon />
- </TsIconButton>
- </Tooltip>
+ <TsIconButton
+ tooltip={t('core:switchTheme')}
+ data-tid="switchTheme"
+ onClick={switchTheme}
+ style={{ marginTop: -15, marginRight: 2 }}
+ size="large"
+ >
+ <ThemingIcon />
+ </TsIconButton>
)}
</Box>
</Root>
diff --git a/src/renderer/components/SearchAutocomplete.tsx b/src/renderer/components/SearchAutocomplete.tsx
index f6ea37c3c..238f7ef82 100644
--- a/src/renderer/components/SearchAutocomplete.tsx
+++ b/src/renderer/components/SearchAutocomplete.tsx
@@ -1188,33 +1188,31 @@ function SearchAutocomplete(props: Props) {
const endAdornment = (
<>
- <Tooltip title={t('core:advancedSearch')}>
- <TsIconButton
- id="advancedButton"
- data-tid="advancedSearch"
- style={{ maxHeight: 34 }}
- size={desktopMode ? 'small' : 'medium'}
- onClick={(event: React.MouseEvent<HTMLButtonElement>) => {
- setAnchorSearch(event.currentTarget);
- }}
- >
- <AdvancedSearchIcon fontSize={desktopMode ? 'small' : 'medium'} />
- {/* <DropDownIcon /> */}
- </TsIconButton>
- </Tooltip>
- <Tooltip title={t('clearSearch') + ' (ESC)'}>
- <TsIconButton
- id="clearSearchID"
- onClick={() => {
- clearSearch();
- }}
- style={{ maxHeight: 34 }}
- size={desktopMode ? 'small' : 'medium'}
- edge="end"
- >
- <CloseIcon fontSize={desktopMode ? 'small' : 'medium'} />
- </TsIconButton>
- </Tooltip>
+ <TsIconButton
+ tooltip={t('core:advancedSearch')}
+ id="advancedButton"
+ data-tid="advancedSearch"
+ style={{ maxHeight: 34 }}
+ size={desktopMode ? 'small' : 'medium'}
+ onClick={(event: React.MouseEvent<HTMLButtonElement>) => {
+ setAnchorSearch(event.currentTarget);
+ }}
+ >
+ <AdvancedSearchIcon fontSize={desktopMode ? 'small' : 'medium'} />
+ {/* <DropDownIcon /> */}
+ </TsIconButton>
+ <TsIconButton
+ tooltip={t('clearSearch') + ' (ESC)'}
+ id="clearSearchID"
+ onClick={() => {
+ clearSearch();
+ }}
+ style={{ maxHeight: 34 }}
+ size={desktopMode ? 'small' : 'medium'}
+ edge="end"
+ >
+ <CloseIcon fontSize={desktopMode ? 'small' : 'medium'} />
+ </TsIconButton>
</>
);
@@ -1343,29 +1341,28 @@ function SearchAutocomplete(props: Props) {
{option}
</Box>
) : (
- <Tooltip title={option}>
- <TsButton
- onClick={() => {
- changeOptions(action.action, false);
- }}
- data-tid={dataTidFormat('menu' + option)}
- variant="text"
- style={{
- backgroundColor: 'transparent',
- textTransform: 'lowercase',
- padding: 0,
- margin: 0,
- }}
- endIcon={
- <ArrowDropDownIcon
- style={{ marginLeft: -10 }}
- fontSize="small"
- />
- }
- >
- {removePrefix(option, action.action)}
- </TsButton>
- </Tooltip>
+ <TsButton
+ tooltip={option}
+ onClick={() => {
+ changeOptions(action.action, false);
+ }}
+ data-tid={dataTidFormat('menu' + option)}
+ variant="text"
+ style={{
+ backgroundColor: 'transparent',
+ textTransform: 'lowercase',
+ padding: 0,
+ margin: 0,
+ }}
+ endIcon={
+ <ArrowDropDownIcon
+ style={{ marginLeft: -10 }}
+ fontSize="small"
+ />
+ }
+ >
+ {removePrefix(option, action.action)}
+ </TsButton>
)}
{!isAction(action.action, SearchQueryComposition.SCOPE) &&
@@ -1470,20 +1467,19 @@ function SearchAutocomplete(props: Props) {
);
}}
/>
- <Tooltip title={isIndexing ? t('searchDisabledWhileIndexing') : ''}>
- <TsButton
- id="searchButton"
- disabled={isIndexing !== undefined}
- style={{
- marginRight: 10,
- marginLeft: 10,
- marginTop: 3,
- }}
- onClick={clickSearchButton}
- >
- {t('searchTitle')}
- </TsButton>
- </Tooltip>
+ <TsButton
+ tooltip={isIndexing ? t('searchDisabledWhileIndexing') : ''}
+ id="searchButton"
+ disabled={isIndexing !== undefined}
+ style={{
+ marginRight: 10,
+ marginLeft: 10,
+ marginTop: 3,
+ }}
+ onClick={clickSearchButton}
+ >
+ {t('searchTitle')}
+ </TsButton>
</div>
</>
);
diff --git a/src/renderer/components/TsButton.tsx b/src/renderer/components/TsButton.tsx
index e58f91021..b0dade835 100644
--- a/src/renderer/components/TsButton.tsx
+++ b/src/renderer/components/TsButton.tsx
@@ -19,16 +19,18 @@
import React from 'react';
import { useSelector } from 'react-redux';
import Button, { ButtonProps } from '@mui/material/Button';
+import TooltipTS from '-/components/Tooltip';
import { isDesktopMode } from '-/reducers/settings';
import AppConfig from '-/AppConfig';
-export type TSButtonProps = ButtonProps & {};
+export type TSButtonProps = ButtonProps & {
+ tooltip?: string;
+};
function TsButton(props: TSButtonProps) {
- const { children, style } = props;
+ const { children, style, tooltip } = props;
const desktopMode = useSelector(isDesktopMode);
-
- return (
+ const button = (
<Button
size={desktopMode ? 'small' : 'medium'}
variant="outlined" // text outlined contained
@@ -43,6 +45,7 @@ function TsButton(props: TSButtonProps) {
{children}
</Button>
);
+ return tooltip ? <TooltipTS title={tooltip}>{button}</TooltipTS> : button;
}
export default TsButton;
diff --git a/src/renderer/components/TsIconButton.tsx b/src/renderer/components/TsIconButton.tsx
index c45d8bc68..4cd5b11f7 100644
--- a/src/renderer/components/TsIconButton.tsx
+++ b/src/renderer/components/TsIconButton.tsx
@@ -20,15 +20,18 @@ import React from 'react';
import { useSelector } from 'react-redux';
import IconButton, { IconButtonProps } from '@mui/material/IconButton';
import { isDesktopMode } from '-/reducers/settings';
+import TooltipTS from '-/components/Tooltip';
import AppConfig from '-/AppConfig';
-export type TSIconButtonProps = IconButtonProps & {};
+export type TSIconButtonProps = IconButtonProps & {
+ tooltip?: string;
+ keyBinding?: string;
+};
function TsIconButton(props: TSIconButtonProps) {
- const { children, style } = props;
+ const { children, style, title, keyBinding, tooltip } = props;
const desktopMode = useSelector(isDesktopMode);
-
- return (
+ const iconButton = (
<IconButton
size={desktopMode ? 'medium' : 'large'}
{...props}
@@ -39,6 +42,13 @@ function TsIconButton(props: TSIconButtonProps) {
{children}
</IconButton>
);
+ return tooltip ? (
+ <TooltipTS keyBinding={keyBinding} title={tooltip}>
+ {iconButton}
+ </TooltipTS>
+ ) : (
+ iconButton
+ );
}
export default TsIconButton;
diff --git a/src/renderer/components/UserDetailsPopover.tsx b/src/renderer/components/UserDetailsPopover.tsx
index 952bbaccc..60f65fd91 100644
--- a/src/renderer/components/UserDetailsPopover.tsx
+++ b/src/renderer/components/UserDetailsPopover.tsx
@@ -23,11 +23,9 @@ import Box from '@mui/material/Box';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import Avatar from '@mui/material/Avatar';
-import Tooltip from '-/components/Tooltip';
import TsButton from '-/components/TsButton';
import Auth from '@aws-amplify/auth';
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
-import { useSelector } from 'react-redux';
import { clearAllURLParams } from '-/utils/dom';
import { Pro } from '-/pro';
import { styled, useTheme } from '@mui/material/styles';
@@ -150,18 +148,17 @@ function UserDetailsPopover(props: Props) {
/>
)}
{'SOFTWARE_TOKEN_MFA'.indexOf(currentUser.preferredMFA) === -1 ? (
- <Tooltip title={t('core:setupTOTPHelp')}>
- <TsButton
- data-tid="setupTOTP"
- className={classes.mainActionButton}
- onClick={() => {
- setSetupTOTPOpened(true);
- }}
- style={{ width: '95%' }}
- >
- {t('core:setupTOTP')}
- </TsButton>
- </Tooltip>
+ <TsButton
+ tooltip={t('core:setupTOTPHelp')}
+ data-tid="setupTOTP"
+ className={classes.mainActionButton}
+ onClick={() => {
+ setSetupTOTPOpened(true);
+ }}
+ style={{ width: '95%' }}
+ >
+ {t('core:setupTOTP')}
+ </TsButton>
) : (
<>
<Typography style={{ color: theme.palette.text.primary }}>
diff --git a/src/renderer/components/dialogs/FilePreviewDialog.tsx b/src/renderer/components/dialogs/FilePreviewDialog.tsx
index b92c4dfcb..0d9669d7b 100644
--- a/src/renderer/components/dialogs/FilePreviewDialog.tsx
+++ b/src/renderer/components/dialogs/FilePreviewDialog.tsx
@@ -165,7 +165,7 @@ function FilePreviewDialog(props: Props) {
aria-labelledby="draggable-dialog-title"
PaperComponent={DraggablePaper}
PaperProps={{ sx: { width: '100%', height: '100%' } }}
- BackdropProps={{ style: { backgroundColor: 'transparent' } }}
+ slotProps={{ backdrop: { style: { backgroundColor: 'transparent' } } }}
>
<DialogTitle
data-tid="importDialogTitle"
diff --git a/src/renderer/components/dialogs/ObjectStoreForm.tsx b/src/renderer/components/dialogs/ObjectStoreForm.tsx
index 0e76ffd16..9dd85b7b9 100644
--- a/src/renderer/components/dialogs/ObjectStoreForm.tsx
+++ b/src/renderer/components/dialogs/ObjectStoreForm.tsx
@@ -27,7 +27,6 @@ import InputAdornment from '@mui/material/InputAdornment';
import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
import { useTranslation } from 'react-i18next';
-import TooltipTS from '../Tooltip';
/**
* https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
@@ -222,16 +221,13 @@ function ObjectStoreForm(props: Props) {
InputProps={{
endAdornment: (
<InputAdornment position="end">
- <TooltipTS title={t('toggleKeyVisibility')}>
- <TsIconButton
- aria-label="toggle password visibility"
- onClick={() =>
- setShowSecretAccessKey(!showSecretAccessKey)
- }
- >
- {showSecretAccessKey ? <Visibility /> : <VisibilityOff />}
- </TsIconButton>
- </TooltipTS>
+ <TsIconButton
+ tooltip={t('toggleKeyVisibility')}
+ aria-label="toggle password visibility"
+ onClick={() => setShowSecretAccessKey(!showSecretAccessKey)}
+ >
+ {showSecretAccessKey ? <Visibility /> : <VisibilityOff />}
+ </TsIconButton>
</InputAdornment>
),
}}
diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.json
index d48299592..50b62414b 100644
--- a/src/renderer/locales/en/core.json
+++ b/src/renderer/locales/en/core.json
@@ -870,5 +870,6 @@
"confirmSearchById": "Do you want to search for the file or folder by its ID?",
"uploadDirsNotSupported": "Uploading folders not supported!",
"targetLocation": "Target location",
+ "exportAsPNG": "Export as PNG",
"-": "-"
}