diff --git a/packages/ui/components/shared/badge.tsx b/packages/ui/components/shared/badge.tsx index d8a17f563b..46a22c2d58 100644 --- a/packages/ui/components/shared/badge.tsx +++ b/packages/ui/components/shared/badge.tsx @@ -1,21 +1,31 @@ import * as React from "react"; import { cva, type VariantProps } from "class-variance-authority"; - import { cn } from "../../lib/utils"; const badgeVariants = cva( - "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold", { variants: { variant: { - default: "border-transparent bg-primary hover:bg-primary/80", + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", secondary: - "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", destructive: - "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", success: - "border-transparent bg-success text-success-foreground hover:bg-success/80", - outline: "text-foreground", + "border-transparent bg-success text-success-foreground hover:bg-success/80 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + outline: + "text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + "static-default": + "border-transparent bg-primary text-primary-foreground", + "static-secondary": + "border-transparent bg-secondary text-secondary-foreground", + "static-destructive": + "border-transparent bg-destructive text-destructive-foreground", + "static-success": + "border-transparent bg-success text-success-foreground", + "static-outline": "border-current text-foreground", }, }, defaultVariants: { diff --git a/tools/bridge-frontend/src/lib/siteMetadata.ts b/tools/bridge-frontend/src/lib/siteMetadata.ts index 34ec555cc6..d64ad7f883 100644 --- a/tools/bridge-frontend/src/lib/siteMetadata.ts +++ b/tools/bridge-frontend/src/lib/siteMetadata.ts @@ -7,7 +7,7 @@ export const siteMetadata = { "Bridge tokens between Layer 1 and Layer 2 networks effortlessly with TEN Bridge. Ensure secure and efficient cross-chain transactions", keywords: "token bridging, cross-chain transactions, Layer 1 to Layer 2 bridge, blockchain bridge, Ten Bridge, crypto bridging, TEN network, TEN blockchain, TEN ecosystem", - siteUrl: `https://${environment}-bridge.ten.xyz`, + siteUrl: `https://${environment && environment + "-"}bridge.ten.xyz`, siteLogo: `/assets/images/cover.png`, siteLogoSquare: `/assets/images/cover.png`, email: "team@ten.xyz", diff --git a/tools/tenscan/frontend/Dockerfile b/tools/tenscan/frontend/Dockerfile index 691489c28a..1144273b25 100644 --- a/tools/tenscan/frontend/Dockerfile +++ b/tools/tenscan/frontend/Dockerfile @@ -1,12 +1,17 @@ FROM node:18-buster as runner -# Install pnpm + RUN npm install -g pnpm -# setup container data structure -RUN mkdir -p /home/obscuro/go-obscuro/tools/tenscan/ -COPY ./tools/tenscan/frontend /home/obscuro/go-obscuro/tools/tenscan/frontend -WORKDIR /home/obscuro/go-obscuro/tools/tenscan/frontend +COPY . /home/obscuro/go-obscuro/ + +WORKDIR /home/obscuro/go-obscuro/ RUN pnpm install -EXPOSE 80 \ No newline at end of file +WORKDIR /home/obscuro/go-obscuro/tools/tenscan/frontend + +RUN pnpm install --filter ./tools/tenscan/frontend... + +EXPOSE 80 + +CMD ["pnpm", "run", "start"] diff --git a/tools/tenscan/frontend/api/batches.ts b/tools/tenscan/frontend/api/batches.ts index 10ff925eaf..ce21899900 100644 --- a/tools/tenscan/frontend/api/batches.ts +++ b/tools/tenscan/frontend/api/batches.ts @@ -1,13 +1,13 @@ import { httpRequest } from "."; import { apiRoutes } from "@/src/routes"; import { pathToUrl } from "@/src/routes/router"; -import { ResponseDataInterface } from "@/src/types/interfaces"; import { Batch, BatchDetails, BatchResponse, LatestBatch, } from "@/src/types/interfaces/BatchInterfaces"; +import { ResponseDataInterface } from "@repo/ui/lib/types/common"; export const fetchBatches = async ( payload?: Record diff --git a/tools/tenscan/frontend/api/blocks.ts b/tools/tenscan/frontend/api/blocks.ts index 0a4519c89e..5ccefdcf00 100644 --- a/tools/tenscan/frontend/api/blocks.ts +++ b/tools/tenscan/frontend/api/blocks.ts @@ -1,12 +1,13 @@ import { httpRequest } from "."; import { apiRoutes } from "@/src/routes"; import { pathToUrl } from "@/src/routes/router"; -import { ResponseDataInterface } from "@/src/types/interfaces"; +import { BlockResponse } from "@/src/types/interfaces/BlockInterfaces"; +import { ResponseDataInterface } from "@repo/ui/lib/types/common"; export const fetchBlocks = async ( payload?: Record -): Promise> => { - return await httpRequest>({ +): Promise> => { + return await httpRequest>({ method: "get", url: pathToUrl(apiRoutes.getBlocks), searchParams: payload, diff --git a/tools/tenscan/frontend/api/contracts.ts b/tools/tenscan/frontend/api/contracts.ts index 0ece0fc929..79134ea44b 100644 --- a/tools/tenscan/frontend/api/contracts.ts +++ b/tools/tenscan/frontend/api/contracts.ts @@ -1,8 +1,8 @@ import { httpRequest } from "."; import { apiRoutes } from "@/src/routes"; import { pathToUrl } from "@/src/routes/router"; -import { ResponseDataInterface } from "@/src/types/interfaces"; import { ContractCount } from "@/src/types/interfaces/ContractInterface"; +import { ResponseDataInterface } from "@repo/ui/lib/types/common"; export const fetchContractCount = async ( payload?: Record diff --git a/tools/tenscan/frontend/api/general.ts b/tools/tenscan/frontend/api/general.ts index a9e09941dc..5a1f5d0d84 100644 --- a/tools/tenscan/frontend/api/general.ts +++ b/tools/tenscan/frontend/api/general.ts @@ -1,4 +1,4 @@ -import { ResponseDataInterface } from "@/src/types/interfaces"; +import { ResponseDataInterface } from "@repo/ui/lib/types/common"; import { httpRequest } from "."; import { pathToUrl } from "@/src/routes/router"; import { apiRoutes } from "@/src/routes"; diff --git a/tools/tenscan/frontend/api/rollups.ts b/tools/tenscan/frontend/api/rollups.ts index eddfc0ed12..954ad2c50d 100644 --- a/tools/tenscan/frontend/api/rollups.ts +++ b/tools/tenscan/frontend/api/rollups.ts @@ -1,8 +1,8 @@ import { httpRequest } from "."; import { apiRoutes } from "@/src/routes"; import { pathToUrl } from "@/src/routes/router"; -import { ResponseDataInterface } from "@/src/types/interfaces"; -import { Batch, BatchResponse } from "@/src/types/interfaces/BatchInterfaces"; +import { ResponseDataInterface } from "@repo/ui/lib/types/common"; +import { BatchResponse } from "@/src/types/interfaces/BatchInterfaces"; import { Rollup, RollupsResponse, diff --git a/tools/tenscan/frontend/api/transactions.ts b/tools/tenscan/frontend/api/transactions.ts index 051bf757ff..9e8cebf2b3 100644 --- a/tools/tenscan/frontend/api/transactions.ts +++ b/tools/tenscan/frontend/api/transactions.ts @@ -1,15 +1,16 @@ -import { jsonHexToObj } from "@/src/lib/utils"; +import { jsonHexToObj } from "@repo/ui/lib/utils"; import { httpRequest } from "."; import { apiRoutes, ethMethods, tenCustomQueryMethods } from "@/src/routes"; import { pathToUrl } from "@/src/routes/router"; -import { ResponseDataInterface, ToastType } from "@/src/types/interfaces"; import { TransactionCount, Price, TransactionResponse, Transaction, } from "@/src/types/interfaces/TransactionInterfaces"; -import { showToast } from "@/src/components/ui/use-toast"; +import { showToast } from "@repo/ui/components/shared/use-toast"; +import { ResponseDataInterface } from "@repo/ui/lib/types/common"; +import { ToastType } from "@repo/ui/lib/enums/toast"; export const fetchTransactions = async ( payload?: Record diff --git a/tools/tenscan/frontend/next.config.js b/tools/tenscan/frontend/next.config.js index 50f8420725..841789e9ae 100644 --- a/tools/tenscan/frontend/next.config.js +++ b/tools/tenscan/frontend/next.config.js @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + transpilePackages: ["@repo/ui"], images: { unoptimized: true, }, diff --git a/tools/tenscan/frontend/package.json b/tools/tenscan/frontend/package.json index 87793b2534..252d566f6b 100644 --- a/tools/tenscan/frontend/package.json +++ b/tools/tenscan/frontend/package.json @@ -10,20 +10,6 @@ "lint": "next lint" }, "dependencies": { - "@radix-ui/react-avatar": "^1.0.4", - "@radix-ui/react-checkbox": "^1.0.4", - "@radix-ui/react-dialog": "^1.0.5", - "@radix-ui/react-dropdown-menu": "^2.0.6", - "@radix-ui/react-icons": "^1.3.0", - "@radix-ui/react-label": "^2.0.2", - "@radix-ui/react-navigation-menu": "^1.1.4", - "@radix-ui/react-popover": "^1.0.7", - "@radix-ui/react-select": "^2.0.0", - "@radix-ui/react-separator": "^1.0.3", - "@radix-ui/react-slot": "^1.0.2", - "@radix-ui/react-tabs": "^1.0.4", - "@radix-ui/react-toast": "^1.1.5", - "@radix-ui/react-tooltip": "^1.0.7", "@tanstack/react-query": "^5.8.1", "@tanstack/react-query-devtools": "^5.8.1", "@tanstack/react-table": "^8.10.7", @@ -33,7 +19,6 @@ "cmdk": "^0.2.0", "date-fns": "^2.30.0", "ethers": "^5.7.2", - "lucide-react": "^0.292.0", "next": "14.0.1", "next-themes": "^0.2.1", "path-to-regexp": "^6.2.1", @@ -43,18 +28,18 @@ "react-json-pretty": "^2.2.0", "recharts": "^2.9.3", "tailwind-merge": "^2.0.0", - "tailwindcss-animate": "^1.0.7", - "zustand": "^4.4.6" + "tailwindcss-animate": "^1.0.7" }, "devDependencies": { - "@types/node": "^20", - "@types/react": "^18", + "@repo/ui": "workspace:*", + "@types/node": "^20.12.12", + "@types/react": "^18.3.3", "@types/react-dom": "^18", "autoprefixer": "^10.0.1", "eslint": "^8", "eslint-config-next": "14.0.1", "postcss": "^8", - "tailwindcss": "^3.3.0", - "typescript": "^5" + "tailwindcss": "^3.4.3", + "typescript": "^5.4.5" } } diff --git a/tools/tenscan/frontend/pages/404.tsx b/tools/tenscan/frontend/pages/404.tsx index 2b7a07c742..52c795cc44 100644 --- a/tools/tenscan/frontend/pages/404.tsx +++ b/tools/tenscan/frontend/pages/404.tsx @@ -1,38 +1,7 @@ -import { ErrorType } from "@/src/types/interfaces"; -import Error from "./_error"; +import Custom404Error from "@repo/ui/components/common/404"; -export function Custom404Error({ - customPageTitle, - showRedirectText, - redirectText, - isFullWidth, - message, - showMessage = true, - redirectLink, - children, -}: ErrorType) { - return ( - - {children} - - ); -} +const Custom404 = () => { + return ; +}; -export default Custom404Error; +export default Custom404; diff --git a/tools/tenscan/frontend/pages/500.tsx b/tools/tenscan/frontend/pages/500.tsx index 2f3826812c..62e6c09860 100644 --- a/tools/tenscan/frontend/pages/500.tsx +++ b/tools/tenscan/frontend/pages/500.tsx @@ -1,32 +1,7 @@ -import { ErrorType } from "@/src/types/interfaces"; -import Error from "./_error"; +import Custom500Error from "@repo/ui/components/common/500"; -function Custom500Error({ - customPageTitle, - message, - showRedirectText, - redirectText, - err, - redirectLink, - children, -}: ErrorType) { - return ( - - {children} - - ); -} +const Custom404 = () => { + return ; +}; -export default Custom500Error; +export default Custom404; diff --git a/tools/tenscan/frontend/pages/_app.tsx b/tools/tenscan/frontend/pages/_app.tsx index 9c63ee0a42..5074041570 100644 --- a/tools/tenscan/frontend/pages/_app.tsx +++ b/tools/tenscan/frontend/pages/_app.tsx @@ -8,15 +8,14 @@ import { } from "@tanstack/react-query"; import "@/styles/globals.css"; import type { AppProps } from "next/app"; -import { Toaster } from "@/src/components/ui/toaster"; -import { WalletConnectionProvider } from "@/src/components/providers/wallet-provider"; -import { NetworkStatus } from "@/src/components/modules/common/network-status"; +import { Toaster } from "@repo/ui/components/shared/toaster"; +import { NetworkStatus } from "@repo/ui/components/common/network-status"; import HeadSeo from "@/src/components/head-seo"; import { siteMetadata } from "@/src/lib/siteMetadata"; import Script from "next/script"; import { GOOGLE_ANALYTICS_ID } from "@/src/lib/constants"; -import { showToast } from "@/src/components/ui/use-toast"; -import { ToastType } from "@/src/types/interfaces"; +import { showToast } from "@repo/ui/components/shared/use-toast"; +import { ToastType } from "@repo/ui/lib/enums/toast"; export default function App({ Component, pageProps }: AppProps) { const mutationCache = new MutationCache({ @@ -76,12 +75,10 @@ export default function App({ Component, pageProps }: AppProps) { enableSystem disableTransitionOnChange > - - - - - - + + + + diff --git a/tools/tenscan/frontend/pages/_error.tsx b/tools/tenscan/frontend/pages/_error.tsx index 54b7deca69..c0a556a211 100644 --- a/tools/tenscan/frontend/pages/_error.tsx +++ b/tools/tenscan/frontend/pages/_error.tsx @@ -1,91 +1,27 @@ +import CustomError from "@repo/ui/components/common/error"; import React from "react"; -import NextErrorComponent from "next/error"; -import Link from "next/link"; -import Image from "next/image"; -import { ErrorType } from "@/src/types/interfaces"; -function ErrorMessage({ - statusText, - message, - showMessage, - showStatusText, -}: any) { +export default function CustomErrorPage({ statusCode, err }: any) { return ( -
- {showStatusText &&

{statusText}

} - {message && showMessage && ( -

{message}

- )} -
+ ); } -export function CustomError({ - showRedirectText = true, - heading = "Oops! Something went wrong.", - statusText = "500", - message = "We're experiencing technical difficulties. Please try again later.", - redirectText = "Home Page", - isFullWidth, - err, - showMessage = true, - showStatusText, - statusCode, - isModal, - redirectLink = "/", - children, - ...props -}: ErrorType) { - return ( -
-
-
-

{heading}

-
- -
- {showRedirectText && ( -
- Go to{" "} - - {redirectText} - {" "} - {/*
- Looks like you're on the wrong side of town, buddy. - Let's get you back on the right side. -
*/} -
- )} - {children} -
-
-
- ); -} - -CustomError.getInitialProps = async ({ res, err }: any) => { +// custom server-side props +CustomErrorPage.getInitialProps = async ({ res, err }: any) => { const statusCode = res ? res.statusCode : err?.statusCode || 404; - const errorInitialProps = await NextErrorComponent.getInitialProps({ - res, - err, - } as any); - errorInitialProps.statusCode = statusCode; - - return statusCode < 500 - ? errorInitialProps - : { ...errorInitialProps, statusCode }; + return { statusCode, err }; }; - -export default CustomError; diff --git a/tools/tenscan/frontend/pages/address/[address].tsx b/tools/tenscan/frontend/pages/address/[address].tsx index 32777aa68e..05c70e86eb 100644 --- a/tools/tenscan/frontend/pages/address/[address].tsx +++ b/tools/tenscan/frontend/pages/address/[address].tsx @@ -1,10 +1,8 @@ -import HeadSeo from "@/src/components/head-seo"; +import React from "react"; import Layout from "@/src/components/layouts/default-layout"; -import EmptyState from "@/src/components/modules/common/empty-state"; -import { Button } from "@/src/components/ui/button"; -import { siteMetadata } from "@/src/lib/siteMetadata"; +import EmptyState from "@repo/ui/components/common/empty-state"; +import { Button } from "@repo/ui/components/shared/button"; import { useRouter } from "next/router"; -import React from "react"; const AddressDetails = () => { const { push } = useRouter(); diff --git a/tools/tenscan/frontend/pages/batch/[hash].tsx b/tools/tenscan/frontend/pages/batch/[hash].tsx index cd55e6f65c..bb6bac900a 100644 --- a/tools/tenscan/frontend/pages/batch/[hash].tsx +++ b/tools/tenscan/frontend/pages/batch/[hash].tsx @@ -7,8 +7,8 @@ import { CardTitle, CardContent, CardDescription, -} from "@/src/components/ui/card"; -import { Skeleton } from "@/src/components/ui/skeleton"; +} from "@repo/ui/components/shared/card"; +import LoadingState from "@repo/ui/components/common/loading-state"; import { useQuery } from "@tanstack/react-query"; import { useRouter } from "next/router"; @@ -26,7 +26,7 @@ export default function Batch() { return ( {isLoading ? ( - + ) : batchDetails ? ( diff --git a/tools/tenscan/frontend/pages/batch/height/[height].tsx b/tools/tenscan/frontend/pages/batch/height/[height].tsx index 7982d825cf..f0624fb889 100644 --- a/tools/tenscan/frontend/pages/batch/height/[height].tsx +++ b/tools/tenscan/frontend/pages/batch/height/[height].tsx @@ -1,14 +1,14 @@ import { fetchBatchByHeight } from "@/api/batches"; import Layout from "@/src/components/layouts/default-layout"; import { BatchHeightDetailsComponent } from "@/src/components/modules/batches/batch-height-details"; +import LoadingState from "@repo/ui/components/common/loading-state"; import { Card, CardHeader, CardTitle, CardContent, CardDescription, -} from "@/src/components/ui/card"; -import { Skeleton } from "@/src/components/ui/skeleton"; +} from "@repo/ui/components/shared/card"; import { useQuery } from "@tanstack/react-query"; import { useRouter } from "next/router"; @@ -26,7 +26,7 @@ export default function Batch() { return ( {isLoading ? ( - + ) : batchDetails ? ( diff --git a/tools/tenscan/frontend/pages/batch/txs/[fullHash].tsx b/tools/tenscan/frontend/pages/batch/txs/[fullHash].tsx deleted file mode 100644 index 1d0748d532..0000000000 --- a/tools/tenscan/frontend/pages/batch/txs/[fullHash].tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { fetchBatchTransactions } from "@/api/batches"; -import Layout from "@/src/components/layouts/default-layout"; -import { DataTable } from "@/src/components/modules/common/data-table/data-table"; -import { columns } from "@/src/components/modules/batches/transaction-columns"; -import { - Card, - CardHeader, - CardTitle, - CardContent, - CardDescription, -} from "@/src/components/ui/card"; -import { useQuery } from "@tanstack/react-query"; -import { useRouter } from "next/router"; -import { getOptions } from "@/src/lib/constants"; -import TruncatedAddress from "@/src/components/modules/common/truncated-address"; - -export default function BatchTransactions() { - const router = useRouter(); - const { fullHash } = router.query; - const options = getOptions(router.query); - - const { data, isLoading, refetch } = useQuery({ - queryKey: ["batchTransactions", { fullHash, options }], - queryFn: () => fetchBatchTransactions(fullHash as string, options), - }); - - const { TransactionsData, Total } = data?.result || { - TransactionsData: [], - Total: 0, - }; - - return ( - - - - Transactions - -

Overview of all transactions in this batch:

- -
-
- - - -
-
- ); -} - -export async function getServerSideProps(context: any) { - return { - props: {}, - }; -} diff --git a/tools/tenscan/frontend/pages/batch/txs/[hash].tsx b/tools/tenscan/frontend/pages/batch/txs/[hash].tsx new file mode 100644 index 0000000000..4de42bc959 --- /dev/null +++ b/tools/tenscan/frontend/pages/batch/txs/[hash].tsx @@ -0,0 +1,75 @@ +import React from "react"; +import { fetchBatchTransactions } from "../../../api/batches"; +import Layout from "../../../src/components/layouts/default-layout"; +import { DataTable } from "@repo/ui/components/common/data-table/data-table"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { columns } from "../../../src/components/modules/batches/transaction-columns"; +import { + Card, + CardHeader, + CardTitle, + CardContent, + CardDescription, +} from "@repo/ui/components/shared/card"; +import { useQuery } from "@tanstack/react-query"; +import { useRouter } from "next/router"; +import { getOptions } from "../../../src/lib/constants"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; + +export default function BatchTransactions() { + const router = useRouter(); + const { hash } = router.query; + const options = getOptions(router.query); + + const { data, isLoading, refetch } = useQuery({ + queryKey: ["batchTransactions", { hash, options }], + queryFn: () => fetchBatchTransactions(hash as string, options), + }); + + const { TransactionsData, Total } = data?.result || { + TransactionsData: [], + Total: 0, + }; + + return ( + + + + Transactions +
+ + + Overview of all transactions in this batch: + + + +
+
+ + + +
+
+ ); +} + +export async function getServerSideProps(context: any) { + return { + props: {}, + }; +} diff --git a/tools/tenscan/frontend/pages/batches/index.tsx b/tools/tenscan/frontend/pages/batches/index.tsx index 2517daac17..318460b4d6 100644 --- a/tools/tenscan/frontend/pages/batches/index.tsx +++ b/tools/tenscan/frontend/pages/batches/index.tsx @@ -1,13 +1,13 @@ import React from "react"; import { columns } from "@/src/components/modules/batches/columns"; -import { DataTable } from "@/src/components/modules/common/data-table/data-table"; +import { DataTable } from "@repo/ui/components/common/data-table/data-table"; import Layout from "@/src/components/layouts/default-layout"; import { Metadata } from "next"; import { useBatchesService } from "@/src/services/useBatchesService"; -import { getItem } from "@/src/lib/utils"; -import { ItemPosition } from "@/src/types/interfaces"; +import { getItem } from "@repo/ui/lib/utils"; import { siteMetadata } from "@/src/lib/siteMetadata"; import HeadSeo from "@/src/components/head-seo"; +import { ItemPosition } from "@repo/ui/lib/enums/ui"; export const metadata: Metadata = { title: "Batches", @@ -15,22 +15,12 @@ export const metadata: Metadata = { }; export default function Batches() { - const { batches, refetchBatches, isBatchesLoading, setNoPolling } = - useBatchesService(); + const { batches, refetchBatches, isBatchesLoading } = useBatchesService(); const { BatchesData, Total } = batches?.result || { BatchesData: [], Total: 0, }; - React.useEffect(() => { - setNoPolling(true); - - return () => { - setNoPolling(false); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - const firstBatchHeight = Number(getItem(BatchesData, "height")); const lastBatchHeight = Number( getItem(BatchesData, "height", ItemPosition.LAST) diff --git a/tools/tenscan/frontend/pages/blocks/index.tsx b/tools/tenscan/frontend/pages/blocks/index.tsx index 756add84b4..4383266fe3 100644 --- a/tools/tenscan/frontend/pages/blocks/index.tsx +++ b/tools/tenscan/frontend/pages/blocks/index.tsx @@ -1,13 +1,13 @@ import React from "react"; import { columns } from "@/src/components/modules/blocks/columns"; -import { DataTable } from "@/src/components/modules/common/data-table/data-table"; +import { DataTable } from "@repo/ui/components/common/data-table/data-table"; import Layout from "@/src/components/layouts/default-layout"; import { Metadata } from "next"; import { useBlocksService } from "@/src/services/useBlocksService"; -import { getItem } from "@/src/lib/utils"; -import { ItemPosition } from "@/src/types/interfaces"; +import { getItem } from "@repo/ui/lib/utils"; import HeadSeo from "@/src/components/head-seo"; import { siteMetadata } from "@/src/lib/siteMetadata"; +import { ItemPosition } from "@repo/ui/lib/enums/ui"; export const metadata: Metadata = { title: "Blocks", @@ -15,19 +15,12 @@ export const metadata: Metadata = { }; export default function Blocks() { - const { blocks, setNoPolling, refetchBlocks, isBlocksLoading } = - useBlocksService(); + const { blocks, refetchBlocks, isBlocksLoading } = useBlocksService(); const { BlocksData, Total } = blocks?.result || { BlocksData: [], Total: 0, }; - React.useEffect(() => { - setNoPolling(true); - return () => setNoPolling(false); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - const firstBlockNumber = Number(getItem(BlocksData, "blockHeader.number")); const lastBlockNumber = Number( getItem(BlocksData, "blockHeader.number", ItemPosition.LAST) diff --git a/tools/tenscan/frontend/pages/docs/[id].tsx b/tools/tenscan/frontend/pages/docs/[id].tsx index 56ca02d6d0..a1b4da5f6a 100644 --- a/tools/tenscan/frontend/pages/docs/[id].tsx +++ b/tools/tenscan/frontend/pages/docs/[id].tsx @@ -1,11 +1,11 @@ import Layout from "@/src/components/layouts/default-layout"; -import Spinner from "@/src/components/ui/spinner"; import { siteMetadata } from "@/src/lib/siteMetadata"; import { useRouter } from "next/router"; import React from "react"; -import Custom404Error from "../404"; -import { showToast } from "@/src/components/ui/use-toast"; -import { ToastType } from "@/src/types/interfaces"; +import { showToast } from "@repo/ui/components/shared/use-toast"; +import { ToastType } from "@repo/ui/lib/enums/toast"; +import Custom404Error from "@repo/ui/components/common/404"; +import Spinner from "@repo/ui/components/shared/spinner"; type Document = { title: string; diff --git a/tools/tenscan/frontend/pages/personal/index.tsx b/tools/tenscan/frontend/pages/personal/index.tsx index 28c4e74e70..d228f98e0d 100644 --- a/tools/tenscan/frontend/pages/personal/index.tsx +++ b/tools/tenscan/frontend/pages/personal/index.tsx @@ -1,13 +1,13 @@ import React from "react"; -import Layout from "@/src/components/layouts/default-layout"; +import Layout from "../../src/components/layouts/default-layout"; import { Metadata } from "next"; -import PersonalTransactions from "@/src/components/modules/personal"; -import { useWalletConnection } from "@/src/components/providers/wallet-provider"; -import ConnectWalletButton from "@/src/components/modules/common/connect-wallet"; -import EmptyState from "@/src/components/modules/common/empty-state"; -import { ethereum } from "@/src/lib/utils"; -import HeadSeo from "@/src/components/head-seo"; -import { siteMetadata } from "@/src/lib/siteMetadata"; +import PersonalTransactions from "../../src/components/modules/personal"; +import useWalletStore from "@repo/ui/stores/wallet-store"; +import ConnectWalletButton from "@repo/ui/components/common/connect-wallet"; +import EmptyState from "@repo/ui/components/common/empty-state"; +import { ethereum } from "@repo/ui/lib/utils"; +import HeadSeo from "../../src/components/head-seo"; +import { siteMetadata } from "../../src/lib/siteMetadata"; export const metadata: Metadata = { title: "Personal Transactions", @@ -15,7 +15,7 @@ export const metadata: Metadata = { }; export default function PersonalPage() { - const { walletConnected } = useWalletConnection(); + const { walletConnected } = useWalletStore(); return ( <> diff --git a/tools/tenscan/frontend/pages/tx/personal/[hash].tsx b/tools/tenscan/frontend/pages/personal/tx/[hash].tsx similarity index 70% rename from tools/tenscan/frontend/pages/tx/personal/[hash].tsx rename to tools/tenscan/frontend/pages/personal/tx/[hash].tsx index 65e0c9889c..00dfdfbf60 100644 --- a/tools/tenscan/frontend/pages/tx/personal/[hash].tsx +++ b/tools/tenscan/frontend/pages/personal/tx/[hash].tsx @@ -1,24 +1,25 @@ -import Layout from "@/src/components/layouts/default-layout"; -import EmptyState from "@/src/components/modules/common/empty-state"; -import { Button } from "@/src/components/ui/button"; +import React from "react"; +import Layout from "../../../src/components/layouts/default-layout"; +import EmptyState from "@repo/ui/components/common/empty-state"; +import { Button } from "@repo/ui/components/shared/button"; import { Card, CardHeader, CardTitle, CardContent, -} from "@/src/components/ui/card"; -import { Skeleton } from "@/src/components/ui/skeleton"; +} from "@repo/ui/components/shared/card"; import { useQuery } from "@tanstack/react-query"; import { useRouter } from "next/router"; -import { fetchPersonalTxnByHash } from "@/api/transactions"; -import { useWalletConnection } from "@/src/components/providers/wallet-provider"; -import { PersonalTxnDetailsComponent } from "@/src/components/modules/personal/personal-txn-details"; -import ConnectWalletButton from "@/src/components/modules/common/connect-wallet"; -import { ethereum } from "@/src/lib/utils"; +import { fetchPersonalTxnByHash } from "../../../api/transactions"; +import { PersonalTxnDetailsComponent } from "../../../src/components/modules/personal/personal-txn-details"; +import { ethereum } from "@repo/ui/lib/utils"; +import useWalletStore from "@repo/ui/stores/wallet-store"; +import ConnectWalletButton from "@repo/ui/components/common/connect-wallet"; +import LoadingState from "@repo/ui/components/common/loading-state"; export default function TransactionDetails() { const router = useRouter(); - const { provider, walletConnected } = useWalletConnection(); + const { provider, walletConnected } = useWalletStore(); const { hash } = router.query; const { data: transactionDetails, isLoading } = useQuery({ @@ -31,7 +32,7 @@ export default function TransactionDetails() { {walletConnected ? ( isLoading ? ( - + ) : transactionDetails ? ( diff --git a/tools/tenscan/frontend/pages/rollup/[hash]/batches.tsx b/tools/tenscan/frontend/pages/rollup/[hash]/batches.tsx index 7df649aef2..e694ac4513 100644 --- a/tools/tenscan/frontend/pages/rollup/[hash]/batches.tsx +++ b/tools/tenscan/frontend/pages/rollup/[hash]/batches.tsx @@ -1,9 +1,9 @@ import React from "react"; import { columns } from "@/src/components/modules/batches/columns"; -import { DataTable } from "@/src/components/modules/common/data-table/data-table"; +import { DataTable } from "@repo/ui/components/common/data-table/data-table"; import Layout from "@/src/components/layouts/default-layout"; import { Metadata } from "next"; -import { formatNumber } from "@/src/lib/utils"; +import { formatNumber } from "@repo/ui/lib/utils"; import { useRollupsService } from "@/src/services/useRollupsService"; export const metadata: Metadata = { diff --git a/tools/tenscan/frontend/pages/rollup/[hash]/index.tsx b/tools/tenscan/frontend/pages/rollup/[hash]/index.tsx index 889f780409..b121ef04c3 100644 --- a/tools/tenscan/frontend/pages/rollup/[hash]/index.tsx +++ b/tools/tenscan/frontend/pages/rollup/[hash]/index.tsx @@ -1,16 +1,16 @@ import { fetchRollupByHash } from "@/api/rollups"; import Layout from "@/src/components/layouts/default-layout"; import { RollupDetailsComponent } from "@/src/components/modules/rollups/rollup-details"; -import EmptyState from "@/src/components/modules/common/empty-state"; -import { Button } from "@/src/components/ui/button"; +import EmptyState from "@repo/ui/components/common/empty-state"; +import LoadingState from "@repo/ui/components/common/loading-state"; +import { Button } from "@repo/ui/components/shared/button"; import { Card, CardHeader, CardTitle, CardContent, CardDescription, -} from "@/src/components/ui/card"; -import { Skeleton } from "@/src/components/ui/skeleton"; +} from "@repo/ui/components/shared/card"; import { useQuery } from "@tanstack/react-query"; import { useRouter } from "next/router"; @@ -28,7 +28,7 @@ export default function RollupDetails() { return ( {isLoading ? ( - + ) : rollupDetails ? ( diff --git a/tools/tenscan/frontend/pages/rollup/batch/sequence/[sequence].tsx b/tools/tenscan/frontend/pages/rollup/batch/sequence/[sequence].tsx index eb8b2716d8..c551d16515 100644 --- a/tools/tenscan/frontend/pages/rollup/batch/sequence/[sequence].tsx +++ b/tools/tenscan/frontend/pages/rollup/batch/sequence/[sequence].tsx @@ -1,18 +1,18 @@ import { fetchRollupByBatchSequence } from "@/api/rollups"; import Layout from "@/src/components/layouts/default-layout"; -import EmptyState from "@/src/components/modules/common/empty-state"; +import EmptyState from "@repo/ui/components/common/empty-state"; import { RollupDetailsComponent } from "@/src/components/modules/rollups/rollup-details"; -import { Button } from "@/src/components/ui/button"; +import { Button } from "@repo/ui/components/shared/button"; import { Card, CardHeader, CardTitle, CardContent, CardDescription, -} from "@/src/components/ui/card"; -import { Skeleton } from "@/src/components/ui/skeleton"; +} from "@repo/ui/components/shared/card"; import { useQuery } from "@tanstack/react-query"; import { useRouter } from "next/router"; +import LoadingState from "@repo/ui/components/common/loading-state"; export default function RollupBatchSequenceDetails() { const router = useRouter(); @@ -28,7 +28,7 @@ export default function RollupBatchSequenceDetails() { return ( {isLoading ? ( - + ) : rollupDetails ? ( diff --git a/tools/tenscan/frontend/pages/rollups/index.tsx b/tools/tenscan/frontend/pages/rollups/index.tsx index f9932f73f8..7d8b6a19d1 100644 --- a/tools/tenscan/frontend/pages/rollups/index.tsx +++ b/tools/tenscan/frontend/pages/rollups/index.tsx @@ -1,13 +1,13 @@ import React from "react"; -import { DataTable } from "@/src/components/modules/common/data-table/data-table"; +import { DataTable } from "@repo/ui/components/common/data-table/data-table"; import Layout from "@/src/components/layouts/default-layout"; import { useRollupsService } from "@/src/services/useRollupsService"; import { Metadata } from "next"; import { columns } from "@/src/components/modules/rollups/columns"; -import { getItem } from "@/src/lib/utils"; -import { ItemPosition } from "@/src/types/interfaces"; +import { getItem } from "@repo/ui/lib/utils"; import HeadSeo from "@/src/components/head-seo"; import { siteMetadata } from "@/src/lib/siteMetadata"; +import { ItemPosition } from "@repo/ui/lib/enums/ui"; export const metadata: Metadata = { title: "Rollups", @@ -15,22 +15,12 @@ export const metadata: Metadata = { }; export default function Rollups() { - const { rollups, setNoPolling, isRollupsLoading, refetchRollups } = - useRollupsService(); + const { rollups, isRollupsLoading, refetchRollups } = useRollupsService(); const { RollupsData, Total } = rollups?.result || { RollupsData: [], Total: 0, }; - React.useEffect(() => { - setNoPolling(true); - - return () => { - setNoPolling(false); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - const firstRollupID = Number(getItem(RollupsData, "ID")); const lastRollupID = Number(getItem(RollupsData, "ID", ItemPosition.LAST)); diff --git a/tools/tenscan/frontend/pages/transactions/index.tsx b/tools/tenscan/frontend/pages/transactions/index.tsx index a94c0e45d4..5225b70d3d 100644 --- a/tools/tenscan/frontend/pages/transactions/index.tsx +++ b/tools/tenscan/frontend/pages/transactions/index.tsx @@ -1,13 +1,13 @@ import React from "react"; import { columns } from "@/src/components/modules/transactions/columns"; -import { DataTable } from "@/src/components/modules/common/data-table/data-table"; +import { DataTable } from "@repo/ui/components/common/data-table/data-table"; import Layout from "@/src/components/layouts/default-layout"; import { useTransactionsService } from "@/src/services/useTransactionsService"; import { Metadata } from "next"; -import { getItem } from "@/src/lib/utils"; -import { ItemPosition } from "@/src/types/interfaces"; +import { getItem } from "@repo/ui/lib/utils"; import HeadSeo from "@/src/components/head-seo"; import { siteMetadata } from "@/src/lib/siteMetadata"; +import { ItemPosition } from "@repo/ui/lib/enums/ui"; export const metadata: Metadata = { title: "Transactions", @@ -15,26 +15,13 @@ export const metadata: Metadata = { }; export default function Transactions() { - const { - transactions, - refetchTransactions, - setNoPolling, - isTransactionsLoading, - } = useTransactionsService(); + const { transactions, refetchTransactions, isTransactionsLoading } = + useTransactionsService(); const { TransactionsData, Total } = transactions?.result || { TransactionsData: [], Total: 0, }; - React.useEffect(() => { - setNoPolling(true); - - return () => { - setNoPolling(false); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - const firstBatchHeight = getItem(TransactionsData, "BatchHeight"); const lastBatchHeight = getItem( TransactionsData, diff --git a/tools/tenscan/frontend/pages/tx/[hash].tsx b/tools/tenscan/frontend/pages/tx/[hash].tsx index c47d0fb2ff..dbd3077971 100644 --- a/tools/tenscan/frontend/pages/tx/[hash].tsx +++ b/tools/tenscan/frontend/pages/tx/[hash].tsx @@ -1,15 +1,15 @@ import { fetchTransactionByHash } from "@/api/transactions"; import Layout from "@/src/components/layouts/default-layout"; import { TransactionDetailsComponent } from "@/src/components/modules/transactions/transaction-details"; -import EmptyState from "@/src/components/modules/common/empty-state"; -import { Button } from "@/src/components/ui/button"; +import EmptyState from "@repo/ui/components/common/empty-state"; +import LoadingState from "@repo/ui/components/common/loading-state"; +import { Button } from "@repo/ui/components/shared/button"; import { Card, CardHeader, CardTitle, CardContent, -} from "@/src/components/ui/card"; -import { Skeleton } from "@/src/components/ui/skeleton"; +} from "@repo/ui/components/shared/card"; import { useQuery } from "@tanstack/react-query"; import { useRouter } from "next/router"; @@ -28,14 +28,7 @@ export default function TransactionDetails() { {isLoading ? ( - <> - - - - - - - + ) : transactionDetails ? ( <> diff --git a/tools/tenscan/frontend/src/components/date-range-picker.tsx b/tools/tenscan/frontend/src/components/date-range-picker.tsx index 325a998b65..3c90d5c8a1 100644 --- a/tools/tenscan/frontend/src/components/date-range-picker.tsx +++ b/tools/tenscan/frontend/src/components/date-range-picker.tsx @@ -1,18 +1,18 @@ "use client"; import * as React from "react"; -import { CalendarIcon } from "@radix-ui/react-icons"; +import { CalendarIcon } from "@repo/ui/components/shared/react-icons"; import { addDays, format } from "date-fns"; import { DateRange } from "react-day-picker"; -import { cn } from "@/src/lib/utils"; -import { Button } from "@/src/components/ui/button"; -import { Calendar } from "@/src/components/ui/calendar"; +import { cn } from "@repo/ui/lib/utils"; +import { Button } from "@repo/ui/components/shared/button"; +import { Calendar } from "@repo/ui/components/shared/calendar"; import { Popover, PopoverContent, PopoverTrigger, -} from "@/src/components/ui/popover"; +} from "@repo/ui/components/shared/popover"; export function CalendarDateRangePicker({ className, diff --git a/tools/tenscan/frontend/src/components/head-seo.tsx b/tools/tenscan/frontend/src/components/head-seo.tsx index 3cafb9c345..d6d588339f 100644 --- a/tools/tenscan/frontend/src/components/head-seo.tsx +++ b/tools/tenscan/frontend/src/components/head-seo.tsx @@ -1,6 +1,6 @@ import Head from "next/head"; -import { SeoProps } from "../types/interfaces"; import { siteMetadata } from "../lib/siteMetadata"; +import { SeoProps } from "@repo/ui/lib/interfaces/ui"; const HeadSeo = ({ title, diff --git a/tools/tenscan/frontend/src/components/health-indicator.tsx b/tools/tenscan/frontend/src/components/health-indicator.tsx index c5c0f296dd..c522ac2a5d 100644 --- a/tools/tenscan/frontend/src/components/health-indicator.tsx +++ b/tools/tenscan/frontend/src/components/health-indicator.tsx @@ -1,13 +1,13 @@ import React from "react"; -import { Badge, badgeVariants } from "./ui/badge"; +import { Badge, badgeVariants } from "@repo/ui/components/shared/badge"; import { useGeneralService } from "../services/useGeneralService"; -import { BarChart } from "lucide-react"; +import { BarChart } from "@repo/ui/components/shared/react-icons"; import { TooltipProvider, TooltipTrigger, TooltipContent, Tooltip, -} from "./ui/tooltip"; +} from "@repo/ui/components/shared/tooltip"; const HealthIndicator = () => { const [status, setStatus] = React.useState(false); diff --git a/tools/tenscan/frontend/src/components/layouts/footer.tsx b/tools/tenscan/frontend/src/components/layouts/footer.tsx index 319c42835c..465fdd6b91 100644 --- a/tools/tenscan/frontend/src/components/layouts/footer.tsx +++ b/tools/tenscan/frontend/src/components/layouts/footer.tsx @@ -1,10 +1,11 @@ import Link from "next/link"; -import { socialLinks, version } from "../../lib/constants"; +import { socialLinks } from "@repo/ui/lib/constants"; import { GitHubLogoIcon, TwitterLogoIcon, DiscordLogoIcon, -} from "@radix-ui/react-icons"; +} from "@repo/ui/components/shared/react-icons"; +import { version } from "@/src/lib/constants"; const SOCIAL_LINKS = [ { diff --git a/tools/tenscan/frontend/src/components/layouts/header.tsx b/tools/tenscan/frontend/src/components/layouts/header.tsx index 9ba8f94c00..b473e027c5 100644 --- a/tools/tenscan/frontend/src/components/layouts/header.tsx +++ b/tools/tenscan/frontend/src/components/layouts/header.tsx @@ -1,13 +1,12 @@ -import { MainNav } from "../main-nav"; -import { ModeToggle } from "../mode-toggle"; -import ConnectWalletButton from "../modules/common/connect-wallet"; -import Link from "next/link"; -import { HamburgerMenuIcon } from "@radix-ui/react-icons"; -import { X } from "lucide-react"; import { useState } from "react"; -import { Button } from "../ui/button"; -import HealthIndicator from "../health-indicator"; +import Link from "next/link"; import Image from "next/image"; +import { MainNav } from "../main-nav"; +import { ModeToggle } from "@repo/ui/components/shared/mode-toggle"; +import ConnectWalletButton from "@repo/ui/components/common/connect-wallet"; +import { HamburgerMenuIcon, X } from "@repo/ui/components/shared/react-icons"; +import { Button } from "@repo/ui/components/shared/button"; +import HealthIndicator from "../health-indicator"; export default function Header() { return ( diff --git a/tools/tenscan/frontend/src/components/main-nav.tsx b/tools/tenscan/frontend/src/components/main-nav.tsx index 704af970cb..6f508f2e59 100644 --- a/tools/tenscan/frontend/src/components/main-nav.tsx +++ b/tools/tenscan/frontend/src/components/main-nav.tsx @@ -2,17 +2,17 @@ import React from "react"; import Link from "next/link"; import { useRouter } from "next/router"; -import { cn } from "@/src/lib/utils"; -import { Button } from "./ui/button"; +import { cn } from "@repo/ui/lib/utils"; +import { Button } from "@repo/ui/components/shared/button"; import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, -} from "./ui/dropdown-menu"; +} from "@repo/ui/components/shared/dropdown-menu"; -import { ChevronDownIcon } from "@radix-ui/react-icons"; +import { ChevronDownIcon } from "@repo/ui/components/shared/react-icons"; import { NavLink } from "@/src/types/interfaces"; import { NavLinks } from "../routes"; diff --git a/tools/tenscan/frontend/src/components/mode-toggle.tsx b/tools/tenscan/frontend/src/components/mode-toggle.tsx deleted file mode 100644 index 7333cb883a..0000000000 --- a/tools/tenscan/frontend/src/components/mode-toggle.tsx +++ /dev/null @@ -1,40 +0,0 @@ -"use client"; - -import * as React from "react"; -import { Moon, Sun } from "lucide-react"; -import { useTheme } from "next-themes"; - -import { Button } from "@/src/components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@/src/components/ui/dropdown-menu"; - -export function ModeToggle() { - const { setTheme } = useTheme(); - - return ( - - - - - - setTheme("light")}> - Light - - setTheme("dark")}> - Dark - - setTheme("system")}> - System - - - - ); -} diff --git a/tools/tenscan/frontend/src/components/modules/batches/batch-hash-details.tsx b/tools/tenscan/frontend/src/components/modules/batches/batch-hash-details.tsx index f48a609f0b..159d9b146d 100644 --- a/tools/tenscan/frontend/src/components/modules/batches/batch-hash-details.tsx +++ b/tools/tenscan/frontend/src/components/modules/batches/batch-hash-details.tsx @@ -1,22 +1,33 @@ -import { Separator } from "@/src/components/ui/separator"; -import TruncatedAddress from "../common/truncated-address"; -import KeyValueItem, { KeyValueList } from "@/src/components/ui/key-value"; -import { formatNumber, formatTimeAgo } from "@/src/lib/utils"; -import { Badge } from "@/src/components/ui/badge"; -import { Batch, BatchDetails } from "@/src/types/interfaces/BatchInterfaces"; +import { useMemo, useState } from "react"; +import { Separator } from "@repo/ui/components/shared/separator"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import KeyValueItem, { + KeyValueList, +} from "@repo/ui/components/shared/key-value"; +import { + formatNumber, + formatTimeAgo, + formatTimestampToDate, +} from "@repo/ui/lib/utils"; +import { Badge } from "@repo/ui/components/shared/badge"; import Link from "next/link"; -import { EyeClosedIcon, EyeOpenIcon } from "@radix-ui/react-icons"; -import { Button } from "../../ui/button"; +import { + EyeClosedIcon, + EyeOpenIcon, +} from "@repo/ui/components/shared/react-icons"; +import { Button } from "@repo/ui/components/shared/button"; +import Copy from "@repo/ui/components/common/copy"; import { useRollupsService } from "@/src/services/useRollupsService"; import JSONPretty from "react-json-pretty"; -import { useState } from "react"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, -} from "../../ui/tooltip"; -import Copy from "../common/copy"; +} from "@repo/ui/components/shared/tooltip"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; +import { BatchDetails } from "@/src/types/interfaces/BatchInterfaces"; export function BatchHashDetailsComponent({ batchDetails, @@ -26,6 +37,31 @@ export function BatchHashDetailsComponent({ const { decryptedRollup, decryptEncryptedData } = useRollupsService(); const [showDecryptedData, setShowDecryptedData] = useState(false); + const transactionHashes = useMemo( + () => + batchDetails?.TxHashes.length > 0 ? ( +
    + {batchDetails.TxHashes.map((txHash, index) => ( +
  • + +
  • + ))} +
+ ) : ( + "-" + ), + [batchDetails?.TxHashes] + ); + + const handleDecryptToggle = () => { + decryptEncryptedData({ StrData: batchDetails?.EncryptedTxBlob }); + setShowDecryptedData(!showDecryptedData); + }; + return (
@@ -33,7 +69,9 @@ export function BatchHashDetailsComponent({ label="Batch Height" value={ {"#" + Number(batchDetails?.Header?.number)} @@ -42,47 +80,75 @@ export function BatchHashDetailsComponent({ /> } + value={ + + } /> + } /> } + value={ + + } /> } /> + } /> - {formatTimeAgo(batchDetails?.Header?.timestamp)} + + {formatTimeAgo(batchDetails?.Header?.timestamp) + + " - " + + formatTimestampToDate(batchDetails?.Header?.timestamp)} } /> } + value={ + + } /> + {formatNumber(batchDetails?.Header?.gasLimit)} + + } /> + {formatNumber(batchDetails?.Header?.baseFeePerGas)} + + } /> } /> @@ -106,73 +177,54 @@ export function BatchHashDetailsComponent({ /> } - /> - + } /> - - - + - {batchDetails?.TxHashes?.map((txHash, index) => ( -
  • - -
  • - ))} - - ) : ( - "-" - ) - } + value={transactionHashes} isLastItem />
    + +
    - {" "} + - {showDecryptedData && decryptedRollup ? ( + + {showDecryptedData && decryptedRollup && ( @@ -183,14 +235,14 @@ export function BatchHashDetailsComponent({ - ) : null} + )}
    - {decryptedRollup && showDecryptedData ? ( + {showDecryptedData && decryptedRollup && ( <> - ) : null} + )} } isLastItem diff --git a/tools/tenscan/frontend/src/components/modules/batches/batch-height-details.tsx b/tools/tenscan/frontend/src/components/modules/batches/batch-height-details.tsx index c19a2d07c5..4c58f4654f 100644 --- a/tools/tenscan/frontend/src/components/modules/batches/batch-height-details.tsx +++ b/tools/tenscan/frontend/src/components/modules/batches/batch-height-details.tsx @@ -1,21 +1,32 @@ -import { Separator } from "@/src/components/ui/separator"; -import TruncatedAddress from "../common/truncated-address"; -import KeyValueItem, { KeyValueList } from "@/src/components/ui/key-value"; -import { formatNumber, formatTimeAgo } from "@/src/lib/utils"; -import { Badge } from "@/src/components/ui/badge"; -import { Batch, BatchDetails } from "@/src/types/interfaces/BatchInterfaces"; +import { Separator } from "@repo/ui/components/shared/separator"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import KeyValueItem, { + KeyValueList, +} from "@repo/ui/components/shared/key-value"; +import { + formatNumber, + formatTimeAgo, + formatTimestampToDate, +} from "@repo/ui/lib/utils"; +import { Badge } from "@repo/ui/components/shared/badge"; +import { Batch } from "@/src/types/interfaces/BatchInterfaces"; import Link from "next/link"; -import { EyeClosedIcon, EyeOpenIcon } from "@radix-ui/react-icons"; -import { Button } from "../../ui/button"; +import { + EyeClosedIcon, + EyeOpenIcon, +} from "@repo/ui/components/shared/react-icons"; +import { Button } from "@repo/ui/components/shared/button"; import { useRollupsService } from "@/src/services/useRollupsService"; import JSONPretty from "react-json-pretty"; -import { useState } from "react"; +import React, { useState } from "react"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, -} from "../../ui/tooltip"; +} from "@repo/ui/components/shared/tooltip"; +import { pageLinks } from "@/src/routes"; +import { pathToUrl } from "@/src/routes/router"; export function BatchHeightDetailsComponent({ batchDetails, @@ -41,45 +52,67 @@ export function BatchHeightDetailsComponent({ value={ } /> + } /> } + value={ + + } /> } /> + } /> - {formatTimeAgo(batchDetails?.header?.timestamp)} + {formatTimeAgo(batchDetails?.header?.timestamp) + + " - " + + formatTimestampToDate(batchDetails?.header?.timestamp)} } /> } + value={ + + } /> } /> @@ -115,7 +149,12 @@ export function BatchHeightDetailsComponent({ /> } + value={ + + } /> - {batchDetails?.txCount || "-"} - + batchDetails?.txCount > 0 ? ( + + {batchDetails?.txCount}{" "} + + View + + + ) : ( + batchDetails?.txCount || "-" + ) } isLastItem /> diff --git a/tools/tenscan/frontend/src/components/modules/batches/columns.tsx b/tools/tenscan/frontend/src/components/modules/batches/columns.tsx index c53138b099..721d15b5b2 100644 --- a/tools/tenscan/frontend/src/components/modules/batches/columns.tsx +++ b/tools/tenscan/frontend/src/components/modules/batches/columns.tsx @@ -2,12 +2,14 @@ import { ColumnDef } from "@tanstack/react-table"; -import { DataTableColumnHeader } from "../common/data-table/data-table-column-header"; -import TruncatedAddress from "../common/truncated-address"; -import { formatNumber, formatTimeAgo } from "@/src/lib/utils"; +import { DataTableColumnHeader } from "@repo/ui/components/common/data-table/data-table-column-header"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { formatNumber, formatTimeAgo } from "@repo/ui/lib/utils"; import { Batch } from "@/src/types/interfaces/BatchInterfaces"; import Link from "next/link"; -import { Badge } from "../../ui/badge"; +import { Badge } from "@repo/ui/components/shared/badge"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export const columns: ColumnDef[] = [ { @@ -19,7 +21,9 @@ export const columns: ColumnDef[] = [ return (
    @@ -98,7 +102,9 @@ export const columns: ColumnDef[] = [ return ( ); }, @@ -124,7 +130,9 @@ export const columns: ColumnDef[] = [ cell: ({ row }) => { return ( {row.original.sequence} @@ -140,13 +148,17 @@ export const columns: ColumnDef[] = [ ), cell: ({ row }) => { - return ( + return row.original.txCount > 0 ? ( {row.original.txCount} + ) : ( + {row.original.txCount} ); }, enableSorting: false, diff --git a/tools/tenscan/frontend/src/components/modules/batches/constants.tsx b/tools/tenscan/frontend/src/components/modules/batches/constants.tsx index 395dc4771b..6f740be779 100644 --- a/tools/tenscan/frontend/src/components/modules/batches/constants.tsx +++ b/tools/tenscan/frontend/src/components/modules/batches/constants.tsx @@ -3,7 +3,7 @@ import { ArrowRightIcon, ArrowUpIcon, CheckCircledIcon, -} from "@radix-ui/react-icons"; +} from "@repo/ui/components/shared/react-icons"; export const labels = [ { diff --git a/tools/tenscan/frontend/src/components/modules/batches/transaction-columns.tsx b/tools/tenscan/frontend/src/components/modules/batches/transaction-columns.tsx index 4e1e97ff75..5ce0aa849b 100644 --- a/tools/tenscan/frontend/src/components/modules/batches/transaction-columns.tsx +++ b/tools/tenscan/frontend/src/components/modules/batches/transaction-columns.tsx @@ -1,15 +1,15 @@ "use client"; import { ColumnDef } from "@tanstack/react-table"; -import { Badge } from "@/src/components/ui/badge"; - +import { Badge } from "@repo/ui/components/shared/badge"; import { statuses } from "../transactions/constants"; -import { DataTableColumnHeader } from "../common/data-table/data-table-column-header"; +import { DataTableColumnHeader } from "@repo/ui/components/common/data-table/data-table-column-header"; import { Transaction } from "@/src/types/interfaces/TransactionInterfaces"; -import TruncatedAddress from "../common/truncated-address"; -import { formatNumber, formatTimeAgo } from "@/src/lib/utils"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { formatTimeAgo } from "@repo/ui/lib/utils"; import Link from "next/link"; -import { EyeOpenIcon } from "@radix-ui/react-icons"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export const columns: ColumnDef[] = [ { @@ -39,7 +39,9 @@ export const columns: ColumnDef[] = [ return ( ); }, diff --git a/tools/tenscan/frontend/src/components/modules/blocks/columns.tsx b/tools/tenscan/frontend/src/components/modules/blocks/columns.tsx index ee189d114b..b7b04e657a 100644 --- a/tools/tenscan/frontend/src/components/modules/blocks/columns.tsx +++ b/tools/tenscan/frontend/src/components/modules/blocks/columns.tsx @@ -2,14 +2,15 @@ import { ColumnDef } from "@tanstack/react-table"; -import { DataTableColumnHeader } from "../common/data-table/data-table-column-header"; +import { DataTableColumnHeader } from "@repo/ui/components/common/data-table/data-table-column-header"; import { Block, BlockHeader } from "@/src/types/interfaces/BlockInterfaces"; -import TruncatedAddress from "../common/truncated-address"; -import { formatNumber, formatTimeAgo } from "@/src/lib/utils"; -import { Badge } from "../../ui/badge"; -import ExternalLink from "../../ui/external-link"; -import { externalLinks } from "@/src/routes"; -import { EyeOpenIcon } from "@radix-ui/react-icons"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { formatNumber, formatTimeAgo } from "@repo/ui/lib/utils"; +import { Badge } from "@repo/ui/components/shared/badge"; +import ExternalLink from "@repo/ui/components/shared/external-link"; +import { externalPageLinks, pageLinks } from "@/src/routes"; +import { EyeOpenIcon } from "@repo/ui/components/shared/react-icons"; +import { pathToUrl } from "@/src/routes/router"; export const columns: ColumnDef[] = [ { @@ -62,7 +63,9 @@ export const columns: ColumnDef[] = [ ) : ( ); }, @@ -152,7 +155,9 @@ export const columns: ColumnDef[] = [ const blockHeader = row.original.blockHeader as BlockHeader; return ( diff --git a/tools/tenscan/frontend/src/components/modules/blocks/constants.tsx b/tools/tenscan/frontend/src/components/modules/blocks/constants.tsx index eca2d7c2b5..b26313a56d 100644 --- a/tools/tenscan/frontend/src/components/modules/blocks/constants.tsx +++ b/tools/tenscan/frontend/src/components/modules/blocks/constants.tsx @@ -2,7 +2,7 @@ import { ArrowDownIcon, ArrowRightIcon, ArrowUpIcon, -} from "@radix-ui/react-icons"; +} from "@repo/ui/components/shared/react-icons"; export const priorities = [ { diff --git a/tools/tenscan/frontend/src/components/modules/common/connect-wallet.tsx b/tools/tenscan/frontend/src/components/modules/common/connect-wallet.tsx deleted file mode 100644 index 0bdba6765e..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/connect-wallet.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { useWalletConnection } from "@/src/components/providers/wallet-provider"; -import { Button } from "@/src/components/ui/button"; -import { Link2Icon, LinkBreak2Icon } from "@radix-ui/react-icons"; -import React from "react"; -import TruncatedAddress from "./truncated-address"; -import { downloadMetaMask, ethereum } from "@/src/lib/utils"; -const ConnectWalletButton = ({ text }: { text?: string }) => { - const { walletConnected, walletAddress, connectWallet, disconnectWallet } = - useWalletConnection(); - - return ( - - ); -}; - -export default ConnectWalletButton; diff --git a/tools/tenscan/frontend/src/components/modules/common/copy.tsx b/tools/tenscan/frontend/src/components/modules/common/copy.tsx deleted file mode 100644 index d24114ed0d..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/copy.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from "react"; -import { CopyIcon, CheckIcon } from "@radix-ui/react-icons"; -import { useCopy } from "@/src/hooks/useCopy"; -import { Button } from "../../ui/button"; - -const Copy = ({ value }: { value: string | number }) => { - const { copyToClipboard, copied } = useCopy(); - return ( - - ); -}; - -export default Copy; diff --git a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-column-header.tsx b/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-column-header.tsx deleted file mode 100644 index 07fbb0cc3a..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-column-header.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { - ArrowDownIcon, - ArrowUpIcon, - CaretSortIcon, - EyeNoneIcon, -} from "@radix-ui/react-icons"; -import { Column } from "@tanstack/react-table"; - -import { cn } from "@/src/lib/utils"; -import { Button } from "@/src/components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "@/src/components/ui/dropdown-menu"; - -interface DataTableColumnHeaderProps - extends React.HTMLAttributes { - column: Column; - title: string; -} - -export function DataTableColumnHeader({ - column, - title, - className, -}: DataTableColumnHeaderProps) { - if (!column.getCanSort()) { - return
    {title}
    ; - } - - return ( -
    - - - - - - column.toggleSorting(false)}> - - Asc - - column.toggleSorting(true)}> - - Desc - - - column.toggleVisibility(false)}> - - Hide - - - -
    - ); -} diff --git a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-faceted-filter.tsx b/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-faceted-filter.tsx deleted file mode 100644 index 641973c663..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-faceted-filter.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import * as React from "react"; -import { CheckIcon, PlusCircledIcon } from "@radix-ui/react-icons"; -import { Column } from "@tanstack/react-table"; - -import { cn } from "@/src/lib/utils"; -import { Badge } from "@/src/components/ui/badge"; -import { Button } from "@/src/components/ui/button"; -import { - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem, - CommandList, - CommandSeparator, -} from "@/src/components/ui/command"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/src/components/ui/popover"; -import { Separator } from "@/src/components/ui/separator"; - -interface DataTableFacetedFilterProps { - column?: Column; - title?: string; - options: { - label: string; - value: string; - icon?: React.ComponentType<{ className?: string }>; - }[]; -} - -export function DataTableFacetedFilter({ - column, - title, - options, -}: DataTableFacetedFilterProps) { - const facets = column?.getFacetedUniqueValues(); - const selectedValues = new Set(column?.getFilterValue() as string[]); - - return ( - - - - - - - - - No results found. - - {options.map((option) => { - const isSelected = selectedValues.has(option.value); - return ( - { - if (isSelected) { - selectedValues.delete(option.value); - } else { - selectedValues.add(option.value); - } - const filterValues = Array.from(selectedValues); - column?.setFilterValue( - filterValues.length ? filterValues : undefined - ); - }} - > -
    - -
    - {option.icon && ( - - )} - {option.label} - {facets?.get(option.value) && ( - - {facets.get(option.value)} - - )} -
    - ); - })} -
    - {selectedValues.size > 0 && ( - <> - - - column?.setFilterValue(undefined)} - className="justify-center text-center" - > - Clear filters - - - - )} -
    -
    -
    -
    - ); -} diff --git a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-pagination.tsx b/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-pagination.tsx deleted file mode 100644 index 0a61d0f786..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-pagination.tsx +++ /dev/null @@ -1,144 +0,0 @@ -import { - ChevronLeftIcon, - ChevronRightIcon, - DoubleArrowLeftIcon, -} from "@radix-ui/react-icons"; -import { PaginationState, Table } from "@tanstack/react-table"; -import { Button } from "@/src/components/ui/button"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/src/components/ui/select"; -import { Input } from "@/src/components/ui/input"; -import { useState } from "react"; - -interface DataTablePaginationProps { - table: Table; - refetch?: () => void; - setPagination: (pagination: PaginationState) => void; -} - -export function DataTablePagination({ - table, - refetch, - setPagination, -}: DataTablePaginationProps) { - const [page, setPage] = useState(table.getState().pagination.pageIndex); - - const handlePageChange = (e: React.ChangeEvent) => { - setPage(Number(e.target.value)); - }; - - const handleKey = (e: React.KeyboardEvent) => { - if ( - e.key === "Enter" && - page > 0 && - page !== table.getState().pagination.pageIndex - ) { - table.setPageIndex(page); - refetch?.(); - } - }; - - return ( -
    -
    - Showing {table?.getFilteredRowModel()?.rows?.length} row(s) -
    -
    -
    -

    Rows per page

    - -
    -
    - Page - e.target.select()} - onBlur={() => setPage(table.getState().pagination.pageIndex)} - /> - {/* uncomment the following line when total count feature is implemented */} - {/* of {formatNumber(table.getPageCount())} */} -
    -
    - - - - {/* uncomment the following line when total count feature is implemented */} - {/* */} -
    -
    -
    - ); -} diff --git a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-row-actions.tsx b/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-row-actions.tsx deleted file mode 100644 index 0f8c652451..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-row-actions.tsx +++ /dev/null @@ -1,65 +0,0 @@ -"use client"; - -import { DotsHorizontalIcon } from "@radix-ui/react-icons"; -import { Row } from "@tanstack/react-table"; -import { Button } from "@/src/components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuRadioGroup, - DropdownMenuRadioItem, - DropdownMenuSeparator, - DropdownMenuSub, - DropdownMenuSubContent, - DropdownMenuSubTrigger, - DropdownMenuTrigger, -} from "@/src/components/ui/dropdown-menu"; - -interface DataTableRowActionsProps { - row: Row; - labels: { label: string; value: string }[] | null; -} - -export function DataTableRowActions({ - row, - labels, -}: DataTableRowActionsProps) { - return ( - - - - - - View - {labels === null ? null : ( - <> - - - Labels - - - {labels?.map((label) => ( - - {label.label} - - ))} - - - - - )} - - - - ); -} diff --git a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-toolbar.tsx b/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-toolbar.tsx deleted file mode 100644 index 93bee611c0..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-toolbar.tsx +++ /dev/null @@ -1,68 +0,0 @@ -"use client"; - -import { Cross2Icon, ReloadIcon } from "@radix-ui/react-icons"; -import { Table } from "@tanstack/react-table"; - -import { Button } from "@/src/components/ui/button"; -import { Input } from "@/src/components/ui/input"; -import { DataTableViewOptions } from "./data-table-view-options"; - -import { DataTableFacetedFilter } from "./data-table-faceted-filter"; - -interface DataTableToolbarProps { - table: Table; - refetch?: () => void; - toolbar?: { - column: string; - title: string; - options: { label: string; value: string }[]; - }[]; -} -export function DataTableToolbar({ - table, - toolbar, - refetch, -}: DataTableToolbarProps) { - const isFiltered = table.getState().columnFilters.length > 0; - - return ( -
    -
    - {toolbar?.map( - (item, index) => - table.getColumn(item.column) && ( - - ) - )} - {isFiltered && ( - - )} -
    -
    - {refetch && ( - - )} - -
    -
    - ); -} diff --git a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-view-options.tsx b/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-view-options.tsx deleted file mode 100644 index b8975ff5cb..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table-view-options.tsx +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu"; -import { MixerHorizontalIcon } from "@radix-ui/react-icons"; -import { Table } from "@tanstack/react-table"; - -import { Button } from "@/src/components/ui/button"; -import { - DropdownMenu, - DropdownMenuCheckboxItem, - DropdownMenuContent, - DropdownMenuLabel, - DropdownMenuSeparator, -} from "@/src/components/ui/dropdown-menu"; - -interface DataTableViewOptionsProps { - table: Table; -} - -export function DataTableViewOptions({ - table, -}: DataTableViewOptionsProps) { - return ( - - - - - - Toggle columns - - {table - .getAllColumns() - .filter( - (column) => - typeof column.accessorFn !== "undefined" && column.getCanHide() - ) - .map((column) => { - return ( - column.toggleVisibility(!!value)} - > - {column.id} - - ); - })} - - - ); -} diff --git a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table.tsx b/tools/tenscan/frontend/src/components/modules/common/data-table/data-table.tsx deleted file mode 100644 index 982835d6d4..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/data-table/data-table.tsx +++ /dev/null @@ -1,211 +0,0 @@ -"use client"; - -import * as React from "react"; -import { - ColumnDef, - ColumnFiltersState, - OnChangeFn, - PaginationState, - SortingState, - VisibilityState, - flexRender, - getCoreRowModel, - getFacetedRowModel, - getFacetedUniqueValues, - getFilteredRowModel, - getPaginationRowModel, - getSortedRowModel, - useReactTable, -} from "@tanstack/react-table"; - -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, -} from "@/src/components/ui/table"; -import { DataTablePagination } from "./data-table-pagination"; -import { DataTableToolbar } from "./data-table-toolbar"; -import { useRouter } from "next/router"; -import { Skeleton } from "@/src/components/ui/skeleton"; -import { Button } from "@/src/components/ui/button"; - -interface DataTableProps { - columns: ColumnDef[]; - data: TData[]; - toolbar?: { - column: string; - title: string; - options: { label: string; value: string }[]; - }[]; - updateQueryParams?: (query: any) => void; - refetch?: () => void; - total: number; - isLoading?: boolean; - noPagination?: boolean; - noResultsText?: string; - noResultsMessage?: string; -} - -export function DataTable({ - columns, - data, - toolbar, - refetch, - total, - isLoading, - noPagination, - noResultsText, - noResultsMessage, -}: DataTableProps) { - const { query, push, pathname } = useRouter(); - const [rowSelection, setRowSelection] = React.useState({}); - const [columnVisibility, setColumnVisibility] = - React.useState({}); - const [columnFilters, setColumnFilters] = React.useState( - [] - ); - const [sorting, setSorting] = React.useState([]); - - const pagination = React.useMemo(() => { - return { - pageIndex: Number(query.page) || 1, - pageSize: Number(query.size) || 20, - }; - }, [query.page, query.size]); - - const setPagination: OnChangeFn = (func) => { - const { pageIndex, pageSize } = - typeof func === "function" ? func(pagination) : func; - const newPageIndex = pagination.pageSize !== pageSize ? 1 : pageIndex; - const params = { - ...query, - page: newPageIndex > 0 ? newPageIndex : 1, - size: pageSize <= 100 ? pageSize : 100, - }; - push({ pathname, query: params }); - }; - - const table = useReactTable({ - data, - columns, - state: { - sorting, - columnVisibility, - rowSelection, - columnFilters, - pagination, - }, - onPaginationChange: setPagination, - manualPagination: true, - // pageCount: Math.ceil(total / pagination.pageSize), - enableRowSelection: true, - onRowSelectionChange: setRowSelection, - onSortingChange: setSorting, - onColumnFiltersChange: setColumnFilters, - onColumnVisibilityChange: setColumnVisibility, - getCoreRowModel: getCoreRowModel(), - getFilteredRowModel: getFilteredRowModel(), - getPaginationRowModel: getPaginationRowModel(), - getSortedRowModel: getSortedRowModel(), - getFacetedRowModel: getFacetedRowModel(), - getFacetedUniqueValues: getFacetedUniqueValues(), - }); - - return ( -
    - {data && ( - - )} -
    - - - {table.getHeaderGroups().map((headerGroup) => ( - - {headerGroup.headers.map((header) => { - return ( - - {header.isPlaceholder - ? null - : flexRender( - header.column.columnDef.header, - header.getContext() - )} - - ); - })} - - ))} - - - {isLoading ? ( - <> - - - - - - - ) : data && table?.getRowModel()?.rows?.length ? ( - table.getRowModel().rows.map((row) => ( - - {row.getVisibleCells().map((cell) => ( - - {flexRender( - cell.column.columnDef.cell, - cell.getContext() - )} - - ))} - - )) - ) : ( - - - {pagination.pageIndex > 1 ? ( -

    - No {noResultsText || "results"} found for the selected - filters. - -

    - ) : ( -

    - {noResultsMessage || - `No ${noResultsText || "results"} found.`} -

    - )} -
    -
    - )} -
    -
    -
    - {data && !isLoading && !noPagination && ( - - )} -
    - ); -} diff --git a/tools/tenscan/frontend/src/components/modules/common/data-table/skeleton-loader.tsx b/tools/tenscan/frontend/src/components/modules/common/data-table/skeleton-loader.tsx deleted file mode 100644 index 89c5627fda..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/data-table/skeleton-loader.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Skeleton } from "@/src/components/ui/skeleton"; -import { TableHeader, TableRow, TableBody } from "@/src/components/ui/table"; -import { Table } from "lucide-react"; -import React from "react"; - -const DataTableSkeleton = ({ columns }: { columns: number }) => { - const renderSkeletonColumns = () => { - return Array.from({ length: columns }).map((_, index) => ( - - )); - }; - - return ( - - - {renderSkeletonColumns()} - - {renderSkeletonColumns()} -
    - ); -}; - -export default DataTableSkeleton; diff --git a/tools/tenscan/frontend/src/components/modules/common/empty-state.tsx b/tools/tenscan/frontend/src/components/modules/common/empty-state.tsx deleted file mode 100644 index 0372c45bd1..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/empty-state.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { cn } from "@/src/lib/utils"; -import Image from "next/image"; -import React from "react"; - -const EmptyState = ({ - title, - description, - icon, - imageSrc, - imageAlt, - action, - className, -}: { - title?: string; - description?: string; - icon?: React.ReactNode; - imageSrc?: string; - imageAlt?: string; - action?: React.ReactNode; - className?: string; -}) => { - return ( -
    -
    - {icon &&
    {icon}
    } - {imageSrc && ( - {imageAlt - )} - {title && ( -

    - {title} -

    - )} - {description && ( -

    {description}

    - )} - {action &&
    {action}
    } -
    -
    - ); -}; - -export default EmptyState; diff --git a/tools/tenscan/frontend/src/components/modules/common/network-status.tsx b/tools/tenscan/frontend/src/components/modules/common/network-status.tsx deleted file mode 100644 index 6f9be08af4..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/network-status.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { cn } from "@/src/lib/utils"; -import React from "react"; - -const MessageContent = ( -

    - You seem to be offline -
    Please check your internet connection. -

    -); - -export const NetworkStatus = ({ message = MessageContent }) => { - const [isOnline, setIsOnline] = React.useState(true); - - React.useEffect(() => { - const setOnlineStatus = () => { - setIsOnline(navigator.onLine); - }; - - window.addEventListener("online", setOnlineStatus); - window.addEventListener("offline", setOnlineStatus); - - return () => { - window.removeEventListener("online", setOnlineStatus); - window.removeEventListener("offline", setOnlineStatus); - }; - }, []); - - return ( -
    -
    - {message} -
    -
    - ); -}; diff --git a/tools/tenscan/frontend/src/components/modules/common/truncated-address.tsx b/tools/tenscan/frontend/src/components/modules/common/truncated-address.tsx deleted file mode 100644 index 789a21e8fd..0000000000 --- a/tools/tenscan/frontend/src/components/modules/common/truncated-address.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import React from "react"; - -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/src/components/ui/tooltip"; - -import Copy from "./copy"; -import Link from "next/link"; - -const TruncatedAddress = ({ - address, - prefixLength, - suffixLength, - showCopy = true, - link, -}: { - address: string; - prefixLength?: number; - suffixLength?: number; - showCopy?: boolean; - link?: - | string - | { - pathname: string; - query: { [key: string]: string | number }; - }; -}) => { - const truncatedAddress = `${address?.substring( - 0, - prefixLength || 6 - )}...${address?.substring(address.length - (suffixLength || 4))}`; - - return ( - <> - {address ? ( -
    - {link ? ( - - - - - {truncatedAddress} - - - -

    {address}

    -
    -
    -
    - ) : ( - - - {truncatedAddress} - -

    {address}

    -
    -
    -
    - )} - {showCopy && } -
    - ) : ( -
    N/A
    - )} - - ); -}; - -export default TruncatedAddress; diff --git a/tools/tenscan/frontend/src/components/modules/dashboard/analytics-card.tsx b/tools/tenscan/frontend/src/components/modules/dashboard/analytics-card.tsx index 41c6b6448e..3f14c5247b 100644 --- a/tools/tenscan/frontend/src/components/modules/dashboard/analytics-card.tsx +++ b/tools/tenscan/frontend/src/components/modules/dashboard/analytics-card.tsx @@ -1,11 +1,11 @@ +import { DashboardAnalyticsData } from "@/src/types/interfaces"; import { Card, CardHeader, CardTitle, CardContent, -} from "@/src/components/ui/card"; -import { Skeleton } from "@/src/components/ui/skeleton"; -import { DashboardAnalyticsData } from "@/src/types/interfaces"; +} from "@repo/ui/components/shared/card"; +import { Skeleton } from "@repo/ui/components/shared/skeleton"; import React from "react"; export default function AnalyticsCard({ diff --git a/tools/tenscan/frontend/src/components/modules/dashboard/index.tsx b/tools/tenscan/frontend/src/components/modules/dashboard/index.tsx index 18124148f6..47c4426ab5 100644 --- a/tools/tenscan/frontend/src/components/modules/dashboard/index.tsx +++ b/tools/tenscan/frontend/src/components/modules/dashboard/index.tsx @@ -4,31 +4,33 @@ import { CardTitle, CardContent, Card, -} from "@/src/components/ui/card"; +} from "@repo/ui/components/shared/card"; import { LayersIcon, FileTextIcon, ReaderIcon, CubeIcon, RocketIcon, -} from "@radix-ui/react-icons"; + BlocksIcon, +} from "@repo/ui/components/shared/react-icons"; import { RecentBatches } from "./recent-batches"; import { RecentTransactions } from "./recent-transactions"; -import { Button } from "@/src/components/ui/button"; +import { Button } from "@repo/ui/components/shared/button"; import { useTransactionsService } from "@/src/services/useTransactionsService"; import { useBatchesService } from "@/src/services/useBatchesService"; -import TruncatedAddress from "../common/truncated-address"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; import { useContractsService } from "@/src/services/useContractsService"; -import { Skeleton } from "@/src/components/ui/skeleton"; +import { Skeleton } from "@repo/ui/components/shared/skeleton"; import AnalyticsCard from "./analytics-card"; import Link from "next/link"; -import { cn, formatNumber } from "@/src/lib/utils"; -import { Badge } from "../../ui/badge"; -import { BlocksIcon } from "lucide-react"; +import { cn, formatNumber } from "@repo/ui/lib/utils"; +import { Badge } from "@repo/ui/components/shared/badge"; + import { useRollupsService } from "@/src/services/useRollupsService"; import { RecentRollups } from "./recent-rollups"; import { DashboardAnalyticsData } from "@/src/types/interfaces"; +import { pageLinks } from "@/src/routes"; interface RecentData { title: string; @@ -45,10 +47,29 @@ export default function Dashboard() { transactions, transactionCount, isTransactionCountLoading, + setNoPolling: setNoPollingTransactions, } = useTransactionsService(); const { contractCount, isContractCountLoading } = useContractsService(); - const { batches, latestBatch, isLatestBatchLoading } = useBatchesService(); - const { rollups } = useRollupsService(); + const { + batches, + latestBatch, + isLatestBatchLoading, + setNoPolling: setNoPollingBatches, + } = useBatchesService(); + const { rollups, setNoPolling: setNoPollingRollups } = useRollupsService(); + + React.useEffect(() => { + setNoPollingTransactions(false); + setNoPollingBatches(false); + setNoPollingRollups(false); + + return () => { + setNoPollingTransactions(true); + setNoPollingBatches(true); + setNoPollingRollups(true); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); const DASHBOARD_DATA = [ { @@ -107,7 +128,7 @@ export default function Dashboard() { }, { title: "Nodes", - value: Coming Soon, + value: Coming Soon, icon: BlocksIcon, }, ]; @@ -117,21 +138,21 @@ export default function Dashboard() { title: "Recent Rollups", data: rollups, component: , - goTo: "/rollups", + goTo: pageLinks.rollups, className: "col-span-1 md:col-span-2 lg:col-span-3", }, { title: "Recent Batches", data: batches, component: , - goTo: "/batches", + goTo: pageLinks.batches, className: "col-span-1 md:col-span-2 lg:col-span-3", }, { title: "Recent Transactions", data: transactions, component: , - goTo: "/transactions", + goTo: pageLinks.transactions, className: "col-span-1 md:col-span-2 lg:col-span-3", }, ]; diff --git a/tools/tenscan/frontend/src/components/modules/dashboard/recent-batches.tsx b/tools/tenscan/frontend/src/components/modules/dashboard/recent-batches.tsx index cf85c04a6b..510ba09cae 100644 --- a/tools/tenscan/frontend/src/components/modules/dashboard/recent-batches.tsx +++ b/tools/tenscan/frontend/src/components/modules/dashboard/recent-batches.tsx @@ -1,8 +1,10 @@ -import TruncatedAddress from "../common/truncated-address"; -import { formatTimeAgo } from "@/src/lib/utils"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { formatTimeAgo } from "@repo/ui/lib/utils"; import { Batch } from "@/src/types/interfaces/BatchInterfaces"; -import { Avatar, AvatarFallback } from "@/src/components/ui/avatar"; +import { Avatar, AvatarFallback } from "@repo/ui/components/shared/avatar"; import Link from "next/link"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export function RecentBatches({ batches }: { batches: any }) { return ( @@ -15,7 +17,9 @@ export function RecentBatches({ batches }: { batches: any }) {

    #{Number(batch?.height)} @@ -28,7 +32,9 @@ export function RecentBatches({ batches }: { batches: any }) {

    diff --git a/tools/tenscan/frontend/src/components/modules/dashboard/recent-rollups.tsx b/tools/tenscan/frontend/src/components/modules/dashboard/recent-rollups.tsx index 30353562a7..1c1dd93dec 100644 --- a/tools/tenscan/frontend/src/components/modules/dashboard/recent-rollups.tsx +++ b/tools/tenscan/frontend/src/components/modules/dashboard/recent-rollups.tsx @@ -1,11 +1,9 @@ -import TruncatedAddress from "../common/truncated-address"; -import { formatTimeAgo } from "@/src/lib/utils"; -import { Avatar, AvatarFallback } from "@/src/components/ui/avatar"; -import { - Rollup, - RollupsResponse, -} from "@/src/types/interfaces/RollupInterfaces"; -import Link from "next/link"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { formatTimeAgo } from "@repo/ui/lib/utils"; +import { Avatar, AvatarFallback } from "@repo/ui/components/shared/avatar"; +import { Rollup } from "@/src/types/interfaces/RollupInterfaces"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export function RecentRollups({ rollups }: { rollups: any }) { return ( @@ -26,7 +24,7 @@ export function RecentRollups({ rollups }: { rollups: any }) {
    diff --git a/tools/tenscan/frontend/src/components/modules/dashboard/recent-transactions.tsx b/tools/tenscan/frontend/src/components/modules/dashboard/recent-transactions.tsx index 79698a5788..97fad80705 100644 --- a/tools/tenscan/frontend/src/components/modules/dashboard/recent-transactions.tsx +++ b/tools/tenscan/frontend/src/components/modules/dashboard/recent-transactions.tsx @@ -1,9 +1,11 @@ -import TruncatedAddress from "../common/truncated-address"; -import { Avatar, AvatarFallback } from "@/src/components/ui/avatar"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { Avatar, AvatarFallback } from "@repo/ui/components/shared/avatar"; import { Transaction } from "@/src/types/interfaces/TransactionInterfaces"; -import { Badge } from "../../ui/badge"; -import { formatTimeAgo } from "@/src/lib/utils"; +import { Badge } from "@repo/ui/components/shared/badge"; +import { formatTimeAgo } from "@repo/ui/lib/utils"; import Link from "next/link"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export function RecentTransactions({ transactions }: { transactions: any }) { return ( @@ -18,7 +20,9 @@ export function RecentTransactions({ transactions }: { transactions: any }) {

    Batch #{Number(transaction?.BatchHeight)} @@ -31,11 +35,13 @@ export function RecentTransactions({ transactions }: { transactions: any }) {

    - {transaction?.Finality} + {transaction?.Finality}
    ) diff --git a/tools/tenscan/frontend/src/components/modules/personal/columns.tsx b/tools/tenscan/frontend/src/components/modules/personal/columns.tsx index 3c1faa6ac9..9dda107e44 100644 --- a/tools/tenscan/frontend/src/components/modules/personal/columns.tsx +++ b/tools/tenscan/frontend/src/components/modules/personal/columns.tsx @@ -1,15 +1,16 @@ "use client"; - +import React from "react"; import { ColumnDef } from "@tanstack/react-table"; -import { Badge, badgeVariants } from "@/src/components/ui/badge"; +import { Badge, badgeVariants } from "@repo/ui/components/shared/badge"; import { statuses, types } from "./data"; -import { DataTableColumnHeader } from "../common/data-table/data-table-column-header"; -import { PersonalTransactions } from "@/src/types/interfaces/TransactionInterfaces"; -import TruncatedAddress from "../common/truncated-address"; -import { formatNumber } from "@/src/lib/utils"; +import { DataTableColumnHeader } from "@repo/ui/components/common/data-table/data-table-column-header"; +import { PersonalTransactions } from "../../..//types/interfaces/TransactionInterfaces"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { formatNumber } from "@repo/ui/lib/utils"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; import Link from "next/link"; -import { EyeOpenIcon } from "@radix-ui/react-icons"; export const columns: ColumnDef[] = [ { @@ -19,11 +20,16 @@ export const columns: ColumnDef[] = [ ), cell: ({ row }) => { return ( -
    + #{Number(row.getValue("blockNumber"))} -
    + ); }, enableSorting: false, @@ -35,7 +41,14 @@ export const columns: ColumnDef[] = [ ), cell: ({ row }) => { - return ; + return ( + + ); }, enableSorting: false, enableHiding: false, @@ -46,7 +59,14 @@ export const columns: ColumnDef[] = [ ), cell: ({ row }) => { - return ; + return ( + + ); }, enableSorting: false, enableHiding: false, @@ -125,14 +145,4 @@ export const columns: ColumnDef[] = [ return value.includes(row.getValue(id)); }, }, - { - id: "actions", - cell: ({ row }) => { - return ( - - - - ); - }, - }, ]; diff --git a/tools/tenscan/frontend/src/components/modules/personal/data.tsx b/tools/tenscan/frontend/src/components/modules/personal/data.tsx index a1797c82a9..c09678e777 100644 --- a/tools/tenscan/frontend/src/components/modules/personal/data.tsx +++ b/tools/tenscan/frontend/src/components/modules/personal/data.tsx @@ -1,4 +1,4 @@ -import { CheckIcon, Cross2Icon } from "@radix-ui/react-icons"; +import { CheckIcon, Cross2Icon } from "@repo/ui/components/shared/react-icons"; export const statuses = [ { diff --git a/tools/tenscan/frontend/src/components/modules/personal/index.tsx b/tools/tenscan/frontend/src/components/modules/personal/index.tsx index 03630d4c07..948c0e4722 100644 --- a/tools/tenscan/frontend/src/components/modules/personal/index.tsx +++ b/tools/tenscan/frontend/src/components/modules/personal/index.tsx @@ -1,25 +1,15 @@ import React from "react"; import { columns } from "@/src/components/modules/personal/columns"; -import { DataTable } from "@/src/components/modules/common/data-table/data-table"; +import { DataTable } from "@repo/ui/components/common/data-table/data-table"; import { useTransactionsService } from "@/src/services/useTransactionsService"; export default function PersonalTransactions() { - const { personalTxns, setNoPolling, personalTxnsLoading } = - useTransactionsService(); + const { personalTxns, personalTxnsLoading } = useTransactionsService(); const { Receipts, Total } = personalTxns || { Receipts: [], Total: 0, }; - React.useEffect(() => { - setNoPolling(true); - - return () => { - setNoPolling(false); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - return ( <>
    diff --git a/tools/tenscan/frontend/src/components/modules/personal/personal-txn-details.tsx b/tools/tenscan/frontend/src/components/modules/personal/personal-txn-details.tsx index 00e174f8e6..0e33d3225e 100644 --- a/tools/tenscan/frontend/src/components/modules/personal/personal-txn-details.tsx +++ b/tools/tenscan/frontend/src/components/modules/personal/personal-txn-details.tsx @@ -1,19 +1,27 @@ -import TruncatedAddress from "../common/truncated-address"; -import KeyValueItem, { KeyValueList } from "@/src/components/ui/key-value"; -import { Badge } from "@/src/components/ui/badge"; +import React, { useState } from "react"; +import KeyValueItem, { + KeyValueList, +} from "@repo/ui/components/shared/key-value"; import { PersonalTransactionType, TransactionReceipt, TransactionType, -} from "@/src/types/interfaces/TransactionInterfaces"; -import { BadgeType } from "@/src/types/interfaces"; -import Link from "next/link"; +} from "../../../types/interfaces/TransactionInterfaces"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { Badge } from "@repo/ui/components/shared/badge"; +import { BadgeType } from "@repo/ui/lib/enums/badge"; +import { Button } from "@repo/ui/components/shared/button"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export function PersonalTxnDetailsComponent({ transactionDetails, }: { transactionDetails: TransactionReceipt; }) { + const [logsExpanded, setLogsExpanded] = useState(false); + const toggleLogs = () => setLogsExpanded(!logsExpanded); + const getTransactionType = (type: TransactionType) => { switch (type) { case PersonalTransactionType.Legacy: @@ -30,14 +38,16 @@ export function PersonalTxnDetailsComponent({ }; return ( -
    +
    } /> @@ -46,14 +56,16 @@ export function PersonalTxnDetailsComponent({ value={ } /> + {Number(transactionDetails?.transactionIndex)} } @@ -61,13 +73,7 @@ export function PersonalTxnDetailsComponent({ + {getTransactionType(transactionDetails?.type)} } @@ -86,27 +92,26 @@ export function PersonalTxnDetailsComponent({ } /> - + {Number(transactionDetails?.blockNumber)} - + } /> - {Number(transactionDetails?.gasUsed)}{" "} + + {Number(transactionDetails?.gasUsed)} } /> + {Number(transactionDetails?.cumulativeGasUsed)} } @@ -114,7 +119,7 @@ export function PersonalTxnDetailsComponent({ + {Number(transactionDetails?.effectiveGasPrice)} } @@ -130,10 +135,7 @@ export function PersonalTxnDetailsComponent({ + } /> } /> - 0 ? (
    - {transactionDetails?.logs.map((log, index) => ( -
    - - } - /> - } - /> - - } - /> - - + {logsExpanded + ? `Hide Logs (${transactionDetails.logs.length})` + : `Show Logs (${transactionDetails.logs.length})`} + + {logsExpanded && ( +
    + {transactionDetails?.logs.map((log, index) => ( +
    + + } + /> + } + /> + + } + /> + + + {log.removed ? "Yes" : "No"} + } - > - {log.removed ? "Yes" : "No"} - - } - /> - - {log.topics.map((topic, index) => ( -
    - } - /> + /> + + {log.topics.map((topic, index) => ( +
    + +
    + ))}
    - ))} -
    - } - /> - + + } + /> + + {Number(transactionDetails?.transactionIndex)} + + } + isLastItem /> - } - /> - - {Number(transactionDetails?.transactionIndex)} - - } - isLastItem - /> - + +
    + ))}
    - ))} + )}
    ) : ( - "No logs found" + "No logs found." ) } isLastItem diff --git a/tools/tenscan/frontend/src/components/modules/resources/decrypt.tsx b/tools/tenscan/frontend/src/components/modules/resources/decrypt.tsx index 98dfd9cbbc..a4379d7d08 100644 --- a/tools/tenscan/frontend/src/components/modules/resources/decrypt.tsx +++ b/tools/tenscan/frontend/src/components/modules/resources/decrypt.tsx @@ -1,26 +1,29 @@ import React, { useEffect, useState } from "react"; -import { Alert, AlertTitle, AlertDescription } from "@/src/components/ui/alert"; -import { Badge } from "@/src/components/ui/badge"; -import { Button } from "@/src/components/ui/button"; +import { + Alert, + AlertTitle, + AlertDescription, +} from "@repo/ui/components/shared/alert"; +import { Badge } from "@repo/ui/components/shared/badge"; +import { Button } from "@repo/ui/components/shared/button"; import { Card, CardHeader, CardTitle, CardContent, -} from "@/src/components/ui/card"; -import { Textarea } from "@/src/components/ui/textarea"; +} from "@repo/ui/components/shared/card"; +import { Textarea } from "@repo/ui/components/shared/textarea"; import { currentEncryptedKey } from "@/src/lib/constants"; -import { CopyIcon } from "@radix-ui/react-icons"; -import { Terminal } from "lucide-react"; +import { CopyIcon, Terminal } from "@repo/ui/components/shared/react-icons"; import { useRouter } from "next/router"; import JSONPretty from "react-json-pretty"; import { useRollupsService } from "@/src/services/useRollupsService"; import { Tooltip, + TooltipContent, TooltipProvider, TooltipTrigger, - TooltipContent, -} from "@radix-ui/react-tooltip"; +} from "@repo/ui/components/shared/tooltip"; export default function Decrypt() { const router = useRouter(); diff --git a/tools/tenscan/frontend/src/components/modules/resources/verified-data/VerifiedContracts.tsx b/tools/tenscan/frontend/src/components/modules/resources/verified-data/VerifiedContracts.tsx index 2554da9a02..220d54a4e7 100644 --- a/tools/tenscan/frontend/src/components/modules/resources/verified-data/VerifiedContracts.tsx +++ b/tools/tenscan/frontend/src/components/modules/resources/verified-data/VerifiedContracts.tsx @@ -5,18 +5,18 @@ import { TableHead, TableBody, TableCell, -} from "@/src/components/ui/table"; -import { Table } from "@/src/components/ui/table"; +} from "@repo/ui/components/shared/table"; +import { Table } from "@repo/ui/components/shared/table"; import { useContractsService } from "@/src/services/useContractsService"; -import TruncatedAddress from "../../common/truncated-address"; -import { Badge } from "@/src/components/ui/badge"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { Badge } from "@repo/ui/components/shared/badge"; import { Card, CardHeader, CardTitle, CardContent, -} from "@/src/components/ui/card"; -import { Separator } from "@/src/components/ui/separator"; +} from "@repo/ui/components/shared/card"; +import { Separator } from "@repo/ui/components/shared/separator"; export default function VerifiedContracts() { const { formattedContracts } = useContractsService(); diff --git a/tools/tenscan/frontend/src/components/modules/resources/verified-data/VerifiedSequencerData.tsx b/tools/tenscan/frontend/src/components/modules/resources/verified-data/VerifiedSequencerData.tsx index 0cbdd962a3..4f5ae0adcf 100644 --- a/tools/tenscan/frontend/src/components/modules/resources/verified-data/VerifiedSequencerData.tsx +++ b/tools/tenscan/frontend/src/components/modules/resources/verified-data/VerifiedSequencerData.tsx @@ -5,18 +5,18 @@ import { TableHead, TableBody, TableCell, -} from "@/src/components/ui/table"; -import { Table } from "@/src/components/ui/table"; +} from "@repo/ui/components/shared/table"; +import { Table } from "@repo/ui/components/shared/table"; import { useContractsService } from "@/src/services/useContractsService"; -import TruncatedAddress from "../../common/truncated-address"; -import { Badge } from "@/src/components/ui/badge"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { Badge } from "@repo/ui/components/shared/badge"; import { Card, CardHeader, CardTitle, CardContent, -} from "@/src/components/ui/card"; -import { Separator } from "@/src/components/ui/separator"; +} from "@repo/ui/components/shared/card"; +import { Separator } from "@repo/ui/components/shared/separator"; export default function VerifiedSequencerData() { const { sequencerData } = useContractsService(); diff --git a/tools/tenscan/frontend/src/components/modules/rollups/columns.tsx b/tools/tenscan/frontend/src/components/modules/rollups/columns.tsx index fe76d6fa3c..429f4d6066 100644 --- a/tools/tenscan/frontend/src/components/modules/rollups/columns.tsx +++ b/tools/tenscan/frontend/src/components/modules/rollups/columns.tsx @@ -1,12 +1,14 @@ "use client"; import { ColumnDef } from "@tanstack/react-table"; -import { DataTableColumnHeader } from "../common/data-table/data-table-column-header"; -import TruncatedAddress from "../common/truncated-address"; -import { formatTimeAgo } from "@/src/lib/utils"; +import { DataTableColumnHeader } from "@repo/ui/components/common/data-table/data-table-column-header"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { formatTimeAgo } from "@repo/ui/lib/utils"; import Link from "next/link"; -import { EyeOpenIcon } from "@radix-ui/react-icons"; +import { EyeOpenIcon } from "@repo/ui/components/shared/react-icons"; import { Rollup } from "@/src/types/interfaces/RollupInterfaces"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export const columns: ColumnDef[] = [ { @@ -33,10 +35,9 @@ export const columns: ColumnDef[] = [ return ( ); }, @@ -80,7 +81,9 @@ export const columns: ColumnDef[] = [ return (
    @@ -102,7 +105,9 @@ export const columns: ColumnDef[] = [ return (
    @@ -119,7 +124,9 @@ export const columns: ColumnDef[] = [ id: "actions", cell: ({ row }) => { return ( - + ); diff --git a/tools/tenscan/frontend/src/components/modules/rollups/constants.tsx b/tools/tenscan/frontend/src/components/modules/rollups/constants.tsx index 2ab030f09f..793b3242f3 100644 --- a/tools/tenscan/frontend/src/components/modules/rollups/constants.tsx +++ b/tools/tenscan/frontend/src/components/modules/rollups/constants.tsx @@ -4,7 +4,7 @@ import { ArrowUpIcon, CheckCircledIcon, ClockIcon, -} from "@radix-ui/react-icons"; +} from "@repo/ui/components/shared/react-icons"; export const labels = [ { diff --git a/tools/tenscan/frontend/src/components/modules/rollups/rollup-details.tsx b/tools/tenscan/frontend/src/components/modules/rollups/rollup-details.tsx index b53eb0e81e..239c6082c4 100644 --- a/tools/tenscan/frontend/src/components/modules/rollups/rollup-details.tsx +++ b/tools/tenscan/frontend/src/components/modules/rollups/rollup-details.tsx @@ -1,8 +1,13 @@ -import TruncatedAddress from "../common/truncated-address"; -import KeyValueItem, { KeyValueList } from "@/src/components/ui/key-value"; -import { formatTimeAgo } from "@/src/lib/utils"; -import { Rollup } from "@/src/types/interfaces/RollupInterfaces"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import KeyValueItem, { + KeyValueList, +} from "@repo/ui/components/shared/key-value"; +import { formatTimeAgo, formatTimestampToDate } from "@repo/ui/lib/utils"; import Link from "next/link"; +import { Rollup } from "@/src/types/interfaces/RollupInterfaces"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; +import { Badge } from "@repo/ui/components/shared/badge"; export function RollupDetailsComponent({ rollupDetails, @@ -15,14 +20,23 @@ export function RollupDetailsComponent({ + {formatTimeAgo(rollupDetails?.Timestamp) + + " - " + + formatTimestampToDate(rollupDetails?.Timestamp)} + + } /> } /> @@ -31,19 +45,26 @@ export function RollupDetailsComponent({ value={ } /> } + value={ + + } /> {"#" + rollupDetails?.FirstSeq} @@ -54,7 +75,9 @@ export function RollupDetailsComponent({ label="Last Batch Seq No." value={ {"#" + rollupDetails?.LastSeq} @@ -66,13 +89,17 @@ export function RollupDetailsComponent({ value={ } /> + } /> {"#" + msg.Sequence} diff --git a/tools/tenscan/frontend/src/components/modules/transactions/columns.tsx b/tools/tenscan/frontend/src/components/modules/transactions/columns.tsx index a615dad2cb..d09df4d386 100644 --- a/tools/tenscan/frontend/src/components/modules/transactions/columns.tsx +++ b/tools/tenscan/frontend/src/components/modules/transactions/columns.tsx @@ -1,14 +1,16 @@ "use client"; import { ColumnDef } from "@tanstack/react-table"; -import { Badge } from "@/src/components/ui/badge"; +import { Badge } from "@repo/ui/components/shared/badge"; import { statuses } from "./constants"; -import { DataTableColumnHeader } from "../common/data-table/data-table-column-header"; +import { DataTableColumnHeader } from "@repo/ui/components/common/data-table/data-table-column-header"; import { Transaction } from "@/src/types/interfaces/TransactionInterfaces"; -import TruncatedAddress from "../common/truncated-address"; -import { formatTimeAgo } from "@/src/lib/utils"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import { formatTimeAgo } from "@repo/ui/lib/utils"; import Link from "next/link"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export const columns: ColumnDef[] = [ { @@ -60,7 +62,9 @@ export const columns: ColumnDef[] = [ return ( ); }, diff --git a/tools/tenscan/frontend/src/components/modules/transactions/constants.tsx b/tools/tenscan/frontend/src/components/modules/transactions/constants.tsx index 2ab030f09f..793b3242f3 100644 --- a/tools/tenscan/frontend/src/components/modules/transactions/constants.tsx +++ b/tools/tenscan/frontend/src/components/modules/transactions/constants.tsx @@ -4,7 +4,7 @@ import { ArrowUpIcon, CheckCircledIcon, ClockIcon, -} from "@radix-ui/react-icons"; +} from "@repo/ui/components/shared/react-icons"; export const labels = [ { diff --git a/tools/tenscan/frontend/src/components/modules/transactions/transaction-details.tsx b/tools/tenscan/frontend/src/components/modules/transactions/transaction-details.tsx index 9b1ba535b8..dc9ab9aea8 100644 --- a/tools/tenscan/frontend/src/components/modules/transactions/transaction-details.tsx +++ b/tools/tenscan/frontend/src/components/modules/transactions/transaction-details.tsx @@ -1,10 +1,14 @@ -import TruncatedAddress from "../common/truncated-address"; -import KeyValueItem, { KeyValueList } from "@/src/components/ui/key-value"; -import { formatTimeAgo } from "@/src/lib/utils"; -import { Badge } from "@/src/components/ui/badge"; +import TruncatedAddress from "@repo/ui/components/common/truncated-address"; +import KeyValueItem, { + KeyValueList, +} from "@repo/ui/components/shared/key-value"; +import { formatTimeAgo, formatTimestampToDate } from "@repo/ui/lib/utils"; +import { BadgeType } from "@repo/ui/lib/enums/badge"; +import { Badge } from "@repo/ui/components/shared/badge"; import { Transaction } from "@/src/types/interfaces/TransactionInterfaces"; -import { BadgeType } from "@/src/types/interfaces"; import Link from "next/link"; +import { pathToUrl } from "@/src/routes/router"; +import { pageLinks } from "@/src/routes"; export function TransactionDetailsComponent({ transactionDetails, @@ -18,7 +22,9 @@ export function TransactionDetailsComponent({ label="Batch Height" value={ {"#" + Number(transactionDetails?.BatchHeight)} @@ -30,13 +36,19 @@ export function TransactionDetailsComponent({ value={ } /> + {formatTimeAgo(transactionDetails?.BatchTimestamp) + + " - " + + formatTimestampToDate(transactionDetails?.BatchTimestamp)} + + } /> (null); - -export const useWalletConnection = (): WalletConnectionContextType => { - const context = useContext(WalletConnectionContext); - if (!context) { - throw new Error( - "useWalletConnection must be used within a WalletConnectionProvider" - ); - } - return context; -}; - -export const WalletConnectionProvider = ({ - children, -}: WalletConnectionProviderProps) => { - const [walletConnected, setWalletConnected] = useState(false); - const [walletAddress, setWalletAddress] = useState(null); - const [provider, setProvider] = - useState(null); - - const connectWallet = async () => { - if (ethereum) { - const ethProvider = new ethers.providers.Web3Provider(ethereum); - setProvider(ethProvider); - - try { - await ethProvider.send("eth_requestAccounts", []); - const signer = ethProvider.getSigner(); - const address = await signer.getAddress(); - setWalletAddress(address); - setWalletConnected(true); - } catch (error: any) { - showToast( - ToastType.DESTRUCTIVE, - "Error connecting to wallet:" + error?.message - ); - } - } else { - showToast( - ToastType.DESTRUCTIVE, - "No ethereum object found. Please install MetaMask!" - ); - } - }; - - const disconnectWallet = () => { - if (provider) { - provider.removeAllListeners(); - setWalletConnected(false); - setWalletAddress(null); - setProvider(null); - } - }; - - useEffect(() => { - if (!ethereum) { - return; - } - - const handleAccountsChanged = (accounts: string[]) => { - if (accounts.length === 0) { - showToast(ToastType.DESTRUCTIVE, "Please connect to MetaMask."); - } else if (accounts[0] !== walletAddress) { - setWalletAddress(accounts[0]); - } - }; - - ethereum.on("accountsChanged", handleAccountsChanged); - return () => { - if (!ethereum) return; - ethereum.removeListener("accountsChanged", handleAccountsChanged); - }; - }); - - const walletConnectionContextValue: WalletConnectionContextType = { - provider, - walletConnected, - walletAddress, - connectWallet, - disconnectWallet, - }; - - return ( - - {children} - - ); -}; diff --git a/tools/tenscan/frontend/src/components/search.tsx b/tools/tenscan/frontend/src/components/search.tsx index 72c09e031c..aa4091d2b5 100644 --- a/tools/tenscan/frontend/src/components/search.tsx +++ b/tools/tenscan/frontend/src/components/search.tsx @@ -1,4 +1,4 @@ -import { Input } from "@/src/components/ui/input"; +import { Input } from "@repo/ui/components/shared/input"; export function Search() { return ( diff --git a/tools/tenscan/frontend/src/components/ui/alert.tsx b/tools/tenscan/frontend/src/components/ui/alert.tsx deleted file mode 100644 index 85cfe674b7..0000000000 --- a/tools/tenscan/frontend/src/components/ui/alert.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import * as React from "react"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/src/lib/utils"; - -const alertVariants = cva( - "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", - { - variants: { - variant: { - default: "bg-background text-foreground", - destructive: - "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", - info: "border-info/50 text-info dark:border-info [&>svg]:text-info", - success: - "border-success/50 text-success dark:border-success [&>svg]:text-success", - warning: - "border-warning/50 text-warning dark:border-warning [&>svg]:text-warning", - }, - }, - defaultVariants: { - variant: "default", - }, - } -); - -const Alert = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes & VariantProps ->(({ className, variant, ...props }, ref) => ( -
    -)); -Alert.displayName = "Alert"; - -const AlertTitle = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
    -)); -AlertTitle.displayName = "AlertTitle"; - -const AlertDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
    -)); -AlertDescription.displayName = "AlertDescription"; - -export { Alert, AlertTitle, AlertDescription }; diff --git a/tools/tenscan/frontend/src/components/ui/avatar.tsx b/tools/tenscan/frontend/src/components/ui/avatar.tsx deleted file mode 100644 index dcc25adf49..0000000000 --- a/tools/tenscan/frontend/src/components/ui/avatar.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import * as React from "react"; -import * as AvatarPrimitive from "@radix-ui/react-avatar"; - -import { cn } from "@/src/lib/utils"; - -type AvatarImageProps = React.ComponentPropsWithoutRef< - typeof AvatarPrimitive.Image -> & { - src?: string | React.ComponentType; -}; - -const Avatar = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -Avatar.displayName = AvatarPrimitive.Root.displayName; - -const AvatarImage = React.forwardRef< - React.ElementRef, - AvatarImageProps ->(({ className, ...props }, ref) => ( - -)); -AvatarImage.displayName = AvatarPrimitive.Image.displayName; - -const AvatarFallback = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; - -export { Avatar, AvatarImage, AvatarFallback }; diff --git a/tools/tenscan/frontend/src/components/ui/badge.tsx b/tools/tenscan/frontend/src/components/ui/badge.tsx deleted file mode 100644 index cac0bf960b..0000000000 --- a/tools/tenscan/frontend/src/components/ui/badge.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import * as React from "react"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/src/lib/utils"; - -const badgeVariants = cva( - "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", - { - variants: { - variant: { - default: "border-transparent bg-primary hover:bg-primary/80", - secondary: - "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", - destructive: - "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", - success: - "border-transparent bg-success text-success-foreground hover:bg-success/80", - outline: "text-foreground", - }, - }, - defaultVariants: { - variant: "default", - }, - } -); - -export interface BadgeProps - extends React.HTMLAttributes, - VariantProps {} - -function Badge({ className, variant, ...props }: BadgeProps) { - return ( -
    - ); -} - -export { Badge, badgeVariants }; diff --git a/tools/tenscan/frontend/src/components/ui/button.tsx b/tools/tenscan/frontend/src/components/ui/button.tsx deleted file mode 100644 index aa0d241a58..0000000000 --- a/tools/tenscan/frontend/src/components/ui/button.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import * as React from "react"; -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/src/lib/utils"; - -const buttonVariants = cva( - "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", - { - variants: { - variant: { - default: "bg-primary text-primary-foreground hover:bg-primary/90", - destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/90", - outline: - "border border-input bg-background hover:bg-accent hover:text-accent-foreground", - secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", - ghost: "hover:bg-accent hover:text-accent-foreground", - link: "text-primary underline-offset-4 hover:underline", - clear: "bg-transparent text-primary-foreground outline-none", - }, - size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-8", - icon: "h-10 w-10 p-1", - wrap: "h-full w-full", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - } -); - -export interface ButtonProps - extends React.ButtonHTMLAttributes, - VariantProps { - asChild?: boolean; -} - -const Button = React.forwardRef( - ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : "button"; - return ( - - ); - } -); -Button.displayName = "Button"; - -export { Button, buttonVariants }; diff --git a/tools/tenscan/frontend/src/components/ui/calendar.tsx b/tools/tenscan/frontend/src/components/ui/calendar.tsx deleted file mode 100644 index 0b2f5e83e6..0000000000 --- a/tools/tenscan/frontend/src/components/ui/calendar.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import * as React from "react"; -import { ChevronLeft, ChevronRight } from "lucide-react"; -import { DayPicker } from "react-day-picker"; - -import { cn } from "@/src/lib/utils"; -import { buttonVariants } from "@/src/components/ui/button"; - -export type CalendarProps = React.ComponentProps; - -function Calendar({ - className, - classNames, - showOutsideDays = true, - ...props -}: CalendarProps) { - return ( - , - IconRight: ({ ...props }) => , - }} - {...props} - /> - ); -} -Calendar.displayName = "Calendar"; - -export { Calendar }; diff --git a/tools/tenscan/frontend/src/components/ui/card.tsx b/tools/tenscan/frontend/src/components/ui/card.tsx deleted file mode 100644 index 3307589084..0000000000 --- a/tools/tenscan/frontend/src/components/ui/card.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import * as React from 'react' - -import { cn } from '@/src/lib/utils' - -const Card = React.forwardRef>( - ({ className, ...props }, ref) => ( -
    - ) -) -Card.displayName = 'Card' - -const CardHeader = React.forwardRef>( - ({ className, ...props }, ref) => ( -
    - ) -) -CardHeader.displayName = 'CardHeader' - -const CardTitle = React.forwardRef>( - ({ className, ...props }, ref) => ( -

    - ) -) -CardTitle.displayName = 'CardTitle' - -const CardDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

    -)) -CardDescription.displayName = 'CardDescription' - -const CardContent = React.forwardRef>( - ({ className, ...props }, ref) => ( -

    - ) -) -CardContent.displayName = 'CardContent' - -const CardFooter = React.forwardRef>( - ({ className, ...props }, ref) => ( -
    - ) -) -CardFooter.displayName = 'CardFooter' - -export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/tools/tenscan/frontend/src/components/ui/checkbox.tsx b/tools/tenscan/frontend/src/components/ui/checkbox.tsx deleted file mode 100644 index e4f571b0ce..0000000000 --- a/tools/tenscan/frontend/src/components/ui/checkbox.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as React from "react"; -import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; -import { Check } from "lucide-react"; - -import { cn } from "@/src/lib/utils"; - -const Checkbox = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - - - -)); -Checkbox.displayName = CheckboxPrimitive.Root.displayName; - -export { Checkbox }; diff --git a/tools/tenscan/frontend/src/components/ui/command.tsx b/tools/tenscan/frontend/src/components/ui/command.tsx deleted file mode 100644 index fd81fd9b4c..0000000000 --- a/tools/tenscan/frontend/src/components/ui/command.tsx +++ /dev/null @@ -1,153 +0,0 @@ -import * as React from "react"; -import { DialogProps } from "@radix-ui/react-dialog"; -import { Command as CommandPrimitive } from "cmdk"; -import { Search } from "lucide-react"; - -import { cn } from "@/src/lib/utils"; -import { Dialog, DialogContent } from "@/src/components/ui/dialog"; - -const Command = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -Command.displayName = CommandPrimitive.displayName; - -interface CommandDialogProps extends DialogProps {} - -const CommandDialog = ({ children, ...props }: CommandDialogProps) => { - return ( - - - - {children} - - - - ); -}; - -const CommandInput = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( -
    - - -
    -)); - -CommandInput.displayName = CommandPrimitive.Input.displayName; - -const CommandList = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -CommandList.displayName = CommandPrimitive.List.displayName; - -const CommandEmpty = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->((props, ref) => ( - -)); - -CommandEmpty.displayName = CommandPrimitive.Empty.displayName; - -const CommandGroup = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -CommandGroup.displayName = CommandPrimitive.Group.displayName; - -const CommandSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -CommandSeparator.displayName = CommandPrimitive.Separator.displayName; - -const CommandItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -CommandItem.displayName = CommandPrimitive.Item.displayName; - -const CommandShortcut = ({ - className, - ...props -}: React.HTMLAttributes) => { - return ( - - ); -}; -CommandShortcut.displayName = "CommandShortcut"; - -export { - Command, - CommandDialog, - CommandInput, - CommandList, - CommandEmpty, - CommandGroup, - CommandItem, - CommandShortcut, - CommandSeparator, -}; diff --git a/tools/tenscan/frontend/src/components/ui/dialog.tsx b/tools/tenscan/frontend/src/components/ui/dialog.tsx deleted file mode 100644 index 973b5c4088..0000000000 --- a/tools/tenscan/frontend/src/components/ui/dialog.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import * as React from 'react' -import * as DialogPrimitive from '@radix-ui/react-dialog' -import { X } from 'lucide-react' - -import { cn } from '@/src/lib/utils' - -const Dialog = DialogPrimitive.Root - -const DialogTrigger = DialogPrimitive.Trigger - -const DialogPortal = DialogPrimitive.Portal - -const DialogClose = DialogPrimitive.Close - -const DialogOverlay = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName - -const DialogContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - {children} - - - Close - - - -)) -DialogContent.displayName = DialogPrimitive.Content.displayName - -const DialogHeader = ({ className, ...props }: React.HTMLAttributes) => ( -
    -) -DialogHeader.displayName = 'DialogHeader' - -const DialogFooter = ({ className, ...props }: React.HTMLAttributes) => ( -
    -) -DialogFooter.displayName = 'DialogFooter' - -const DialogTitle = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -DialogTitle.displayName = DialogPrimitive.Title.displayName - -const DialogDescription = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -DialogDescription.displayName = DialogPrimitive.Description.displayName - -export { - Dialog, - DialogPortal, - DialogOverlay, - DialogClose, - DialogTrigger, - DialogContent, - DialogHeader, - DialogFooter, - DialogTitle, - DialogDescription -} diff --git a/tools/tenscan/frontend/src/components/ui/dropdown-menu.tsx b/tools/tenscan/frontend/src/components/ui/dropdown-menu.tsx deleted file mode 100644 index f08b9a2d01..0000000000 --- a/tools/tenscan/frontend/src/components/ui/dropdown-menu.tsx +++ /dev/null @@ -1,183 +0,0 @@ -import * as React from 'react' -import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu' -import { Check, ChevronRight, Circle } from 'lucide-react' - -import { cn } from '@/src/lib/utils' - -const DropdownMenu = DropdownMenuPrimitive.Root - -const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger - -const DropdownMenuGroup = DropdownMenuPrimitive.Group - -const DropdownMenuPortal = DropdownMenuPrimitive.Portal - -const DropdownMenuSub = DropdownMenuPrimitive.Sub - -const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup - -const DropdownMenuSubTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, children, ...props }, ref) => ( - - {children} - - -)) -DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName - -const DropdownMenuSubContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName - -const DropdownMenuContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, sideOffset = 4, ...props }, ref) => ( - - - -)) -DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName - -const DropdownMenuItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, ...props }, ref) => ( - -)) -DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName - -const DropdownMenuCheckboxItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, checked, ...props }, ref) => ( - - - - - - - {children} - -)) -DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName - -const DropdownMenuRadioItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - - - - {children} - -)) -DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName - -const DropdownMenuLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, ...props }, ref) => ( - -)) -DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName - -const DropdownMenuSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName - -const DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes) => { - return -} -DropdownMenuShortcut.displayName = 'DropdownMenuShortcut' - -export { - DropdownMenu, - DropdownMenuTrigger, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuCheckboxItem, - DropdownMenuRadioItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuShortcut, - DropdownMenuGroup, - DropdownMenuPortal, - DropdownMenuSub, - DropdownMenuSubContent, - DropdownMenuSubTrigger, - DropdownMenuRadioGroup -} diff --git a/tools/tenscan/frontend/src/components/ui/external-link.tsx b/tools/tenscan/frontend/src/components/ui/external-link.tsx deleted file mode 100644 index 13366137ea..0000000000 --- a/tools/tenscan/frontend/src/components/ui/external-link.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { ExternalLinkIcon } from "@radix-ui/react-icons"; -import React from "react"; - -const ExternalLink = ({ - href, - children, - className, -}: { - href: string; - children: React.ReactNode; - className?: string; -}) => { - return ( - - {children} - - ); -}; - -export default ExternalLink; diff --git a/tools/tenscan/frontend/src/components/ui/input.tsx b/tools/tenscan/frontend/src/components/ui/input.tsx deleted file mode 100644 index e23cdfa1a8..0000000000 --- a/tools/tenscan/frontend/src/components/ui/input.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from 'react' - -import { cn } from '@/src/lib/utils' - -export interface InputProps extends React.InputHTMLAttributes {} - -const Input = React.forwardRef( - ({ className, type, ...props }, ref) => { - return ( - - ) - } -) -Input.displayName = 'Input' - -export { Input } diff --git a/tools/tenscan/frontend/src/components/ui/key-value.tsx b/tools/tenscan/frontend/src/components/ui/key-value.tsx deleted file mode 100644 index 540e3a7ce3..0000000000 --- a/tools/tenscan/frontend/src/components/ui/key-value.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React from "react"; -import { Separator } from "./separator"; - -export const KeyValueList = ({ children }: { children: React.ReactNode }) => ( -
      {children}
    -); - -export const KeyValueItem = ({ - label, - value, - isLastItem, -}: { - label?: string; - value: string | number | React.ReactNode; - isLastItem?: boolean; -}) => ( -
  • -
    - {label && {label}} - {value} -
    - {!isLastItem && } -
  • -); - -export default KeyValueItem; diff --git a/tools/tenscan/frontend/src/components/ui/label.tsx b/tools/tenscan/frontend/src/components/ui/label.tsx deleted file mode 100644 index 27adca2cea..0000000000 --- a/tools/tenscan/frontend/src/components/ui/label.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as React from 'react' -import * as LabelPrimitive from '@radix-ui/react-label' -import { cva, type VariantProps } from 'class-variance-authority' - -import { cn } from '@/src/lib/utils' - -const labelVariants = cva( - 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70' -) - -const Label = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & VariantProps ->(({ className, ...props }, ref) => ( - -)) -Label.displayName = LabelPrimitive.Root.displayName - -export { Label } diff --git a/tools/tenscan/frontend/src/components/ui/navigation-menu.tsx b/tools/tenscan/frontend/src/components/ui/navigation-menu.tsx deleted file mode 100644 index 1e7b75005f..0000000000 --- a/tools/tenscan/frontend/src/components/ui/navigation-menu.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import * as React from 'react' -import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu' -import { cva } from 'class-variance-authority' -import { ChevronDown } from 'lucide-react' - -import { cn } from '@/src/lib/utils' - -const NavigationMenu = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - {children} - - -)) -NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName - -const NavigationMenuList = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName - -const NavigationMenuItem = NavigationMenuPrimitive.Item - -const navigationMenuTriggerStyle = cva( - 'group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50' -) - -const NavigationMenuTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - {children}{' '} - -)) -NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName - -const NavigationMenuContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName - -const NavigationMenuLink = NavigationMenuPrimitive.Link - -const NavigationMenuViewport = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( -
    - -
    -)) -NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName - -const NavigationMenuIndicator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -
    - -)) -NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName - -export { - navigationMenuTriggerStyle, - NavigationMenu, - NavigationMenuList, - NavigationMenuItem, - NavigationMenuContent, - NavigationMenuTrigger, - NavigationMenuLink, - NavigationMenuIndicator, - NavigationMenuViewport -} diff --git a/tools/tenscan/frontend/src/components/ui/popover.tsx b/tools/tenscan/frontend/src/components/ui/popover.tsx deleted file mode 100644 index 18b61979cf..0000000000 --- a/tools/tenscan/frontend/src/components/ui/popover.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import * as React from 'react' -import * as PopoverPrimitive from '@radix-ui/react-popover' - -import { cn } from '@/src/lib/utils' - -const Popover = PopoverPrimitive.Root - -const PopoverTrigger = PopoverPrimitive.Trigger - -const PopoverContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, align = 'center', sideOffset = 4, ...props }, ref) => ( - - - -)) -PopoverContent.displayName = PopoverPrimitive.Content.displayName - -export { Popover, PopoverTrigger, PopoverContent } diff --git a/tools/tenscan/frontend/src/components/ui/select.tsx b/tools/tenscan/frontend/src/components/ui/select.tsx deleted file mode 100644 index bb1703edc5..0000000000 --- a/tools/tenscan/frontend/src/components/ui/select.tsx +++ /dev/null @@ -1,119 +0,0 @@ -import * as React from 'react' -import * as SelectPrimitive from '@radix-ui/react-select' -import { Check, ChevronDown } from 'lucide-react' - -import { cn } from '@/src/lib/utils' - -const Select = SelectPrimitive.Root - -const SelectGroup = SelectPrimitive.Group - -const SelectValue = SelectPrimitive.Value - -const SelectTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - {children} - - - - -)) -SelectTrigger.displayName = SelectPrimitive.Trigger.displayName - -const SelectContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, position = 'popper', ...props }, ref) => ( - - - - {children} - - - -)) -SelectContent.displayName = SelectPrimitive.Content.displayName - -const SelectLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -SelectLabel.displayName = SelectPrimitive.Label.displayName - -const SelectItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - - - - - {children} - -)) -SelectItem.displayName = SelectPrimitive.Item.displayName - -const SelectSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -SelectSeparator.displayName = SelectPrimitive.Separator.displayName - -export { - Select, - SelectGroup, - SelectValue, - SelectTrigger, - SelectContent, - SelectLabel, - SelectItem, - SelectSeparator -} diff --git a/tools/tenscan/frontend/src/components/ui/separator.tsx b/tools/tenscan/frontend/src/components/ui/separator.tsx deleted file mode 100644 index fd1ac8931b..0000000000 --- a/tools/tenscan/frontend/src/components/ui/separator.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import * as React from "react"; -import * as SeparatorPrimitive from "@radix-ui/react-separator"; - -import { cn } from "@/src/lib/utils"; - -const Separator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->( - ( - { className, orientation = "horizontal", decorative = true, ...props }, - ref - ) => ( - - ) -); -Separator.displayName = SeparatorPrimitive.Root.displayName; - -export { Separator }; diff --git a/tools/tenscan/frontend/src/components/ui/skeleton.tsx b/tools/tenscan/frontend/src/components/ui/skeleton.tsx deleted file mode 100644 index 03e4c85986..0000000000 --- a/tools/tenscan/frontend/src/components/ui/skeleton.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { cn } from "@/src/lib/utils" - -function Skeleton({ - className, - ...props -}: React.HTMLAttributes) { - return ( -
    - ) -} - -export { Skeleton } diff --git a/tools/tenscan/frontend/src/components/ui/spinner.tsx b/tools/tenscan/frontend/src/components/ui/spinner.tsx deleted file mode 100644 index 2948ef451b..0000000000 --- a/tools/tenscan/frontend/src/components/ui/spinner.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from "react"; - -const Spinner = () => { - return ( -
    -
    -
    - ); -}; - -export default Spinner; diff --git a/tools/tenscan/frontend/src/components/ui/table.tsx b/tools/tenscan/frontend/src/components/ui/table.tsx deleted file mode 100644 index 0b8376b09f..0000000000 --- a/tools/tenscan/frontend/src/components/ui/table.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import * as React from 'react' - -import { cn } from '@/src/lib/utils' - -const Table = React.forwardRef>( - ({ className, ...props }, ref) => ( -
    - - - ) -) -Table.displayName = 'Table' - -const TableHeader = React.forwardRef< - HTMLTableSectionElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( - -)) -TableHeader.displayName = 'TableHeader' - -const TableBody = React.forwardRef< - HTMLTableSectionElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( - -)) -TableBody.displayName = 'TableBody' - -const TableFooter = React.forwardRef< - HTMLTableSectionElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( - -)) -TableFooter.displayName = 'TableFooter' - -const TableRow = React.forwardRef>( - ({ className, ...props }, ref) => ( - - ) -) -TableRow.displayName = 'TableRow' - -const TableHead = React.forwardRef< - HTMLTableCellElement, - React.ThHTMLAttributes ->(({ className, ...props }, ref) => ( -
    -)) -TableHead.displayName = 'TableHead' - -const TableCell = React.forwardRef< - HTMLTableCellElement, - React.TdHTMLAttributes ->(({ className, ...props }, ref) => ( - -)) -TableCell.displayName = 'TableCell' - -const TableCaption = React.forwardRef< - HTMLTableCaptionElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
    -)) -TableCaption.displayName = 'TableCaption' - -export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } diff --git a/tools/tenscan/frontend/src/components/ui/tabs.tsx b/tools/tenscan/frontend/src/components/ui/tabs.tsx deleted file mode 100644 index 47a3925903..0000000000 --- a/tools/tenscan/frontend/src/components/ui/tabs.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import * as React from 'react' -import * as TabsPrimitive from '@radix-ui/react-tabs' - -import { cn } from '@/src/lib/utils' - -const Tabs = TabsPrimitive.Root - -const TabsList = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -TabsList.displayName = TabsPrimitive.List.displayName - -const TabsTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -TabsTrigger.displayName = TabsPrimitive.Trigger.displayName - -const TabsContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -TabsContent.displayName = TabsPrimitive.Content.displayName - -export { Tabs, TabsList, TabsTrigger, TabsContent } diff --git a/tools/tenscan/frontend/src/components/ui/textarea.tsx b/tools/tenscan/frontend/src/components/ui/textarea.tsx deleted file mode 100644 index db65d62a57..0000000000 --- a/tools/tenscan/frontend/src/components/ui/textarea.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from "react" - -import { cn } from "@/src/lib/utils" - -export interface TextareaProps - extends React.TextareaHTMLAttributes {} - -const Textarea = React.forwardRef( - ({ className, ...props }, ref) => { - return ( -