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

Tong/refine UI 1 #374

Merged
merged 9 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/playwright-report/
/blob-report/
/playwright/.cache/
/out/
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/footer-rectangle-dark.svg
supertong marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/footer-rectangle-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/app/components/Connect/ConnectSmall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const ConnectSmall: React.FC<ConnectSmallProps> = ({
const ref = useRef(null);
useOnClickOutside(ref, handleClickOutside);

const { coinName, networkName } = getNetworkConfig();
const { coinName } = getNetworkConfig();
const { isApiNormal, isGeoBlocked, apiMessage } = useHealthCheck();

// Renders the Tooltip describing the reason
Expand Down Expand Up @@ -146,7 +146,7 @@ export const ConnectSmall: React.FC<ConnectSmallProps> = ({
disabled={Boolean(address) || !isApiNormal}
>
<PiWalletBold size={20} className="flex md:hidden" />
<span className="hidden md:flex">Connect to {networkName} network</span>
<span className="hidden md:flex">Connect Wallets</span>
</button>
{!isApiNormal && renderApiNotAvailableTooltip()}
</div>
Expand Down
73 changes: 41 additions & 32 deletions src/app/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Image from "next/image";
import {
BsDiscord,
BsGithub,
Expand All @@ -10,6 +11,8 @@ import { GoHome } from "react-icons/go";
import { IoMdBook } from "react-icons/io";
import { MdAlternateEmail, MdForum } from "react-icons/md";

import babylonIcon from "@/app/assets/logo-white.svg";

const iconLinks = [
{
name: "Website",
Expand Down Expand Up @@ -65,44 +68,50 @@ const iconLinks = [

export const Footer: React.FC = () => {
return (
<div className="container mx-auto flex flex-col items-center">
<div className="w-24">
<div className="divider my-1" />
</div>
<div className="flex justify-center gap-8 p-2">
<a
href="https://babylonlabs.io/terms-of-use"
target="_blank"
rel="noopener noreferrer"
className="transition-colors hover:text-primary"
>
Terms of Use
</a>
<a
href="https://babylonlabs.io/privacy-policy"
target="_blank"
rel="noopener noreferrer"
className="transition-colors hover:text-primary"
>
Privacy Policy
</a>
</div>
<div className="flex flex-wrap justify-center gap-8 p-4 pt-2 md:flex-row md:p-6 md:pt-2">
{iconLinks.map(({ name, url, Icon }) => (
<div
key={name}
className="flex w-4 items-center justify-center text-[22px] text-xl"
>
<div className="hidden md:flex bg-footer-texture-light dark:bg-footer-texture-dark bg-[length:100%_100%] h-[238px] text-white">
<div className="container mx-auto flex flex-row items-center justify-around">
<div className="flex flex-col">
<div className="flex flex-wrap justify-center gap-8 p-4 pt-2 md:flex-row md:p-6 md:pt-2">
{iconLinks.map(({ name, url, Icon }) => (
<div
key={name}
className="flex w-4 items-center justify-center text-[22px] text-xl"
>
<a
href={url}
target="_blank"
rel="noopener noreferrer"
className="transition-colors hover:text-primary"
>
<Icon title={name} />
</a>
</div>
))}
</div>
<div>
<a
href="https://babylonlabs.io/terms-of-use"
target="_blank"
rel="noopener noreferrer"
className="transition-colors hover:text-primary"
>
Terms of Use
</a>{" "}
-{" "}
<a
href={url}
href="https://babylonlabs.io/privacy-policy"
target="_blank"
rel="noopener noreferrer"
className="transition-colors hover:text-primary"
>
<Icon title={name} />
</a>
Privacy Policy
</a>{" "}
- 2024 Babylon Labs. All rights reserved.
</div>
))}
</div>
<div>
<Image src={babylonIcon} alt="babylon" />
</div>
</div>
</div>
);
Expand Down
47 changes: 25 additions & 22 deletions src/app/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useWalletConnection } from "@/app/context/wallet/WalletConnectionProvid
import { useAppState } from "@/app/state";
import { shouldDisplayTestingMsg } from "@/config";

import { ConnectSmall } from "../Connect/ConnectSmall";
import { ConnectedSmall } from "../Connect/ConnectedSmall";
import { ConnectSmall } from "../Connect/ConnectSmall";
import { Logo } from "../Logo/Logo";
import { TestingInfo } from "../TestingInfo/TestingInfo";
import { ThemeToggle } from "../ThemeToggle/ThemeToggle";
Expand All @@ -16,8 +16,8 @@ export const Header = () => {

return (
<nav>
<div className="bg-base-300 shadow-sm">
<div className="container mx-auto flex w-full items-center justify-between gap-4 p-6 pb-4 md:pb-6">
<section className="bg-primary-main dark:bg-[#181818] h-[300px] mb-[-188px]">
supertong marked this conversation as resolved.
Show resolved Hide resolved
<div className="container h-[84px] py-[22px] px-6 mx-auto flex items-center justify-between">
<Logo />
<div className="flex flex-1">
{shouldDisplayTestingMsg() && (
Expand All @@ -26,26 +26,29 @@ export const Header = () => {
</div>
)}
</div>
<ConnectSmall
loading={loading}
onConnect={open}
address={address}
btcWalletBalanceSat={totalBalance}
onDisconnect={disconnect}
/>
<ThemeToggle />
</div>
<div
className={`${address && "justify-end p-6 pt-0"}container mx-auto flex w-full items-center gap-4 md:hidden md:p-0`}
>
<ConnectedSmall
loading={loading}
address={address}
btcWalletBalanceSat={totalBalance}
onDisconnect={disconnect}
/>
<div className="flex items-center gap-4">
<ConnectSmall
loading={loading}
onConnect={open}
address={address}
btcWalletBalanceSat={totalBalance}
onDisconnect={disconnect}
/>
<ThemeToggle />
</div>
<div
className={`${address && "justify-end p-6 pt-0"}container mx-auto flex w-full items-center gap-4 md:hidden md:p-0`}
supertong marked this conversation as resolved.
Show resolved Hide resolved
>
<ConnectedSmall
loading={loading}
address={address}
btcWalletBalanceSat={totalBalance}
onDisconnect={disconnect}
/>
</div>
</div>
</div>
</section>

{shouldDisplayTestingMsg() && (
<div className="container mx-auto flex w-full items-center p-6 pb-0 xl:hidden">
<TestingInfo />
Expand Down
16 changes: 8 additions & 8 deletions src/app/components/Header/SimplifiedHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { TestingInfo } from "../TestingInfo/TestingInfo";
export const SimplifiedHeader = () => {
return (
<nav>
<div className="bg-base-300 shadow-sm">
<div className="container mx-auto flex w-full items-center justify-between gap-4 p-6 pb-4 md:pb-6">
<section className="bg-primary-main dark:bg-[#181818] h-[300px] mb-[-188px]">
<div className="container h-[84px] py-[22px] px-6 mx-auto flex items-center justify-between">
supertong marked this conversation as resolved.
Show resolved Hide resolved
<Logo />
<div className="flex flex-1">
{shouldDisplayTestingMsg() && (
Expand All @@ -17,12 +17,12 @@ export const SimplifiedHeader = () => {
)}
</div>
</div>
</div>
{shouldDisplayTestingMsg() && (
<div className="container mx-auto flex w-full items-center p-6 pb-0 xl:hidden">
<TestingInfo />
</div>
)}
{shouldDisplayTestingMsg() && (
<div className="container mx-auto flex w-full items-center p-6 pb-0 xl:hidden">
<TestingInfo />
</div>
)}
</section>
</nav>
);
};
22 changes: 2 additions & 20 deletions src/app/components/Logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
import { useTheme } from "next-themes";
import Image from "next/image";
import { useEffect, useState } from "react";

import darkLogo from "@/app/assets/logo-black.svg";
import lightLogo from "@/app/assets/logo-white.svg";
import logo from "@/app/assets/logo-white.svg";

interface LogoProps {}

export const Logo: React.FC<LogoProps> = () => {
const [mounted, setMounted] = useState(false);
const { resolvedTheme } = useTheme();
const lightSelected = resolvedTheme === "light";

// useEffect only runs on the client, so now we can safely show the UI
useEffect(() => {
setMounted(true);
}, []);

// uses placeholder of babylon logo with primary color
// since before theme is resolved, we don't know which logo to show
if (!mounted) {
return <div className="h-[40px] w-[159px]" />;
}

return (
<div className="flex">
<Image src={lightSelected ? darkLogo : lightLogo} alt="Babylon" />
<Image src={logo} alt="Babylon" />
</div>
);
};
1 change: 1 addition & 0 deletions src/app/global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function GlobalError({
network === Network.MAINNET
? "main-app-mainnet"
: "main-app-testnet",
"bg-primary-contrast dark:bg-[#1E1E1E]",
)}
>
<GenericError />
Expand Down
20 changes: 0 additions & 20 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,6 @@ input[type="number"] {
width: 1px !important;
}

[data-theme="dark"] .main-app-mainnet {
background: rgb(43, 43, 43) url("./assets/bg-pattern.svg") left top/auto
repeat;
}

[data-theme="light"] .main-app-mainnet {
background: rgb(236, 236, 236) url("./assets/bg-pattern.svg") left top/auto
repeat;
}

[data-theme="dark"] .main-app-testnet {
background: rgb(43, 43, 43) url("./assets/testnet-bg-pattern.svg") left
top/auto repeat;
}

[data-theme="light"] .main-app-testnet {
background: rgb(236, 236, 236) url("./assets/testnet-bg-pattern.svg") left
top/auto repeat;
}

[data-theme="dark"] .react-responsive-modal-modal {
background-color: #1e1e1e;
color: #fff;
Expand Down
1 change: 1 addition & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function RootLayout({
network === Network.MAINNET
? "main-app-mainnet"
: "main-app-testnet",
"bg-primary-contrast dark:bg-[#1E1E1E]",
)}
>
{children}
Expand Down
12 changes: 11 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@ const config: Config = {
screens: screenBreakPoints,
extend: {
colors: {
primary: "#FF7C2A",
primary: {
DEFAULT: "#000000DE",
main: "#042F40",
dark: "#12495E",
light: "#387085",
contrast: "#F5F7F2",
},
secondary: "#0DB7BF",
"base-400": "hsl(var(--base-400) / <alpha-value>)",
},
gridTemplateColumns: {
stakingFinalityProvidersMobile: "2fr 1fr",
stakingFinalityProvidersDesktop: "2fr 1.5fr 2fr 0.75fr 0.75fr",
},
backgroundImage: {
"footer-texture-light": "url(/footer-rectangle-light.svg)",
"footer-texture-dark": "url(/footer-rectangle-dark.svg)",
},
},
},
plugins: [require("daisyui")],
Expand Down