Skip to content
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

(DO NOT MERGE) Feat/explorer homepage UI #5

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ceaeae3
first commit
DivyanshArya09 Aug 9, 2024
2e12150
add: charts & carousel
DivyanshArya09 Aug 9, 2024
4574976
test
DivyanshArya09 Aug 9, 2024
5c7c1ed
add: layouts
DivyanshArya09 Aug 9, 2024
8895c01
add: layouts
DivyanshArya09 Aug 9, 2024
6fa5ac7
Merge pull request #1 from DevForce99/feat/homepage-ui_analytics
aashaykapoor Aug 11, 2024
0712145
add base gridtable component
RitwikSingh28 Aug 11, 2024
15c6383
Merge pull request #3 from DevForce99/feat/homepage-ui_explore_table
aashaykapoor Aug 11, 2024
8b2f394
added and styled gridTable Components, tabs and buttons
ankit723 Aug 13, 2024
8576687
few dsigns fixes
ankit723 Aug 13, 2024
ac5c773
fixed many designs changes and added the export csv modal
ankit723 Aug 15, 2024
7d9391a
design bug fixes
ankit723 Aug 15, 2024
210affb
design bug fixes
ankit723 Aug 15, 2024
26cc13f
update h1 font
aashaykapoor Aug 15, 2024
2f6c029
Merge branch 'feat/explorer-homepage-ui' of github.com:DevForce99/fue…
aashaykapoor Aug 15, 2024
eef47da
refactor placeholder
aashaykapoor Aug 15, 2024
3ea08ea
refactor css
aashaykapoor Aug 15, 2024
a536a7e
fix: grid not loading
aashaykapoor Aug 15, 2024
0001280
add all-blocks components
aashaykapoor Aug 17, 2024
5089009
all block-efficiency component
aashaykapoor Aug 17, 2024
06f620f
created the statistics page and and the line graph component using re…
ankit723 Aug 18, 2024
2d6f305
bug fixes in the stas page and the line stats components
ankit723 Aug 19, 2024
4c8d4c7
add blocks components
aashaykapoor Aug 19, 2024
46ae7ec
header added in the stats page
ankit723 Aug 19, 2024
13d2e77
add blocks table
aashaykapoor Aug 20, 2024
f943d86
fix: block table not loading
aashaykapoor Aug 20, 2024
ace8000
completed the blocks page along with the Grid table component
ankit723 Aug 21, 2024
bece4ab
Merge pull request #6 from DevForce99/feat/explorer-all-blocks-ui
aashaykapoor Aug 22, 2024
1a76a64
Merge branch 'feat/stats-page-ui' into feat/explorer-homepage-ui
aashaykapoor Aug 26, 2024
c630ae4
created the nfts page
ankit723 Aug 26, 2024
a616ec7
created the nfts page
ankit723 Aug 26, 2024
e5d915a
add contracts to nft-ui
aashaykapoor Aug 26, 2024
c52c10c
Merge branch 'main' of github.com:DevForce99/fuel-explorer into feat/…
aashaykapoor Aug 26, 2024
02343e5
generated types
aashaykapoor Aug 26, 2024
43a52c0
contracts completed and few bugs fixed
ankit723 Aug 27, 2024
0f17acf
contracts completed and few bugs fixed
ankit723 Aug 27, 2024
2b7b612
nft-ui page completed
ankit723 Aug 27, 2024
27af7d4
Merge branch 'feat/explorer-homepage-ui' into feat/nft-ui
aashaykapoor Aug 28, 2024
41806d3
Merge pull request #9 from DevForce99/feat/nft-ui
aashaykapoor Aug 28, 2024
8d650e5
most things fixed in homepage blocks and statistics
ankit723 Aug 28, 2024
7a3700c
bug fixes
ankit723 Aug 29, 2024
e276c0a
added getBlocks
raghukapur9 Sep 2, 2024
7e7a2f5
Merge branch 'blocksPage' of github.com:DevForce99/fuel-explorer into…
aashaykapoor Sep 3, 2024
16b6af3
Merge pull request #10 from DevForce99/feat/homepage-fixes
aashaykapoor Sep 3, 2024
39d2d1a
refactor blocks path
aashaykapoor Sep 3, 2024
08a7225
add getblock query
aashaykapoor Sep 5, 2024
f217b13
few changes
Sep 5, 2024
293f70b
Blocks backend integration done
Sep 5, 2024
5e75f69
fix pagination logic
aashaykapoor Sep 6, 2024
4d43f87
pagination fixing
Sep 7, 2024
7ac3d83
gridTable related bug fixes
Sep 7, 2024
afd3987
fix blocks
aashaykapoor Sep 7, 2024
82f33b4
Merge branch 'feat/explorer-homepage-ui' of github.com:DevForce99/fue…
aashaykapoor Sep 7, 2024
1586b24
fix pagination logic
aashaykapoor Sep 7, 2024
28793e8
blocks design fixes
Sep 8, 2024
49f9a7d
Merge branch 'feat/explorer-homepage-ui' of github.com:DevForce99/fue…
aashaykapoor Sep 8, 2024
aa5c597
fix title
aashaykapoor Sep 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,9 @@
"ws@<8.17.1": ">=8.17.1",
"fast-loops@<1.1.4": ">=1.1.4"
}
},
"dependencies": {
"embla-carousel-react": "8.1.8",
"recharts": "2.12.7"
}
}
11 changes: 2 additions & 9 deletions packages/app-commons/src/components/PageTitle/PageTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';
import type { BaseProps } from '@fuels/ui';
import { Badge, HStack, Heading } from '@fuels/ui';
import { HStack, Heading } from '@fuels/ui';
import { tv } from 'tailwind-variants';

export type PageTitleProps = BaseProps<{
Expand All @@ -15,18 +15,12 @@ export function PageTitle({
children,
as = 'h2',
size = '1',
icon,
rightElement,
className,
}: PageTitleProps) {
const classes = styles({ size });
return (
<Heading as={as} className={classes.root({ className })}>
{icon && (
<Badge color="gray" size="2" className={classes.icon()}>
{icon}
</Badge>
)}
<HStack className={classes.title()}>{children}</HStack>
<div className="flex items-center h-full tablet:self-center">
{rightElement}
Expand All @@ -38,8 +32,7 @@ export function PageTitle({
const styles = tv({
slots: {
root: [
'first:mb-8 flex items-center justify-between gap-2',
'border-border border-b',
'first:mb-4 flex items-center justify-between gap-2',
'tablet:flex-nowrap tablet:gap-4',
],
icon: ['h-full flex-shrink-0 px-2', 'tablet:self-start tablet:mt-1.5'],
Expand Down
7 changes: 7 additions & 0 deletions packages/app-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@vercel/analytics": "1.1.3",
"app-commons": "workspace:*",
"app-portal": "workspace:*",
"chart.js": "4.4.3",
"clsx": "2.1.0",
"csstype": "3.1.3",
"dayjs": "1.11.10",
Expand All @@ -38,10 +39,15 @@
"next": "14.1.0",
"next-themes": "0.2.1",
"react": "18.2.0",
"react-chartjs-2": "5.2.0",
"react-data-table-component": "7.6.2",
"react-dom": "18.2.0",
"react-json-view-lite": "1.4.0",
"react-modal": "3.16.1",
"react-use": "17.5.0",
"react-window": "1.8.10",
"styled-components": "6.1.12",
"recharts": "2.12.7",
"tai64": "1.0.0",
"tailwind-variants": "0.1.20",
"wagmi": "2.12.1",
Expand All @@ -68,6 +74,7 @@
"@types/node": "20.11.6",
"@types/react": "18.2.54",
"@types/react-dom": "18.2.22",
"@types/react-modal": "3.16.3",
"@types/react-window": "1.8.8",
"@xstate/cli": "^0.5.17",
"autoprefixer": "10.4.17",
Expand Down
17 changes: 17 additions & 0 deletions packages/app-explorer/src/app/blocks/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { OverlayDialog, Providers } from 'app-portal';
import type { Metadata } from 'next';

export const metadata: Metadata = {
title: 'All Blocks',
};

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<Providers>
<OverlayDialog />
{children}
</Providers>
);
}

export const dynamic = 'force-static';
23 changes: 23 additions & 0 deletions packages/app-explorer/src/app/blocks/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use client';
import { Box, Flex } from '@fuels/ui';
import { tv } from 'tailwind-variants';
import { BlocksScreen } from '~/systems/Block/screens/BlockScreen';

const Blocks = () => {
const classes = styles();
return (
<Flex justify="center">
<Box className={classes.content()}>
<BlocksScreen />
</Box>
</Flex>
);
};
const styles = tv({
slots: {
content: 'w-full max-w-[100%]',
},
});
export default Blocks;

export const dynamic = 'force-static';
7 changes: 6 additions & 1 deletion packages/app-explorer/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
:root {
--hero-bg: #000;
--font-geist-mono: 'GeistMono', 'SF Mono', 'Segoe UI Mono', 'Roboto Mono', Menlo, Courier, monospace;
}

h1,
h2,
h3,
h4,
Expand All @@ -11,6 +11,11 @@ h6 {
font-weight: 600;
letter-spacing: -0.025em;
}

h1,
h2{
font-family: var(--font-geist-mono);
}
kbd {
font-size: 0.875rem;
font-family: var(--default-font-family);
Expand Down
17 changes: 17 additions & 0 deletions packages/app-explorer/src/app/nfts/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { OverlayDialog, Providers } from 'app-portal';
import type { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Fuel NFTs',
};

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<Providers>
<OverlayDialog />
{children}
</Providers>
);
}

export const dynamic = 'force-static';
14 changes: 14 additions & 0 deletions packages/app-explorer/src/app/nfts/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import dynamicImport from 'next/dynamic';

const Page = dynamicImport(
async () => import('~/systems/NFTs/screens/NFTsScreen'),
{
ssr: false,
},
);

export default function NFTs() {
return <Page />;
}

export const dynamic = 'force-static';
40 changes: 31 additions & 9 deletions packages/app-explorer/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
'use client';
import { GridTable } from '@fuels/ui';
import { Suspense } from 'react';
import { useState } from 'react';
import { columns, data } from '~/systems/Home/components/DataTable/data';
import { TxListLoader } from '~/systems/Transactions/components/TxList/TxListLoader';
import { TxsAccountTable } from '~/systems/Transactions/components/TxsAccontTable/TxsAccountTable';
import { TxsTitle } from '~/systems/Transactions/components/TxsTitle/TxsTitle';
import { TxsScreenSync } from '~/systems/Transactions/pages/TxsScreenSync';
import { TxsTokenTable } from '~/systems/Transactions/components/TxsTokenTable/TxsTokenTable';
import type { TxsRouteProps } from '~/systems/Transactions/types';

export default async function Home({
searchParams: { cursor, dir },
}: TxsRouteProps) {
export default function Home({ searchParams: { page = '1' } }: TxsRouteProps) {
const [activeTab, setActiveTab] = useState('Top Tokens');
const [currentGridPage, setCurrentGridPage] = useState<number>(0);
return (
<>
<TxsTitle />
<Suspense key={cursor} fallback={<TxListLoader numberOfTxs={10} />}>
<TxsScreenSync cursor={cursor} dir={dir} />
<TxsTitle activeTab={activeTab} setActiveTab={setActiveTab} />

<Suspense
key={page}
fallback={<TxListLoader page={page} numberOfTxs={10} />}
>
{activeTab === 'Top Tokens' ? (
<GridTable
onPageChanged={() => {}}
data={data}
columns={columns}
pageCount={1}
currentPage={currentGridPage}
setCurrentPage={setCurrentGridPage}
/>
) : activeTab === 'Top NFTs' ? (
<TxsTokenTable />
) : activeTab === 'Top Accounts' ? (
<TxsAccountTable />
) : (
''
)}
</Suspense>
</>
);
}

export const revalidate = 10;
17 changes: 17 additions & 0 deletions packages/app-explorer/src/app/statistics/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { OverlayDialog, Providers } from 'app-portal';
import type { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Fuel Statistics',
};

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<Providers>
<OverlayDialog />
{children}
</Providers>
);
}

export const dynamic = 'force-static';
15 changes: 15 additions & 0 deletions packages/app-explorer/src/app/statistics/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import dynamicImport from 'next/dynamic';

const Page = dynamicImport(
async () => import('~/systems/Statistics/screens/StatisticsScreen'),
{
ssr: false,
// loading: EcosystemScreenLoader,
},
);

export default function Statistics() {
return <Page />;
}

export const dynamic = 'force-static';
30 changes: 30 additions & 0 deletions packages/app-explorer/src/systems/Block/actions/get-blocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use server';

import { z } from 'zod';
import { act } from '~/systems/Core/utils/act-server';
import { sdk } from '~/systems/Core/utils/sdk';

const PER_PAGE = 10;

const schema = z.object({
cursor: z.string().optional().nullable(),
dir: z.enum(['after', 'before']).optional(),
});

export const getBlocks = act(schema, async ({ cursor, dir = 'after' }) => {
const params = { last: PER_PAGE } as {
first?: number;
last?: number;
before?: string;
after?: string;
};
if (cursor && dir === 'after') {
params.after = cursor;
}
if (cursor && dir === 'before') {
params.before = cursor;
}

const { data } = await sdk.blocks(params);
return data;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Box, HStack, Text, VStack } from '@fuels/ui';

type BlockEfficiencyItemProps = {
current: number;
total: number;
};

export default function BlockEfficiencyItem({
current,
total,
}: BlockEfficiencyItemProps) {
// Convert current and total to millions
const currentInMillions = current / 1_000_000;
const totalInMillions = total / 1_000_000;

// Calculate progress percentage
const progress = (current / total) * 100;

return (
<Box>
<VStack gap="2">
<HStack className="justify-between">
{/* Format current and total as M (millions) */}
<Text className="font-inter text-gray-10 text-[0.7rem]">
{currentInMillions % 1 === 0
? currentInMillions.toFixed(0)
: currentInMillions.toFixed(1)}
M /
{totalInMillions % 1 === 0
? totalInMillions.toFixed(0)
: totalInMillions.toFixed(1)}
M
</Text>
<Text className="font-inter text-gray-10 text-[0.7rem]">
({progress.toFixed(2)}%)
</Text>
</HStack>
<div className="mt-[4px]">
<div className="w-full h-[4px] rounded-full bg-gray-5">
<div
className="h-full bg-brand rounded-full"
style={{ width: `${progress}%` }}
/>
</div>
</div>
</VStack>
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Box, Copyable, HStack, VStack } from '@fuels/ui';

type BlockHashItemProps = {
hashAddress: string;
width: string;
};

export default function BlockHashItem({
hashAddress,
width,
}: BlockHashItemProps) {
return (
<VStack gap="1">
<Box>
<HStack width={width} maxWidth={'1'}>
<Copyable
value={hashAddress}
className="font-mono text-gray-10 w-full"
>
<p className="overflow-hidden text-ellipsis whitespace-nowrap">
{hashAddress}
</p>
</Copyable>
</HStack>
</Box>
</VStack>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Box, Copyable, HStack, Text, VStack } from '@fuels/ui';

export interface BlockItemProps {
blockId: string;
ethValue: string;
}

export default function BlockItem({ blockId, ethValue }: BlockItemProps) {
return (
<VStack gap="1">
<HStack>
<Box>
<Copyable
value={blockId}
className="font-mono font-semibold text-sm "
>
#{blockId}
</Copyable>
</Box>
</HStack>
<Text className="text-gray-10 text-xs text-ellipsis w-[7rem]">
{ethValue} ETH
</Text>
</VStack>
);
}
Loading