Skip to content

Commit

Permalink
chore(rxPage): fix layout
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed Mar 25, 2024
1 parent 9e93ec0 commit 2675efc
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 59 deletions.
2 changes: 1 addition & 1 deletion plugins/lime-plugin-rx/src/rxPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Page = ({}) => {
<Fragment>
<div
className={
"my-0 flex flex-col justify-between items-center -translate-y-6 container container-padded"
"flex flex-col items-center -translate-y-6 w-full max-w-screen-md mx-auto"
}
>
<InternetPath />
Expand Down
121 changes: 65 additions & 56 deletions plugins/lime-plugin-rx/src/sections/alignment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ function stripIface(hostIface) {
}

export const AlignmentCard = ({ status }: { status: StatusResponse }) => {
const hasMostActive = !!status.most_active?.iface;
const { data: bathost } = useBatHost(
status.most_active && status.most_active.station_mac,
status.most_active && status.most_active.iface,
{ enabled: !!status.most_active }
{ enabled: hasMostActive }
);

const traffic = Math.round(
Expand All @@ -31,51 +32,61 @@ export const AlignmentCard = ({ status }: { status: StatusResponse }) => {
1024
);
return (
<div className={"flex flex-row mt-6"}>
<div className={"flex-1 text-7xl text-center text-primary"}>
<SignalColor
className={"font-bold"}
signal={+status.most_active.signal}
/>
<div className={"text-3xl"}>
{status.most_active?.chains &&
status.most_active.chains.map((chain, i) => (
<span key={i}>
<SignalColor
className={"font-bold"}
signal={chain}
/>
{i !== status.most_active.chains.length - 1 &&
" / "}
<div className={"flex flex-row mt-6 justify-between md:px-8"}>
{hasMostActive && (
<>
<div className={"flex-1 text-7xl text-center text-primary"}>
<SignalColor
className={"font-bold"}
signal={+status.most_active.signal}
/>
<div className={"text-3xl"}>
{status.most_active?.chains &&
status.most_active.chains.map((chain, i) => (
<span key={i}>
<SignalColor
className={"font-bold"}
signal={chain}
/>
{i !==
status.most_active.chains.length -
1 && " / "}
</span>
))}
</div>
</div>
<div className={"flex-1 flex flex-col text-xl "}>
<div className={"font-bold"}>
<Trans>Most active link</Trans>
</div>
<div className={"text-primary font-bold"}>
{bathost && bathost.hostname ? (
<span>{stripIface(bathost.hostname)}</span>
) : (
<span className="withLoadingEllipsis">
<Trans>Fetching name</Trans>
</span>
)}
</div>
<div className={""}>
<Trans>Interface: </Trans>
<span className={"font-bold"}>
{status.most_active.iface}
</span>
))}
</div>
<div className={""}>
<Trans>Traffic: </Trans>
<span className={"font-bold"}> {traffic}MB/s</span>
</div>
</div>
</>
)}
{!hasMostActive && (
<div className={"flex-1 flex justify-center"}>
No most active iface
</div>
</div>
<div className={"flex-1 flex flex-col text-xl "}>
<div className={"font-bold"}>
<Trans>Most active link</Trans>
</div>
<div className={"text-primary font-bold"}>
{bathost && bathost.hostname ? (
<span>{stripIface(bathost.hostname)}</span>
) : (
<span className="withLoadingEllipsis">
<Trans>Fetching name</Trans>
</span>
)}
</div>
<div className={""}>
<Trans>Interface: </Trans>
<span className={"font-bold"}>
{status.most_active.iface}
</span>
</div>
<div className={""}>
<Trans>Traffic: </Trans>
<span className={"font-bold"}> {traffic}MB/s</span>
</div>
</div>
<div className={"flex-1 flex justify-center"}>
)}
<div className={"flex justify-center"}>
<Button size={"lg"} color={"secondary"} href={"#/align"}>
<Trans>
Check
Expand All @@ -98,18 +109,16 @@ export const Alignment = () => {
}
>
<Section>
<div>
<SectionTitle
icon={<AlignIcon className={IconsClassName} />}
>
<Trans>Your Alignment</Trans>
</SectionTitle>
{isLoading ? (
<span>Loading...</span>
) : (
<AlignmentCard status={status} />
)}
</div>
<SectionTitle icon={<AlignIcon className={IconsClassName} />}>
<Trans>Your Alignment</Trans>
</SectionTitle>
{isLoading ? (
<div className={"flex-1 flex justify-center"}>
Loading...
</div>
) : (
<AlignmentCard status={status} />
)}
</Section>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions plugins/lime-plugin-rx/src/sections/internetPath.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const InternetPath = () => {
let pathComponent = (
<div
className={
"flex-1 full flex flex-column text-center text-lg text-disabled justify-content-center align-items-center mt-5 gap-4"
"flex-1 flex flex-column text-center text-lg text-disabled justify-content-center align-items-center mt-5 gap-4"
}
>
<Loading />
Expand All @@ -90,7 +90,7 @@ export const InternetPath = () => {
pathComponent = (
<div
className={
"flex-1 full flex flex-column text-center text-lg text-disabled justify-content-center align-items-center mt-5 gap-4"
"flex-1 flex flex-column text-center text-lg text-disabled justify-content-center align-items-center mt-5 gap-4"
}
>
<GlobeIcon
Expand Down

0 comments on commit 2675efc

Please sign in to comment.