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

Feat/home #24

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c223caa
feat: get TPS data for dashboard
raghukapur9 Sep 6, 2024
b21900d
add table component
aashaykapoor Sep 6, 2024
b50b66e
Merge branch 'main' of github.com:DevForce99/fuel-explorer into feat/…
aashaykapoor Sep 10, 2024
b0c2149
add home components
aashaykapoor Sep 11, 2024
9e7332d
home page fixed
Sep 12, 2024
d9173cf
Account Data Indexing
raghukapur9 Sep 13, 2024
f64b80e
Merge branch 'feat/TPS' of github.com:DevForce99/fuel-explorer into f…
aashaykapoor Sep 13, 2024
760f3a0
Merge branch 'FuelLabs:main' into feat/accountDataIndexer
raghukapur9 Sep 13, 2024
6ea9887
removed AccountModel class
raghukapur9 Sep 13, 2024
3377401
refactor block ui components
aashaykapoor Sep 14, 2024
5a1c2fe
refactor homepage and add data
aashaykapoor Sep 14, 2024
393baa8
fix:homepage-blocks-ui
aashaykapoor Sep 15, 2024
924c399
Merge branch 'FuelLabs:main' into feat/accountDataIndexer
raghukapur9 Sep 16, 2024
e8bd42e
Account Balance Changes
shivam-25 Sep 16, 2024
8081dca
Block and Transaction stats
shivam-25 Sep 16, 2024
8aebca6
Merge branch 'feat/accountDataIndexer' of https://github.com/DevForce…
shivam-25 Sep 16, 2024
2b7b219
Account stats
shivam-25 Sep 16, 2024
890c920
Daily Account Statistics
shivam-25 Sep 16, 2024
243c78a
tested and fixed account statistics
raghukapur9 Sep 16, 2024
02aaf56
changed query params for CumulativeAccountCreationStatistics
raghukapur9 Sep 16, 2024
dc032a3
Top Accounts
shivam-25 Sep 16, 2024
a87eac6
Top Accounts fix
shivam-25 Sep 16, 2024
208f03f
Paginated top accounts
shivam-25 Sep 17, 2024
c9ca0d8
Export functionlity query
shivam-25 Sep 18, 2024
c3a0cc9
Fixed end to end export data for account
shivam-25 Sep 19, 2024
285a57a
Merge branch 'main' of https://github.com/DevForce99/fuel-explorer in…
shivam-25 Sep 19, 2024
6a58d85
removed WS and added dashboard queries for graph and blocks
raghukapur9 Sep 21, 2024
b5ba01f
fixed time calculation
raghukapur9 Sep 21, 2024
22d1509
moved tps and dashboard blocks to explorer.graphql
raghukapur9 Sep 22, 2024
b0764cc
formatted getBlocksDashboard
raghukapur9 Sep 22, 2024
71ea2e4
Merge branch 'feat/account-stats' of github.com:DevForce99/fuel-explo…
aashaykapoor Sep 22, 2024
eae1c5a
adding generated files
raghukapur9 Sep 22, 2024
6a69c22
totalDeapps added
ankit723 Sep 23, 2024
cec6ebf
Merge branch 'feat/homePageTPS-WS' of github.com:DevForce99/fuel-expl…
aashaykapoor Sep 24, 2024
3a0e58a
blocks and tps data added
ankit723 Sep 24, 2024
513fe23
blocks and tps data added
ankit723 Sep 24, 2024
20d8223
refactor blocks timestamp
aashaykapoor Sep 24, 2024
6e1ce84
bug fixes
ankit723 Sep 24, 2024
2074eec
rebase
ankit723 Sep 24, 2024
5509e12
rebase
ankit723 Sep 24, 2024
8f5dd70
home page
ankit723 Sep 25, 2024
30b13b0
home page done
ankit723 Sep 25, 2024
0c7840a
fix: grid-layout
DivyanshArya09 Sep 25, 2024
0dd8657
fix: grid-layout
DivyanshArya09 Sep 25, 2024
0da59e4
fix: tps ui
aashaykapoor Sep 25, 2024
119e774
fix time on tps
aashaykapoor Sep 25, 2024
6ed902c
fix time
aashaykapoor Sep 25, 2024
4088fcc
fix tps
aashaykapoor Sep 25, 2024
203b346
fix: normalize daily transactions
aashaykapoor Sep 25, 2024
7bacb9b
remove redundant code
aashaykapoor Sep 25, 2024
8e70e19
fix: dapp component
aashaykapoor Sep 25, 2024
df6c110
fix: latest block
aashaykapoor Sep 25, 2024
3c0f26d
fix block table width
aashaykapoor Sep 25, 2024
5018334
home page done
ankit723 Sep 25, 2024
28f2d40
home page done
ankit723 Sep 25, 2024
90b70ac
home page done
ankit723 Sep 25, 2024
a6fb98c
fix: dapps
aashaykapoor Sep 25, 2024
46bcdea
home page done
ankit723 Sep 25, 2024
3d5c759
home page done
ankit723 Sep 25, 2024
83b2dc8
fix: ui related issue
aashaykapoor Sep 25, 2024
b7e98ef
home page bug fix
ankit723 Sep 27, 2024
a32cdf5
home page bug fix
ankit723 Sep 27, 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
6 changes: 6 additions & 0 deletions fuel-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[toolchain]
channel = "latest-2023-11-30"

[components]
fuel-core = "0.24.3"
forc = "0.54.0"
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,8 @@
"ws@<8.17.1": ">=8.17.1",
"fast-loops@<1.1.4": ">=1.1.4"
}
},
"dependencies": {
"recharts": "2.12.7"
}
}
2 changes: 2 additions & 0 deletions packages/app-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
"react": "18.2.0",
"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",
"recharts": "2.12.7",
"tai64": "1.0.0",
"tailwind-variants": "0.1.20",
"wagmi": "2.12.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-explorer/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function RootLayout({
<body>
<ThemeProvider>
<PointsProgramEyebrow />
<Layout contentClassName="[&_.rt-ContainerInner]:flex-col [&_.rt-ContainerInner]:gap-10">
<Layout contentClassName="[&_.rt-ContainerInner]:flex-col [&_.rt-ContainerInner]:gap-10 bg-gray-3 dark:bg-gray-1">
{children}
</Layout>
<Analytics />
Expand Down
43 changes: 43 additions & 0 deletions packages/app-explorer/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,51 @@
// 'use client';
// import { GridTable } from '@fuels/ui';
// import { Suspense, 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 { TxsTokenTable } from '~/systems/Transactions/components/TxsTokenTable/TxsTokenTable';
// import type { TxsRouteProps } from '~/systems/Transactions/types';

// export default function Home({ searchParams: { page = '1' } }: TxsRouteProps) {
// const [activeTab, setActiveTab] = useState('Top Tokens');
// const [currentGridPage, setCurrentGridPage] = useState<number>(0);
// return (
// <>
// <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>
// </>
// );
// }

import { Suspense } from 'react';
import { TxListLoader } from '~/systems/Transactions/components/TxList/TxListLoader';
import { TxsTitle } from '~/systems/Transactions/components/TxsTitle/TxsTitle';
import { TxsScreenSync } from '~/systems/Transactions/pages/TxsScreenSync';
import type { TxsRouteProps } from '~/systems/Transactions/types';
// import { TxsTitle } from '~/systems/Transactions/components/TxsTitle/TxsTitle';

export default async function Home({
searchParams: { cursor, dir },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function Layout({ children, contentClassName }: LayoutProps) {
<Container
size="4"
className={cx(
'py-8 pb-10 px-6 tablet:px-10 tablet:py-12 tablet:pb-8 laptop:py-16 laptop:pb-18 min-h-[80vh]',
'py-8 pb-10 px-6 tablet:px-10 tablet:py-8 tablet:pb-8 laptop:py-8 laptop:pb-18 min-h-[80vh]',
contentClassName,
)}
>
Expand Down
5 changes: 3 additions & 2 deletions packages/app-explorer/src/systems/Core/utils/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { getSdk } from '@fuel-explorer/graphql/sdk';
import { GraphQLClient } from 'graphql-request';

const FUEL_INDEXER_API_KEY = process.env.FUEL_INDEXER_API_KEY;
const FUEL_INDEXER_API = process.env.FUEL_INDEXER_API;
const FUEL_INDEXER_API_KEY = 'nZ9GZayrd8';
const FUEL_INDEXER_API =
'https://explorer-indexer-testnet.fuel.network/graphql';
const FUEL_INDEXER_MAINNET_KEY = process.env.FUEL_INDEXER_MAINNET_KEY;

if (!FUEL_INDEXER_API) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { HStack, RoundedContainer, VStack } from '@fuels/ui';
import { tv } from 'tailwind-variants';
import { fromNow } from '~/systems/Core/utils/dayjs';
import { Block } from '../interface/blocks.interface';

interface BlockTableProps {
block: Block;
}

export const BlockTableTile: React.FC<BlockTableProps> = ({ block }) => {
const classes = styles();

return (
<RoundedContainer className="bg-white hover:bg-gray-5 py-3">
<HStack align={'center'} className="justify-between">
<div className="space-y-[4px]">
<p className={classes.paragraphStrong()}>#{block.blockNo}</p>
<p className={classes.paragraph()}>{+block.gasUsed / 10 ** 9} ETH</p>
</div>
<div className="flex items-center gap-[4px] overflow-hidden">
{/* Uncomment the image if needed */}
{/* <img
className="w-[16px] h-[14px] rounded-full overflow-hidden"
src="https://s3-alpha-sig.figma.com/img/404f/e544/a721b4897fea63c5007fea0819a062e4?Expires=1724025600&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4&Signature=HQ4U-6SV-6Neqns-0oAsAQiV26pnff609Srfd-PFdNQJvjOH7t7CfkNNoA90jzSdyELyRALWQfQAf5yrQAdKzz-yLKDg1A5Y7VpRN5ZRnR6~eHBGovRzDEdLtiHSRRY04fTUR~DN6RAXpPZBwnporoqKgk3ntoYvskkkEl56Hn1WUYhnfM3OtgqaZu327f39qdvO3VZudMUpVLxOWVk92ky4USKXEmu1AA9Y1luOexzTNyqQdabjaLQbr5zF-hPZtQV-pKHIKBCewNvhGiMp8hVU~XXnCcJvMvI9AaI~fZnq~6frNAAQEN9c22usX3kIwmTy9qoOXqzqFcOxoW4PGQ__"
alt=""
/> */}
<p
className={`${classes.paragraph()} overflow-hidden text-ellipsis whitespace-nowrap w-[100px]`}
>
{block.producer}
</p>
</div>

<div className="space-y-[4px]">
<VStack gap={'0'}>
<HStack gap={'1'} className="items-center">
<svg
width="11"
height="8"
viewBox="0 0 11 8"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0.875 4.25L3.5 6.875L9.5 0.875"
stroke="#00F58C"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
<p className={classes.paragraphAccent()}>Settled</p>
</HStack>
<p
className={`${classes.paragraph()} overflow-hidden text-ellipsis whitespace-nowrap`}
>
{fromNow(block.timeStamp)}
</p>
</VStack>
</div>
</HStack>
</RoundedContainer>
);
};

const styles = tv({
slots: {
paragraphStrong: [
'text-[12px]',
'text-[color:var(--gray-12)]',
'font-bold',
' w-[110px]',
],
paragraph: [
'text-muted',
'text-[12px]',
'p-0',
'whitespace-nowrap',
'text-ellipsis',
],
paragraphAccent: ['text-accent text-[12px] p-0'],
},
});
134 changes: 134 additions & 0 deletions packages/app-explorer/src/systems/Home/components/DailyTransaction.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { ChartConfig, RoundedContainer } from '@fuels/ui';
import dayjs from 'dayjs';
import {
CartesianGrid,
Line,
LineChart,
ResponsiveContainer,
Tooltip,
XAxis,
YAxis,
} from 'recharts';
// import { Block } from '../interface/blocks.interface';

// const chartData = [
// { time: '01:00', value: 100000 },
// { time: '09:00', value: 500000 },
// { time: '17:00', value: 1000000 },
// { time: '23:00', value: 1500000 },
// ];

const chartConfig = {
desktop: {
label: 'Desktop',
color: '#00F58C',
},
} satisfies ChartConfig;

interface DailyTransactionProps {
blocks: any;
}
const DailyTransaction = (blocks: DailyTransactionProps) => {
const chartData = blocks.blocks?.map((block: any) => ({
time: dayjs(Number(block.time)).format('HH:mm'),
value: block.value,
}));
const cumilativeTsx = blocks.blocks.reduce(
(sum: any, block: any) => sum + Number(block.value),
0,
);
return (
<RoundedContainer className="py-4 px-5 h-full space-y-8 ">
<div className="space-y-[16px]">
<div className="flex items-center justify-between">
<div className="text-[15px] leading-[24px] text-heading font-semibold group relative">
<div className=" relative group">
<div className="flex items-center group">
<span className="">Daily Transactions</span>
<span className="ml-2 group cursor-pointer">
<svg
width="14"
height="14"
viewBox="0 0 14 14"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7 0.5C5.71442 0.5 4.45772 0.881218 3.3888 1.59545C2.31988 2.30968 1.48676 3.32484 0.994786 4.51256C0.502816 5.70028 0.374095 7.00721 0.624899 8.26809C0.875703 9.52896 1.49477 10.6872 2.40381 11.5962C3.31285 12.5052 4.47104 13.1243 5.73192 13.3751C6.99279 13.6259 8.29973 13.4972 9.48744 13.0052C10.6752 12.5132 11.6903 11.6801 12.4046 10.6112C13.1188 9.54229 13.5 8.28558 13.5 7C13.4982 5.27665 12.8128 3.62441 11.5942 2.40582C10.3756 1.18722 8.72335 0.50182 7 0.5ZM6.75 3.5C6.89834 3.5 7.04334 3.54399 7.16668 3.6264C7.29002 3.70881 7.38615 3.82594 7.44291 3.96299C7.49968 4.10003 7.51453 4.25083 7.48559 4.39632C7.45665 4.5418 7.38522 4.67544 7.28033 4.78033C7.17544 4.88522 7.04181 4.95665 6.89632 4.98559C6.75083 5.01453 6.60003 4.99968 6.46299 4.94291C6.32595 4.88614 6.20881 4.79001 6.1264 4.66668C6.04399 4.54334 6 4.39834 6 4.25C6 4.05109 6.07902 3.86032 6.21967 3.71967C6.36032 3.57902 6.55109 3.5 6.75 3.5ZM7.5 10.5C7.23479 10.5 6.98043 10.3946 6.7929 10.2071C6.60536 10.0196 6.5 9.76522 6.5 9.5V7C6.36739 7 6.24022 6.94732 6.14645 6.85355C6.05268 6.75979 6 6.63261 6 6.5C6 6.36739 6.05268 6.24021 6.14645 6.14645C6.24022 6.05268 6.36739 6 6.5 6C6.76522 6 7.01957 6.10536 7.20711 6.29289C7.39465 6.48043 7.5 6.73478 7.5 7V9.5C7.63261 9.5 7.75979 9.55268 7.85356 9.64645C7.94732 9.74021 8 9.86739 8 10C8 10.1326 7.94732 10.2598 7.85356 10.3536C7.75979 10.4473 7.63261 10.5 7.5 10.5Z"
fill="#646464"
/>
</svg>
</span>
</div>
<div className="absolute left-[20px] top-[30px] w-[20rem] opacity-0 group-hover:opacity-100 transition-opacity duration-300 z-10 px-3 py-2 text-xs font-light text-black dark:text-white bg-gray-3 rounded-lg shadow-sm">
The total number of transactions completed on Fuel Network
within a 24-hour period.
<div className="absolute left-[10px] top-[-6px] w-0 h-0 border-l-[6px] border-l-transparent border-r-[6px] border-r-transparent border-b-[6px] border-b-gray-3" />
</div>
</div>
</div>
<span className="text-[13px] leading-[20px] text-muted block">
24h
</span>
</div>
<h2 className="text-[32px] leading-[36px] text-heading font-bold">
{cumilativeTsx.toLocaleString()}
</h2>

<ResponsiveContainer width="100%" height={160}>
<LineChart
data={chartData}
margin={{ top: 10, right: 0, left: -20, bottom: 0 }}
>
<CartesianGrid
strokeDasharray="3 3"
stroke="#333"
vertical={false}
/>
<XAxis
dataKey="time"
tick={{
fontSize: 10,
className: 'fill-heading',
}}
/>
<Tooltip
formatter={(value) => [`${Number(value)}`]}
labelFormatter={(label) => label.toLocaleString()}
contentStyle={{
backgroundColor: 'var(--gray-1)',
borderColor: 'var(--gray-2)',
borderRadius: '8px',
color: 'var(--gray-1)',
}}
labelStyle={{
color: 'var(--gray-12)',
fontWeight: 'bold',
}}
itemStyle={{
color: '#00F58C',
}}
cursor={{ strokeWidth: 0.1, radius: 10 }}
/>
<YAxis
tick={{
fontSize: 12,
className: 'fill-heading',
}}
/>
<Line
type="monotone"
dataKey="value"
stroke={chartConfig.desktop.color}
strokeWidth={2}
dot={false}
activeDot={{ r: 4 }}
/>
</LineChart>
</ResponsiveContainer>
</div>
</RoundedContainer>
);
};

export default DailyTransaction;
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import type { Meta, StoryObj } from '@storybook/react';
import GridTable, { GridTableProps } from './GridTable';
import { columns, data } from './data';

const meta: Meta<typeof GridTable> = {
title: 'Home/GridTable',
component: GridTable,
parameters: {
layout: 'fullscreen',
},
};

export default meta;
type Story = StoryObj<GridTableProps<any>>;

export const Desktop: Story = {
args: {
columns,
data: data.slice(0, 10),
totalRows: data.length,
rowsPerPage: 10,
pageCount: Math.ceil(data.length / 10),
onPageChanged: (selectedPage: number) =>
console.log(`Page changed to: ${selectedPage}`),
},
};

export const Tablet: Story = {
args: {
columns,
data: data.slice(0, 10),
totalRows: data.length,
rowsPerPage: 10,
pageCount: Math.ceil(data.length / 10),
onPageChanged: (selectedPage: number) =>
console.log(`Page changed to: ${selectedPage}`),
},
parameters: {
viewport: {
defaultViewport: 'ipad',
},
},
};

export const Mobile: Story = {
args: {
columns,
data: data.slice(0, 10),
totalRows: data.length,
rowsPerPage: 10,
pageCount: Math.ceil(data.length / 10),
onPageChanged: (selectedPage: number) =>
console.log(`Page changed to: ${selectedPage}`),
},
parameters: {
viewport: {
defaultViewport: 'iphonex',
},
},
};
Loading