Skip to content

Commit

Permalink
Added level from polybase
Browse files Browse the repository at this point in the history
  • Loading branch information
AkhileshManda committed Mar 26, 2023
1 parent 5517152 commit a7a5343
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions ui/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ interface IProp {

const CustomLayout = ({ children }: IProp) => {
const { authState, signIn, signOut, db } = useContext(AuthContext);
const [currLevel, setCurrLevel] = React.useState(undefined);
const [loading, setLoading] = React.useState(false);

const router = useRouter();
const {
token: { colorBgContainer },
Expand Down Expand Up @@ -133,16 +136,26 @@ const CustomLayout = ({ children }: IProp) => {
console.log("done");
};

const getNFTFromID = async (id: string) => {
const { data, block } = await db!
.collection("DTenderDynamicNFTMetadata")
.record(id)
.get();
console.log("DATA: ", data);
};
useEffect(() => {
const getNFTFromID = async () => {
setLoading(true);
const { data, block } = await db!
.collection("DTenderDynamicNFTMetadata")
// .record(localStorage.getItem("walletAddress") as string)
.record("1")
.get();

// return data?.level;
console.log("Data: ", data);
setCurrLevel(data.level);
setLoading(false);
};

getNFTFromID();
}, []);

getNFTFromID("1");
return (
console.log(currLevel);
return !loading ? (
<Layout style={{ height: "100vh", overflowY: "clip" }}>
<Header className="header" style={{ padding: "35px 20px" }}>
<div
Expand Down Expand Up @@ -185,7 +198,7 @@ const CustomLayout = ({ children }: IProp) => {
<p
style={{ color: "white", fontWeight: "600", fontSize: "20px" }}
>
0
{currLevel! + 1}
</p>
</div>
</div>
Expand Down Expand Up @@ -221,6 +234,8 @@ const CustomLayout = ({ children }: IProp) => {
</Layout>
</Layout>
</Layout>
) : (
<p style={{ color: "white" }}>LOADING.....</p>
);
};

Expand Down

1 comment on commit a7a5343

@vercel
Copy link

@vercel vercel bot commented on a7a5343 Mar 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

d-tender – ./

d-tender-git-main-kitai.vercel.app
d-tender.vercel.app
d-tender-kitai.vercel.app

Please sign in to comment.