Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 21 additions & 0 deletions extension/src/popup/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import { About } from "popup/views/About";
import { SendPayment } from "popup/views/SendPayment";
import { ManageAssets } from "popup/views/ManageAssets";
import { VerifyAccount } from "popup/views/VerifyAccount";
import { Swap } from "popup/views/Swap";

import "popup/metrics/views";
import { DEV_SERVER } from "@shared/constants/services";
Expand Down Expand Up @@ -143,6 +144,23 @@ const UnlockAccountRoute = (props: RouteProps) => {
return <Route {...props} />;
};

export const VerifiedAccountRoute = (props: RouteProps) => {
const location = useLocation();
const hasPrivateKey = useSelector(hasPrivateKeySelector);

if (!hasPrivateKey) {
return (
<Redirect
to={{
pathname: ROUTES.verifyAccount,
state: { from: location },
}}
/>
);
}
return <Route {...props} />;
};

const HomeRoute = () => {
const allAccounts = useSelector(allAccountsSelector);
const applicationState = useSelector(applicationStateSelector);
Expand Down Expand Up @@ -281,6 +299,9 @@ export const Router = () => {
<PublicKeyRoute path={ROUTES.manageAssets}>
<ManageAssets />
</PublicKeyRoute>
<PublicKeyRoute path={ROUTES.swap}>
<Swap />
</PublicKeyRoute>
<HomeRoute />
{DEV_SERVER && (
<Route path={ROUTES.debug}>
Expand Down
3 changes: 3 additions & 0 deletions extension/src/popup/assets/icon-swap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion extension/src/popup/components/BottomNav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ROUTES } from "popup/constants/routes";
import HistoryIcon from "popup/assets/icon-history.svg";
import WalletIcon from "popup/assets/icon-wallet.svg";
import SettingsIcon from "popup/assets/icon-settings.svg";
import SwapIcon from "popup/assets/icon-swap.svg";

import "./styles.scss";

Expand All @@ -32,7 +33,9 @@ export const BottomNav = () => (
<BottomNavLink to={ROUTES.accountHistory}>
<img src={HistoryIcon} alt="history icon" />
</BottomNavLink>
{/* <img src={SwapIcon} alt="swap icon" /> */}
<BottomNavLink to={ROUTES.swap}>
<img src={SwapIcon} alt="swap icon" />
</BottomNavLink>
<BottomNavLink to={ROUTES.settings}>
<img src={SettingsIcon} alt="settings icon" />
</BottomNavLink>
Expand Down
32 changes: 7 additions & 25 deletions extension/src/popup/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import React from "react";
import { useSelector } from "react-redux";

import { settingsNetworkDetailsSelector } from "popup/ducks/settings";

import FreighterLogoLockup from "popup/assets/logo-lockup-freighter.svg";

Expand All @@ -11,25 +8,10 @@ interface HeaderProps {
isPopupView?: boolean;
}

export const Header = ({ isPopupView = false }: HeaderProps) => {
const { isTestnet, networkName } = useSelector(
settingsNetworkDetailsSelector,
);
return (
<header className={`Header ${isPopupView ? "Header__popup" : ""}`}>
<div className={isPopupView ? "" : "Header__fullscreen"}>
<img alt="Freighter logo" src={FreighterLogoLockup} />
{isPopupView ? null : (
<div className="Header__network">
<div
className={`Header__network__icon ${
isTestnet ? "Header__network__icon--testnet" : ""
}`}
/>
<div className="Header__network__name">{networkName}</div>
</div>
)}
</div>
</header>
);
};
export const Header = ({ isPopupView = false }: HeaderProps) => (
<header className={`Header ${isPopupView ? "Header__popup" : ""}`}>
<div className={isPopupView ? "" : "Header__fullscreen"}>
<img alt="Freighter logo" src={FreighterLogoLockup} />
</div>
</header>
);
27 changes: 0 additions & 27 deletions extension/src/popup/components/Header/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,4 @@
margin: 0 auto;
max-width: var(--fullscreen--max-width);
}

&__network {
background: var(--pal-background-secondary);
border-radius: 8rem;
align-items: center;
display: flex;
padding: 0.5rem 0.875rem;

&__icon {
background: var(--pal-success);
border-radius: 2rem;
height: 0.6875rem;
margin-right: 0.5rem;
position: relative;
width: 0.6875rem;

&--testnet {
background: var(--pal-warning);
}
}

&__name {
font-size: 0.875rem;
font-weight: var(--font-weight-medium);
text-transform: uppercase;
}
}
}
Loading