Skip to content

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

chore: code optimizations

Ilian Sapundshiev129caae0b1ff
diff --git a/src/renderer/components/FileView.tsx b/src/renderer/components/FileView.tsx
index 5c02725f2..8ce357650 100644
--- a/src/renderer/components/FileView.tsx
+++ b/src/renderer/components/FileView.tsx
@@ -23,6 +23,7 @@ import { useFilePropertiesContext } from '-/hooks/useFilePropertiesContext';
import { useFullScreenContext } from '-/hooks/useFullScreenContext';
import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';
import useEventListener from '-/utils/useEventListener';
+import { Box } from '@mui/material';
import { rgbToHex, useTheme } from '@mui/material/styles';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import fscreen from 'fscreen';
@@ -214,9 +215,9 @@ function FileView(props: Props) {
]);
return (
- <div
+ <Box
ref={fileViewerContainer}
- style={{
+ sx={{
width: '100%',
height: height || '100%',
display: 'flex',
@@ -225,13 +226,13 @@ function FileView(props: Props) {
}}
>
{isFullscreen && (
- <div
+ <Box
data-tid="fullscreenTID"
- style={{
+ sx={{
position: 'absolute',
textAlign: 'center',
- top: 20,
- right: 20,
+ top: '20px',
+ right: '20px',
zIndex: 10000,
color: theme.palette.primary.main,
}}
@@ -240,7 +241,7 @@ function FileView(props: Props) {
<CloseIcon />
<br />
<span>ESC</span>
- </div>
+ </Box>
)}
{openedEntry.isFile && (
<iframe
@@ -258,7 +259,7 @@ function FileView(props: Props) {
id={'FileViewer' + eventID.current}
/>
)}
- </div>
+ </Box>
);
}
diff --git a/src/renderer/components/dialogs/components/TsDialogTitle.tsx b/src/renderer/components/dialogs/components/TsDialogTitle.tsx
index e274ecba7..2533f8a0f 100644
--- a/src/renderer/components/dialogs/components/TsDialogTitle.tsx
+++ b/src/renderer/components/dialogs/components/TsDialogTitle.tsx
@@ -20,6 +20,7 @@ import AppConfig from '-/AppConfig';
import { ArrowBackIcon, CloseDialogIcon } from '-/components/CommonIcons';
import TsIconButton from '-/components/TsIconButton';
import { isDesktopMode } from '-/reducers/settings';
+import Box from '@mui/material/Box';
import DialogTitle, { DialogTitleProps } from '@mui/material/DialogTitle';
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
@@ -53,11 +54,11 @@ function TsDialogTitle(props: TSDialogTitle) {
title={t('closeButtonDialog')}
aria-label="close"
tabIndex={-1}
- style={
+ sx={
{
position: 'absolute',
- right: 15,
- top: 15,
+ right: '15px',
+ top: '15px',
zIndex: 1000,
WebkitAppRegion: 'no-drag',
} as React.CSSProperties & { WebkitAppRegion?: string }
@@ -74,10 +75,10 @@ function TsDialogTitle(props: TSDialogTitle) {
title={t('closeButtonDialog')}
aria-label="close"
tabIndex={-1}
- style={
+ sx={
{
float: 'left',
- marginLeft: AppConfig.isMacLike && desktopMode ? 40 : 0,
+ marginLeft: AppConfig.isMacLike && desktopMode ? '40px' : 0,
WebkitAppRegion: 'no-drag',
} as React.CSSProperties & { WebkitAppRegion?: string }
}
@@ -92,25 +93,23 @@ function TsDialogTitle(props: TSDialogTitle) {
<DialogTitle
id={smallScreen ? '' : 'draggable-dialog-title'}
{...rest}
- style={{
+ sx={{
cursor: smallScreen ? 'unset' : 'move',
...style,
}}
>
{smallScreen ? ( // && !desktopMode
<>
- <div style={{ display: 'flex' }}>
+ <Box sx={{ display: 'flex' }}>
{backButton}
- <span style={{ alignSelf: 'center', margin: '0 auto' }}>
- {title}
- </span>
+ <Box sx={{ alignSelf: 'center', margin: '0 auto' }}>{title}</Box>
{actionSlot && (
- <span style={{ float: 'right', alignSelf: 'center' }}>
+ <Box sx={{ float: 'right', alignSelf: 'center' }}>
{actionSlot}
- </span>
+ </Box>
)}
- </div>
- <div style={{ textAlign: 'center' }}>{children}</div>
+ </Box>
+ <Box sx={{ textAlign: 'center' }}>{children}</Box>
</>
) : (
<>