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

remove homepage elements #638

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 0 additions & 17 deletions .env-cmdrc
Original file line number Diff line number Diff line change
@@ -1,17 +0,0 @@
{
"development": {
"REACT_APP_IS_HOME_SITE": false
},
"development-home": {
"REACT_APP_IS_HOME_SITE": true
},
"development-app": {
"REACT_APP_IS_HOME_SITE": false
},
"production-home": {
"REACT_APP_IS_HOME_SITE": true
},
"production-app": {
"REACT_APP_IS_HOME_SITE": false
}
}
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@
},
"scripts": {
"start": "PORT=3010 react-app-rewired start",
"start-home": "yarn lingui:prepare && PORT=3010 env-cmd -e development-home react-app-rewired start",
"start-app": "yarn lingui:prepare && PORT=3011 env-cmd -e development-app react-app-rewired start",
"start-app": "yarn lingui:prepare && PORT=3011 react-app-rewired start",
"start-win": "set PORT=3010&react-app-rewired start",
"build": "INLINE_RUNTIME_CHUNK=false react-app-rewired build",
"build-home": "INLINE_RUNTIME_CHUNK=false env-cmd -e production-home react-app-rewired build",
"build-app": "INLINE_RUNTIME_CHUNK=false env-cmd -e production-app react-app-rewired build",
"build-app": "INLINE_RUNTIME_CHUNK=false react-app-rewired build",
"test": "react-app-rewired test",
"test:ci": "react-app-rewired test --watchAll=false --transformIgnorePatterns \"node_modules/(?!@wagmi)/\"",
"eject": "react-scripts eject",
Expand Down
314 changes: 131 additions & 183 deletions src/App/App.js

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions src/components/EventToast/useEventToast.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { useLocalStorage } from "react-use";
import toast from "react-hot-toast";
import { homeEventsData, appEventsData } from "config/events";
import { appEventsData } from "config/events";
import { useEffect } from "react";
import EventToast from "./EventToast";
import { isFuture, parse } from "date-fns";
import { isHomeSite } from "lib/legacy";

function useEventToast() {
const isHome = isHomeSite();
const [visited, setVisited] = useLocalStorage("visited-announcements", []);

useEffect(() => {
const eventsData = isHome ? homeEventsData : appEventsData;

eventsData
appEventsData
.filter((event) => event.isActive)
.filter((event) => isFuture(parse(event.validTill + ", +00", "d MMM yyyy, H:mm, x", new Date())))
.filter((event) => Array.isArray(visited) && !visited.includes(event.id))
Expand All @@ -37,7 +33,7 @@ function useEventToast() {
}
);
});
}, [visited, setVisited, isHome]);
}, [visited, setVisited]);
}

export default useEventToast;
9 changes: 3 additions & 6 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import React from "react";
import cx from "classnames";
import "./Footer.css";
import logoImg from "img/ic_gmx_footer.svg";
import { NavLink } from "react-router-dom";
import { isHomeSite, getAppBaseUrl, shouldShowRedirectModal } from "lib/legacy";
import { getAppBaseUrl, shouldShowRedirectModal } from "lib/legacy";
import { getFooterLinks, SOCIAL_LINKS } from "./constants";
import ExternalLink from "components/ExternalLink/ExternalLink";

type Props = { showRedirectModal?: (to: string) => void; redirectPopupTimestamp?: () => void };

export default function Footer({ showRedirectModal, redirectPopupTimestamp }: Props) {
const isHome = isHomeSite();

return (
<div className="Footer">
<div className={cx("Footer-wrapper", { home: isHome })}>
<div className="Footer-wrapper">
<div className="Footer-logo">
<img src={logoImg} alt="MetaMask" />
</div>
Expand All @@ -28,7 +25,7 @@ export default function Footer({ showRedirectModal, redirectPopupTimestamp }: Pr
})}
</div>
<div className="Footer-links">
{getFooterLinks(isHome).map(({ external, label, link, isAppLink }) => {
{getFooterLinks().map(({ external, label, link, isAppLink }) => {
if (external) {
return (
<ExternalLink key={label} href={link} className="Footer-link">
Expand Down
19 changes: 5 additions & 14 deletions src/components/Footer/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,11 @@ type SocialLink = {
icon: string;
};

export function getFooterLinks(isHome) {
const FOOTER_LINKS: { home: Link[]; app: Link[] } = {
home: [
{ label: t`Terms and Conditions`, link: "/terms-and-conditions" },
{ label: t`Referral Terms`, link: "/referral-terms" },
{ label: t`Media Kit`, link: "https://docs.gmx.io/docs/community/media-kit", external: true },
// { label: "Jobs", link: "/jobs", isAppLink: true },
],
app: [
{ label: t`Media Kit`, link: "https://docs.gmx.io/docs/community/media-kit", external: true },
// { label: "Jobs", link: "/jobs" },
],
};
return FOOTER_LINKS[isHome ? "home" : "app"];
export function getFooterLinks(): Link[] {
return [
{ label: t`Media Kit`, link: "https://docs.gmx.io/docs/community/media-kit", external: true },
// { label: "Jobs", link: "/jobs" },
];
}

export const SOCIAL_LINKS: SocialLink[] = [
Expand Down
46 changes: 12 additions & 34 deletions src/components/Header/AppHeaderLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,17 @@ import { FiX } from "react-icons/fi";
import { Trans } from "@lingui/macro";
import { Link } from "react-router-dom";

import { HeaderLink } from "./HeaderLink";
import "./Header.css";
import { isHomeSite } from "lib/legacy";
import ExternalLink from "components/ExternalLink/ExternalLink";
import logoImg from "img/logo_GMX.svg";

type Props = {
small?: boolean;
clickCloseIcon?: () => void;
openSettings?: () => void;
redirectPopupTimestamp: number;
showRedirectModal: (to: string) => void;
};

export function AppHeaderLinks({
small,
openSettings,
clickCloseIcon,
redirectPopupTimestamp,
showRedirectModal,
}: Props) {
export function AppHeaderLinks({ small, openSettings, clickCloseIcon }: Props) {
return (
<div className="App-header-links">
{small && (
Expand All @@ -40,48 +30,36 @@ export function AppHeaderLinks({
</div>
)}
<div className="App-header-link-container">
<HeaderLink
to="/dashboard"
redirectPopupTimestamp={redirectPopupTimestamp}
showRedirectModal={showRedirectModal}
>
<Link to="/dashboard">
<Trans>Dashboard</Trans>
</HeaderLink>
</Link>
</div>
<div className="App-header-link-container">
<HeaderLink to="/earn" redirectPopupTimestamp={redirectPopupTimestamp} showRedirectModal={showRedirectModal}>
<Link to="/earn">
<Trans>Earn</Trans>
</HeaderLink>
</Link>
</div>
<div className="App-header-link-container">
<HeaderLink to="/buy" redirectPopupTimestamp={redirectPopupTimestamp} showRedirectModal={showRedirectModal}>
<Link to="/buy">
<Trans>Buy</Trans>
</HeaderLink>
</Link>
</div>
<div className="App-header-link-container">
<HeaderLink
to="/referrals"
redirectPopupTimestamp={redirectPopupTimestamp}
showRedirectModal={showRedirectModal}
>
<Link to="/referrals">
<Trans>Referrals</Trans>
</HeaderLink>
</Link>
</div>
<div className="App-header-link-container">
<HeaderLink
to="/ecosystem"
redirectPopupTimestamp={redirectPopupTimestamp}
showRedirectModal={showRedirectModal}
>
<Link to="/ecosystem">
<Trans>Ecosystem</Trans>
</HeaderLink>
</Link>
</div>
<div className="App-header-link-container">
<ExternalLink href="https://docs.gmx.io/">
<Trans>Docs</Trans>
</ExternalLink>
</div>
{small && !isHomeSite() && (
{small && (
<div className="App-header-link-container">
{/* eslint-disable-next-line */}
<a href="#" onClick={openSettings}>
Expand Down
77 changes: 24 additions & 53 deletions src/components/Header/AppHeaderUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@ import { ARBITRUM, ARBITRUM_GOERLI, AVALANCHE, AVALANCHE_FUJI, getChainName } fr
import { isDevelopment } from "config/env";
import { getIcon } from "config/icons";
import { useChainId } from "lib/chains";
import { getAccountUrl, isHomeSite } from "lib/legacy";
import LanguagePopupHome from "../NetworkDropdown/LanguagePopupHome";
import { getAccountUrl } from "lib/legacy";
import NetworkDropdown from "../NetworkDropdown/NetworkDropdown";
import "./Header.css";
import { HeaderLink } from "./HeaderLink";
import useWallet from "lib/wallets/useWallet";
import { useConnectModal } from "@rainbow-me/rainbowkit";
import { Link } from "react-router-dom";

type Props = {
openSettings: () => void;
small?: boolean;
disconnectAccountAndCloseSettings: () => void;
redirectPopupTimestamp: number;
showRedirectModal: (to: string) => void;
tradePageVersion: number;
};

Expand Down Expand Up @@ -55,18 +52,10 @@ if (isDevelopment()) {
});
}

export function AppHeaderUser({
openSettings,
small,
disconnectAccountAndCloseSettings,
redirectPopupTimestamp,
showRedirectModal,
tradePageVersion,
}: Props) {
export function AppHeaderUser({ openSettings, small, disconnectAccountAndCloseSettings, tradePageVersion }: Props) {
const { chainId } = useChainId();
const { active, account } = useWallet();
const { openConnectModal } = useConnectModal();
const showConnectionOptions = !isHomeSite();

const tradeLink = tradePageVersion === 1 ? "/trade" : "/v2";

Expand All @@ -75,18 +64,13 @@ export function AppHeaderUser({
if (!active || !account) {
return (
<div className="App-header-user">
<div className={cx("App-header-trade-link", { "homepage-header": isHomeSite() })}>
<HeaderLink
className="default-btn"
to={tradeLink!}
redirectPopupTimestamp={redirectPopupTimestamp}
showRedirectModal={showRedirectModal}
>
{isHomeSite() ? <Trans>Launch App</Trans> : <Trans>Trade</Trans>}
</HeaderLink>
<div className="App-header-trade-link">
<Link className="default-btn" to={tradeLink!}>
<Trans>Trade</Trans>
</Link>
</div>

{showConnectionOptions && openConnectModal ? (
{openConnectModal && (
<>
<ConnectWalletButton onClick={openConnectModal} imgSrc={connectWalletImg}>
{small ? <Trans>Connect</Trans> : <Trans>Connect Wallet</Trans>}
Expand All @@ -98,8 +82,6 @@ export function AppHeaderUser({
openSettings={openSettings}
/>
</>
) : (
<LanguagePopupHome />
)}
</div>
);
Expand All @@ -110,35 +92,24 @@ export function AppHeaderUser({
return (
<div className="App-header-user">
<div className={cx("App-header-trade-link")}>
<HeaderLink
className="default-btn"
to={tradeLink!}
redirectPopupTimestamp={redirectPopupTimestamp}
showRedirectModal={showRedirectModal}
>
{isHomeSite() ? <Trans>Launch App</Trans> : <Trans>Trade</Trans>}
</HeaderLink>
<Link className="default-btn" to={tradeLink!}>
<Trans>Trade</Trans>
</Link>
</div>

{showConnectionOptions ? (
<>
<div className="App-header-user-address">
<AddressDropdown
account={account}
accountUrl={accountUrl}
disconnectAccountAndCloseSettings={disconnectAccountAndCloseSettings}
/>
</div>
<NetworkDropdown
small={small}
networkOptions={NETWORK_OPTIONS}
selectorLabel={selectorLabel}
openSettings={openSettings}
/>
</>
) : (
<LanguagePopupHome />
)}
<div className="App-header-user-address">
<AddressDropdown
account={account}
accountUrl={accountUrl}
disconnectAccountAndCloseSettings={disconnectAccountAndCloseSettings}
/>
</div>
<NetworkDropdown
small={small}
networkOptions={NETWORK_OPTIONS}
selectorLabel={selectorLabel}
openSettings={openSettings}
/>
</div>
);
}