Skip to content
Open
9 changes: 7 additions & 2 deletions public/icons/tokens/wxtz.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 31 additions & 30 deletions src/components/MarketSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type MarketLogoProps = {
export const MarketLogo = ({ size, logo, testChainName }: MarketLogoProps) => {
return (
<Box sx={{ mr: 2, width: size, height: size, position: 'relative' }}>
<Box sx={{filter: 'brightness(0.7)'}}><img src={logo} alt="" width="100%" height="100%" /></Box>
<Box sx={{ filter: 'brightness(0.7)' }}><img src={logo} alt="" width="100%" height="100%" /></Box>

{testChainName && (
<Tooltip title={testChainName} arrow>
Expand Down Expand Up @@ -173,35 +173,36 @@ export const MarketSwitcher = () => {
</Typography>
</Box>

{availableMarkets.map((marketId: CustomMarket) => {
const { market, network } = getMarketInfoById(marketId);
const marketNaming = getMarketHelpData(market.marketTitle);
return (
<MenuItem
key={marketId}
data-cy={`marketSelector_${marketId}`}
value={marketId}
sx={{
'.MuiListItemIcon-root': { minWidth: 'unset' },
display: market.v3 ? 'flex' : 'none',
}}
>
<MarketLogo
size={32}
logo={network.networkLogoPath}
testChainName={marketNaming.testChainName}
/>
<ListItemText sx={{ mr: 0 }}>
{marketNaming.name} {market.isFork ? 'Fork' : ''}
</ListItemText>
<ListItemText sx={{ textAlign: 'right' }}>
<Typography color="text.secondary" variant="description">
{marketNaming.testChainName}
</Typography>
</ListItemText>
</MenuItem>
);
})}
{availableMarkets
.map((marketId: CustomMarket) => {
const { market, network } = getMarketInfoById(marketId);
const marketNaming = getMarketHelpData(market.marketTitle);
return (
<MenuItem
key={marketId}
data-cy={`marketSelector_${marketId}`}
value={marketId}
sx={{
'.MuiListItemIcon-root': { minWidth: 'unset' },
display: market.v3 ? 'flex' : 'none',
}}
>
<MarketLogo
size={32}
logo={network.networkLogoPath}
testChainName={marketNaming.testChainName}
/>
<ListItemText sx={{ mr: 0 }}>
{marketNaming.name} {market.isFork ? 'Fork' : ''}
</ListItemText>
<ListItemText sx={{ textAlign: 'right' }}>
<Typography color="text.secondary" variant="description">
{marketNaming.testChainName}
</Typography>
</ListItemText>
</MenuItem>
);
})}
</TextField>
);
};
7 changes: 6 additions & 1 deletion src/components/TextWithTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ export const TextWithTooltip = ({
const [open, setOpen] = useState(false);

return (
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Box sx={{
display: 'flex',
alignItems: 'center',
flexWrap: "wrap",
gap: "3px"
}}>
{text && <Typography {...rest}>{text}</Typography>}

<ContentWithTooltip tooltipContent={<>{children}</>} open={open} setOpen={setOpen}>
Expand Down
32 changes: 32 additions & 0 deletions src/components/primitives/WarningSnackbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Alert, Snackbar } from '@mui/material'
import React from 'react'

type TSnackbar = {
open: boolean;
message: string;
}

type TProps = {
snackbar: TSnackbar;
handleCloseSnackbar: () => void;
}

export default function WarningSnackbar({ snackbar, handleCloseSnackbar }: TProps) {
return (
<Snackbar
open={snackbar.open}
autoHideDuration={6000}
onClose={handleCloseSnackbar}
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
>
<Alert
onClose={handleCloseSnackbar}
severity="warning"
variant="filled"
sx={{ width: '100%', alignItems: "center" }}
>
{snackbar.message}
</Alert>
</Snackbar>
)
}
4 changes: 2 additions & 2 deletions src/components/transactions/FlowCommons/TxModalDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ export const DetailsNumberLineWithSub = ({
loading = false,
}: DetailsNumberLineWithSubProps) => {
return (
<Row caption={description} captionVariant="description" mb={4} align="flex-start">
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end' }}>
<Row caption={description} captionVariant="description" mb={4} align="flex-start" flexWrap={'wrap'} gap={'5px'}>
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', marginLeft: 'auto' }}>
{loading ? (
<>
<Skeleton variant="rectangular" height={20} width={100} sx={{ borderRadius: '4px' }} />
Expand Down
10 changes: 10 additions & 0 deletions src/helpers/toggle-mode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const toggleMode = () => {
const isTestnetEnabled = localStorage.getItem('testnetsEnabled') === 'true';
const toggledTestnet = isTestnetEnabled ? "false" : "true";
localStorage.setItem('testnetsEnabled', toggledTestnet);

// Set window.location to trigger a page reload when navigating to the the dashboard
window.location.href = '/';

return toggledTestnet;
};
25 changes: 25 additions & 0 deletions src/hooks/useSnackbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useState } from 'react';

const snackbarInit = {
open: false,
message: ""
}

export default function useSnackbar() {
const [snackbar, setSnackbar] = useState(snackbarInit);

function handleCloseSnackbar() {
setSnackbar(state => ({ ...state, open: false }));
}

function handleOpenSnackbar({ message = "" }: { message: string }) {
setSnackbar({ open: true, message });
}

return {
snackbar,
setSnackbar,
handleCloseSnackbar,
handleOpenSnackbar
}
}
Loading