Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(ui-ux): added liquidity overview screen #794

Merged
merged 22 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7ed2c83
feature(ui-ux): added liquidity overview screen
fullstackninja864 Mar 21, 2023
a1bc05a
added Link component
fullstackninja864 Mar 21, 2023
e49454d
added Disclosure for mobile view
fullstackninja864 Mar 21, 2023
f555084
removed env variables
fullstackninja864 Mar 21, 2023
26b03f2
removed unused api endpoint
fullstackninja864 Mar 21, 2023
a81110e
lint fix
fullstackninja864 Mar 21, 2023
cac5eb9
fixed width in small screen
fullstackninja864 Mar 21, 2023
f2e5400
renamed router
fullstackninja864 Mar 22, 2023
48297d7
Merge branch 'main' of github.com:WavesHQ/bridge into harsh/liquidity…
fullstackninja864 Mar 22, 2023
3fb8527
added tool tip and added fetch balances on network change
fullstackninja864 Mar 22, 2023
63152a1
Merge branch 'main' into harsh/liquidityOverview
kyleleow Mar 23, 2023
54aff64
minor ui updates
fullstackninja864 Mar 23, 2023
973ac4f
Merge branch 'harsh/liquidityOverview' of github.com:WavesHQ/bridge i…
fullstackninja864 Mar 23, 2023
cb8dbf9
hide navigation when bridge is down
fullstackninja864 Mar 23, 2023
0fa5ae8
desc update
fullstackninja864 Mar 23, 2023
a8b8b45
Merge branch '1.9.0' into harsh/liquidityOverview
fullstackninja864 Mar 23, 2023
1370a5f
minor fix
fullstackninja864 Mar 23, 2023
f8a5074
Merge branch 'harsh/liquidityOverview' of github.com:WavesHQ/bridge i…
fullstackninja864 Mar 23, 2023
60df6ac
minor updates
fullstackninja864 Mar 23, 2023
87aa727
updated hotWalletAddress to HotWalletAddress
fullstackninja864 Mar 23, 2023
1bf0947
Merge branch '1.9.0' into harsh/liquidityOverview
kyleleow Mar 24, 2023
27437c0
chore: update dfi label on ethereum
kyleleow Mar 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion apps/web/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import Image from "next/image";
import Link from "next/link";
import ConnectButton from "./ConnectButton";
import Banner from "./Banner";
import Navigation from "./Navigation";

export default function Header(): JSX.Element {
export default function Header({
isBridgeUp,
}: {
isBridgeUp: boolean;
}): JSX.Element {
return (
<div className="relative z-[1] flex flex-col">
<Banner />
Expand All @@ -18,10 +23,20 @@ export default function Header(): JSX.Element {
/>
</div>
</Link>
{isBridgeUp && (
<div className="hidden lg:block">
<Navigation />
</div>
)}
<div className="flex h-9 items-center md:h-10 lg:h-12">
<ConnectButton />
</div>
</div>
{isBridgeUp && (
<div className="lg:hidden px-5 md:px-10 mb-6 md:mb-12">
<Navigation />
</div>
)}
</div>
);
}
44 changes: 44 additions & 0 deletions apps/web/src/components/Link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* eslint-disable no-restricted-imports */
import { LinkProps as NextLinkProps } from "next/dist/client/link";
import { useRouter } from "next/router";
import NextLink from "next/link";
import { PropsWithChildren } from "react";
import { UrlObject } from "url";
import { useNetworkEnvironmentContext } from "@contexts/NetworkEnvironmentContext";

export interface LinkUrlObject extends UrlObject {
query?: Record<string, string>;
}

interface LinkProps extends NextLinkProps {
href: LinkUrlObject;
}

/**
* Overrides the default next/link to provide ability to 'keep ?network= query string'.
* This allows `<Link>` usage to be network agnostic where ?network= are automatically appended.
*
* To keep implementation simple, LinkProps enforce href to be strictly a `UrlObject` object
* where query is a `Record<string, string>`. Hence only use this for internal linking.
*
* @param {PropsWithChildren<LinkProps>} props
*/
export function Link(props: PropsWithChildren<LinkProps>): JSX.Element {
const { children, href } = props;
const router = useRouter();
const networkQuery = router.query.network;

const { networkEnv } = useNetworkEnvironmentContext();
if (networkQuery) {
href.query = {
...(href.query ?? {}),
network: networkEnv,
};
}

return (
<NextLink passHref {...props} legacyBehavior>
{children}
</NextLink>
);
}
33 changes: 33 additions & 0 deletions apps/web/src/components/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import clsx from "clsx";
import { useRouter } from "next/router";
import { Link } from "./Link";

export default function Navigation() {
const router = useRouter();
const isRoot = router.pathname === "/";

return (
<div className="flex flex-row rounded-[40px] bg-dark-100 p-1 border-[0.5px] border-dark-300/50">
<Link href={{ pathname: "/" }}>
<a
className={clsx(
"w-1/2 text-xs md:text-sm py-3 min-w-[136px] text-center font-semibold rounded-[40px]",
isRoot ? "bg-dark-1000 text-dark-00" : "text-dark-1000"
)}
>
Bridge
</a>
</Link>
<Link href={{ pathname: "/liquidity" }}>
<a
className={clsx(
"w-1/2 text-xs md:text-sm py-3 min-w-[136px] text-center font-semibold rounded-[40px]",
!isRoot ? "bg-dark-1000 text-dark-00" : "text-dark-1000"
)}
>
Liquidity
</a>
</Link>
</div>
);
}
Loading