Add Simplex contact method to coordinator dialog

This commit is contained in:
Reckless_Satoshi 2023-11-03 12:13:59 +00:00 committed by Reckless_Satoshi
parent 9d87bf6bd6
commit 013ca083c4
21 changed files with 74 additions and 37 deletions

View File

@ -57,6 +57,7 @@ import {
BadgeLoved, BadgeLoved,
BadgeLimits, BadgeLimits,
NostrIcon, NostrIcon,
SimplexIcon,
} from '../Icons'; } from '../Icons';
import { AppContext } from '../../contexts/AppContext'; import { AppContext } from '../../contexts/AppContext';
import { systemClient } from '../../services/System'; import { systemClient } from '../../services/System';
@ -76,6 +77,7 @@ const ContactButtons = ({
telegram, telegram,
twitter, twitter,
matrix, matrix,
simplex,
website, website,
reddit, reddit,
}: Contact): JSX.Element => { }: Contact): JSX.Element => {
@ -215,6 +217,16 @@ const ContactButtons = ({
</Tooltip> </Tooltip>
</Grid> </Grid>
)} )}
{simplex !== undefined && (
<Grid item>
<Tooltip enterTouchDelay={0} enterNextDelay={2000} title={t('Simplex')}>
<IconButton component='a' target='_blank' href={`${simplex}`} rel='noreferrer'>
<SimplexIcon sx={{ width: '0.7em', height: '0.7em' }} />
</IconButton>
</Tooltip>
</Grid>
)}
</Grid> </Grid>
); );
}; };
@ -712,7 +724,10 @@ const CoordinatorDialog = ({ open = false, onClose, coordinator, network }: Prop
}} }}
> >
{pn(parseFloat(coordinator?.info?.last_day_volume).toFixed(8))} {pn(parseFloat(coordinator?.info?.last_day_volume).toFixed(8))}
<BitcoinSignIcon sx={{ width: 14, height: 14 }} color={'text.secondary'} /> <BitcoinSignIcon
sx={{ width: '1em', height: '1em' }}
color={'text.secondary'}
/>
</div> </div>
</ListItemText> </ListItemText>
</ListItem> </ListItem>
@ -733,7 +748,10 @@ const CoordinatorDialog = ({ open = false, onClose, coordinator, network }: Prop
}} }}
> >
{pn(parseFloat(coordinator?.info?.lifetime_volume).toFixed(8))} {pn(parseFloat(coordinator?.info?.lifetime_volume).toFixed(8))}
<BitcoinSignIcon sx={{ width: 14, height: 14 }} color={'text.secondary'} /> <BitcoinSignIcon
sx={{ width: '1em', height: '1em' }}
color={'text.secondary'}
/>
</div> </div>
</ListItemText> </ListItemText>
</ListItem> </ListItem>

View File

@ -13,10 +13,6 @@ import {
} from '../../contexts/FederationContext'; } from '../../contexts/FederationContext';
interface FederationTableProps { interface FederationTableProps {
federation: Record<string, Coordinator>;
dispatchFederation: (action: ActionFederation) => void;
fetchCoordinatorInfo: (coordinator: Coordinator) => Promise<void>;
setFocusedCoordinator: (state: number) => void;
openCoordinator: () => void; openCoordinator: () => void;
maxWidth?: number; maxWidth?: number;
maxHeight?: number; maxHeight?: number;
@ -30,7 +26,7 @@ const FederationTable = ({
fillContainer = false, fillContainer = false,
}: FederationTableProps): JSX.Element => { }: FederationTableProps): JSX.Element => {
const { t } = useTranslation(); const { t } = useTranslation();
const { federation, setFocusedCoordinator, coordinatorUpdatedAt } = const { federation, sortedCoordinators, setFocusedCoordinator, coordinatorUpdatedAt } =
useContext<UseFederationStoreType>(FederationContext); useContext<UseFederationStoreType>(FederationContext);
const { hostUrl } = useContext<UseAppStoreType>(AppContext); const { hostUrl } = useContext<UseAppStoreType>(AppContext);
const theme = useTheme(); const theme = useTheme();
@ -120,34 +116,37 @@ const FederationTable = ({
}, },
}; };
}, },
[federation], [coordinatorUpdatedAt],
); );
const upObj = useCallback((width: number) => { const upObj = useCallback(
return { (width: number) => {
field: 'up', return {
headerName: t('Up'), field: 'up',
width: width * fontSize, headerName: t('Up'),
renderCell: (params: any) => { width: width * fontSize,
return ( renderCell: (params: any) => {
<div return (
style={{ cursor: 'pointer' }} <div
onClick={() => { style={{ cursor: 'pointer' }}
onClickCoordinator(params.row.shortAlias); onClick={() => {
}} onClickCoordinator(params.row.shortAlias);
> }}
{Boolean(params.row.loadingInfo) && Boolean(params.row.enabled) ? ( >
<CircularProgress thickness={0.35 * fontSize} size={1.5 * fontSize} /> {Boolean(params.row.loadingInfo) && Boolean(params.row.enabled) ? (
) : params.row.info !== undefined ? ( <CircularProgress thickness={0.35 * fontSize} size={1.5 * fontSize} />
<Link color='success' /> ) : params.row.info !== undefined ? (
) : ( <Link color='success' />
<LinkOff color='error' /> ) : (
)} <LinkOff color='error' />
</div> )}
); </div>
}, );
}; },
}, []); };
},
[coordinatorUpdatedAt],
);
const columnSpecs = { const columnSpecs = {
alias: { alias: {
@ -220,6 +219,11 @@ const FederationTable = ({
} }
}; };
const reorderedCoordinators = sortedCoordinators.reduce((coordinators, key) => {
coordinators[key] = federation.coordinators[key];
return coordinators;
}, {});
return ( return (
<Box <Box
sx={ sx={
@ -232,7 +236,7 @@ const FederationTable = ({
localeText={localeText} localeText={localeText}
rowHeight={3.714 * theme.typography.fontSize} rowHeight={3.714 * theme.typography.fontSize}
headerHeight={3.25 * theme.typography.fontSize} headerHeight={3.25 * theme.typography.fontSize}
rows={Object.values(federation.coordinators)} rows={Object.values(reorderedCoordinators)}
getRowId={(params: Coordinator) => params.shortAlias} getRowId={(params: Coordinator) => params.shortAlias}
columns={columns} columns={columns}
checkboxSelection={false} checkboxSelection={false}

View File

@ -18,6 +18,7 @@ export interface Contact {
telegram?: string | undefined; telegram?: string | undefined;
reddit?: string | undefined; reddit?: string | undefined;
matrix?: string | undefined; matrix?: string | undefined;
simplex?: string | undefined;
twitter?: string | undefined; twitter?: string | undefined;
website?: string | undefined; website?: string | undefined;
} }

View File

@ -35,9 +35,6 @@ const FederationWidget = React.forwardRef(function Component(
return ( return (
<Paper elevation={3} style={{ width: '100%', height: '100%' }}> <Paper elevation={3} style={{ width: '100%', height: '100%' }}>
<FederationTable <FederationTable
federation={federation.coordinators}
// setFederation={setFederation}
setFocusedCoordinator={setFocusedCoordinator}
openCoordinator={() => setOpen({ ...open, coordinator: true })} openCoordinator={() => setOpen({ ...open, coordinator: true })}
maxWidth={layout.w * gridCellSize} // EM units maxWidth={layout.w * gridCellSize} // EM units
maxHeight={layout.h * gridCellSize} // EM units maxHeight={layout.h * gridCellSize} // EM units

View File

@ -268,6 +268,7 @@
"RoboSats version": "Versió de RoboSats", "RoboSats version": "Versió de RoboSats",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Comissió del prenedor", "Taker fee": "Comissió del prenedor",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Poplatek příjemce", "Taker fee": "Poplatek příjemce",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Takergebühr", "Taker fee": "Takergebühr",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Taker fee", "Taker fee": "Taker fee",

View File

@ -268,6 +268,7 @@
"RoboSats version": "Versión de RoboSats", "RoboSats version": "Versión de RoboSats",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Comisión del tomador", "Taker fee": "Comisión del tomador",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats bersioa", "RoboSats version": "RoboSats bersioa",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Hartzaile kuota", "Taker fee": "Hartzaile kuota",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Frais du preneur", "Taker fee": "Frais du preneur",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Commissione dell'acquirente", "Taker fee": "Commissione dell'acquirente",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSatsバージョン", "RoboSats version": "RoboSatsバージョン",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "テイカー手数料", "Taker fee": "テイカー手数料",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Opłata takera", "Taker fee": "Opłata takera",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Taxa do tomador", "Taker fee": "Taxa do tomador",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Комиссия тейкера", "Taker fee": "Комиссия тейкера",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Takeravgift", "Taker fee": "Takeravgift",

View File

@ -268,6 +268,7 @@
"RoboSats version": "Toleo la RoboSats", "RoboSats version": "Toleo la RoboSats",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "Ada ya Kuchukua", "Taker fee": "Ada ya Kuchukua",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats version", "RoboSats version": "RoboSats version",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "ค่าธรรมเนียม Taker", "Taker fee": "ค่าธรรมเนียม Taker",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats 版本", "RoboSats version": "RoboSats 版本",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "吃单方费用", "Taker fee": "吃单方费用",

View File

@ -268,6 +268,7 @@
"RoboSats version": "RoboSats 版本", "RoboSats version": "RoboSats 版本",
"See PGP Key": "See PGP Key", "See PGP Key": "See PGP Key",
"Send Email": "Send Email", "Send Email": "Send Email",
"Simplex": "Simplex",
"Stats for Nerds": "Stats for Nerds", "Stats for Nerds": "Stats for Nerds",
"Summary": "Summary", "Summary": "Summary",
"Taker fee": "吃單方費用", "Taker fee": "吃單方費用",