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,
BadgeLimits,
NostrIcon,
SimplexIcon,
} from '../Icons';
import { AppContext } from '../../contexts/AppContext';
import { systemClient } from '../../services/System';
@ -76,6 +77,7 @@ const ContactButtons = ({
telegram,
twitter,
matrix,
simplex,
website,
reddit,
}: Contact): JSX.Element => {
@ -215,6 +217,16 @@ const ContactButtons = ({
</Tooltip>
</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>
);
};
@ -712,7 +724,10 @@ const CoordinatorDialog = ({ open = false, onClose, coordinator, network }: Prop
}}
>
{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>
</ListItemText>
</ListItem>
@ -733,7 +748,10 @@ const CoordinatorDialog = ({ open = false, onClose, coordinator, network }: Prop
}}
>
{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>
</ListItemText>
</ListItem>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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