From 46eefc0c91432d0e051703b0b81fcf4a889e58ee Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 4 Oct 2024 12:11:23 +0800 Subject: [PATCH 1/3] fix epoch2 zkl data --- src/api/index.ts | 7 +++++++ src/pages/DashboardS2/index2.tsx | 12 ++++++++++-- yarn.lock | 28 +++++----------------------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 75e0f31..90a625f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -688,6 +688,7 @@ export interface TvlCategoryMilestone { name: string; data: string; type: string; + zkl: number } interface TvlCategoryMilestoneResponse { @@ -832,6 +833,12 @@ export const getCategoryZKL = (): Promise => { return http.get(`${BASE_URL_LRT_POINTS}/tvl/category/milestone/s2-1`); }; +export const getCategoryZKLE2 = (): Promise => { + return http.get( + `${BASE_URL_LRT_POINTS}/tvl/category/milestone/season?season=2` + ); +}; + export interface PortocolSpinItem { projectName: string; remainSpinNum: number; diff --git a/src/pages/DashboardS2/index2.tsx b/src/pages/DashboardS2/index2.tsx index 318b825..78724ce 100644 --- a/src/pages/DashboardS2/index2.tsx +++ b/src/pages/DashboardS2/index2.tsx @@ -10,6 +10,7 @@ import { TvlCategoryMilestone, getAccountTvl, getCategoryZKL, + getCategoryZKLE2, getExplorerTokenTvl, getNovaCategoryPoints, getNovaCategoryUserPoints, @@ -452,7 +453,11 @@ export default function Dashboard() { const [categoryZKLs, setCategoryZKLs] = useState([]); const getCategoryZKLFunc = async () => { - const { data } = await getCategoryZKL(); + console.log("epoch", epochActive); + const { data } = + epochActive === 1 + ? await getTvlCategoryMilestone({ season: 2 }) + : await getCategoryZKL(); setCategoryZKLs(data || []); }; @@ -624,9 +629,12 @@ export default function Dashboard() { getNovaCategoryPointsFunc(); getNovaCategoryUserPointsFunc(); getNovaCategoryUserPointsTotalFunc(); - getCategoryZKLFunc(); }, [address, season]); + useEffect(() => { + getCategoryZKLFunc(); + }, [address, epochActive]); + const allSupportedPoints = [ { name: "Nova Points", diff --git a/yarn.lock b/yarn.lock index 32f4cb8..af83180 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4230,9 +4230,9 @@ camelize@^1.0.0: integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ== caniuse-lite@^1.0.30001587, caniuse-lite@^1.0.30001599: - version "1.0.30001599" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001599.tgz#571cf4f3f1506df9bf41fcbb6d10d5d017817bce" - integrity sha512-LRAQHZ4yT1+f9LemSMeqdMpMxZcc4RMWdj4tiFe3G8tNkWK+E58g+/tzotb5cU6TbcVJLr4fySiAW7XmxQvZQA== + version "1.0.30001666" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001666.tgz" + integrity sha512-gD14ICmoV5ZZM1OdzPWmpx+q4GyefaK06zi8hmfHV5xe4/2nOQX3+Dw5o+fSqOws2xVwL9j+anOPFwHzdEdV4g== chalk@^2.4.2: version "2.4.2" @@ -7152,16 +7152,7 @@ strict-uri-encode@^2.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -7733,7 +7724,7 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -7751,15 +7742,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 62d950de1b3a7fd7e63d22331a074324d966bd28 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 4 Oct 2024 12:19:19 +0800 Subject: [PATCH 2/3] fix category tvl data --- src/api/index.ts | 6 +++++- src/pages/DashboardS2/index2.tsx | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 75e0f31..417806a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -696,11 +696,15 @@ interface TvlCategoryMilestoneResponse { data: TvlCategoryMilestone[]; } -export const getTvlCategoryMilestone = (params: { +export const getTvlCategoryMilestoneBySeason = (params: { season: number; }): Promise => http.get(`${BASE_URL_LRT_POINTS}/tvl/category/milestone/season`, { params }); +export const getTvlCategoryMilestone = + (): Promise => + http.get(`${BASE_URL_LRT_POINTS}/tvl/category/milestone`); + export const modifyUsername = (userName: string): Promise => http.post(`${BASE_URL_API}/invite/modify/username`, { userName }); diff --git a/src/pages/DashboardS2/index2.tsx b/src/pages/DashboardS2/index2.tsx index 318b825..4dfbb35 100644 --- a/src/pages/DashboardS2/index2.tsx +++ b/src/pages/DashboardS2/index2.tsx @@ -18,6 +18,7 @@ import { getTokenPrice, getTotalTvlByToken, getTvlCategoryMilestone, + getTvlCategoryMilestoneBySeason, } from "@/api"; import { useAccount } from "wagmi"; import EcoDApps from "@/components/DashboardS2/Tabs/EcoDApps"; @@ -421,7 +422,7 @@ export default function Dashboard() { TvlCategoryMilestone[] >([]); const getTvlCategoryMilestoneFunc = async () => { - const res = await getTvlCategoryMilestone({ season }); + const res = await getTvlCategoryMilestone(); console.log("getTvlCategory", res); setTvlCategoryMilestone(res?.data || []); }; From 6e7a1b74304c4813688f9987b2d37c42da170155 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 10 Oct 2024 10:00:23 +0800 Subject: [PATCH 3/3] fix category zkl --- src/pages/DashboardS2/index2.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/DashboardS2/index2.tsx b/src/pages/DashboardS2/index2.tsx index 2a92764..a3442cc 100644 --- a/src/pages/DashboardS2/index2.tsx +++ b/src/pages/DashboardS2/index2.tsx @@ -457,7 +457,7 @@ export default function Dashboard() { console.log("epoch", epochActive); const { data } = epochActive === 1 - ? await getTvlCategoryMilestone({ season: 2 }) + ? await getTvlCategoryMilestoneBySeason({ season: 2 }) : await getCategoryZKL(); setCategoryZKLs(data || []); };