Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tenscan] implement monorepo changes #2064

Merged
merged 21 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4312599
Update 404 component with default values
Jennievon Sep 27, 2024
8a3f6d6
Merge branch 'jennifer/3417-implement-shared-components-utils-hooks-e…
Jennievon Sep 27, 2024
caed604
Update package dependencies
Jennievon Sep 27, 2024
408faca
Merge branch 'jennifer/3417-implement-shared-components-utils-hooks-e…
Jennievon Sep 27, 2024
49f2284
feat: page links' variables
Jennievon Sep 28, 2024
7183ec6
Merge branch 'jennifer/3417-implement-shared-components-utils-hooks-e…
Jennievon Sep 28, 2024
a7d5e79
Merge branch 'jennifer/3417-implement-shared-components-utils-hooks-e…
Jennievon Sep 28, 2024
5370ea2
refactor document page
Jennievon Sep 28, 2024
41b475f
fix: build error - duplicate import
Jennievon Sep 28, 2024
81bed71
Update npm install to pnpm install
Jennievon Sep 28, 2024
73b5016
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Oct 3, 2024
c712083
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Oct 4, 2024
1a4b6c2
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Oct 4, 2024
5037652
Update Dockerfile for tenscan FE
Jennievon Oct 4, 2024
f1e60e2
fix: show full address on desktop
Jennievon Oct 4, 2024
f6c3033
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Oct 6, 2024
8cff405
revert Tenscan changes
Jennievon Oct 8, 2024
2a789be
add monorepo structure doc for TEN frontend projects
Jennievon Oct 8, 2024
4991b86
update dependencies and import paths
Jennievon Oct 8, 2024
5856516
refactor badge styles and add static variants
Jennievon Oct 8, 2024
b991500
Merge branch 'main' of https://github.com/ten-protocol/go-ten into je…
Jennievon Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions packages/ui/components/shared/badge.tsx
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion tools/bridge-frontend/src/lib/siteMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: "[email protected]",
Expand Down
17 changes: 11 additions & 6 deletions tools/tenscan/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
WORKDIR /home/obscuro/go-obscuro/tools/tenscan/frontend

RUN pnpm install --filter ./tools/tenscan/frontend...

EXPOSE 80

CMD ["pnpm", "run", "start"]
2 changes: 1 addition & 1 deletion tools/tenscan/frontend/api/batches.ts
Original file line number Diff line number Diff line change
@@ -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<string, any>
Expand Down
7 changes: 4 additions & 3 deletions tools/tenscan/frontend/api/blocks.ts
Original file line number Diff line number Diff line change
@@ -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<string, any>
): Promise<ResponseDataInterface<any>> => {
return await httpRequest<ResponseDataInterface<any>>({
): Promise<ResponseDataInterface<BlockResponse>> => {
return await httpRequest<ResponseDataInterface<BlockResponse>>({
method: "get",
url: pathToUrl(apiRoutes.getBlocks),
searchParams: payload,
Expand Down
2 changes: 1 addition & 1 deletion tools/tenscan/frontend/api/contracts.ts
Original file line number Diff line number Diff line change
@@ -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<string, any>
Expand Down
2 changes: 1 addition & 1 deletion tools/tenscan/frontend/api/general.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 2 additions & 2 deletions tools/tenscan/frontend/api/rollups.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
7 changes: 4 additions & 3 deletions tools/tenscan/frontend/api/transactions.ts
Original file line number Diff line number Diff line change
@@ -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<string, any>
Expand Down
1 change: 1 addition & 0 deletions tools/tenscan/frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
transpilePackages: ["@repo/ui"],
images: {
unoptimized: true,
},
Expand Down
27 changes: 6 additions & 21 deletions tools/tenscan/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
}
}
41 changes: 5 additions & 36 deletions tools/tenscan/frontend/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Error
heading={` ${customPageTitle || "Oops! Page"} Not Found`}
statusText={`We can't seem to find the ${
customPageTitle || "page"
} you're looking for.`}
statusCode={404}
showRedirectText={showRedirectText}
redirectText={redirectText || "Home Page"}
message={
message ||
`The ${
customPageTitle || "page"
} you are looking for might have been removed, had its name changed, or is temporarily unavailable.`
}
isFullWidth={isFullWidth}
showMessage={showMessage}
redirectLink={redirectLink}
>
{children}
</Error>
);
}
const Custom404 = () => {
return <Custom404Error />;
};

export default Custom404Error;
export default Custom404;
35 changes: 5 additions & 30 deletions tools/tenscan/frontend/pages/500.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Error
heading={"Oops! Something went wrong."}
message={
message ||
"We're experiencing technical difficulties. Please try again later."
}
statusText={customPageTitle || `An Error occured`}
statusCode={500}
showRedirectText={showRedirectText || true}
redirectText={redirectText || "Home Page"}
err={err}
redirectLink={redirectLink}
>
{children}
</Error>
);
}
const Custom404 = () => {
return <Custom500Error />;
};

export default Custom500Error;
export default Custom404;
19 changes: 8 additions & 11 deletions tools/tenscan/frontend/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -76,12 +75,10 @@ export default function App({ Component, pageProps }: AppProps) {
enableSystem
disableTransitionOnChange
>
<WalletConnectionProvider>
<Component {...pageProps} />
<Toaster />
<NetworkStatus />
<ReactQueryDevtools initialIsOpen={false} />
</WalletConnectionProvider>
<Component {...pageProps} />
<Toaster />
<NetworkStatus />
<ReactQueryDevtools initialIsOpen={false} />
</ThemeProvider>
</QueryClientProvider>
</>
Expand Down
Loading
Loading