11import React , { useEffect , useState } from 'react' ;
22import tw from 'twin.macro' ;
3- import { faCircle , faHdd , faMemory , faMicrochip , faServer } from '@fortawesome/free-solid-svg-icons' ;
3+ import { faCircle , faEthernet , faHdd , faMemory , faMicrochip , faServer } from '@fortawesome/free-solid-svg-icons' ;
44import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
55import { bytesToHuman , megabytesToHuman } from '@/helpers' ;
66import TitledGreyBox from '@/components/elements/TitledGreyBox' ;
77import { ServerContext } from '@/state/server' ;
8+ import CopyOnClick from '@/components/elements/CopyOnClick' ;
89
910interface Stats {
1011 memory : number ;
@@ -49,6 +50,9 @@ const ServerDetailsBlock = () => {
4950
5051 const name = ServerContext . useStoreState ( state => state . server . data ! . name ) ;
5152 const limits = ServerContext . useStoreState ( state => state . server . data ! . limits ) ;
53+ const primaryAllocation = ServerContext . useStoreState ( state => state . server . data ! . allocations . filter ( alloc => alloc . isDefault ) . map (
54+ allocation => allocation . alias + ':' + allocation . port || allocation . ip + ':' + allocation . port
55+ ) ) . toString ( ) ;
5256
5357 const disklimit = limits . disk ? megabytesToHuman ( limits . disk ) : 'Unlimited' ;
5458 const memorylimit = limits . memory ? megabytesToHuman ( limits . memory ) : 'Unlimited' ;
@@ -66,6 +70,12 @@ const ServerDetailsBlock = () => {
6670 />
6771 { ! status ? 'Connecting...' : status }
6872 </ p >
73+ < CopyOnClick text = { primaryAllocation } >
74+ < p css = { tw `text-xs mt-2` } >
75+ < FontAwesomeIcon icon = { faEthernet } fixedWidth css = { tw `mr-1` } />
76+ < code css = { tw `ml-1` } > { primaryAllocation } </ code >
77+ </ p >
78+ </ CopyOnClick >
6979 < p css = { tw `text-xs mt-2` } >
7080 < FontAwesomeIcon icon = { faMicrochip } fixedWidth css = { tw `mr-1` } /> { stats . cpu . toFixed ( 2 ) } %
7181 </ p >
0 commit comments