From fda3208072031c84347abe5daaae69d6c54a3ab5 Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Sun, 20 Apr 2025 17:57:19 +0200 Subject: [PATCH] Remove Add and use AddIcon from MUI --- src/common/BoundedNumericTextField.tsx | 10 +++---- src/components/Apps/AppInfo.tsx | 1 - src/components/Apps/Apps-styles.tsx | 39 ++++++++++--------------- src/components/Apps/AppsHomeDesktop.tsx | 4 +-- src/components/Apps/AppsPrivate.tsx | 4 +-- 5 files changed, 23 insertions(+), 35 deletions(-) diff --git a/src/common/BoundedNumericTextField.tsx b/src/common/BoundedNumericTextField.tsx index 9951d7e..fa0d4b1 100644 --- a/src/common/BoundedNumericTextField.tsx +++ b/src/common/BoundedNumericTextField.tsx @@ -1,9 +1,4 @@ -import { - IconButton, - InputAdornment, - TextField, - TextFieldProps, -} from '@mui/material'; +import { IconButton, InputAdornment, TextFieldProps } from '@mui/material'; import React, { useRef, useState } from 'react'; import AddIcon from '@mui/icons-material/Add'; import RemoveIcon from '@mui/icons-material/Remove'; @@ -44,6 +39,7 @@ export const BoundedNumericTextField = ({ const stringIsEmpty = (value: string) => { return value === ''; }; + const isAllZerosNum = /^0*\.?0*$/; const isFloatNum = /^-?[0-9]*\.?[0-9]*$/; const isIntegerNum = /^-?[0-9]+$/; @@ -85,6 +81,7 @@ export const BoundedNumericTextField = ({ } return value; }; + const filterValue = (value: string) => { if (stringIsEmpty(value)) return ''; value = filterTypes(value); @@ -120,6 +117,7 @@ export const BoundedNumericTextField = ({ setTextFieldValue(value); }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { onChange, ...noChangeProps } = { ...props }; return ( diff --git a/src/components/Apps/AppInfo.tsx b/src/components/Apps/AppInfo.tsx index 3ac6282..aab351d 100644 --- a/src/components/Apps/AppInfo.tsx +++ b/src/components/Apps/AppInfo.tsx @@ -1,4 +1,3 @@ -import React, { useEffect, useMemo, useState } from 'react'; import { AppCircle, AppCircleContainer, diff --git a/src/components/Apps/Apps-styles.tsx b/src/components/Apps/Apps-styles.tsx index 152c09a..cc0f299 100644 --- a/src/components/Apps/Apps-styles.tsx +++ b/src/components/Apps/Apps-styles.tsx @@ -2,12 +2,12 @@ import { Typography, Box, ButtonBase } from '@mui/material'; import { styled } from '@mui/system'; export const AppsParent = styled(Box)(({ theme }) => ({ + alignItems: 'center', display: 'flex', - width: '100%', flexDirection: 'column', height: '100%', - alignItems: 'center', overflow: 'auto', + width: '100%', // For WebKit-based browsers (Chrome, Safari, etc.) '::-webkit-scrollbar': { width: '0px', // Set the width to 0 to hide the scrollbar @@ -25,34 +25,34 @@ export const AppsParent = styled(Box)(({ theme }) => ({ })); export const AppsContainer = styled(Box)(({ theme }) => ({ - display: 'flex', - width: '90%', - justifyContent: 'space-evenly', - gap: '24px', - flexWrap: 'wrap', alignItems: 'flex-start', alignSelf: 'center', backgroundColor: theme.palette.background.default, color: theme.palette.text.primary, + display: 'flex', + flexWrap: 'wrap', + gap: '24px', + justifyContent: 'space-evenly', + width: '90%', })); export const AppsLibraryContainer = styled(Box)(({ theme }) => ({ - display: 'flex', - width: '100%', - flexDirection: 'column', - justifyContent: 'flex-start', alignItems: 'center', backgroundColor: theme.palette.background.paper, + display: 'flex', + flexDirection: 'column', + justifyContent: 'flex-start', + width: '100%', })); export const AppsWidthLimiter = styled(Box)(({ theme }) => ({ - display: 'flex', - width: '90%', - flexDirection: 'column', - justifyContent: 'flex-start', alignItems: 'flex-start', backgroundColor: theme.palette.background.default, color: theme.palette.text.primary, + display: 'flex', + flexDirection: 'column', + justifyContent: 'flex-start', + width: '90%', })); export const AppsSearchContainer = styled(Box)(({ theme }) => ({ @@ -99,15 +99,6 @@ export const AppCircleContainer = styled(Box)(({ theme }) => ({ width: '100%', })); -export const Add = styled(Typography)(({ theme }) => ({ - backgroundColor: theme.palette.background.default, - color: theme.palette.text.primary, - fontSize: '36px', - fontWeight: 500, - lineHeight: '43.57px', - textAlign: 'left', -})); - export const AppCircleLabel = styled(Typography)(({ theme }) => ({ backgroundColor: theme.palette.background.default, color: theme.palette.text.primary, diff --git a/src/components/Apps/AppsHomeDesktop.tsx b/src/components/Apps/AppsHomeDesktop.tsx index f02941f..d9ad291 100644 --- a/src/components/Apps/AppsHomeDesktop.tsx +++ b/src/components/Apps/AppsHomeDesktop.tsx @@ -7,7 +7,7 @@ import { AppsContainer, } from './Apps-styles'; import { Box, ButtonBase, Input, useTheme } from '@mui/material'; -import { Add } from '@mui/icons-material'; +import AddIcon from '@mui/icons-material/Add'; import { executeEvent } from '../../utils/events'; import { Spacer } from '../../common/Spacer'; import { SortablePinnedApps } from './SortablePinnedApps'; @@ -140,7 +140,7 @@ export const AppsHomeDesktop = ({ }} > - + + Library diff --git a/src/components/Apps/AppsPrivate.tsx b/src/components/Apps/AppsPrivate.tsx index fc032ff..4d3e852 100644 --- a/src/components/Apps/AppsPrivate.tsx +++ b/src/components/Apps/AppsPrivate.tsx @@ -23,13 +23,13 @@ import { import { Label } from '../Group/AddGroup'; import { Spacer } from '../../common/Spacer'; import { - Add, AppCircle, AppCircleContainer, AppCircleLabel, PublishQAppChoseFile, PublishQAppInfo, } from './Apps-styles'; +import AddIcon from '@mui/icons-material/Add'; import ImageUploader from '../../common/ImageUploader'; import { MyContext } from '../../App'; import { fileToBase64 } from '../../utils/fileReading'; @@ -234,7 +234,7 @@ export const AppsPrivate = ({ myName }) => { }} > - + + Private