-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* generate login modal icons from both apiEndpoint and nodeAddress * change the node icon in the navbar once nodeAddress is loaded * change the node icon in the navbar based on localStorage * better config overview * better format strategies hopr values * move save btn in config * open swagger and scallar ui * peers page, nodes and peers in 1 column * peer address and peer id in the same lines in subpages * cleanup * node-jazz * scalar icon changed * sortable tables * format * fix build errors * sort peers subpage * sort channels subpages * format * bold alias and alias page last seen * format
- Loading branch information
1 parent
4bc9775
commit dca88b3
Showing
25 changed files
with
655 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { useEffect } from 'react'; | ||
import { useAppDispatch, useAppSelector } from '../../store'; | ||
import { Link } from 'react-router-dom'; | ||
import styled from '@emotion/styled'; | ||
|
||
// HOPR Components | ||
import SmallActionButton from '../../future-hopr-lib-components/Button/SmallActionButton'; | ||
import { generateBase64Jazz } from '../../utils/functions'; | ||
|
||
//Mui | ||
import CopyIcon from '@mui/icons-material/ContentCopy'; | ||
import LaunchIcon from '@mui/icons-material/Launch'; | ||
|
||
interface Props { | ||
peerId?: string; | ||
nodeAddress?: string; | ||
shortenPeerId?: boolean; | ||
} | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
align-items: center; | ||
.node-jazz-icon { | ||
height: 30px; | ||
width: 30px; | ||
} | ||
`; | ||
|
||
const PeersInfo: React.FC<Props> = (props) => { | ||
const { peerId, nodeAddress, ...rest } = props; | ||
const aliases = useAppSelector((store) => store.node.aliases.data); | ||
const peerIdToAliasLink = useAppSelector((store) => store.node.links.peerIdToAlias); | ||
|
||
const getAliasByPeerId = (peerId: string): string | JSX.Element => { | ||
const shortPeerId = peerId && `${peerId.substring(0, 6)}...${peerId.substring(peerId.length - 8, peerId.length)}`; | ||
const displayPeerId = props.shortenPeerId ? shortPeerId : peerId; | ||
if (aliases && peerId && peerIdToAliasLink[peerId]) | ||
return ( | ||
<> | ||
<strong>{peerIdToAliasLink[peerId]}</strong> ({displayPeerId}) | ||
</> | ||
); | ||
return displayPeerId; | ||
}; | ||
|
||
const noCopyPaste = !( | ||
window.location.protocol === 'https:' || | ||
window.location.hostname === 'localhost' || | ||
window.location.hostname === '127.0.0.1' | ||
); | ||
|
||
const icon = nodeAddress && generateBase64Jazz(nodeAddress); | ||
|
||
return ( | ||
<Container> | ||
<img | ||
className={`node-jazz-icon node-jazz-icon-present`} | ||
src={icon || ''} | ||
data-src={nodeAddress} | ||
/> | ||
<div> | ||
<span>{peerId && getAliasByPeerId(peerId)}</span>{' '} | ||
<SmallActionButton | ||
onClick={() => navigator.clipboard.writeText(peerId as string)} | ||
disabled={noCopyPaste} | ||
tooltip={noCopyPaste ? 'Clipboard not supported on HTTP' : 'Copy Peer Id'} | ||
> | ||
<CopyIcon /> | ||
</SmallActionButton> | ||
<br /> | ||
<span>{nodeAddress}</span>{' '} | ||
<SmallActionButton | ||
onClick={() => navigator.clipboard.writeText(nodeAddress as string)} | ||
disabled={noCopyPaste} | ||
tooltip={noCopyPaste ? 'Clipboard not supported on HTTP' : 'Copy Node Address'} | ||
> | ||
<CopyIcon /> | ||
</SmallActionButton> | ||
<SmallActionButton tooltip={'Open in gnosisscan.io'}> | ||
<Link | ||
to={`https://gnosisscan.io/address/${nodeAddress}`} | ||
target="_blank" | ||
> | ||
<LaunchIcon /> | ||
</Link> | ||
</SmallActionButton> | ||
</div> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default PeersInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.