From b55ff60b526bc16d2843bf74c3d664a0970ca5a3 Mon Sep 17 00:00:00 2001 From: moreal Date: Fri, 28 Jun 2024 08:09:22 +0900 Subject: [PATCH 1/3] chore: use yarn 4.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 215ccc8..6db61b5 100644 --- a/package.json +++ b/package.json @@ -34,5 +34,5 @@ "tailwindcss": "^3.1.3", "typescript": "^5.4.5" }, - "packageManager": "yarn@4.1.1" + "packageManager": "yarn@4.3.1" } From ac75a6756fa15e4be9a8d1edab01a2f53a7b0ad4 Mon Sep 17 00:00:00 2001 From: moreal Date: Fri, 28 Jun 2024 08:12:06 +0900 Subject: [PATCH 2/3] feat: remove unused page --- components/rank/RankRow.tsx | 18 -------------- pages/[network]/rank.tsx | 47 ------------------------------------- 2 files changed, 65 deletions(-) delete mode 100644 components/rank/RankRow.tsx delete mode 100644 pages/[network]/rank.tsx diff --git a/components/rank/RankRow.tsx b/components/rank/RankRow.tsx deleted file mode 100644 index 2042128..0000000 --- a/components/rank/RankRow.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import type { NextPage } from 'next' -import Link from 'next/link' - -export interface RankRowProps { - rank: number, - name: string, - avatarAddress: string, -} - -export const RankRow: NextPage = ({ rank, name, avatarAddress }) => { - return ( - -
- {rank} {name} {avatarAddress} -
- - ) -} diff --git a/pages/[network]/rank.tsx b/pages/[network]/rank.tsx deleted file mode 100644 index 0991a4c..0000000 --- a/pages/[network]/rank.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import type { NextPage, GetServerSideProps } from 'next' -import { RankRow, RankRowProps } from '../../components/rank/RankRow' -import { networkToSDK } from '../../sdk' - -interface RankProps { - rows: RankRowProps[] -} - -const Rank: NextPage = ({ rows }) => { - return ( -
- {rows.map((row) => )} -
- ) -} - -export const getServerSideProps: GetServerSideProps = async (context) => { - const network = context.query.network; - if (typeof(network) !== "string") { - throw new Error("Network parameter is not a string."); - } - - const page = context.query.page || "0"; - if (typeof(page) !== "string") { - throw new Error("Page parameter is not a string."); - } - - const sdk = networkToSDK(network); - - const res = await sdk.RankingMap({ - index: parseInt(page), - }); - let rows = res.stateQuery.rankingMap?.rankingInfos.map((info: any, index: any) => { - return { - name: info.avatarName, - rank: index, - avatarAddress: info.avatarAddress, - } - }) || []; - return { - props: { - rows - } - } -} - -export default Rank From c810696fa920d3e4672fdd93dc552e6895502d37 Mon Sep 17 00:00:00 2001 From: moreal Date: Fri, 28 Jun 2024 08:19:54 +0900 Subject: [PATCH 3/3] chore: move utilities to utils directory --- pages/[network]/avatar/[address].tsx | 2 +- pages/[network]/raw/[address].tsx | 2 +- pages/[network]/stake/[address].tsx | 2 +- apiClient.ts => utils/apiClient.ts | 4 ++-- sdk.ts => utils/sdk.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename apiClient.ts => utils/apiClient.ts (94%) rename sdk.ts => utils/sdk.ts (93%) diff --git a/pages/[network]/avatar/[address].tsx b/pages/[network]/avatar/[address].tsx index 4eb2f84..e337e57 100644 --- a/pages/[network]/avatar/[address].tsx +++ b/pages/[network]/avatar/[address].tsx @@ -1,5 +1,5 @@ import type { NextPage, GetServerSideProps } from "next"; -import { getBalance } from "../../../apiClient"; +import { getBalance } from "../../../utils/apiClient"; import { getGraphQLSDK } from "../../../utils/mimirGraphQLClient"; import { getPlanetName, getNodeType } from "../../../utils/network"; import { NodeType } from "../../../constants/network"; diff --git a/pages/[network]/raw/[address].tsx b/pages/[network]/raw/[address].tsx index aff0606..3f6f62d 100644 --- a/pages/[network]/raw/[address].tsx +++ b/pages/[network]/raw/[address].tsx @@ -1,5 +1,5 @@ import type { NextPage, GetServerSideProps } from "next" -import { networkToSDK } from "../../../sdk"; +import { networkToSDK } from "../../../utils/sdk"; import { decode } from "bencodex"; import React from "react"; import { JSONTree } from "react-json-tree"; diff --git a/pages/[network]/stake/[address].tsx b/pages/[network]/stake/[address].tsx index 97c593f..a50dca6 100644 --- a/pages/[network]/stake/[address].tsx +++ b/pages/[network]/stake/[address].tsx @@ -1,5 +1,5 @@ import type { NextPage, GetServerSideProps } from "next" -import { networkToSDK } from "../../../sdk"; +import { networkToSDK } from "../../../utils/sdk"; import { BencodexList, decode } from "bencodex"; import React from "react"; import * as crypto from "node:crypto"; diff --git a/apiClient.ts b/utils/apiClient.ts similarity index 94% rename from apiClient.ts rename to utils/apiClient.ts index eedd6fd..0b23dcd 100644 --- a/apiClient.ts +++ b/utils/apiClient.ts @@ -1,6 +1,6 @@ import { GraphQLClient } from "graphql-request"; -import { NetworkType, NodeType } from "./constants/network"; -import { PlanetName, getSdk } from "./generated/mimir/graphql-request"; +import { NetworkType, NodeType } from "../constants/network"; +import { PlanetName, getSdk } from "../generated/mimir/graphql-request"; export const BASE_URL = "https://mimir.nine-chronicles.dev/"; export const INTERNAL_BASE_URL = "https://mimir-internal.nine-chronicles.dev/"; diff --git a/sdk.ts b/utils/sdk.ts similarity index 93% rename from sdk.ts rename to utils/sdk.ts index f9c8b4c..2c8cb44 100644 --- a/sdk.ts +++ b/utils/sdk.ts @@ -1,5 +1,5 @@ import { GetServerSidePropsContext } from "next/types"; -import { getSdk } from "./generated/headless/graphql-request"; +import { getSdk } from "../generated/headless/graphql-request"; import { GraphQLClient } from "graphql-request" function parseNetworkConfMap(confMapString: string): Map> {