Skip to content

Commit

Permalink
Merge pull request #242 from So-Fan/staging
Browse files Browse the repository at this point in the history
Utilities
  • Loading branch information
Sajistreo3 authored Oct 16, 2023
2 parents a46dbc7 + edb511f commit 3ff706c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 16 deletions.
2 changes: 1 addition & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ function App() {
/>
<Route path="*" element={<ErrorPage />} />
<Route
path="/collectionlive/:id/:collectionAddress"
path="/collectionlive/:id/:collectionAddressurl"
element={
<LaunchpadCollectionLive isLogged={loggedInUser} />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import React from "react";
import UtilitiesComponent from "../UtilitiesComponent/UtilitiesComponent";
import "./LaunchpadCollectionLiveUtilities.css";
import { v4 as uuidv4 } from "uuid";
function LaunchpadCollectionLiveUtilities({
utilitiesArray
}) {


function LaunchpadCollectionLiveUtilities({ utilitiesArray }) {
return (
<section className="launchpad-collection-live-utilities-container">
<div className="launchpad-collection-live-utilities-title">Utilité</div>
{utilitiesArray.map((element) => (
{utilitiesArray && utilitiesArray.length > 0 ? (
utilitiesArray.map((utility) => (
<UtilitiesComponent
key={uuidv4()}
utilitiesTitle={element.title}
utilitiesStatus={element.status}
utilitiesDescription={element.description}
utilitiesDate={element.date}
utilitiesTitle={utility?.title}
utilitiesStatus={utility?.claimed_status}
utilitiesDescription={utility?.description}
utilitiesDate={utility?.date ? new Date(utility.date.seconds * 1000).toDateString() : 'N/A'}
launchpadCollectionLiveUtilities={true}
/>
))}
))
) : (
<p>Pas d'Utilité disponibles pour le moment.</p>
)}
</section>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import {
limit,
getDocs,
getDoc,
doc,
} from "firebase/firestore";
import { db } from "../../Configs/firebase";
import { useParams } from "react-router-dom";

import LaunchpadCollectionLiveHeader from "../../Components/LaunchpadCollectionLiveHeader/LaunchpadCollectionLiveHeader";
import LaunchpadCollectionLiveUtilities from "../../Components/LaunchpadCollectionLiveUtilities/LaunchpadCollectionLiveUtilities";
import MoreAboutThisCollection from "../../Components/MoreAboutThisCollection/MoreAboutThisCollection";
Expand Down Expand Up @@ -48,6 +51,7 @@ function LaunchpadCollectionLive(isLogged) {
const [nftLimitByWalletInfo, setNftLimitByWalletInfo] = useState();
const [totalPriceInUSDC, setTotalPriceInUSDC] = useState();
const [mintCounter, setMintCounter] = useState(1);
const [utilities, setUtilities] = useState([]);

const [athleteFanNumber, setAthleteFanNumber] = useState();
const { alchemy } = useToggleNetwork();
Expand Down Expand Up @@ -208,6 +212,37 @@ function LaunchpadCollectionLive(isLogged) {
getPrice();
}
}, [alchemy]);

// ----------------------- Shajeed -------------------------

const { collectionAddressurl } = useParams();

useEffect(() => {
const q = query(
collection(db, "nft_collections"),
where("collection_address", "==", collectionAddress)
);

getDocs(q).then((querySnapshot) => {
const docData = querySnapshot.docs[0];
if (docData) {
const docId = docData.id;
const unsub = onSnapshot(
collection(db, "nft_collections", docId, "utilities"),
(snapshot) => {
const utilitiesData = snapshot.docs.map((doc) => doc.data());
setUtilities(utilitiesData);
}
);

return () => {
unsub();
};
}
});
}, [collectionAddress]);

// ---------------------------------------------------------
const dataBackend = {
header: [
{
Expand All @@ -229,7 +264,7 @@ function LaunchpadCollectionLive(isLogged) {
date: "July 9th 2023",
},
{
title: "3 online VIP live ",
title: "3 online VIP live",
status: "Disponible",
description:
"Have access with all other members to 3 live important events during the entire competition, at three key times.",
Expand Down Expand Up @@ -543,9 +578,7 @@ function LaunchpadCollectionLive(isLogged) {
/>
<div className="launchpad-collection-live-page-left-container">
{crossmintPayLoadLocalStorage ? "sqhdddddddddddsqdhhhhhhhhh" : ""}
<LaunchpadCollectionLiveUtilities
utilitiesArray={dataBackend.utilities}
/>
<LaunchpadCollectionLiveUtilities utilitiesArray={utilities} />
<div className="launchpad-collection-live-page-more-about-collection-container">
<LaunchpadCollectionLiveMoreAboutCollection
knowMoreAboutCollection={
Expand Down

0 comments on commit 3ff706c

Please sign in to comment.