From 6e1d39014c9bff029e3645b6def1d2b020c742c5 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 19 Jun 2024 11:28:44 +0300 Subject: [PATCH] Format homepage --- packages/wallet/frontend/src/pages/index.tsx | 197 ++++++++++--------- 1 file changed, 102 insertions(+), 95 deletions(-) diff --git a/packages/wallet/frontend/src/pages/index.tsx b/packages/wallet/frontend/src/pages/index.tsx index c26b3aa30..67ed33aed 100644 --- a/packages/wallet/frontend/src/pages/index.tsx +++ b/packages/wallet/frontend/src/pages/index.tsx @@ -6,8 +6,8 @@ import { accountService } from '@/lib/api/account' import { Link } from '@/ui/Link' import { type Account } from '@/lib/api/account' import type { - GetServerSideProps, - InferGetServerSidePropsType + GetServerSideProps, + InferGetServerSidePropsType } from 'next/types' import { userService } from '@/lib/api/user' import type { NextPageWithLayout } from '@/lib/types/app' @@ -17,78 +17,85 @@ import { useEffect } from 'react' type HomeProps = InferGetServerSidePropsType const HomePage: NextPageWithLayout = ({ accounts, user }) => { - const { isUserFirstTime, setRunOnboarding, stepIndex, setStepIndex } = - useOnboardingContext() + const { isUserFirstTime, setRunOnboarding, stepIndex, setStepIndex } = + useOnboardingContext() - useEffect(() => { - if (isUserFirstTime) { - setTimeout(() => { - setStepIndex(stepIndex + 1) - setRunOnboarding(true) - }, 500) - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) + useEffect(() => { + if (isUserFirstTime) { + setTimeout(() => { + setStepIndex(stepIndex + 1) + setRunOnboarding(true) + }, 500) + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) - return ( - <> - -

Accounts

-
- - - New account - - {accounts.length > 0 ? - accounts.map((account) => ( - <> - - - - - - - - - ) - ) : null} -
- - ) + return ( + <> + +

Accounts

+
+ + + + New account + + + {accounts.length > 0 + ? accounts.map((account) => ( + <> + + + + + + + + + )) + : null} +
+ + ) } //
@@ -118,36 +125,36 @@ const HomePage: NextPageWithLayout = ({ accounts, user }) => { //
export const getServerSideProps: GetServerSideProps<{ - accounts: Account[] - user: { - firstName: string - lastName: string - email: string - } + accounts: Account[] + user: { + firstName: string + lastName: string + email: string + } }> = async (ctx) => { - const response = await accountService.list(ctx.req.headers.cookie) - const user = await userService.me(ctx.req.headers.cookie) + const response = await accountService.list(ctx.req.headers.cookie) + const user = await userService.me(ctx.req.headers.cookie) - if (!response.success || !user.success) { - return { - notFound: true - } + if (!response.success || !user.success) { + return { + notFound: true } + } - return { - props: { - accounts: response.result ?? [], - user: { - firstName: user.result?.firstName ?? '', - lastName: user.result?.lastName ?? '', - email: user.result?.email ?? '' - } - } + return { + props: { + accounts: response.result ?? [], + user: { + firstName: user.result?.firstName ?? '', + lastName: user.result?.lastName ?? '', + email: user.result?.email ?? '' + } } + } } -HomePage.getLayout = function(page) { - return {page} +HomePage.getLayout = function (page) { + return {page} } export default HomePage