-
Notifications
You must be signed in to change notification settings - Fork 2
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
update AppLayout #419
Merged
Merged
update AppLayout #419
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f7587e6
update AppLayout
EmilMalanczak 248b353
update NotSupportedWarning
EmilMalanczak 7357e1a
add layout background
EmilMalanczak 4426544
disable migration banner feature flag
EmilMalanczak c31edf1
change wrong topbar backdrop
EmilMalanczak 1a70d0e
fix topbar zindex
EmilMalanczak f903f60
fix sandbox mode issues
EmilMalanczak f0e2e45
shrink layout max width
EmilMalanczak 6db4f5d
update all pages layouts
EmilMalanczak 565394f
fix e2e tests
EmilMalanczak 1640b74
fix e2e tests
EmilMalanczak bb014a4
remove topbar sticky position
EmilMalanczak d8d72fb
add compact layout todo note
EmilMalanczak 39518bc
make topbar accessible on not supported view
EmilMalanczak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
packages/app/src/ui/atoms/sky-migration-top-banner/SkyMigrationTopBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
import { cx } from 'class-variance-authority' | ||
import { useState } from 'react' | ||
|
||
import { usePageChainId } from '@/domain/hooks/usePageChainId' | ||
import { useBannerVisibility } from '@/domain/state/bannersVisibility' | ||
import { useOpenDialog } from '@/domain/state/dialogs' | ||
import { selectNetworkDialogConfig } from '@/features/dialogs/select-network/SelectNetworkDialog' | ||
import { Navbar } from '@/features/navbar/Navbar' | ||
import { TopbarContainer } from '@/features/topbar/TopbarContainer' | ||
import { cn } from '@/ui/utils/style' | ||
import { | ||
SKY_MIGRATION_TOP_BANNER_ID, | ||
SkyMigrationTopBanner, | ||
} from '../../atoms/sky-migration-top-banner/SkyMigrationTopBanner' | ||
import { LayoutBackground } from './components/LayoutBackground' | ||
import { PageNotSupportedWarning } from './components/PageNotSupportedWarning' | ||
|
||
interface AppLayoutProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export function AppLayout({ children }: AppLayoutProps) { | ||
const [mobileMenuCollapsed, setMobileMenuCollapsed] = useState(true) | ||
const { pageSupported, pageName } = usePageChainId() | ||
const { handleCloseBanner, showBanner } = useBannerVisibility(SKY_MIGRATION_TOP_BANNER_ID) | ||
const openDialog = useOpenDialog() | ||
|
||
return ( | ||
<div className={cn('flex min-h-screen flex-col')}> | ||
<div | ||
className={cn( | ||
'grid min-h-screen w-full grid-cols-[1fr_calc(100%-48px)_1fr] grid-rows-[auto_auto_1fr_auto] items-start gap-x-[24px]', | ||
'bg-secondary lg:grid-cols-[1fr_min(calc(100%-128px),1608px)_1fr] lg:gap-x-[64px]', | ||
)} | ||
> | ||
<LayoutBackground /> | ||
|
||
{import.meta.env.VITE_FEATURE_TOP_BANNER === '1' && showBanner && ( | ||
<SkyMigrationTopBanner onClose={handleCloseBanner} /> | ||
<SkyMigrationTopBanner onClose={handleCloseBanner} className="col-span-full " /> | ||
)} | ||
<Navbar | ||
mobileMenuCollapsed={mobileMenuCollapsed} | ||
setMobileMenuCollapsed={setMobileMenuCollapsed} | ||
className="z-20" | ||
/> | ||
<main className={cx('isolate flex w-full grow flex-col', !mobileMenuCollapsed && 'hidden lg:flex')}> | ||
<div className="sticky top-0 z-20 col-start-2 col-end-2 mb-6 bg-secondary/30 pt-2 backdrop-blur-xs"> | ||
<TopbarContainer /> | ||
</div> | ||
|
||
<main className="isolate z-20 col-span-full grid grid-cols-subgrid [&>*]:col-start-2 [&>*]:col-end-2"> | ||
{children} | ||
{!pageSupported && ( | ||
<> | ||
<div className="fixed inset-0 z-10 bg-gray-100/30 backdrop-blur-[1.5px]" aria-hidden="true" /> | ||
<PageNotSupportedWarning | ||
pageName={pageName} | ||
openNetworkSelectDialog={() => openDialog(selectNetworkDialogConfig, {})} | ||
className="z-20" | ||
/> | ||
</> | ||
)} | ||
</main> | ||
|
||
{!pageSupported && ( | ||
<PageNotSupportedWarning | ||
pageName={pageName} | ||
openNetworkSelectDialog={() => openDialog(selectNetworkDialogConfig, {})} | ||
/> | ||
)} | ||
</div> | ||
) | ||
} |
55 changes: 55 additions & 0 deletions
55
packages/app/src/ui/layouts/app-layout/components/LayoutBackground.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Path, pathGroups, paths } from '@/config/paths' | ||
import { cn } from '@/ui/utils/style' | ||
import { CSSProperties } from 'react' | ||
import { matchPath, useLocation } from 'react-router-dom' | ||
|
||
const pageGradients = { | ||
savings: { | ||
from: '#11B93E', | ||
via: '#40DA69', | ||
to: '#FFFFFF', | ||
}, | ||
farms: { | ||
from: '#FA43BD', | ||
via: '#FFB5B5', | ||
to: '#FFFFFF', | ||
}, | ||
borrow: { | ||
from: '#FF895D', | ||
via: '#FFE6A4', | ||
to: '#FFFFFF', | ||
}, | ||
} | ||
|
||
export function LayoutBackground() { | ||
const location = useLocation() | ||
|
||
const currentPage = Object.entries(paths).find(([_, path]) => matchPath(path, location.pathname))?.[0] as Path | ||
|
||
const activePathGroup = Object.entries(pathGroups).find(([_, paths]) => | ||
paths.includes(currentPage), | ||
)?.[0] as keyof typeof pathGroups | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
'fixed top-0 right-0 z-10 aspect-[582/1010] bg-[url("/backgrounds/background-lines.svg")] bg-contain bg-no-repeat', | ||
'w-[200vw] max-w-[1010px] lg:w-full md:w-[125vw] sm:w-[150vw]', | ||
)} | ||
> | ||
<div | ||
className={cn( | ||
'aspect-square w-[70vw] translate-x-[643px] translate-y-[66px] blur-[250px] md:w-[367px] sm:blur-[384px]', | ||
'bg-gradient-to-r from-[--gradient-from] via-[--gradient-via] to-[--gradient-to] duration-300 ease-out [transition-property:_--gradient-from,_--gradient-via,_--gradient-to]', | ||
)} | ||
style={ | ||
{ | ||
'--gradient-from': pageGradients[activePathGroup].from, | ||
'--gradient-via': pageGradients[activePathGroup].via, | ||
'--gradient-to': pageGradients[activePathGroup].to, | ||
} as CSSProperties | ||
} | ||
/> | ||
</div> | ||
) | ||
} |
58 changes: 29 additions & 29 deletions
58
packages/app/src/ui/layouts/app-layout/components/PageNotSupportedWarning.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import { Button } from '@/ui/atoms/button/Button' | ||
import { Button } from '@/ui/atoms/new/button/Button' | ||
import { cn } from '@/ui/utils/style' | ||
import { testIds } from '@/ui/utils/testIds' | ||
import { AlertTriangle } from 'lucide-react' | ||
|
||
export interface PageNotSupportedWarningProps { | ||
pageName: string | ||
openNetworkSelectDialog: () => void | ||
className?: string | ||
} | ||
|
||
export function PageNotSupportedWarning({ | ||
pageName, | ||
openNetworkSelectDialog, | ||
className, | ||
}: PageNotSupportedWarningProps) { | ||
export function PageNotSupportedWarning({ pageName, openNetworkSelectDialog }: PageNotSupportedWarningProps) { | ||
return ( | ||
<div | ||
className={cn( | ||
'sticky bottom-0 flex min-h-28 w-full flex-col items-center justify-center gap-2.5 lg:flex-row lg:gap-40', | ||
'bg-white p-4 shadow-[0_0_128px_rgba(0,0,0,0.1)]', | ||
className, | ||
)} | ||
> | ||
<div className="flex gap-4"> | ||
<AlertTriangle className="h-8 w-8 text-[#FC4F37]" /> | ||
<div className="flex flex-col gap-0.5"> | ||
<div className="font-semibold text-primary text-sm lg:text-base"> | ||
{pageName} {pageName.endsWith('s') ? 'are' : 'is'} not supported on the network you are connected to. | ||
</div> | ||
<div className="text-prompt-foreground text-xs lg:text-sm"> | ||
Switch to other supported networks to unlock this page. | ||
<div className="fixed inset-0 z-30"> | ||
<div className="fixed inset-0 bg-reskin-alpha-overlay backdrop-blur-[2px]" aria-hidden="true" /> | ||
|
||
<div | ||
className={cn( | ||
'absolute bottom-0 z-20 flex min-h-28 w-full flex-col items-center justify-center gap-4 lg:flex-row lg:gap-40', | ||
'bg-primary p-4 shadow-[0_0_128px_rgba(0,0,0,0.1)]', | ||
)} | ||
> | ||
<div className="flex gap-4"> | ||
<AlertTriangle className="h-8 w-8 text-system-error-primary" /> | ||
<div className="flex flex-col gap-0.5"> | ||
<div className="typography-label-5 lg:typography-label-4 text-primary"> | ||
{pageName} {pageName.endsWith('s') ? 'are' : 'is'} not supported on the network you are connected to. | ||
</div> | ||
<div className="typography-body-5 text-secondary"> | ||
Switch to other supported networks to unlock this page. | ||
</div> | ||
</div> | ||
</div> | ||
<Button | ||
size="l" | ||
variant="secondary" | ||
className="w-full px-20 lg:w-fit" | ||
onClick={openNetworkSelectDialog} | ||
data-testid={testIds.component.SwitchNotSupportedNetworkButton} | ||
> | ||
Switch network | ||
</Button> | ||
</div> | ||
<Button | ||
className="w-full px-20 lg:w-fit" | ||
onClick={openNetworkSelectDialog} | ||
data-testid={testIds.component.SwitchNotSupportedNetworkButton} | ||
> | ||
Switch network | ||
</Button> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gradients are slightly different to the one from figma (not noticeable, matter of 1-2deg and few % color length) but this way its cleaner