Skip to content

Commit

Permalink
build: hides new user banner and shows distrobution date for the user (
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-garrett authored Dec 11, 2024
1 parent 28afa60 commit 4a5cf3b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 66 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/containers/App/AppLayoutRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ThemeProvider } from '@mui/material/styles';
import {
FeatureLoader,
Footer,
CustomBanner,
// CustomBanner,
} from '@notional-finance/shared-web';
import {
Header,
Expand Down Expand Up @@ -58,7 +58,7 @@ const AppLayoutRoute = ({
<MetaTagManager metaTagCategory={slicedPath} />
)}
<AppShell>
<CustomBanner />
{/* <CustomBanner /> */}
<Header>
<WalletSelector />
</Header>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import { TokenBalance } from '@notional-finance/core-entities';
import {
checkStarterBoostToken,
formatCryptoWithFiat,
formatNumberAsPercent,
formatNumberAsPercentWithUndefined,
formatTokenType,
getHoldingsSortOrder,
} from '@notional-finance/helpers';
import { H4, LinkText } from '@notional-finance/mui';
import { LaunchIcon, RocketIcon } from '@notional-finance/icons';
import { H4 } from '@notional-finance/mui';
import { RocketIcon } from '@notional-finance/icons';
import {
useFiatToken,
useNOTE,
useAppState,
usePendingPnLCalculation,
usePortfolioHoldings,
useSelectedNetwork,
useNotionalContext,
} from '@notional-finance/notionable-hooks';
import {
boostEndDate,
getDateString,
Network,
PORTFOLIO_ACTIONS,
RATE_PRECISION,
starterBoostDistributionDate,
TXN_HISTORY_TYPE,
} from '@notional-finance/util';
import { useMemo } from 'react';
Expand All @@ -34,9 +32,6 @@ export function useDetailedHoldingsTable() {
const network = useSelectedNetwork();
const holdings = usePortfolioHoldings(network);
const theme = useTheme();
const {
globalState: { isStarterBoostUser },
} = useNotionalContext();
const pendingTokens = usePendingPnLCalculation(network).flatMap(
({ tokens }) => tokens
);
Expand Down Expand Up @@ -116,10 +111,6 @@ export function useDetailedHoldingsTable() {
const isDebt = b.isNegative();
const { icon, formattedTitle, titleWithMaturity, title } =
formatTokenType(b.token, isDebt, true);
const isStarterBoost = checkStarterBoostToken(
b.underlying.symbol,
isStarterBoostUser
);
const marketApy = marketYield?.totalAPY;
const noteIncentives = marketYield?.noteIncentives?.incentiveAPY;
const secondaryIncentives =
Expand Down Expand Up @@ -151,57 +142,30 @@ export function useDetailedHoldingsTable() {
},
];

if (isStarterBoost && !isDebt) {
const boostValue = s?.accumulatedCostRealized?.mulInRatePrecision(
Math.floor((0.05 / 52) * RATE_PRECISION)
);
const currentDate = new Date();

// NOTE: Temporary hashKey check for one new user boost user
if (
b.hashKey ===
'0x5ae5b2bb9c4eb5945c56ae69f4d891fd2e498407b18a3b0e3028e4d6e1b35857'
) {
subRowData.push({
label: (
<FormattedMessage defaultMessage={'STARTER BOOST BONUS'} />
),
value:
currentDate >= boostEndDate ? (
<LinkText
// TODO: ADD DISTRIBUTION LINK
href={''}
sx={{
cursor: 'pointer',
display: 'flex',
alignItems: 'flex-start',
}}
>
<Box component={'span'}>
<FormattedMessage defaultMessage={'See Distribution'} />
</Box>
<LaunchIcon
sx={{
marginLeft: theme.spacing(0.5),
value: (
<H4 sx={{ display: 'flex', alignItems: 'center' }}>
<RocketIcon sx={{ marginRight: theme.spacing(0.5) }} />
<Box component={'span'}>
<FormattedMessage
defaultMessage={'Distribution: {endDate}'}
values={{
endDate: getDateString(
starterBoostDistributionDate.getTime() / 1000
),
}}
/>
</LinkText>
) : (
<H4 sx={{ display: 'flex', alignItems: 'center' }}>
<RocketIcon
sx={{
marginRight: theme.spacing(0.5),
height: theme.spacing(2.5),
width: theme.spacing(2.5),
}}
/>
<Box
component={'span'}
sx={{
marginLeft: theme.spacing(0.5),
display: 'flex',
alignItems: 'center',
}}
>
{boostValue?.toDisplayStringWithSymbol() || '-'}
</Box>
</H4>
),
</Box>
</H4>
),
});
}

Expand Down
8 changes: 2 additions & 6 deletions packages/shared/web/src/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function Header({ children }: HeaderProps) {
: appTheme;
const { navLinks } = useNavLinks(false, theme);
const {
globalState: { networkAccounts, isStarterBoostUser },
globalState: { networkAccounts },
} = useNotionalContext();

const subGraphError =
Expand Down Expand Up @@ -71,11 +71,7 @@ export function Header({ children }: HeaderProps) {

return (
<ThemeProvider theme={theme}>
<AppBar
position="fixed"
showBorder={pathname !== '/'}
showBanner={isStarterBoostUser && pathname.includes('portfolio')}
>
<AppBar position="fixed" showBorder={pathname !== '/'}>
<Toolbar
sx={{
'&.MuiToolbar-root': {
Expand Down
1 change: 1 addition & 0 deletions packages/util/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export enum Network {
}

export const boostEndDate = new Date('2024-12-10T23:59:59Z');
export const starterBoostDistributionDate = new Date('2025-01-15T23:59:59Z');
export const boostEndDateString = getDateString(boostEndDate.getTime() / 1000);

export const NetworkId: Record<Network, number> = {
Expand Down

0 comments on commit 4a5cf3b

Please sign in to comment.