Skip to content

Commit

Permalink
Feat/v3 main (#443)
Browse files Browse the repository at this point in the history
* feat: wip v3

* feat: v3 design

* fix: some ui mistakes

* feat: v3 design

* fix: UI

* fix: padding

* fix: wip

* fix: some UI fix

* feat: design

* fix: adapt paddings

* fix: spacing

* fix: design

* fix: search

* fix: some clearning

* fix: remove withdrawal fee

* fix: staking

* wip

* feat: deposit/redeem

* fix: 1

* fix: responsiveness

* fix: animate spin bg

* fix: improve entrance animation

* fix: remove bolt

* fix: only v3

* feat: wip

* fix: toast

* fix: pre-tests

* fix: remove dead code

* fix: registry with kind

* feat: new registry

* feat: icon

* fix: deposit

* feat: add maxLoss popover & hide vaults tab when no subvault

* feat: yieldOnTime

* fix: remove retired/migrated from v3

* fix: deposited amountv3

* fix: linting

* fix: chain

* feat: add link to explorer

* feat: add message

* style: upd header

* copy: change copy of instant yield

* style: update spacing on desktop

* style: change banner warning text color

* copy: change copy for headline

* fix: veYFI refresh and stop-color

* perf: hook optimization and pagination

* fix: pagination

* fix: prefetch & img

* perf: improve global performances

* fix: adjust size

* fix: not use 137

* fix: use filteredChains

* chores: code splitting

* fix: upd hook refres dependencies

* perf: change token icons size for 32px

* fix: imports

* fix: staking data feat

* feat: reenable prefetching

* feat: add yprisma

* fix: remove opt reward file as data automated from yDaemon (#415)

* deps: remove use-query-params, not working properly with framer motion and not required

* fix: change yPrisma asset url

* fix: upd assets

* fix: use base_yearn_assets_uri

* refactor: v3 Vaults About Section (#422)

* feat: Add new vaults about page

* feat: Add about page menu

* chore: yarn.lock

* refactor: Fewer clicks to select a single network (#423)

* refactor: Fewer clicks to select a single network

* Feat/ext 5 (#424)

* nit: change stop-opacity in svg to stopOpacity

* fix: improve query url state + fix no select select all

* lint: fix ts lint

* chores: add pre-commit hook to catch ts errors

* fix: replace undefined with null

---------

Co-authored-by: Majorfi <[email protected]>

---------

Co-authored-by: Major <[email protected]>
Co-authored-by: Majorfi <[email protected]>

* fix: disable eth for non wETH vault & fix zapWith

* feat: Tooltip for earnings [PRO-119] (#425)

* Fix flashing sign (#428)

* fix: flashing of staking contract

* fix: flashing of staking contract

---------

Co-authored-by: Majorfi <[email protected]>

* feat: display staked

* feat: enable polygon fetching for v3 | rename table labels | add deposited & tvl instead of just TVL | filter out polygon for v2

* feat: display NEW when APR type includes new

* fix: link to explorer sometime out

* fix: invalid perf fee on v3

* fix: asset quality by using 128 instead of 32

* chores: update asset URL + sizes

* fix: balance endpoint

* fix: description should use vault description as primary souce

* fix: minor UI update

* fix: size of input

* fix: improve portals error message

* fix: hide low tvl removal

* fix: error message and vault list order

* fix: search

* fix: some mobile issues

* feat: display new when APR is new

* fix: search system

* feat: remove support for Wido solver (#435)

Co-authored-by: Majorfi <[email protected]>

* Feat/upgrade portals to v2 (#441)

* feat: remove support for Wido solver

* feat: upgrade portals solver to V2

---------

Co-authored-by: Majorfi <[email protected]>

* fix: error message missing margin top

* feat: add Changelog commit hook

* chore: bump some packages

* fix: searchbar uncontrolled

* fix: vault list no results

* fix: reset for queryArgs

* chore: set APR as new when it's new

* chore: set polygon only in vault display for V3

* chore: re-add card on the index page

* style: extra padding on top of TVL

* style: update some colors and fix v3 bg

* style: update some colors and fix v3 bg

* chore: move vault-v3 to plain v3. Update popover

* fix: add back icon

* fix: extra zap slippage /100 on portals

* style: update popover header colors

* fix: searchbar display

* feat: enable properly portals for zap with native token

* fix: display outputValue

* fix: pricing system

* fix: avoid scientific notation in OPBoost page

---------

Co-authored-by: Majorfi <[email protected]>
Co-authored-by: Karelian Pie <[email protected]>
  • Loading branch information
3 people authored Nov 30, 2023
1 parent b083643 commit 9165839
Show file tree
Hide file tree
Showing 160 changed files with 8,023 additions and 4,791 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
indent: 'off',
'no-multi-spaces': ['error', {ignoreEOLComments: false}],
'@typescript-eslint/indent': 0,
'@typescript-eslint/consistent-type-assertions': 0,
'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'],
'object-curly-newline': [
'error',
Expand Down
10 changes: 9 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
if git status -s | grep -q "CHANGELOG"; then
npx lint-staged
exit 0
else
echo
echo "❌ CHANGELOG Not Updated."
echo
exit 1
fi
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.ts|*.tsx": ["yarn prettier-format", "eslint"],
"*.ts|*.tsx": ["yarn prettier-format", "yarn eslint --quiet --fix", "bash -c tsc --noEmit"],
"*.scss|*.css": "yarn prettier-format"
}
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# 0.3.0 (x/12/2023)

- Build: Release the V3 vaults.
- Build: Release the multichain config.
- Fix: The zap balances fetching to use the multichain endpoint rather than the currently connected one.
- Fix: On some 404 pages, the error message was positioned incorrectly (top) and needed to be centered.
- Chore: Add the Changelog commit hook to enforce the changelog update on commit.
- Deps: Deprecate Wido due to project end-of-life.
- Deps: Bump Portals solver to V2 version.
- Deps: Bump various packages.
- Nit: SearchBar using uncontrolled input.
- Fix: When searching for vaults in a aggregator vault and the search input give no match, the component was moving to "this vault is a strategy" instead of staying in the "no match" state.
- Fix: Add an `onReset` function in the `useQueryArguments` hook to be able to reset the query arguments to their default values.
- Chore: Use `New` for APR when it's tagged as new.
- Fix: On V3, we only display Polygon for now, as the V3 vaults are polygon only.
- Fix: Add Card for V3 on the index page.
- Nit: Minor CSS fixes on TVL display on Mobile for V3.
- Fix: Add the V3 line in the popover menu & fix some hook issue around the V3 color scheme. Adapt the color scheme to the Dark, Light and V3.
- Rename path `vault-v3` to simple `v3`.
- Fix: Portals zap slippage too low.
- Fix: Searchbar on the vault details page was removed if the search was not giving any result.
- Feat: Accept native coin for Portals Zap.
- Fix: Balance refresh not refreshing properly.
- Fix: Update the zap schema from yDaemon
- Fix: For portals, uses `OutputValue` instead of `MinOutputValue` for display.
- Fix: The price system was mixed-chain, not multi-chain
- Fix: Avoid decimal notations in the OP boost page

# 0.1.25 (28/08/2023)

- Gauge voting for veYFI under the `gauge-voting` feature flag
Expand Down
193 changes: 108 additions & 85 deletions apps/common/components/AppHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import {cloneElement, Fragment, useMemo, useState} from 'react';
import {cloneElement, useMemo, useState} from 'react';
import Link from 'next/link';
import {useRouter} from 'next/router';
import {AnimatePresence} from 'framer-motion';
import {Popover, Transition} from '@headlessui/react';
import {useIsMounted} from '@react-hookz/web';
import {VaultsHeader} from '@vaults/components/header/VaultsHeader';
import {VaultsV3Header} from '@vaults-v3/components/header/VaultsHeader';
import {V3Logo} from '@vaults-v3/Mark';
import {VeYfiHeader} from '@veYFI/components/header/VeYfiHeader';
import {Header} from '@yearn-finance/web-lib/components/Header';
import {Renderable} from '@yearn-finance/web-lib/components/Renderable';
import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3';
import {BalanceReminderPopover} from '@common/components/BalanceReminderPopover';
import {ImageWithFallback} from '@common/components/ImageWithFallback';
import {cl} from '@yearn-finance/web-lib/utils/cl';
import {useMenu} from '@common/contexts/useMenu';
import {useCurrentApp} from '@common/hooks/useCurrentApp';
import {LogoYearn} from '@common/icons/LogoYearn';
import {YBalHeader} from '@yBal/components/header/YBalHeader';
import {YBribeHeader} from '@yBribe/components/header/YBribeHeader';
Expand All @@ -33,6 +32,7 @@ function Logo(): ReactElement {
<VaultsHeader pathname={pathname} />
<VeYfiHeader pathname={pathname} />
<YBribeHeader pathname={pathname} />
<VaultsV3Header pathname={pathname} />
<MotionDiv
name={'yearn'}
animate={pathname === '/' ? 'enter' : 'exit'}>
Expand All @@ -48,82 +48,118 @@ function Logo(): ReactElement {

function LogoPopover(): ReactElement {
const [isShowing, set_isShowing] = useState(false);

const YETH = {
name: 'yETH',
href: 'https://yeth.yearn.fi',
isDisabled: false,
icon: (
<ImageWithFallback
alt={'yETH'}
className={'h-8 w-8'}
width={100}
height={100}
src={`${process.env.BASE_YEARN_ASSETS_URI}/1/0x1BED97CBC3c24A4fb5C069C6E311a967386131f7/logo-128.png`}
loading={'eager'}
priority
/>
)
};
const router = useRouter();
const {name: currentAppName} = useCurrentApp(router);

return (
<Popover
onMouseEnter={(): void => set_isShowing(true)}
onMouseLeave={(): void => set_isShowing(false)}
className={'relative'}>
<Popover.Button className={'flex items-center'}>
<Link href={'/'}>
<span className={'sr-only'}>{'Back to home'}</span>
<Logo />
</Link>
</Popover.Button>
<Transition
as={Fragment}
show={isShowing}
enter={'transition ease-out duration-200'}
enterFrom={'opacity-0 translate-y-1'}
enterTo={'opacity-100 translate-y-0'}
leave={'transition ease-in duration-150'}
leaveFrom={'opacity-100 translate-y-0'}
leaveTo={'opacity-0 translate-y-1'}>
<Popover.Panel
className={'absolute left-1/2 z-10 mt-6 w-80 -translate-x-1/2 px-4 pt-4 sm:px-0 md:w-96'}>
<div className={'overflow-hidden border border-neutral-200 shadow-lg'}>
<div className={'relative grid grid-cols-2 bg-neutral-0 md:grid-cols-3'}>
{[...Object.values(APPS), YETH]
.filter(({isDisabled}): boolean => !isDisabled)
.map(({name, href, icon}): ReactElement => {
return (
<>
<Popover
onMouseEnter={(): void => set_isShowing(true)}
onMouseLeave={(): void => set_isShowing(false)}>
<div
onClick={(): void => set_isShowing(false)}
onMouseEnter={(): void => set_isShowing(false)}
className={cl(
'fixed inset-0 bg-neutral-900 backdrop-blur-sm transition-opacity',
!isShowing ? 'opacity-0 pointer-events-none' : 'opacity-50 pointer-events-auto'
)}
/>
<Popover.Button className={'z-20 flex items-center'}>
<Link href={'/'}>
<span className={'sr-only'}>{'Back to home'}</span>
<Logo />
</Link>
</Popover.Button>

<Transition.Root show={isShowing}>
<Transition.Child
as={'div'}
enter={'transition ease-out duration-200'}
enterFrom={'opacity-0 translate-y-1'}
enterTo={'opacity-100 translate-y-0'}
leave={'transition ease-in duration-150'}
leaveFrom={'opacity-100 translate-y-0'}
leaveTo={'opacity-0 translate-y-1'}
className={'relative z-[9999999]'}>
<Popover.Panel
className={'absolute left-1/2 z-20 w-80 -translate-x-1/2 px-4 pt-6 sm:px-0 md:w-[560px]'}>
<div className={'overflow-hidden pt-4 shadow-xl'}>
<div
className={cl(
'relative grid grid-cols-2 gap-2 border p-6 md:grid-cols-5',
currentAppName === 'V3'
? 'bg-[#000520] border-neutral-200/60 rounded-sm'
: 'bg-[#F4F4F4] dark:bg-[#282828] border-transparent'
)}>
<div className={'col-span-3 grid grid-cols-2 gap-2 md:grid-cols-3'}>
{[...Object.values(APPS)]
.filter(({isDisabled}): boolean => !isDisabled)
.filter(({name}): boolean => name !== 'V3')
.map(({name, href, icon}): ReactElement => {
return (
<Link
prefetch={false}
key={name}
href={href}
onClick={(): void => set_isShowing(false)}>
<div
onClick={(): void => set_isShowing(false)}
className={cl(
'flex cursor-pointer border flex-col items-center justify-center transition-colors p-4',
currentAppName !== 'V3'
? 'bg-[#EBEBEB] border-transparent hover:bg-[#c3c3c380] dark:bg-[#0C0C0C] hover:dark:bg-[#3d3d3d80]'
: 'bg-[#000520] hover:bg-[#33374d80] border-[#151C40]'
)}>
<div>{cloneElement(icon, {className: 'w-8 h-8'})}</div>
<div className={'pt-2 text-center'}>
<b className={'text-base'}>{name}</b>
</div>
</div>
</Link>
);
})}
</div>
<div className={'col-span-2 grid grid-cols-2 gap-2 md:grid-cols-3'}>
<Link
prefetch={false}
key={name}
href={href}
key={currentAppName}
href={'/v3'}
className={'col-span-3 row-span-2'}
onClick={(): void => set_isShowing(false)}>
<div
onClick={(): void => set_isShowing(false)}
className={
'flex cursor-pointer flex-col items-center p-4 transition-colors hover:bg-neutral-200'
}>
<div>{cloneElement(icon)}</div>
<div className={'pt-2 text-center'}>
<b className={'text-base'}>{name}</b>
className={cl(
'relative flex h-full w-full cursor-pointer flex-col items-center justify-center transition-all rounded-sm p-4',
currentAppName !== 'V3'
? 'bg-[#EBEBEB] hover:bg-[#c3c3c380] dark:bg-[#0C0C0C] hover:dark:bg-[#3d3d3d80]'
: 'bg-[#010A3B] hover:brightness-125'
)}>
<div className={'z-10 flex w-full flex-col items-center'}>
<V3Logo className={'h-20'} />
<div className={'-mb-2 pt-4 text-center'}>
<p
className={cl(
'font-bold text-black dark:text-white text-sm',
'whitespace-break-spaces'
)}>
{`Discover\nBrand New Vaults`}
</p>
</div>
</div>
</div>
</Link>
);
})}
</div>
</div>
</Popover.Panel>
</Transition>
</Popover>
</div>
</div>
</div>
</Popover.Panel>
</Transition.Child>
</Transition.Root>
</Popover>
</>
);
}

export function AppHeader(): ReactElement {
const isMounted = useIsMounted();
const {pathname} = useRouter();
const {isActive} = useWeb3();
const {onOpenMenu} = useMenu();
const menu = useMemo((): TMenu[] => {
const HOME_MENU = {path: '/', label: 'Home'};
Expand All @@ -136,6 +172,10 @@ export function AppHeader(): ReactElement {
return [HOME_MENU, ...APPS[AppName.YBAL].menu];
}

if (pathname.startsWith('/v3')) {
return [HOME_MENU, ...APPS[AppName.VAULTSV3].menu];
}

if (pathname.startsWith('/vaults')) {
return [HOME_MENU, ...APPS[AppName.VAULTS].menu];
}
Expand All @@ -159,35 +199,18 @@ export function AppHeader(): ReactElement {
];
}, [pathname]);

const supportedNetworks = useMemo((): number[] => {
const ethereumOnlyPaths = ['/ycrv', '/ybal', '/veyfi', '/ybribe'];
if (ethereumOnlyPaths.some((path): boolean => pathname.startsWith(path))) {
return [1];
}

return [1, 10, 250, 42161];
}, [pathname]);

return (
<Header
showNetworkSelector={false}
linkComponent={<Link href={''} />}
currentPathName={pathname}
onOpenMenuMobile={onOpenMenu}
nav={menu}
supportedNetworks={supportedNetworks}
logo={
<AnimatePresence mode={'wait'}>
<LogoPopover />
</AnimatePresence>
}
extra={
<Renderable shouldRender={isActive && isMounted()}>
<div className={'ml-4'}>
<BalanceReminderPopover />
</div>
</Renderable>
}
/>
);
}
Loading

1 comment on commit 9165839

@vercel
Copy link

@vercel vercel bot commented on 9165839 Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.