TagSpaces is an offline, open source, document manager with tagging support
chore: migration to tstogglebutton
Ilian Sapundshiev474dc4e31f4b
diff --git a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx b/src/renderer/components/dialogs/CreateEditLocationDialog.tsxindex bf7c3384d..92b579113 100644--- a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx+++ b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx@@ -21,7 +21,6 @@ import { ExpandIcon, IDIcon, RemoveIcon } from '-/components/CommonIcons';import DraggablePaper from '-/components/DraggablePaper';import { BetaLabel, ProLabel, ProTooltip } from '-/components/HelperComponents';import InfoIcon from '-/components/InfoIcon';-import Tooltip from '-/components/Tooltip';import TsButton from '-/components/TsButton';import TsIconButton from '-/components/TsIconButton';import TsSelect from '-/components/TsSelect';@@ -64,7 +63,6 @@ import ListItemIcon from '@mui/material/ListItemIcon';import ListItemText from '@mui/material/ListItemText';import Paper from '@mui/material/Paper';import Switch from '@mui/material/Switch';-import ToggleButton from '@mui/material/ToggleButton';import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';import Typography from '@mui/material/Typography';import { useTheme } from '@mui/material/styles';@@ -75,6 +73,7 @@ import CryptoJS from 'crypto-js';import React, { ChangeEvent, useEffect, useState } from 'react';import { useTranslation } from 'react-i18next';import { useSelector } from 'react-redux';+import TsToggleButton from '../TsToggleButton';import LocalForm from './components/LocalForm';interface Props {@@ -911,71 +910,62 @@ function CreateEditLocationDialog(props: Props) {size="small"exclusive>- <ToggleButton+ <TsToggleButtonvalue={persistTagsInSidecarFile !== null? persistTagsInSidecarFile: false}+ style={{+ borderTopRightRadius: 0,+ borderBottomRightRadius: 0,+ }}+ tooltip={+ t('core:useDefaultTaggingType') ++ ': ' ++ (currentTagsSetting+ ? t('core:useSidecarFile')+ : t('core:renameFile'))+ }data-tid="settingsSetPersistTagsDefault"onClick={() => setPersistTagsInSidecarFile(null)}>- <Tooltip- title={- <Typography color="inherit">- {t('core:useDefaultTaggingType')}:{' '}- <b>- {currentTagsSetting- ? t('core:useSidecarFile')- : t('core:renameFile')}- </b>- </Typography>- }- >- <div style={{ display: 'flex' }}>- {persistTagsInSidecarFile === null && <CheckIcon />}- {t('core:defaultSetting')} - </div>- </Tooltip>- </ToggleButton>- <ToggleButton+ <div style={{ display: 'flex' }}>+ {persistTagsInSidecarFile === null && <CheckIcon />}+ {t('core:defaultSetting')} + </div>+ </TsToggleButton>+ <TsToggleButtonvalue={false}+ style={{+ borderRadius: 0,+ }}data-tid="locationSetPersistTagsInFileName"+ tooltip={t('core:tagsInFilenameExplanation')}onClick={() => setPersistTagsInSidecarFile(false)}>- <Tooltip- title={- <Typography color="inherit">- {t('core:tagsInFilenameExplanation')}- </Typography>- }- >- <div style={{ display: 'flex' }}>- {persistTagsInSidecarFile !== null &&- !persistTagsInSidecarFile && <CheckIcon />}- {t('core:renameFile')} - </div>- </Tooltip>- </ToggleButton>- <ToggleButton+ <div style={{ display: 'flex' }}>+ {persistTagsInSidecarFile !== null &&+ !persistTagsInSidecarFile && <CheckIcon />}+ {t('core:renameFile')} + </div>+ </TsToggleButton>+ <TsToggleButtonvalue={true}+ style={{+ borderTopLeftRadius: 0,+ borderBottomLeftRadius: 0,+ }}data-tid="locationSetPersistTagsInSidecarFile"+ tooltip={t('core:tagsInSidecarFileExplanation')}onClick={() => setPersistTagsInSidecarFile(true)}>- <Tooltip- title={- <Typography color="inherit">- {t('core:tagsInSidecarFileExplanation')}- </Typography>- }- >- <div style={{ display: 'flex' }}>- {persistTagsInSidecarFile !== null &&- persistTagsInSidecarFile && <CheckIcon />}- {t('core:useSidecarFile')} - </div>- </Tooltip>- </ToggleButton>+ <div style={{ display: 'flex' }}>+ {persistTagsInSidecarFile !== null &&+ persistTagsInSidecarFile && <CheckIcon />}+ {t('core:useSidecarFile')} + </div>+ </TsToggleButton></ToggleButtonGroup>}label={diff --git a/src/renderer/components/dialogs/components/SettingsGeneral.tsx b/src/renderer/components/dialogs/components/SettingsGeneral.tsxindex 107a7d60a..72241c747 100644--- a/src/renderer/components/dialogs/components/SettingsGeneral.tsx+++ b/src/renderer/components/dialogs/components/SettingsGeneral.tsx@@ -20,11 +20,11 @@ import AppConfig from '-/AppConfig';import { BetaLabel } from '-/components/HelperComponents';import InfoIcon from '-/components/InfoIcon';import PerspectiveSelector from '-/components/PerspectiveSelector';-import Tooltip from '-/components/Tooltip';import TransparentBackground from '-/components/TransparentBackground';import TsButton from '-/components/TsButton';import TsSelect from '-/components/TsSelect';import TsTextField from '-/components/TsTextField';+import TsToggleButton from '-/components/TsToggleButton';import ColorPickerDialog from '-/components/dialogs/ColorPickerDialog';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';import { PerspectiveIDs } from '-/perspectives';@@ -43,7 +43,6 @@ import ListItem from '@mui/material/ListItem';import ListItemText from '@mui/material/ListItemText';import MenuItem from '@mui/material/MenuItem';import Switch from '@mui/material/Switch';-import ToggleButton from '@mui/material/ToggleButton';import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';import Typography from '@mui/material/Typography';import { useState } from 'react';@@ -188,48 +187,42 @@ function SettingsGeneral() {size="small"exclusive>- <ToggleButton+ <TsToggleButtonvalue={false}data-tid="settingsSetPersistTagsInFileName"+ style={{+ borderTopRightRadius: 0,+ borderBottomRightRadius: 0,+ }}+ tooltip={t('core:tagsInFilenameExplanation')}onClick={() =>dispatch(SettingsActions.setPersistTagsInSidecarFile(false))}>- <Tooltip- title={- <Typography color="inherit">- {t('core:tagsInFilenameExplanation')}- </Typography>- }- >- <div style={{ display: 'flex', textTransform: 'unset' }}>- {!persistTagsInSidecarFile && <CheckIcon />}- {t('core:renameFile')} - <InfoMuiIcon />- </div>- </Tooltip>- </ToggleButton>- <ToggleButton+ <div style={{ display: 'flex', textTransform: 'unset' }}>+ {!persistTagsInSidecarFile && <CheckIcon />}+ {t('core:renameFile')} + <InfoMuiIcon />+ </div>+ </TsToggleButton>+ <TsToggleButtonvalue={true}data-tid="settingsSetPersistTagsInSidecarFile"+ tooltip={t('core:tagsInSidecarFileExplanation')}+ style={{+ borderTopLeftRadius: 0,+ borderBottomLeftRadius: 0,+ }}onClick={() =>dispatch(SettingsActions.setPersistTagsInSidecarFile(true))}>- <Tooltip- title={- <Typography color="inherit">- {t('core:tagsInSidecarFileExplanation')}- </Typography>- }- >- <div style={{ display: 'flex', textTransform: 'unset' }}>- {persistTagsInSidecarFile && <CheckIcon />}- {t('core:useSidecarFile')} - <InfoMuiIcon />- </div>- </Tooltip>- </ToggleButton>+ <div style={{ display: 'flex' }}>+ {persistTagsInSidecarFile && <CheckIcon />}+ {t('core:useSidecarFile')} + <InfoMuiIcon />+ </div>+ </TsToggleButton></ToggleButtonGroup>)}</ListItem>@@ -241,48 +234,42 @@ function SettingsGeneral() {size="small"exclusive>- <ToggleButton+ <TsToggleButtonvalue={false}data-tid="fileNameBeginningTagTID"+ tooltip={t('core:fileNameBeginTagPlaceExplanation')}+ style={{+ borderTopRightRadius: 0,+ borderBottomRightRadius: 0,+ }}onClick={() =>dispatch(SettingsActions.setFileNameTagPlace(false))}>- <Tooltip- title={- <Typography color="inherit">- {t('core:fileNameBeginTagPlaceExplanation')}- </Typography>- }- >- <div style={{ display: 'flex', textTransform: 'unset' }}>- {!filenameTagPlacedAtEnd && <CheckIcon />}- {t('core:atTheBeginningOfFileName')} - <InfoMuiIcon />- </div>- </Tooltip>- </ToggleButton>- <ToggleButton+ <div style={{ display: 'flex' }}>+ {!filenameTagPlacedAtEnd && <CheckIcon />}+ {t('core:atTheBeginningOfFileName')} + <InfoMuiIcon />+ </div>+ </TsToggleButton>+ <TsToggleButtonvalue={true}data-tid="fileNameEndTagTID"+ style={{+ borderTopLeftRadius: 0,+ borderBottomLeftRadius: 0,+ }}+ tooltip={t('core:fileNameEndTagPlaceExplanation')}onClick={() =>dispatch(SettingsActions.setFileNameTagPlace(true))}>- <Tooltip- title={- <Typography color="inherit">- {t('core:fileNameEndTagPlaceExplanation')}- </Typography>- }- >- <div style={{ display: 'flex', textTransform: 'unset' }}>- {filenameTagPlacedAtEnd && <CheckIcon />}- {t('core:filenameTagPlacedAtEnd')} - <InfoMuiIcon />- </div>- </Tooltip>- </ToggleButton>+ <div style={{ display: 'flex' }}>+ {filenameTagPlacedAtEnd && <CheckIcon />}+ {t('core:filenameTagPlacedAtEnd')} + <InfoMuiIcon />+ </div>+ </TsToggleButton></ToggleButtonGroup></ListItem>)}