Skip to content

Commit

Permalink
updage: links
Browse files Browse the repository at this point in the history
  • Loading branch information
w84april committed Nov 20, 2024
1 parent ef932eb commit 14cac0c
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 60 deletions.
2 changes: 1 addition & 1 deletion apps/common/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function AppHeader(props: {supportedNetworks: Chain[]}): ReactElement {
const [isMenuOpen, set_isMenuOpen] = useState<boolean>(false);

const menu = useMemo((): TMenu[] => {
const HOME_MENU = {path: '/', label: 'Home'};
const HOME_MENU = {path: '/apps', label: 'Apps'};

if (pathname.startsWith('/ycrv')) {
return [HOME_MENU, ...APPS[AppName.YCRV].menu];
Expand Down
4 changes: 2 additions & 2 deletions apps/common/components/MobileNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {ReactElement} from 'react';
export function MobileNavbar({onClose}: {onClose: VoidFunction}): ReactElement {
const pathName = usePathname();

const currentTab = pathName?.startsWith('/home/') ? pathName?.split('/')[2] : '/';
const currentTab = pathName?.startsWith('/apps') ? pathName?.split('/')[2] : '/';
return (
<div
className={
Expand All @@ -25,7 +25,7 @@ export function MobileNavbar({onClose}: {onClose: VoidFunction}): ReactElement {
currentTab === tab.route ? 'text-white' : 'text-gray-400'
)}
onClick={onClose}
href={tab.route === '/' ? tab.route : `/home/${tab.route}`}>
href={tab.route === '/apps' ? tab.route : `/apps/${tab.route}`}>
<div className={'flex size-6 items-center justify-center'}>
{iconsDict[tab.route as keyof typeof iconsDict]}
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/common/components/MobileTopNav.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {type ReactElement, useCallback} from 'react';
import {useRouter} from 'next/router';
import {useSearch} from '@common/contexts/useSearch';
import {IconBurgerPlain} from '@common/icons/IconBurgerPlain';
import {IconCross} from '@common/icons/IconCross';
import {IconSearch} from '@common/icons/IconSearch';
import {LogoYearn} from '@common/icons/LogoYearn';

import {SearchBar} from './SearchBar';
import {IconBurgerPlain} from '@common/icons/IconBurgerPlain';

export function MobileTopNav({
isSearchOpen,
Expand All @@ -26,7 +26,7 @@ export function MobileTopNav({
if (!configuration.searchValue) {
return;
}
router.push(`/home/search?query=${configuration.searchValue}`);
router.push(`/apps/search/${encodeURIComponent(configuration.searchValue)}`);
}, [configuration.searchValue, router]);

return (
Expand Down
8 changes: 4 additions & 4 deletions apps/common/components/ModalMobileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {TMenu} from '@yearn-finance/web-lib/components/Header';

export function FooterNav(): ReactElement {
const menu = useMemo((): TMenu[] => {
const HOME_MENU = {path: '/', label: 'Home'};
const HOME_MENU = {path: '/apps', label: 'Apps'};

return [
HOME_MENU,
Expand Down Expand Up @@ -48,19 +48,19 @@ export function FooterNav(): ReactElement {
</div>
<div className={'flex items-center gap-6'}>
<Link
href={'/'}
href={'https://paragraph.xyz/@yearn'}
target={'_blank'}
className={'flex items-center gap-x-4'}>
<IconParagraph className={'size-8 transition-colors hover:text-primary'} />
</Link>
<Link
href={'/'}
href={'https://discord.com/invite/b8ENPNqG5c'}
target={'_blank'}
className={'flex items-center gap-x-4'}>
<IconDiscord className={'size-8 transition-colors hover:text-primary'} />
</Link>
<Link
href={'/'}
href={'https://x.com/yearnfi'}
target={'_blank'}
className={'flex items-center gap-x-4'}>
<IconTwitter className={'size-8 transition-colors hover:text-primary'} />
Expand Down
14 changes: 9 additions & 5 deletions apps/common/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export function Sidebar(props: TSidebarProps): ReactElement {
const router = useRouter();
const {configuration, dispatch} = useSearch();

const currentTab = pathName?.startsWith('/home/') ? pathName?.split('/')[2] : '/';
const currentTab = pathName?.startsWith('/apps') ? pathName?.split('/')[2] : '/';

const onSearchClick = useCallback(() => {
if (!configuration.searchValue) {
router.push('/');
router.push('/apps');
return;
}
router.push(`/home/search/${encodeURIComponent(configuration.searchValue)}`);
router.push(`/apps/search/${encodeURIComponent(configuration.searchValue)}`);
}, [configuration.searchValue, router]);

return (
Expand Down Expand Up @@ -64,10 +64,14 @@ export function Sidebar(props: TSidebarProps): ReactElement {
'py-2 px-[28px] flex gap-4 text-base hover:bg-gray-600/40',
currentTab === tab.route ? 'text-white font-bold' : 'text-gray-400'
)}
href={tab.route === '/' ? tab.route : `/home/${tab.route}`}
href={tab.route === '/apps' ? tab.route : `/apps/${tab.route}`}
key={tab.route}>
<div className={'flex size-6 items-center justify-center'}>
{iconsDict[tab.route as '/' | 'community-apps' | 'vaults' | 'yearn-x' | 'integrations']}
{
iconsDict[
tab.route as '/apps' | 'community-apps' | 'vaults' | 'yearn-x' | 'integrations'
]
}
</div>
<p>{tab.title}</p>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion apps/common/utils/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export const CATEGORY_PAGE_FILTERS = [
];

export const iconsDict = {
'/': <IconYearn />,
'/apps': <IconYearn />,
about: <IconAbout />,
vaults: <IconVaults />,
'community-apps': <IconFrontends />,
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function LandingAppHeader(): ReactElement {
const [isMenuOpen, set_isMenuOpen] = useState<boolean>(false);

const menu = useMemo((): TMenu[] => {
const HOME_MENU = {path: '/home', label: 'Home'};
const HOME_MENU = {path: '/apps', label: 'Apps'};

return [
HOME_MENU,
Expand Down
36 changes: 9 additions & 27 deletions apps/landing/components/sections/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Link from 'next/link';

import {Button} from '../common/Button';

import type {ReactElement} from 'react';
Expand All @@ -8,34 +10,14 @@ export function Form(): ReactElement {
className={'flex max-w-6xl flex-col items-center pt-[160px]'}
id={'form'}>
<p className={'text-left font-aeonikFono text-3xl font-light text-white md:text-center md:text-5xl'}>
{'SUBMIT YOUR APP IDEA OR INTEGRATION'}
{'SUBMIT YOUR APP OR INTEGRATION'}
</p>
<form className={'mt-10 flex w-full max-w-[480px] flex-col gap-4'}>
<input
className={'h-[56px] rounded-lg border bg-transparent px-4'}
type={'text'}
placeholder={'Name'}
name={'name'}
/>
<input
className={'h-[56px] rounded-lg border bg-transparent px-4'}
type={'text'}
placeholder={'TG tag'}
name={'tgTag'}
/>
<input
className={'h-[56px] rounded-lg border bg-transparent px-4'}
type={'text'}
placeholder={'Project name'}
name={'projectName'}
/>
<textarea
className={'h-[152px] resize-none rounded-lg border bg-transparent px-4'}
placeholder={'Description'}
name={'description'}
/>
<Button className={'mt-6'}>{'SUBMIT'}</Button>
</form>
<Link
href={'https://forms.gle/S8rL8ZviGsaxZ1LYA'}
className={'mt-10 w-full max-w-[480px]'}
target={'_blank'}>
<Button className={'mt-6 w-full'}>{'SUBMIT YOUR APP'}</Button>
</Link>
</div>
);
}
4 changes: 2 additions & 2 deletions apps/landing/components/sections/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function Hero(): ReactElement {
</p>
</div>
<div className={'mt-[72px] flex gap-2 md:mt-[48px] lg:mt-[72px]'}>
<Link href={'/home'}>
<Link href={'/apps'}>
<Button className={'w-[192px] px-[15px]'}>{'DISCOVER PRODUCTS'}</Button>
</Link>
<Button
Expand Down Expand Up @@ -171,7 +171,7 @@ export function Hero(): ReactElement {
<div className={'mt-10 flex w-full flex-col gap-2'}>
<Link
className={'w-full'}
href={'/'}>
href={'/apps'}>
<Button className={'w-full px-[15px]'}>{'DISCOVER PRODUCTS'}</Button>
</Link>
<Button
Expand Down
8 changes: 4 additions & 4 deletions apps/landing/components/sections/WaysToEarn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function WaysToEarn(): ReactElement {
</p>
<div className={'mt-10 grid grid-flow-row grid-cols-12 grid-rows-10 gap-6 md:h-[480px] md:grid-flow-col'}>
<Link
href={'/home'}
href={'/apps'}
className={
'group relative col-span-12 row-span-4 overflow-hidden rounded-lg border border-[#292929] p-6 transition-colors md:col-span-7 md:row-span-12 md:p-10'
}
Expand Down Expand Up @@ -79,18 +79,18 @@ export function WaysToEarn(): ReactElement {
title={'COMMUNITY APPS.'}
info={'Apps built on Yearn vaults by contributors and the wider community!'}
logoSrc={'/landing/community-logo.png'}
href={'/home/community-apps'}
href={'/apps/community-apps'}
hoverLogoSrc={'/landing/community-hover.png'}
/>
</div>
<div className={'col-span-12 row-span-3 md:col-span-5 md:row-span-6'}>
<EarnCard
title={'INTEGRATIONS'}
title={'INTEGRATIONS.'}
info={
'Yearn Vaults are a core part of DeFi, and you can access them through many popular apps and UIs.'
}
logoSrc={'/landing/integrations.png'}
href={'/home/integrations'}
href={'/apps/integrations'}
hoverLogoSrc={'/landing/integrations-hover.png'}
/>
</div>
Expand Down
8 changes: 4 additions & 4 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ const WithLayout = memo(function WithLayout(
const {name} = useCurrentApp(props.router);
const [isSearchOpen, set_isSearchOpen] = useState(false);
const [isNavbarOpen, set_isNavbarOpen] = useState(false);
const isHomepage = props.router.asPath?.startsWith('/home');
const isAppsPage = props.router.asPath?.startsWith('/apps');
const pathName = usePathname();

if (isHomepage) {
if (isAppsPage) {
return (
<SearchContextApp>
<div
id={'app'}
className={'font-aeonik mb-0 flex min-h-screen justify-center bg-gray-900'}>
className={'mb-0 flex min-h-screen justify-center bg-gray-900 font-aeonik'}>
<div className={'flex w-full max-w-[1230px] justify-start'}>
<motion.nav className={'fixed z-50 w-full md:hidden'}>
<MobileTopNav
Expand Down Expand Up @@ -167,7 +167,7 @@ function MyApp(props: AppProps): ReactElement {
og={manifest.og || 'https://yearn.fi/og.png'}
uri={manifest.uri || 'https://yearn.fi'}
/>
<main className={'font-aeonik size-full min-h-screen'}>
<main className={'size-full min-h-screen font-aeonik'}>
<PlausibleProvider
domain={'yearn.fi'}
enabled={true}>
Expand Down
2 changes: 1 addition & 1 deletion pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MyDocument extends Document {

render(): ReactElement {
const {route} = this.props as any;
const isLanding = route === '/' || route.startsWith('/home/');
const isLanding = route.startsWith('/apps');
return (
<Html
lang={'en'}
Expand Down
2 changes: 1 addition & 1 deletion pages/home/[category].tsx → pages/apps/[category].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {TApp} from '@common/types/category';
export default function Index(props: {router: NextRouter}): ReactElement {
const [shuffledApps, set_shuffledApps] = useState<TApp[]>();
const currentCatrgory = useMemo(() => {
const currentTab = props.router.asPath?.startsWith('/home/') ? props.router.asPath?.split('/')[2] : '/';
const currentTab = props.router.asPath?.startsWith('/apps') ? props.router.asPath?.split('/')[2] : '/';
return CATEGORIES_DICT[currentTab as keyof typeof CATEGORIES_DICT];
}, [props.router.asPath]);

Expand Down
8 changes: 4 additions & 4 deletions pages/home/index.tsx → pages/apps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ export default function Home(): ReactElement {
<div className={'flex flex-col gap-10'}>
<CategorySection
title={'Vaults'}
onExpandClick={async () => router.push('/home/vaults')}
onExpandClick={async () => router.push('/apps/vaults')}
apps={VAULTS_APPS}
/>
<CategorySection
title={'Community Apps'}
onExpandClick={async () => router.push('/home/community-apps')}
onExpandClick={async () => router.push('/apps/community-apps')}
apps={COMMUNITY_APPS}
/>
<CategorySection
title={'Yearn X Projects'}
onExpandClick={async () => router.push('/home/yearn-x')}
onExpandClick={async () => router.push('/apps/yearn-x')}
apps={YEARN_X_APPS}
/>
<CategorySection
title={'Integrations'}
onExpandClick={async () => router.push('/home/integrations')}
onExpandClick={async () => router.push('/apps/integrations')}
apps={INTEGRATIONS_APPS}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function SeachResults(): ReactElement {
{`Hmm, we couldn't find what you're looking for, did you spell it right? Try again or go`}{' '}
<Link
className={'text-white hover:underline'}
href={'/'}>
href={'/apps'}>
{'home'}
</Link>
</p>
Expand Down

0 comments on commit 14cac0c

Please sign in to comment.