2022-09-09 17:18:04 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
2022-05-19 12:33:41 +00:00
|
|
|
|
|
|
|
import {
|
|
|
|
Dialog,
|
|
|
|
DialogContent,
|
|
|
|
Divider,
|
|
|
|
Link,
|
|
|
|
List,
|
|
|
|
ListItemText,
|
|
|
|
ListItem,
|
|
|
|
ListItemIcon,
|
|
|
|
Typography,
|
2022-10-31 18:03:34 +00:00
|
|
|
LinearProgress,
|
2022-09-09 17:18:04 +00:00
|
|
|
} from '@mui/material';
|
2022-05-19 12:33:41 +00:00
|
|
|
|
2022-09-09 17:18:04 +00:00
|
|
|
import BoltIcon from '@mui/icons-material/Bolt';
|
|
|
|
import PublicIcon from '@mui/icons-material/Public';
|
|
|
|
import DnsIcon from '@mui/icons-material/Dns';
|
|
|
|
import WebIcon from '@mui/icons-material/Web';
|
|
|
|
import FavoriteIcon from '@mui/icons-material/Favorite';
|
|
|
|
import GitHubIcon from '@mui/icons-material/GitHub';
|
|
|
|
import EqualizerIcon from '@mui/icons-material/Equalizer';
|
2022-05-19 12:33:41 +00:00
|
|
|
|
2022-09-23 09:52:59 +00:00
|
|
|
import { AmbossIcon, BitcoinSignIcon, RoboSatsNoTextIcon } from '../Icons';
|
2022-05-19 12:33:41 +00:00
|
|
|
|
2022-10-30 19:13:01 +00:00
|
|
|
import { pn } from '../../utils';
|
2022-10-31 18:03:34 +00:00
|
|
|
import { Info } from '../../models';
|
2022-05-19 12:33:41 +00:00
|
|
|
|
2022-09-09 17:33:29 +00:00
|
|
|
interface Props {
|
2022-10-20 17:24:53 +00:00
|
|
|
open: boolean;
|
2022-10-30 19:13:01 +00:00
|
|
|
onClose: () => void;
|
2022-10-31 18:03:34 +00:00
|
|
|
info: Info;
|
2022-09-09 17:33:29 +00:00
|
|
|
}
|
2022-05-19 12:33:41 +00:00
|
|
|
|
2022-10-31 18:03:34 +00:00
|
|
|
const StatsDialog = ({ open = false, onClose, info }: Props): JSX.Element => {
|
2022-05-19 12:33:41 +00:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
return (
|
2022-10-31 18:03:34 +00:00
|
|
|
<Dialog open={open} onClose={onClose}>
|
|
|
|
<div style={info.loading ? {} : { display: 'none' }}>
|
|
|
|
<LinearProgress />
|
|
|
|
</div>
|
|
|
|
|
2022-05-19 12:33:41 +00:00
|
|
|
<DialogContent>
|
2022-09-09 17:18:04 +00:00
|
|
|
<Typography component='h5' variant='h5'>
|
|
|
|
{t('Stats For Nerds')}
|
|
|
|
</Typography>
|
2022-05-19 12:33:41 +00:00
|
|
|
|
|
|
|
<List dense>
|
|
|
|
<Divider />
|
|
|
|
|
2022-09-23 09:52:59 +00:00
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
2022-09-23 10:28:46 +00:00
|
|
|
<RoboSatsNoTextIcon
|
|
|
|
sx={{ width: '1.4em', height: '1.4em', right: '0.2em', position: 'relative' }}
|
|
|
|
/>
|
2022-09-23 09:52:59 +00:00
|
|
|
</ListItemIcon>
|
2022-09-23 10:28:46 +00:00
|
|
|
<ListItemText
|
2022-10-31 18:03:34 +00:00
|
|
|
primary={`${t('Client')} ${info.clientVersion} - ${t('Coordinator')} ${
|
|
|
|
info.coordinatorVersion
|
|
|
|
}`}
|
2022-09-23 10:28:46 +00:00
|
|
|
secondary={t('RoboSats version')}
|
|
|
|
/>
|
2022-09-23 09:52:59 +00:00
|
|
|
</ListItem>
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
2022-05-19 12:33:41 +00:00
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
|
|
|
<BoltIcon />
|
|
|
|
</ListItemIcon>
|
2022-10-31 18:03:34 +00:00
|
|
|
<ListItemText primary={info.lnd_version} secondary={t('LND version')} />
|
2022-05-19 12:33:41 +00:00
|
|
|
</ListItem>
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
2022-10-31 18:03:34 +00:00
|
|
|
{info.network === 'testnet' ? (
|
2022-05-19 12:33:41 +00:00
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
|
|
|
<DnsIcon />
|
|
|
|
</ListItemIcon>
|
2022-10-31 18:03:34 +00:00
|
|
|
<ListItemText secondary={`${t('LN Node')}: ${info.node_alias}`}>
|
2022-05-19 12:33:41 +00:00
|
|
|
<Link
|
2022-09-09 17:18:04 +00:00
|
|
|
target='_blank'
|
2022-10-31 18:03:34 +00:00
|
|
|
href={`https://1ml.com/testnet/node/${info.node_id}`}
|
2022-09-09 17:18:04 +00:00
|
|
|
rel='noreferrer'
|
2022-05-19 12:33:41 +00:00
|
|
|
>
|
2022-10-31 18:03:34 +00:00
|
|
|
{`${info.node_id.slice(0, 12)}... (1ML)`}
|
2022-05-19 12:33:41 +00:00
|
|
|
</Link>
|
|
|
|
</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
) : (
|
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
|
|
|
<AmbossIcon />
|
|
|
|
</ListItemIcon>
|
2022-10-31 18:03:34 +00:00
|
|
|
<ListItemText secondary={info.node_alias}>
|
|
|
|
<Link
|
|
|
|
target='_blank'
|
|
|
|
href={`https://amboss.space/node/${info.node_id}`}
|
|
|
|
rel='noreferrer'
|
|
|
|
>
|
|
|
|
{`${info.node_id.slice(0, 12)}... (AMBOSS)`}
|
2022-05-19 12:33:41 +00:00
|
|
|
</Link>
|
|
|
|
</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
)}
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
|
|
|
<WebIcon />
|
|
|
|
</ListItemIcon>
|
2022-10-31 18:03:34 +00:00
|
|
|
<ListItemText secondary={info.alternative_name}>
|
|
|
|
<Link target='_blank' href={`http://${info.alternative_site}`} rel='noreferrer'>
|
|
|
|
{`${info.alternative_site.slice(0, 12)}...onion`}
|
2022-05-19 12:33:41 +00:00
|
|
|
</Link>
|
|
|
|
</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
|
|
|
<GitHubIcon />
|
|
|
|
</ListItemIcon>
|
2022-09-23 09:52:59 +00:00
|
|
|
<ListItemText secondary={t('Coordinator commit hash')}>
|
2022-05-19 12:33:41 +00:00
|
|
|
<Link
|
2022-09-09 17:18:04 +00:00
|
|
|
target='_blank'
|
2022-10-31 18:03:34 +00:00
|
|
|
href={`https://github.com/Reckless-Satoshi/robosats/tree/${info.robosats_running_commit_hash}`}
|
2022-09-09 17:18:04 +00:00
|
|
|
rel='noreferrer'
|
2022-05-19 12:33:41 +00:00
|
|
|
>
|
2022-10-31 18:03:34 +00:00
|
|
|
{`${info.robosats_running_commit_hash.slice(0, 12)}...`}
|
2022-05-19 12:33:41 +00:00
|
|
|
</Link>
|
|
|
|
</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
|
|
|
<EqualizerIcon />
|
|
|
|
</ListItemIcon>
|
2022-09-09 17:18:04 +00:00
|
|
|
<ListItemText secondary={t('24h contracted volume')}>
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
cursor: 'pointer',
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
}}
|
|
|
|
>
|
2022-10-31 18:03:34 +00:00
|
|
|
{pn(info.last_day_volume)}
|
2022-09-09 17:18:04 +00:00
|
|
|
<BitcoinSignIcon sx={{ width: 14, height: 14 }} color={'text.secondary'} />
|
2022-05-19 12:33:41 +00:00
|
|
|
</div>
|
|
|
|
</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
|
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
|
|
|
<EqualizerIcon />
|
|
|
|
</ListItemIcon>
|
2022-09-09 17:18:04 +00:00
|
|
|
<ListItemText secondary={t('Lifetime contracted volume')}>
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
cursor: 'pointer',
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
}}
|
|
|
|
>
|
2022-10-31 18:03:34 +00:00
|
|
|
{pn(info.lifetime_volume)}
|
2022-09-09 17:18:04 +00:00
|
|
|
<BitcoinSignIcon sx={{ width: 14, height: 14 }} color={'text.secondary'} />
|
2022-05-19 12:33:41 +00:00
|
|
|
</div>
|
|
|
|
</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
|
|
|
|
<Divider />
|
|
|
|
<ListItem>
|
|
|
|
<ListItemIcon>
|
|
|
|
<PublicIcon />
|
|
|
|
</ListItemIcon>
|
|
|
|
<ListItemText
|
|
|
|
primary={
|
2022-09-09 17:18:04 +00:00
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'left',
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<span>{`${t('Made with')} `}</span>
|
|
|
|
<FavoriteIcon sx={{ color: '#ff0000', height: '22px', width: '22px' }} />
|
|
|
|
<span>{` ${t('and')} `}</span>
|
|
|
|
<BoltIcon sx={{ color: '#fcba03', height: '23px', width: '23px' }} />
|
2022-05-19 12:33:41 +00:00
|
|
|
</div>
|
|
|
|
}
|
2022-09-09 17:18:04 +00:00
|
|
|
secondary={t('... somewhere on Earth!')}
|
2022-05-19 12:33:41 +00:00
|
|
|
/>
|
|
|
|
</ListItem>
|
|
|
|
</List>
|
|
|
|
</DialogContent>
|
|
|
|
</Dialog>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default StatsDialog;
|