mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-13 19:41:22 +00:00
Add theme
This commit is contained in:
parent
d0cfc4db2f
commit
fbf4207680
@ -9,31 +9,20 @@ import {
|
|||||||
DialogTitle,
|
DialogTitle,
|
||||||
Divider,
|
Divider,
|
||||||
IconButton,
|
IconButton,
|
||||||
InputBase,
|
|
||||||
InputLabel,
|
|
||||||
Snackbar,
|
Snackbar,
|
||||||
Typography,
|
Typography,
|
||||||
|
useTheme,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import React, {
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
useCallback,
|
|
||||||
useContext,
|
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useState,
|
|
||||||
} from 'react';
|
|
||||||
import CloseIcon from '@mui/icons-material/Close';
|
import CloseIcon from '@mui/icons-material/Close';
|
||||||
import { MyContext, getBaseApiReact } from '../../App';
|
import { getBaseApiReact } from '../../App';
|
||||||
import {
|
import {
|
||||||
executeEvent,
|
executeEvent,
|
||||||
subscribeToEvent,
|
subscribeToEvent,
|
||||||
unsubscribeFromEvent,
|
unsubscribeFromEvent,
|
||||||
} from '../../utils/events';
|
} from '../../utils/events';
|
||||||
import { getFee, getNameOrAddress } from '../../background';
|
import { getFee, getNameOrAddress } from '../../background';
|
||||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
|
||||||
import { AddressBox } from '../../styles/App-styles';
|
|
||||||
import { Spacer } from '../../common/Spacer';
|
import { Spacer } from '../../common/Spacer';
|
||||||
import Copy from '../../assets/svgs/Copy.svg';
|
|
||||||
import { Loader } from '../Loader';
|
|
||||||
import { FidgetSpinner } from 'react-loader-spinner';
|
import { FidgetSpinner } from 'react-loader-spinner';
|
||||||
import { useModal } from '../../common/useModal';
|
import { useModal } from '../../common/useModal';
|
||||||
|
|
||||||
@ -56,15 +45,18 @@ export const Minting = ({
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const { show: showKey, message } = useModal();
|
const { show: showKey, message } = useModal();
|
||||||
const { isShow: isShowNext, onOk, show: showNext } = useModal();
|
const { isShow: isShowNext, onOk, show: showNext } = useModal();
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
const [info, setInfo] = useState(null);
|
const [info, setInfo] = useState(null);
|
||||||
const [names, setNames] = useState({});
|
const [names, setNames] = useState({});
|
||||||
const [accountInfos, setAccountInfos] = useState({});
|
const [accountInfos, setAccountInfos] = useState({});
|
||||||
const [showWaitDialog, setShowWaitDialog] = useState(false);
|
const [showWaitDialog, setShowWaitDialog] = useState(false);
|
||||||
|
|
||||||
const isPartOfMintingGroup = useMemo(() => {
|
const isPartOfMintingGroup = useMemo(() => {
|
||||||
if (groups?.length === 0) return false;
|
if (groups?.length === 0) return false;
|
||||||
return !!groups?.find((item) => item?.groupId?.toString() === '694');
|
return !!groups?.find((item) => item?.groupId?.toString() === '694');
|
||||||
}, [groups]);
|
}, [groups]);
|
||||||
|
|
||||||
const getMintingAccounts = useCallback(async () => {
|
const getMintingAccounts = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const url = `${getBaseApiReact()}/admin/mintingaccounts`;
|
const url = `${getBaseApiReact()}/admin/mintingaccounts`;
|
||||||
@ -107,7 +99,7 @@ export const Minting = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// error
|
console.log(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -133,6 +125,7 @@ export const Minting = ({
|
|||||||
setAccountInfo(data);
|
setAccountInfo(data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
if (!others) {
|
if (!others) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@ -254,7 +247,6 @@ export const Minting = ({
|
|||||||
window
|
window
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
'ADMIN_ACTION',
|
'ADMIN_ACTION',
|
||||||
|
|
||||||
{
|
{
|
||||||
type: 'removemintingaccount',
|
type: 'removemintingaccount',
|
||||||
value: val,
|
value: val,
|
||||||
@ -358,7 +350,6 @@ export const Minting = ({
|
|||||||
if (findRewardShare) {
|
if (findRewardShare) {
|
||||||
return true; // Exit early if found
|
return true; // Exit early if found
|
||||||
}
|
}
|
||||||
|
|
||||||
await sleep(pollingInterval); // Wait before the next poll
|
await sleep(pollingInterval); // Wait before the next poll
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,7 +502,7 @@ export const Minting = ({
|
|||||||
|
|
||||||
const _blocksNeed = () => {
|
const _blocksNeed = () => {
|
||||||
if (accountInfo?.level === 0) {
|
if (accountInfo?.level === 0) {
|
||||||
return 7200;
|
return 7200; // TODO manage these magic numbers in a proper location
|
||||||
} else if (accountInfo?.level === 1) {
|
} else if (accountInfo?.level === 1) {
|
||||||
return 72000;
|
return 72000;
|
||||||
} else if (accountInfo?.level === 2) {
|
} else if (accountInfo?.level === 2) {
|
||||||
@ -562,11 +553,11 @@ export const Minting = ({
|
|||||||
fullScreen
|
fullScreen
|
||||||
sx={{
|
sx={{
|
||||||
'& .MuiDialog-paper': {
|
'& .MuiDialog-paper': {
|
||||||
|
height: '100vh',
|
||||||
margin: 0,
|
margin: 0,
|
||||||
maxWidth: '100%',
|
maxWidth: '100%',
|
||||||
width: '100%',
|
|
||||||
height: '100vh',
|
|
||||||
overflow: 'hidden', // Prevent scrollbars
|
overflow: 'hidden', // Prevent scrollbars
|
||||||
|
width: '100%',
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -583,6 +574,7 @@ export const Minting = ({
|
|||||||
>
|
>
|
||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<DialogContent
|
<DialogContent
|
||||||
sx={{
|
sx={{
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
@ -591,37 +583,40 @@ export const Minting = ({
|
|||||||
{isLoading && (
|
{isLoading && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
position: 'absolute',
|
alignItems: 'center',
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
left: 0,
|
||||||
|
position: 'absolute',
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FidgetSpinner
|
<FidgetSpinner
|
||||||
visible={true}
|
|
||||||
height="80"
|
|
||||||
width="80"
|
|
||||||
ariaLabel="fidget-spinner-loading"
|
ariaLabel="fidget-spinner-loading"
|
||||||
wrapperStyle={{}}
|
height="80"
|
||||||
|
visible={true}
|
||||||
|
width="80"
|
||||||
wrapperClass="fidget-spinner-wrapper"
|
wrapperClass="fidget-spinner-wrapper"
|
||||||
|
wrapperStyle={{}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Card
|
<Card
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: 'var(--bg-2)',
|
backgroundColor: theme.palette.background.default,
|
||||||
padding: '10px',
|
padding: '10px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography>Account: {handleNames(accountInfo?.address)}</Typography>
|
<Typography>Account: {handleNames(accountInfo?.address)}</Typography>
|
||||||
|
|
||||||
<Typography>Level: {accountInfo?.level}</Typography>
|
<Typography>Level: {accountInfo?.level}</Typography>
|
||||||
|
|
||||||
<Typography>
|
<Typography>
|
||||||
blocks remaining until next level: {_levelUpBlocks()}
|
blocks remaining until next level: {_levelUpBlocks()}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Typography>
|
<Typography>
|
||||||
This node is minting: {nodeInfos?.isMintingPossible?.toString()}
|
This node is minting: {nodeInfos?.isMintingPossible?.toString()}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -630,11 +625,11 @@ export const Minting = ({
|
|||||||
{isPartOfMintingGroup && !accountIsMinting && (
|
{isPartOfMintingGroup && !accountIsMinting && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
|
||||||
gap: '5px',
|
|
||||||
flexDirection: 'column',
|
|
||||||
width: '100%',
|
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
gap: '5px',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
@ -674,7 +669,7 @@ export const Minting = ({
|
|||||||
)}
|
)}
|
||||||
<Card
|
<Card
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: 'var(--bg-2)',
|
backgroundColor: theme.palette.background.default,
|
||||||
padding: '10px',
|
padding: '10px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -709,14 +704,14 @@ export const Minting = ({
|
|||||||
size="small"
|
size="small"
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: 'var(--danger)',
|
backgroundColor: 'var(--danger)',
|
||||||
color: 'black',
|
color: theme.palette.text.primary,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
opacity: 0.7,
|
|
||||||
maxWidth: '90%',
|
maxWidth: '90%',
|
||||||
|
opacity: 0.7,
|
||||||
width: '200px',
|
width: '200px',
|
||||||
'&:hover': {
|
'&:hover': {
|
||||||
backgroundColor: 'var(--danger)',
|
backgroundColor: 'var(--danger)',
|
||||||
color: 'black',
|
color: theme.palette.text.primary,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
@ -727,7 +722,9 @@ export const Minting = ({
|
|||||||
>
|
>
|
||||||
Remove minting account
|
Remove minting account
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<Spacer height="10px" />
|
<Spacer height="10px" />
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
@ -744,7 +741,7 @@ export const Minting = ({
|
|||||||
{!isPartOfMintingGroup && (
|
{!isPartOfMintingGroup && (
|
||||||
<Card
|
<Card
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: 'var(--bg-2)',
|
backgroundColor: theme.palette.background.default,
|
||||||
padding: '10px',
|
padding: '10px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -768,7 +765,7 @@ export const Minting = ({
|
|||||||
size="small"
|
size="small"
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: 'var(--green)',
|
backgroundColor: 'var(--green)',
|
||||||
color: 'black',
|
color: theme.palette.text.primary,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
|
|
||||||
@ -802,6 +799,7 @@ export const Minting = ({
|
|||||||
<DialogTitle id="alert-dialog-title">
|
<DialogTitle id="alert-dialog-title">
|
||||||
{isShowNext ? 'Confirmed' : 'Please Wait'}
|
{isShowNext ? 'Confirmed' : 'Please Wait'}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
|
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
{!isShowNext && (
|
{!isShowNext && (
|
||||||
<Typography>
|
<Typography>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user