-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Ashtar-Global-Solutions-Dev/Hammad_Dev
Hammad dev
- Loading branch information
Showing
15 changed files
with
743 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Spinner } from "@nextui-org/react"; | ||
import { useWallet } from "@solana/wallet-adapter-react"; | ||
import React, { useEffect, useState } from "react"; | ||
|
||
import NftCard from "@/components/common/nft-card"; | ||
import { API_URL } from "@/config/config"; | ||
import Utils from "@/lib/utils"; | ||
|
||
const BarTab = () => { | ||
const { publicKey } = useWallet(); | ||
const [inventoryData, setInventoryData] = useState([]); | ||
const [loading, setLoading] = useState(false); | ||
|
||
const { fetchInventoryData } = Utils(); | ||
|
||
// const FetchInventory = useCallback(async () => { | ||
// setLoading(true); | ||
// await axios | ||
// .get(`${API_URL}resources/inventory/${publicKey}`) | ||
// .then((result) => { | ||
// setInventoryData(result?.data?.result); | ||
// setLoading(false); | ||
// }) | ||
// .catch((err) => { | ||
// setLoading(false); | ||
// toast.error(err.data?.message || "Something went wrong"); | ||
// }); | ||
// }, [publicKey]); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
const res = await fetchInventoryData("bar", setLoading); | ||
setInventoryData(res); | ||
}; | ||
|
||
fetchData(); | ||
}, []); | ||
|
||
return ( | ||
<div className="grid grid-cols-2 xl:grid-cols-3 gap-8 p-3"> | ||
{loading ? ( | ||
<Spinner color="white" /> | ||
) : ( | ||
inventoryData.map((item, index) => ( | ||
<NftCard | ||
key={index} | ||
name={item.metadata.name} | ||
picture={item.metadata.uri} | ||
width={90} | ||
imageWidth={70} | ||
imageHeight={70} | ||
nftNameStyle="text-[13px]" | ||
btnStyle="bg-opacity-70 text-xs h-6" | ||
btnDisabled | ||
amount={item?.balance} | ||
/> | ||
)) | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default BarTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import axios from "axios"; | ||
import { toast } from "react-toastify"; | ||
import { Spinner } from "@nextui-org/react"; | ||
import { useWallet } from "@solana/wallet-adapter-react"; | ||
import React, { useCallback, useEffect, useState } from "react"; | ||
|
||
import NftCard from "@/components/common/nft-card"; | ||
|
||
import Utils from "@/lib/utils"; | ||
|
||
const OresTab = () => { | ||
const { publicKey } = useWallet(); | ||
const [inventoryData, setInventoryData] = useState([]); | ||
const [loading, setLoading] = useState(false); | ||
|
||
const { fetchInventoryData } = Utils(); | ||
|
||
// const FetchInventory = useCallback(async () => { | ||
// setLoading(true); | ||
// await axios | ||
// .get(`${API_URL}resources/inventory/${publicKey}`) | ||
// .then((result) => { | ||
// setInventoryData(result?.data?.result); | ||
// setLoading(false); | ||
// }) | ||
// .catch((err) => { | ||
// setLoading(false); | ||
// toast.error(err.data?.message || "Something went wrong"); | ||
// }); | ||
// }, [publicKey]); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
const res = await fetchInventoryData("bar", setLoading); | ||
setInventoryData(res); | ||
}; | ||
|
||
fetchData(); | ||
}, []); | ||
|
||
return ( | ||
<div className="grid grid-cols-2 xl:grid-cols-3 gap-8 p-3"> | ||
{loading ? ( | ||
<Spinner color="white" /> | ||
) : ( | ||
inventoryData.map((item, index) => ( | ||
<NftCard | ||
key={index} | ||
name={item.metadata.name} | ||
picture={item.metadata.uri} | ||
width={90} | ||
imageWidth={70} | ||
imageHeight={70} | ||
nftNameStyle="text-[13px]" | ||
btnStyle="bg-opacity-70 text-xs h-6" | ||
btnDisabled | ||
amount={item?.balance} | ||
/> | ||
)) | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default OresTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,71 @@ | ||
import React from "react"; | ||
import axios from "axios"; | ||
import { toast } from "react-toastify"; | ||
import { Spinner } from "@nextui-org/react"; | ||
import { useWallet } from "@solana/wallet-adapter-react"; | ||
import React, { useEffect, useState } from "react"; | ||
|
||
import CraftData from "@/data/craft-adamantite-data.json"; | ||
import NftCard from "@/components/common/nft-card"; | ||
import Utils from "@/lib/utils"; | ||
|
||
//import filterResourcesByMetadataSymbols | ||
|
||
const BronzeTab = () => { | ||
const { publicKey } = useWallet(); | ||
const { createRecipe, fetchCraftData } = Utils(); | ||
const [craftData, setCraftData] = useState([]); | ||
const [dataLoading, setDataLoading] = useState(false); | ||
const [loading, setLoading] = useState({ | ||
name: "", | ||
status: false, | ||
}); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
const res = await fetchCraftData("adamantite", setDataLoading); | ||
setCraftData(res); | ||
}; | ||
|
||
fetchData(); | ||
}, []); | ||
|
||
const AdamantiteTab = () => { | ||
return ( | ||
<div className="grid grid-cols-3 gap-x-24 gap-y-8"> | ||
{CraftData.map((craftment, index) => ( | ||
<NftCard | ||
divStyle="bg-black shadow-black shadow-xl rounded-xl p-2" | ||
key={index} | ||
name={craftment.name} | ||
picture={craftment.picture} | ||
buttonText="Craft" | ||
width={165} | ||
imageWidth={155} | ||
imageHeight={140} | ||
nftNameStyle="text-[15px] pr-1" | ||
btnStyle="bg-gradient-to-b from-[#8E8B77] to-[#30302E] text-xs h-6 w-24 h-6 font-bold drop-shadow-lg" | ||
creationFrom="cube" | ||
materials={craftment.materials} | ||
experience={craftment.experience} | ||
/> | ||
))} | ||
{dataLoading ? ( | ||
<Spinner color="white" /> | ||
) : ( | ||
craftData?.map((craftment, index) => ( | ||
<> | ||
<NftCard | ||
divStyle="bg-black shadow-black shadow-xl rounded-xl p-2" | ||
key={index} | ||
name={craftment?.metadata?.name} | ||
picture={craftment?.metadata?.uri} | ||
buttonText="Craft" | ||
width={165} | ||
imageWidth={155} | ||
imageHeight={140} | ||
nftNameStyle="text-[15px]" | ||
btnStyle="bg-gradient-to-b from-[#8E8B77] to-[#30302E] text-xs h-6 w-24 h-6 font-bold drop-shadow-lg" | ||
materials={craftment?.material} | ||
experience={45} | ||
btnClick={async () => { | ||
// await createRecipe( | ||
// craftment?.addresses?.recipe, | ||
// craftment?.metadata?.name, | ||
// setLoading | ||
// ); | ||
fetchCraftData("bronze", setDataLoading, true); | ||
}} | ||
loading={loading} | ||
btnDisabled={ | ||
loading.status && loading.name === craftment?.metadata?.name | ||
} | ||
/> | ||
</> | ||
)) | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default AdamantiteTab; | ||
export default BronzeTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.