Skip to content

Commit

Permalink
fix: progress bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Wulabalabo committed Jan 3, 2024
1 parent c203925 commit 5a1179d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
47 changes: 27 additions & 20 deletions app/ticks/[name]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
"use client"
"use client";

import { useEffect, useState } from "react"
import { TransactionBlock } from "@mysten/sui.js/transactions"
import { ReloadIcon } from "@radix-ui/react-icons"
import * as Progress from "@radix-ui/react-progress"
import { useWallet } from "@suiet/wallet-kit"
import NP from "number-precision"
import { useEffect, useState } from "react";
import { TransactionBlock } from "@mysten/sui.js/transactions";
import { ReloadIcon } from "@radix-ui/react-icons";
import * as Progress from "@radix-ui/react-progress";
import { useWallet } from "@suiet/wallet-kit";
import NP from "number-precision";
// @ts-ignore
import thousandify from "thousandify"
import thousandify from "thousandify";

import { DEPLOY_RECORD, PACKAGE_ID } from "@/config/site"
import { getOwnedObjects, getSuiDynamicFields, getSuiObject } from "@/lib/apis"
import { Button } from "@/components/ui/button"
import TickStats from "@/components/tick-stats"
import UserStats from "@/components/user-stats"

import "../../progress.css"

import { DEPLOY_RECORD, PACKAGE_ID } from "@/config/site";
import { getOwnedObjects, getSuiDynamicFields, getSuiObject } from "@/lib/apis";
import { Button } from "@/components/ui/button";
import TickStats from "@/components/tick-stats";
import UserStats from "@/components/user-stats";



import "../../progress.css";


export const runtime = "edge"

Expand Down Expand Up @@ -64,9 +69,10 @@ export default function Home({ params }: { params: { name: string } }) {
tickData[1]["value"] = `${
parseInt(data.current_epoch) + 1
}/${parseInt(data.epoch_count)}`
setProgress(
(Number(data.current_epoch) / Number(data.epoch_count)) * 100
)
let progress =
(Number(data.current_epoch) / Number(data.epoch_count)) * 100>100?100:(Number(data.current_epoch) / Number(data.epoch_count)) * 100

setProgress(progress)
tickData[2]["value"] = `${data.total_transactions ?? 0}`
setMintFee(parseInt(data.mint_fee) / 1000000000)
// @ts-ignore
Expand Down Expand Up @@ -189,16 +195,17 @@ export default function Home({ params }: { params: { name: string } }) {
// @ts-ignore
const data =
res.data && res.data && res.data?.content
? res.data?.content.fields
? res.data?.content?.fields
: null
if (data) {
console.log(data)
tickData[0]["value"] = `${
(parseInt(data.total_transactions ?? 0) *
parseInt(data.mint_fee)) /
1000000000
}`
tickData[1]["value"] = `${
parseInt(data.current_epoch) + 1
21600
}/${parseInt(data.epoch_count)}`
tickData[2]["value"] = `${data.total_transactions ?? 0}`
// @ts-ignore
Expand Down Expand Up @@ -286,4 +293,4 @@ export default function Home({ params }: { params: { name: string } }) {
</div>
</section>
)
}
}
2 changes: 1 addition & 1 deletion components/tick-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function TickTable(props: TickTableProps) {
{tick.tick}
</div>
{tick.tick.toLowerCase() == 'move' && <div className="flex flex-col justify-center">
<svg data-testid="icon-verified" viewBox="0 0 22 22" class="aspect-1 w-6">
<svg data-testid="icon-verified" viewBox="0 0 22 22" className="aspect-1 w-6">
<linearGradient id="a" x1="4.411" x2="18.083" y1="2.495" y2="21.508"
gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#f4e72a"></stop>
Expand Down

0 comments on commit 5a1179d

Please sign in to comment.