Skip to content

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

chore: migration to tsiconbuttons

Ilian Sapundshiev68ed4b161780
diff --git a/src/renderer/components/CommonIcons.tsx b/src/renderer/components/CommonIcons.tsx
index b91715fcb..0cf7829cd 100644
--- a/src/renderer/components/CommonIcons.tsx
+++ b/src/renderer/components/CommonIcons.tsx
@@ -168,3 +168,9 @@ export const PrevDocumentIcon = (props) => (
);
export { default as NextDocumentIcon } from '@mui/icons-material/ExpandCircleDownOutlined';
+
+export { default as ThemingIcon } from '@mui/icons-material/InvertColors';
+
+export { default as TagLibraryIcon } from '@mui/icons-material/LocalOfferOutlined';
+
+export { default as RecentThingsIcon } from '@mui/icons-material/BookmarksOutlined';
diff --git a/src/renderer/components/MobileNavigation.tsx b/src/renderer/components/MobileNavigation.tsx
index 72e1c6060..97c849fd8 100644
--- a/src/renderer/components/MobileNavigation.tsx
+++ b/src/renderer/components/MobileNavigation.tsx
@@ -27,11 +27,7 @@ import FileDownloadIcon from '@mui/icons-material/FileDownload';
import TsButton from '-/components/TsButton';
import ButtonGroup from '@mui/material/ButtonGroup';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
-import IconButton from '@mui/material/IconButton';
-import ThemingIcon from '@mui/icons-material/InvertColors';
-import TagLibraryIcon from '@mui/icons-material/LocalOfferOutlined';
-import RecentThingsIcon from '@mui/icons-material/BookmarksOutlined';
-import HelpIcon from '@mui/icons-material/HelpOutline';
+import TsIconButton from '-/components/TsIconButton';
import { Divider } from '@mui/material';
import {
OpenLinkIcon,
@@ -47,6 +43,10 @@ import {
LinkFileIcon,
AccountIcon,
AddExistingFileIcon,
+ HelpIcon,
+ ThemingIcon,
+ TagLibraryIcon,
+ RecentThingsIcon,
} from '-/components/CommonIcons';
import InfoIcon from '-/components/InfoIcon';
import Popover from '@mui/material/Popover';
@@ -112,7 +112,6 @@ function MobileNavigation(props: Props) {
const { t } = useTranslation();
const theme = useTheme();
const dispatch: AppDispatch = useDispatch();
-
const { setSelectedLocation, currentLocation } = useCurrentLocationContext();
const { currentDirectoryPath } = useDirectoryContentContext();
const { openFileUpload } = useFileUploadContext();
@@ -125,30 +124,12 @@ function MobileNavigation(props: Props) {
const { currentOpenedPanel, showPanel } = usePanelsContext();
const { openDownloadUrl } = useDownloadUrlDialogContext();
const keyBindings = useSelector(getKeyBindingObject);
- /* const isLocationManagerPanelOpenedSelector = useSelector(
- isLocationManagerPanelOpened,
- );
- const isTagLibraryPanelOpenedSelector = useSelector(isTagLibraryPanelOpened);
- const isSearchPanelOpenedSelector = useSelector(isSearchPanelOpened);
- const isHelpFeedbackPanelOpenedSelector = useSelector(
- isHelpFeedbackPanelOpened,
- );*/
const { currentUser } = useUserContext();
-
const [showTeaserBanner, setShowTeaserBanner] = useState<boolean>(true);
const [anchorUser, setAnchorUser] = useState<HTMLButtonElement | null>(null);
-
const showProTeaser = !Pro && showTeaserBanner;
-
const { hideDrawer, width } = props;
- /*const openLocationManagerPanel = () =>
- dispatch(AppActions.openLocationManagerPanel());
- const openTagLibraryPanel = () => dispatch(AppActions.openTagLibraryPanel());
- const openSearchPanel = () => dispatch(AppActions.openSearchPanel());
- const openHelpFeedbackPanel = () =>
- dispatch(AppActions.openHelpFeedbackPanel());*/
const switchTheme = () => dispatch(SettingsActions.switchTheme());
-
const [openedCreateMenu, setOpenCreateMenu] = React.useState(false);
const anchorRef = React.useRef<HTMLDivElement>(null);
@@ -483,7 +464,7 @@ function MobileNavigation(props: Props) {
<ProTeaser setShowTeaserBanner={setShowTeaserBanner} />
)}
<Tooltip title={t('core:settings')}>
- <IconButton
+ <TsIconButton
id="verticalNavButton"
data-tid="settings"
onClick={() => {
@@ -493,17 +474,16 @@ function MobileNavigation(props: Props) {
size="large"
>
<SettingsIcon />
- </IconButton>
+ </TsIconButton>
</Tooltip>
<ToggleButtonGroup exclusive>
<ToggleButton
onClick={() => showPanel('locationManagerPanel')}
- size="small"
- className={
- currentOpenedPanel === 'locationManagerPanel'
- ? classNames(classes.button, classes.selectedButton)
- : classes.button
- }
+ // className={
+ // currentOpenedPanel === 'locationManagerPanel'
+ // ? classNames(classes.button, classes.selectedButton)
+ // : classes.button
+ // }
data-tid="locationManager"
value="check"
>
@@ -517,7 +497,6 @@ function MobileNavigation(props: Props) {
<ToggleButton
data-tid="tagLibrary"
onClick={() => showPanel('tagLibraryPanel')}
- size="small"
className={
currentOpenedPanel === 'tagLibraryPanel'
? classNames(classes.button, classes.selectedButton)
@@ -534,7 +513,6 @@ function MobileNavigation(props: Props) {
</ToggleButton>
<ToggleButton
data-tid="quickAccessButton"
- size="small"
onClick={() => showPanel('searchPanel')}
className={
currentOpenedPanel === 'searchPanel'
@@ -550,7 +528,6 @@ function MobileNavigation(props: Props) {
<ToggleButton
data-tid="helpFeedback"
onClick={() => showPanel('helpFeedbackPanel')}
- size="small"
className={
currentOpenedPanel === 'helpFeedbackPanel'
? classNames(classes.button, classes.selectedButton)
@@ -566,7 +543,7 @@ function MobileNavigation(props: Props) {
{currentUser ? (
<>
<Tooltip title={t('core:userAccount')}>
- <IconButton
+ <TsIconButton
data-tid="accountCircleIconTID"
onClick={(event: React.MouseEvent<HTMLButtonElement>) =>
setAnchorUser(event.currentTarget)
@@ -575,7 +552,7 @@ function MobileNavigation(props: Props) {
size="large"
>
<AccountIcon />
- </IconButton>
+ </TsIconButton>
</Tooltip>
<Popover
open={Boolean(anchorUser)}
@@ -595,14 +572,14 @@ function MobileNavigation(props: Props) {
</>
) : (
<Tooltip title={t('core:switchTheme')}>
- <IconButton
+ <TsIconButton
data-tid="switchTheme"
onClick={switchTheme}
style={{ marginTop: -15, marginRight: 2 }}
size="large"
>
<ThemingIcon />
- </IconButton>
+ </TsIconButton>
</Tooltip>
)}
</Box>