Skip to content

Commit

Permalink
Merge pull request #361 from zkLinkProtocol/feat/epoch3
Browse files Browse the repository at this point in the history
Feat/epoch3
  • Loading branch information
MickWang authored Aug 31, 2024
2 parents b8c564a + adb6f65 commit de53cc8
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 84 deletions.
11 changes: 7 additions & 4 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,13 @@ interface NovaProjectTotalPointsResponse {
data: NovaProjectTotalPoints[];
}

export const getNovaProjectTotalPoints =
(): Promise<NovaProjectTotalPointsResponse> => {
return http.get(`${BASE_URL_LRT_POINTS}/nova/project/points`);
};
export const getNovaProjectTotalPoints = (params: {
season: number;
}): Promise<NovaProjectTotalPointsResponse> => {
return http.get(`${BASE_URL_LRT_POINTS}/nova/project/points`, {
params,
});
};

export interface CategoryZKLItem {
name: string;
Expand Down
9 changes: 6 additions & 3 deletions src/components/DashboardS2/Tabs/EcoDApps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,14 @@ export default function EcoDApps({
tvlCategoryMilestone,
holdingPoints,
novaCategoryTotalPoints,
season,
}: {
tabActive?: {
category: string;
name: string;
iconURL: string;
};
season: number;
novaCategoryUserPoints: NovaCategoryUserPoints[];
tvlCategoryMilestone: TvlCategoryMilestone[];
holdingPoints?: NovaPointsListItem;
Expand All @@ -612,15 +614,16 @@ export default function EcoDApps({
>([]);

const getProjectTotalPoints = async () => {
const { data } = await getNovaProjectTotalPoints();
console.log("season", season);
const { data } = await getNovaProjectTotalPoints({ season });
if (data) {
setProjectTotalPoints(data);
}
};

useEffect(() => {
getProjectTotalPoints();
}, []);
}, [season]);

const getTotalPointsByProject = useCallback(
(project: string) => {
Expand Down Expand Up @@ -1206,7 +1209,7 @@ export default function EcoDApps({
],
},
{
category: "gamefi",
category: "other",
iconURL: "/img/icon-skyrangers.png",
name: "Sky Rangers",
link: "https://statics.skyrangers.io/",
Expand Down
30 changes: 15 additions & 15 deletions src/components/DashboardS2/Tabs/SectorHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ export default function SectorHeader({
holding: [
{
tvl: 0,
zkl: 500000,
zkl: 100000,
},
{
tvl: 200000000,
zkl: 1000000,
zkl: 200000,
},
{
tvl: 500000000,
zkl: 2000000,
zkl: 500000,
},
{
tvl: 1000000000,
zkl: 3000000,
zkl: 1000000,
},
],
spotdex: [
Expand All @@ -71,15 +71,15 @@ export default function SectorHeader({
},
{
tvl: 5000000,
zkl: 500000,
zkl: 200000,
},
{
tvl: 25000000,
zkl: 1000000,
zkl: 500000,
},
{
tvl: 50000000,
zkl: 1500000,
zkl: 1000000,
},
],
perpdex: [
Expand All @@ -89,15 +89,15 @@ export default function SectorHeader({
},
{
tvl: 100000000,
zkl: 500000,
zkl: 200000,
},
{
tvl: 500000000,
zkl: 1000000,
zkl: 500000,
},
{
tvl: 2000000000,
zkl: 2000000,
zkl: 1000000,
},
],
lending: [
Expand All @@ -107,15 +107,15 @@ export default function SectorHeader({
},
{
tvl: 10000000,
zkl: 350000,
zkl: 200000,
},
{
tvl: 50000000,
zkl: 700000,
zkl: 500000,
},
{
tvl: 200000000,
zkl: 1500000,
zkl: 1000000,
},
],
};
Expand All @@ -128,15 +128,15 @@ export default function SectorHeader({
} = {
gamefi: {
zkl: 10000,
max: 1000000,
max: 500000,
},
other: {
zkl: 50000,
max: 500000,
},
nativeboost: {
zkl: 50000,
max: 500000,
max: 5000000,
},
};

Expand Down
1 change: 1 addition & 0 deletions src/constants/epoch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export const epochList = [
season: 2,
},
{ name: "Epoch Two", season: 3 },
{ name: "Epoch Three", season: 4 },
];
110 changes: 73 additions & 37 deletions src/pages/DashboardS2/index2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ export default function Dashboard() {
name: "Lending",
category: "lending",
},
{
iconURL: "/img/icon-sector-6.svg",
name: "GameFi",
category: "gamefi",
},
// {
// iconURL: "/img/icon-sector-6.svg",
// name: "GameFi",
// category: "gamefi",
// },
{
iconURL: "/img/icon-sector-7.svg",
name: "Others",
Expand Down Expand Up @@ -425,7 +425,7 @@ export default function Dashboard() {
console.log("getTvlCategory", res);
setTvlCategoryMilestone(res?.data || []);
};
const [epochActive, setEpochActive] = useState(1);
const [epochActive, setEpochActive] = useState(2);

const season = useMemo(() => {
if (tabs2Active === 99) {
Expand Down Expand Up @@ -457,36 +457,68 @@ export default function Dashboard() {
};

const novaPointsList = useMemo(() => {
const categorys = [
{
name: "Assets Points",
category: "holding",
},
{
name: "Native Boost Points",
category: "nativeboost",
},
{
name: "Spot DEX Points",
category: "spotdex",
},
{
name: "Perp DEX Points",
category: "perpdex",
},
{
name: "Lending Points",
category: "lending",
},
{
name: "GameFi Points",
category: "gamefi",
},
{
name: "Others Points",
category: "other",
},
];
const categorys =
epochActive === 2
? [
{
name: "Assets Points",
category: "holding",
},
{
name: "Native Boost Points",
category: "nativeboost",
},
{
name: "Spot DEX Points",
category: "spotdex",
},
{
name: "Perp DEX Points",
category: "perpdex",
},
{
name: "Lending Points",
category: "lending",
},
// {
// name: "GameFi Points",
// category: "gamefi",
// },
{
name: "Others Points",
category: "other",
},
]
: [
{
name: "Assets Points",
category: "holding",
},
{
name: "Native Boost Points",
category: "nativeboost",
},
{
name: "Spot DEX Points",
category: "spotdex",
},
{
name: "Perp DEX Points",
category: "perpdex",
},
{
name: "Lending Points",
category: "lending",
},
{
name: "GameFi Points",
category: "gamefi",
},
{
name: "Others Points",
category: "other",
},
];

const arr = categorys.map((c) => {
const userCategoryData = novaCategoryUserPointsTotal.find(
Expand Down Expand Up @@ -633,9 +665,12 @@ export default function Dashboard() {
<div className="mt-[12px] before">
Epoch One (From May 30th to July 15th)
</div>
<div className="mt-[12px] before text-[#fff]">
<div className="mt-[12px] before">
Epoch Two (From July 16th to Aug 31st)
</div>
<div className="mt-[12px] before text-[#fff]">
Epoch Three (From Step 1)
</div>
</div>
</div>

Expand Down Expand Up @@ -765,6 +800,7 @@ export default function Dashboard() {
)}
{tabs2Active !== 0 && tabs2Active !== 99 && (
<EcoDApps
season={season}
tabActive={tabs2[tabs2Active]}
novaCategoryUserPoints={novaCategoryUserPoints}
tvlCategoryMilestone={tvlCategoryMilestone}
Expand Down
Loading

0 comments on commit de53cc8

Please sign in to comment.