Move transition in a separate file

This commit is contained in:
Nicola Benaglia 2025-06-12 22:30:59 +02:00
parent 274c8d1048
commit df49f327f1
10 changed files with 445 additions and 403 deletions

View File

@ -0,0 +1,12 @@
import { Slide } from '@mui/material';
import { TransitionProps } from '@mui/material/transitions';
import { forwardRef, ReactElement, Ref } from 'react';
export const TransitionUp = forwardRef(function Transition(
props: TransitionProps & {
children: ReactElement;
},
ref: Ref<unknown>
) {
return <Slide direction="up" ref={ref} {...props} />;
});

View File

@ -111,7 +111,7 @@ export const AppsDevModeNavBar = () => {
variant="scrollable" // Make tabs scrollable variant="scrollable" // Make tabs scrollable
scrollButtons={true} scrollButtons={true}
sx={{ sx={{
'& .MuiTabs-indicator': { '&.MuiTabs-indicator': {
backgroundColor: theme.palette.text.primary, backgroundColor: theme.palette.text.primary,
}, },
maxHeight: `275px`, // Ensure the tabs container fits within the available space maxHeight: `275px`, // Ensure the tabs container fits within the available space

View File

@ -193,7 +193,7 @@ export const AppsNavBarDesktop = ({ disableBack }) => {
variant="scrollable" // Make tabs scrollable variant="scrollable" // Make tabs scrollable
scrollButtons={true} scrollButtons={true}
sx={{ sx={{
'& .MuiTabs-indicator': { '&.MuiTabs-indicator': {
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
}, },
maxHeight: `275px`, // Ensure the tabs container fits within the available space maxHeight: `275px`, // Ensure the tabs container fits within the available space

View File

@ -357,7 +357,7 @@ export const AppsPrivate = ({ myName, myAddress }) => {
variant={'fullWidth'} variant={'fullWidth'}
scrollButtons="auto" scrollButtons="auto"
sx={{ sx={{
'& .MuiTabs-indicator': { '&.MuiTabs-indicator': {
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
}, },
}} }}

View File

@ -1,8 +1,5 @@
import { import {
forwardRef,
Fragment, Fragment,
ReactElement,
Ref,
SyntheticEvent, SyntheticEvent,
useContext, useContext,
useEffect, useEffect,
@ -17,8 +14,6 @@ import Typography from '@mui/material/Typography';
import CloseIcon from '@mui/icons-material/Close'; import CloseIcon from '@mui/icons-material/Close';
import ExpandLess from '@mui/icons-material/ExpandLess'; import ExpandLess from '@mui/icons-material/ExpandLess';
import ExpandMore from '@mui/icons-material/ExpandMore'; import ExpandMore from '@mui/icons-material/ExpandMore';
import Slide from '@mui/material/Slide';
import { TransitionProps } from '@mui/material/transitions';
import { import {
Box, Box,
Collapse, Collapse,
@ -40,6 +35,7 @@ import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useSetAtom } from 'jotai'; import { useSetAtom } from 'jotai';
import { txListAtom } from '../../atoms/global'; import { txListAtom } from '../../atoms/global';
import { TransitionUp } from '../../common/Transitions.tsx';
export const Label = styled('label')` export const Label = styled('label')`
display: block; display: block;
@ -49,15 +45,6 @@ export const Label = styled('label')`
margin-bottom: 4px; margin-bottom: 4px;
`; `;
const Transition = forwardRef(function Transition(
props: TransitionProps & {
children: ReactElement;
},
ref: Ref<unknown>
) {
return <Slide direction="up" ref={ref} {...props} />;
});
export const AddGroup = ({ address, open, setOpen }) => { export const AddGroup = ({ address, open, setOpen }) => {
const { show } = useContext(QORTAL_APP_CONTEXT); const { show } = useContext(QORTAL_APP_CONTEXT);
const setTxList = useSetAtom(txListAtom); const setTxList = useSetAtom(txListAtom);
@ -228,13 +215,12 @@ export const AddGroup = ({ address, open, setOpen }) => {
open={open} open={open}
onClose={handleClose} onClose={handleClose}
slots={{ slots={{
transition: Transition, transition: TransitionUp,
}} }}
> >
<AppBar <AppBar
sx={{ sx={{
position: 'relative', position: 'relative',
bgcolor: theme.palette.background.default,
}} }}
> >
<Toolbar> <Toolbar>
@ -281,7 +267,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
scrollButtons="auto" scrollButtons="auto"
allowScrollButtonsMobile allowScrollButtonsMobile
sx={{ sx={{
'& .MuiTabs-indicator': { '&.MuiTabs-indicator': {
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
}, },
}} }}
@ -421,10 +407,10 @@ export const AddGroup = ({ address, open, setOpen }) => {
<Box <Box
sx={{ sx={{
display: 'flex',
gap: '15px',
alignItems: 'center', alignItems: 'center',
cursor: 'pointer', cursor: 'pointer',
display: 'flex',
gap: '15px',
}} }}
onClick={() => setOpenAdvance((prev) => !prev)} onClick={() => setOpenAdvance((prev) => !prev)}
> >

View File

@ -255,7 +255,7 @@ export const ManageMembers = ({
scrollButtons="auto" // Show scroll buttons automatically scrollButtons="auto" // Show scroll buttons automatically
allowScrollButtonsMobile // Show scroll buttons on mobile as well allowScrollButtonsMobile // Show scroll buttons on mobile as well
sx={{ sx={{
'& .MuiTabs-indicator': { '&.MuiTabs-indicator': {
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
}, },
maxWidth: '100%', // Ensure the tabs container fits within the available space maxWidth: '100%', // Ensure the tabs container fits within the available space

View File

@ -40,6 +40,7 @@ import { walletVersion } from '../../background/background.ts';
import Base58 from '../../encryption/Base58.ts'; import Base58 from '../../encryption/Base58.ts';
import { QORTAL_APP_CONTEXT } from '../../App'; import { QORTAL_APP_CONTEXT } from '../../App';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { TransitionUp } from '../../common/Transitions.tsx';
const LocalNodeSwitch = styled(Switch)(({ theme }) => ({ const LocalNodeSwitch = styled(Switch)(({ theme }) => ({
padding: 8, padding: 8,
@ -74,15 +75,6 @@ const LocalNodeSwitch = styled(Switch)(({ theme }) => ({
}, },
})); }));
const Transition = forwardRef(function Transition(
props: TransitionProps & {
children: ReactElement;
},
ref: Ref<unknown>
) {
return <Slide direction="up" ref={ref} {...props} />;
});
export const Settings = ({ open, setOpen, rawWallet }) => { export const Settings = ({ open, setOpen, rawWallet }) => {
const [checked, setChecked] = useState(false); const [checked, setChecked] = useState(false);
const [isEnabledDevMode, setIsEnabledDevMode] = useAtom(enabledDevModeAtom); const [isEnabledDevMode, setIsEnabledDevMode] = useAtom(enabledDevModeAtom);
@ -163,7 +155,7 @@ export const Settings = ({ open, setOpen, rawWallet }) => {
open={open} open={open}
onClose={handleClose} onClose={handleClose}
slots={{ slots={{
transition: Transition, transition: TransitionUp,
}} }}
> >
<AppBar sx={{ position: 'relative' }}> <AppBar sx={{ position: 'relative' }}>

View File

@ -41,6 +41,7 @@ import { useModal } from '../../hooks/useModal.tsx';
import { useAtom, useSetAtom } from 'jotai'; import { useAtom, useSetAtom } from 'jotai';
import { memberGroupsAtom, txListAtom } from '../../atoms/global'; import { memberGroupsAtom, txListAtom } from '../../atoms/global';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { TransitionUp } from '../../common/Transitions.tsx';
export const Minting = ({ setIsOpenMinting, myAddress, show }) => { export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
const setTxList = useSetAtom(txListAtom); const setTxList = useSetAtom(txListAtom);
@ -540,14 +541,8 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
maxWidth="lg" maxWidth="lg"
fullWidth fullWidth
fullScreen fullScreen
sx={{ slots={{
'& .MuiDialog-paper': { transition: TransitionUp,
height: '100vh',
margin: 0,
maxWidth: '100%',
overflow: 'hidden', // Prevent scrollbars
width: '100%',
},
}} }}
> >
<AppBar sx={{ position: 'relative' }}> <AppBar sx={{ position: 'relative' }}>
@ -575,11 +570,51 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
</Toolbar> </Toolbar>
</AppBar> </AppBar>
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> <Box
<Tabs value={setValueMintingTab} onChange={handleChange}> sx={{
<Tab label="Minting Details" {...a11yProps(0)} /> bgcolor: theme.palette.background.default,
<Tab label="Item Two" {...a11yProps(1)} /> color: theme.palette.text.primary,
<Tab label="Item Three" {...a11yProps(2)} /> display: 'flex',
flexDirection: 'column',
flexGrow: 1,
overflowY: 'auto',
}}
>
<Box
sx={{ borderBottom: 1, borderColor: theme.palette.text.secondary }}
>
<Tabs
value={setValueMintingTab}
onChange={handleChange}
variant={'fullWidth'}
scrollButtons="auto"
allowScrollButtonsMobile
sx={{
'&.MuiTabs-indicator': {
backgroundColor: theme.palette.background.default,
},
}}
>
<Tab
label="Minting Details"
sx={{
'&.Mui-selected': {
color: theme.palette.text.primary,
},
fontSize: '1rem',
}}
{...a11yProps(0)}
/>
<Tab
label="Minting Actions"
sx={{
'&.Mui-selected': {
color: theme.palette.text.primary,
},
fontSize: '1rem',
}}
{...a11yProps(1)}
/>
</Tabs> </Tabs>
</Box> </Box>
@ -640,7 +675,10 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
</Typography> </Typography>
<Grid container spacing={2}> <Grid container spacing={2}>
<StatCard label="Current Tier" value="Tier 2 (Level 3 + 4)" /> <StatCard
label="Current Tier"
value="Tier 2 (Level 3 + 4)"
/>
<StatCard <StatCard
label="Total Minters in The Tier" label="Total Minters in The Tier"
value="77 Minters" value="77 Minters"
@ -858,9 +896,12 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
{mintingAccounts?.length > 1 && ( {mintingAccounts?.length > 1 && (
<Typography> <Typography>
{t('group:message.generic.minting_keys_per_node_different', { {t(
'group:message.generic.minting_keys_per_node_different',
{
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
})} }
)}
</Typography> </Typography>
)} )}
</Card> </Card>
@ -987,6 +1028,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
</DialogContent> </DialogContent>
</> </>
)} )}
</Box>
<Snackbar <Snackbar
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}

View File

@ -16,15 +16,21 @@ import { getBaseApiReact } from '../../App';
import { executeEvent } from '../../utils/events'; import { executeEvent } from '../../utils/events';
import { useAtom } from 'jotai'; import { useAtom } from 'jotai';
import { memberGroupsAtom, txListAtom } from '../../atoms/global'; import { memberGroupsAtom, txListAtom } from '../../atoms/global';
import { useTranslation } from 'react-i18next';
export const TaskManager = ({ getUserInfo }) => { export const TaskManager = ({ getUserInfo }) => {
const [memberGroups] = useAtom(memberGroupsAtom); const [memberGroups] = useAtom(memberGroupsAtom);
const [txList, setTxList] = useAtom(txListAtom); const [txList, setTxList] = useAtom(txListAtom);
const [open, setOpen] = React.useState(false); const [open, setOpen] = React.useState(false);
const intervals = useRef({}); const intervals = useRef({});
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation([
'auth',
'core',
'group',
'question',
'tutorial',
]);
const handleClick = () => { const handleClick = () => {
setOpen((prev) => !prev); setOpen((prev) => !prev);
@ -199,7 +205,11 @@ export const TaskManager = ({ getUserInfo }) => {
)} )}
</ListItemIcon> </ListItemIcon>
<ListItemText primary="Ongoing Transactions" /> <ListItemText
primary={t('core:message.generic.ongoing_transactions', {
postProcess: 'capitalizeFirstChar',
})}
/>
{open ? <ExpandLess /> : <ExpandMore />} {open ? <ExpandLess /> : <ExpandMore />}
</ListItemButton> </ListItemButton>

View File

@ -41,7 +41,7 @@ export const Tutorials = () => {
> >
<Tabs <Tabs
sx={{ sx={{
'& .MuiTabs-indicator': { '&.MuiTabs-indicator': {
backgroundColor: theme.palette.background.default, backgroundColor: theme.palette.background.default,
}, },
}} }}