🐛 fix: some UI issues

This commit is contained in:
Martial BE 2024-01-02 17:29:35 +08:00 committed by Buer
parent 84c7802646
commit e15be8bc82
25 changed files with 46 additions and 19 deletions

View File

@ -1,6 +1,7 @@
{ {
"root": true, "root": true,
"env": { "env": {
"node": true,
"browser": true, "browser": true,
"es2021": true "es2021": true
}, },
@ -43,7 +44,7 @@
"react/jsx-uses-react": "error", "react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error", "react/jsx-uses-vars": "error",
"react/react-in-jsx-scope": "off", "react/react-in-jsx-scope": "off",
"no-undef": "off", "no-undef": "error",
"react/display-name": "off", "react/display-name": "off",
"react/jsx-filename-extension": "off", "react/jsx-filename-extension": "off",
"no-param-reassign": "off", "no-param-reassign": "off",

View File

@ -1,6 +1,6 @@
import { useEffect, useCallback, createContext } from 'react'; import { useEffect, useCallback, createContext } from 'react';
import { API } from 'utils/api'; import { API } from 'utils/api';
import { showNotice } from 'utils/common'; import { showNotice, showError } from 'utils/common';
import { SET_SITE_INFO } from 'store/actions'; import { SET_SITE_INFO } from 'store/actions';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';

View File

@ -62,7 +62,8 @@ SubCard.propTypes = {
secondary: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object]), secondary: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object]),
sx: PropTypes.object, sx: PropTypes.object,
contentSX: PropTypes.object, contentSX: PropTypes.object,
title: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object]) title: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object]),
subTitle: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object])
}; };
SubCard.defaultProps = { SubCard.defaultProps = {

View File

@ -28,6 +28,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
import PropTypes from 'prop-types';
import { Box, Avatar } from '@mui/material'; import { Box, Avatar } from '@mui/material';
import { alpha } from '@mui/material/styles'; import { alpha } from '@mui/material/styles';
import Card from '@mui/material/Card'; import Card from '@mui/material/Card';
@ -119,3 +120,7 @@ export default function UserCard({ children }) {
</Card> </Card>
); );
} }
UserCard.propTypes = {
children: PropTypes.node
};

View File

@ -49,6 +49,7 @@ const GitHubOAuth = () => {
let code = searchParams.get('code'); let code = searchParams.get('code');
let state = searchParams.get('state'); let state = searchParams.get('state');
sendCode(code, state, 0).then(); sendCode(code, state, 0).then();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
return ( return (

View File

@ -80,7 +80,6 @@ const RegisterForm = ({ ...others }) => {
return; return;
} }
}; };
useEffect(() => { useEffect(() => {
let affCode = searchParams.get('aff'); let affCode = searchParams.get('aff');
if (affCode) { if (affCode) {
@ -92,6 +91,7 @@ const RegisterForm = ({ ...others }) => {
setTurnstileEnabled(true); setTurnstileEnabled(true);
setTurnstileSiteKey(siteInfo.turnstile_site_key); setTurnstileSiteKey(siteInfo.turnstile_site_key);
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [siteInfo]); }, [siteInfo]);
return ( return (

View File

@ -15,7 +15,7 @@ import { Formik } from 'formik';
import AnimateButton from 'ui-component/extended/AnimateButton'; import AnimateButton from 'ui-component/extended/AnimateButton';
// assets // assets
import { showError, showInfo } from 'utils/common'; import { showError, showInfo, showSuccess } from 'utils/common';
// ===========================|| FIREBASE - REGISTER ||=========================== // // ===========================|| FIREBASE - REGISTER ||=========================== //

View File

@ -6,6 +6,7 @@ import { Button, Stack, Typography, Alert } from '@mui/material';
// assets // assets
import { showError, showInfo } from 'utils/common'; import { showError, showInfo } from 'utils/common';
import { API } from 'utils/api';
// ===========================|| FIREBASE - REGISTER ||=========================== // // ===========================|| FIREBASE - REGISTER ||=========================== //
@ -37,6 +38,7 @@ const ResetPasswordForm = () => {
token, token,
email email
}); });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
return ( return (

View File

@ -231,6 +231,7 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
initChannel(1); initChannel(1);
setInitialInput({ ...defaultConfig.input, is_edit: false }); setInitialInput({ ...defaultConfig.input, is_edit: false });
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [channelId]); }, [channelId]);
return ( return (

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useState } from 'react'; import { useState } from 'react';
import { showInfo, showError } from 'utils/common'; import { showInfo, showError, renderNumber } from 'utils/common';
import { API } from 'utils/api'; import { API } from 'utils/api';
import { CHANNEL_OPTIONS } from 'constants/ChannelConstants'; import { CHANNEL_OPTIONS } from 'constants/ChannelConstants';

View File

@ -189,6 +189,7 @@ export default function ChannelPage() {
.catch((reason) => { .catch((reason) => {
showError(reason); showError(reason);
}); });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
return ( return (

View File

@ -58,7 +58,8 @@ const StatisticalBarChart = ({ isLoading, chartDatas }) => {
}; };
StatisticalBarChart.propTypes = { StatisticalBarChart.propTypes = {
isLoading: PropTypes.bool isLoading: PropTypes.bool,
chartDatas: PropTypes.oneOfType([PropTypes.array, PropTypes.object])
}; };
export default StatisticalBarChart; export default StatisticalBarChart;

View File

@ -116,7 +116,9 @@ const StatisticalLineChartCard = ({ isLoading, title, chartData, todayValue }) =
StatisticalLineChartCard.propTypes = { StatisticalLineChartCard.propTypes = {
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
title: PropTypes.string title: PropTypes.string,
chartData: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
todayValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
}; };
export default StatisticalLineChartCard; export default StatisticalLineChartCard;

View File

@ -1,4 +1,3 @@
require('dayjs/locale/zh-cn');
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/material/styles';
import { IconUser, IconKey, IconBrandGithubCopilot, IconSitemap } from '@tabler/icons-react'; import { IconUser, IconKey, IconBrandGithubCopilot, IconSitemap } from '@tabler/icons-react';
@ -7,6 +6,7 @@ import { LocalizationProvider, DateTimePicker } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import LogType from '../type/LogType'; import LogType from '../type/LogType';
require('dayjs/locale/zh-cn');
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
export default function TableToolBar({ filterName, handleFilterName, userIsAdmin }) { export default function TableToolBar({ filterName, handleFilterName, userIsAdmin }) {

View File

@ -98,6 +98,7 @@ export default function Log() {
showError(reason); showError(reason);
}); });
setInitPage(false); setInitPage(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [initPage]); }, [initPage]);
return ( return (

View File

@ -15,7 +15,7 @@ import {
FormHelperText FormHelperText
} from '@mui/material'; } from '@mui/material';
import { Formik } from 'formik'; import { Formik } from 'formik';
import { showError } from 'utils/common'; import { showError, showSuccess } from 'utils/common';
import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/material/styles';
import * as Yup from 'yup'; import * as Yup from 'yup';
import useRegister from 'hooks/useRegister'; import useRegister from 'hooks/useRegister';
@ -167,5 +167,6 @@ export default EmailModal;
EmailModal.propTypes = { EmailModal.propTypes = {
open: PropTypes.bool, open: PropTypes.bool,
handleClose: PropTypes.func handleClose: PropTypes.func,
turnstileToken: PropTypes.string
}; };

View File

@ -91,6 +91,7 @@ const EditModal = ({ open, redemptiondId, onCancel, onOk }) => {
} else { } else {
setInputs(originInputs); setInputs(originInputs);
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [redemptiondId]); }, [redemptiondId]);
return ( return (

View File

@ -137,6 +137,7 @@ export default function Redemption() {
.catch((reason) => { .catch((reason) => {
showError(reason); showError(reason);
}); });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
return ( return (

View File

@ -1,4 +1,3 @@
require('dayjs/locale/zh-cn');
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import SubCard from 'ui-component/cards/SubCard'; import SubCard from 'ui-component/cards/SubCard';
import { Stack, FormControl, InputLabel, OutlinedInput, Checkbox, Button, FormControlLabel, TextField } from '@mui/material'; import { Stack, FormControl, InputLabel, OutlinedInput, Checkbox, Button, FormControlLabel, TextField } from '@mui/material';
@ -8,6 +7,7 @@ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'; import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
require('dayjs/locale/zh-cn');
const OperationSetting = () => { const OperationSetting = () => {
let now = new Date(); let now = new Date();

View File

@ -53,6 +53,7 @@ const OtherSetting = () => {
useEffect(() => { useEffect(() => {
getOptions().then(); getOptions().then();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
const updateOption = async (key, value) => { const updateOption = async (key, value) => {

View File

@ -1,4 +1,4 @@
import { useState, useEffect } from 'react'; import { useState, useEffect, useMemo } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Tabs, Tab, Box, Card } from '@mui/material'; import { Tabs, Tab, Box, Card } from '@mui/material';
import { IconSettings2, IconActivity, IconSettings } from '@tabler/icons-react'; import { IconSettings2, IconActivity, IconSettings } from '@tabler/icons-react';
@ -35,11 +35,14 @@ const Setting = () => {
const location = useLocation(); const location = useLocation();
const navigate = useNavigate(); const navigate = useNavigate();
const hash = location.hash.replace('#', ''); const hash = location.hash.replace('#', '');
const tabMap = { const tabMap = useMemo(
() => ({
operation: 0, operation: 0,
system: 1, system: 1,
other: 2 other: 2
}; }),
[]
);
const [value, setValue] = useState(tabMap[hash] || 0); const [value, setValue] = useState(tabMap[hash] || 0);
const handleChange = (event, newValue) => { const handleChange = (event, newValue) => {

View File

@ -1,4 +1,3 @@
require('dayjs/locale/zh-cn');
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import * as Yup from 'yup'; import * as Yup from 'yup';
import { Formik } from 'formik'; import { Formik } from 'formik';
@ -26,6 +25,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'; import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
import { renderQuotaWithPrompt, showSuccess, showError } from 'utils/common'; import { renderQuotaWithPrompt, showSuccess, showError } from 'utils/common';
import { API } from 'utils/api'; import { API } from 'utils/api';
require('dayjs/locale/zh-cn');
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
is_edit: Yup.boolean(), is_edit: Yup.boolean(),
@ -88,6 +88,7 @@ const EditModal = ({ open, tokenId, onCancel, onOk }) => {
if (tokenId) { if (tokenId) {
loadToken().then(); loadToken().then();
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tokenId]); }, [tokenId]);
return ( return (

View File

@ -54,6 +54,7 @@ export default function Token() {
.catch((reason) => { .catch((reason) => {
showError(reason); showError(reason);
}); });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
const onPaginationChange = (event, activePage) => { const onPaginationChange = (event, activePage) => {

View File

@ -122,6 +122,7 @@ const EditModal = ({ open, userId, onCancel, onOk }) => {
} else { } else {
setInputs(originInputs); setInputs(originInputs);
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [userId]); }, [userId]);
return ( return (

View File

@ -135,6 +135,7 @@ export default function Users() {
.catch((reason) => { .catch((reason) => {
showError(reason); showError(reason);
}); });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
return ( return (