Skip to content

Commit

Permalink
update epoch3
Browse files Browse the repository at this point in the history
  • Loading branch information
zkLeonardo committed Aug 31, 2024
1 parent 9c950fc commit adb6f65
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 60 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
7 changes: 5 additions & 2 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
95 changes: 64 additions & 31 deletions src/pages/DashboardS2/index2.tsx
Original file line number Diff line number Diff line change
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 @@ -768,6 +800,7 @@ export default function Dashboard() {
)}
{tabs2Active !== 0 && tabs2Active !== 99 && (
<EcoDApps
season={season}
tabActive={tabs2[tabs2Active]}
novaCategoryUserPoints={novaCategoryUserPoints}
tvlCategoryMilestone={tvlCategoryMilestone}
Expand Down
94 changes: 71 additions & 23 deletions src/pages/Leaderboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -466,35 +466,83 @@ const ColLine = styled.div`
`;

export default function Leaderboard() {
const tabs = [
{ name: "Holding", category: "holding", iconURL: "/img/icon-sector-1.svg" },
{
name: "Boosted",
category: "nativeboost",
iconURL: "/img/icon-sector-2.svg",
},
{
name: "Spot DEX",
category: "spotdex",
iconURL: "/img/icon-sector-3.svg",
},
{
name: "Perp DEX",
category: "perpdex",
iconURL: "/img/icon-sector-4.svg",
},
{ name: "Lending", category: "lending", iconURL: "/img/icon-sector-5.svg" },
// { name: "GameFi", category: "gamefi" },
{ name: "Other", category: "other", iconURL: "/img/icon-sector-7.svg" },
];

const { address } = useAccount();
const { invite } = useSelector((store: RootState) => store.airdrop);
const [tabActive, setTabActive] = useState(0);
const [epochActive, setEpochActive] = useState(1);
const [epochActive, setEpochActive] = useState(2);
const [selfData, setSelfData] = useState<ListItem | null>(null);
const [categoryList, setCategoryList] = useState<ListItem[]>([]);

const tabs = useMemo(() => {
return epochActive === 2
? [
{
name: "Holding",
category: "holding",
iconURL: "/img/icon-sector-1.svg",
},
{
name: "Boosted",
category: "nativeboost",
iconURL: "/img/icon-sector-2.svg",
},
{
name: "Spot DEX",
category: "spotdex",
iconURL: "/img/icon-sector-3.svg",
},
{
name: "Perp DEX",
category: "perpdex",
iconURL: "/img/icon-sector-4.svg",
},
{
name: "Lending",
category: "lending",
iconURL: "/img/icon-sector-5.svg",
},
// { name: "GameFi", category: "gamefi" },
{
name: "Other",
category: "other",
iconURL: "/img/icon-sector-7.svg",
},
]
: [
{
name: "Holding",
category: "holding",
iconURL: "/img/icon-sector-1.svg",
},
{
name: "Boosted",
category: "nativeboost",
iconURL: "/img/icon-sector-2.svg",
},
{
name: "Spot DEX",
category: "spotdex",
iconURL: "/img/icon-sector-3.svg",
},
{
name: "Perp DEX",
category: "perpdex",
iconURL: "/img/icon-sector-4.svg",
},
{
name: "Lending",
category: "lending",
iconURL: "/img/icon-sector-5.svg",
},
{ name: "GameFi", category: "gamefi" },
{
name: "Other",
category: "other",
iconURL: "/img/icon-sector-7.svg",
},
];
}, [epochActive]);

const getCategoryListFunc = async (category: string) => {
try {
const { data } = await getCategoryList(category, {
Expand Down

0 comments on commit adb6f65

Please sign in to comment.