change(OurSponsors) removed a lot to reformat into better code

This commit is contained in:
darkicewolf50 2024-03-16 21:52:16 -06:00
parent 7a83dfcf70
commit cc91df581a
2 changed files with 39 additions and 143 deletions

View File

@ -1,41 +1,41 @@
Diamond Tier: Diamond Tier:
- Name: Schulich School of Engineering - Schulich School of Engineering:
LogoUrl: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQj9L3ZGK6WtOmJbzxmCzRxwLXYKGC5SDcAKHb0ScfbUmbtG0IujQt6eQDaI_Pm9g4DZvc&usqp=CAU LogoUrl: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQj9L3ZGK6WtOmJbzxmCzRxwLXYKGC5SDcAKHb0ScfbUmbtG0IujQt6eQDaI_Pm9g4DZvc&usqp=CAU
Url: https://schulich.ucalgary.ca/ Url: https://schulich.ucalgary.ca/
DescriptionAboutSponsor: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eu magna in diam consectetur rhoncus vel nec turpis. Sed finibus mi eu sem varius faucibus. Donec semper erat et bibendum pharetra. Suspendisse cursus lorem sed nisi semper, a rutrum nunc luctus. Nunc ullamcorper enim id orci interdum ultrices. Donec vestibulum nunc vel nisl pretium tempus. Morbi quis ante et ligula eleifend eleifend. Proin bibendum maximus elit vitae congue. Vivamus egestas, ex in tempor posuere, ligula nunc iaculis massa, in imperdiet dui justo eu dolor. Nullam placerat velit quis sem mattis, laoreet pharetra elit tempor. DescriptionAboutSponsor: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eu magna in diam consectetur rhoncus vel nec turpis. Sed finibus mi eu sem varius faucibus. Donec semper erat et bibendum pharetra. Suspendisse cursus lorem sed nisi semper, a rutrum nunc luctus. Nunc ullamcorper enim id orci interdum ultrices. Donec vestibulum nunc vel nisl pretium tempus. Morbi quis ante et ligula eleifend eleifend. Proin bibendum maximus elit vitae congue. Vivamus egestas, ex in tempor posuere, ligula nunc iaculis massa, in imperdiet dui justo eu dolor. Nullam placerat velit quis sem mattis, laoreet pharetra elit tempor.
Platinum Tier: Platinum Tier:
- Name: Platinum Sponsor Name - Platinum Sponsor Name:
LogoUrl: LogoUrl:
Url: Url:
DescriptionAboutSponsor: DescriptionAboutSponsor:
Gold Tier: Gold Tier:
- Name: Suri - Suri:
LogoUrl: https://lh5.googleusercontent.com/WJsBsmcLypQhY0MMOLQtJSGFXrLQqPKNc3502rYUGKPCq_SfS9CxuoB3n541Kn9bKPm2b5aixCnYsCVYZAts2Y8xvmOHWL3nnbKtWUkE1KoFYYQ4bXUlikfF0NPIynxhzQ=w1280 LogoUrl: https://lh5.googleusercontent.com/WJsBsmcLypQhY0MMOLQtJSGFXrLQqPKNc3502rYUGKPCq_SfS9CxuoB3n541Kn9bKPm2b5aixCnYsCVYZAts2Y8xvmOHWL3nnbKtWUkE1KoFYYQ4bXUlikfF0NPIynxhzQ=w1280
Url: https://www.surimanufacturing.com/ Url: https://www.surimanufacturing.com/
DescriptionAboutSponsor: DescriptionAboutSponsor:
- Name: SKF - SKF:
LogoUrl: https://www.skf.com/v2/assets/img/skf-logo-white.svg LogoUrl: https://www.skf.com/v2/assets/img/skf-logo-white.svg
Url: https://www.skf.com/ca/en Url: https://www.skf.com/ca/en
DescriptionAboutSponsor: I am not sure DescriptionAboutSponsor: I am not sure
- Name: WRMA - WRMA:
LogoUrl: https://wildrosemx.com/wp-content/uploads/2021/08/wild-rose-motocross-calgary-rasterized.png LogoUrl: https://wildrosemx.com/wp-content/uploads/2021/08/wild-rose-motocross-calgary-rasterized.png
Url: https://wildrosemx.com/ Url: https://wildrosemx.com/
DescriptionAboutSponsor: DescriptionAboutSponsor:
Silver Tier: Silver Tier:
- Name: Encore Metals - Encore Metals:
LogoUrl: https://www.encoremetals.com/assets/images/logos/encore-metals-logo.png LogoUrl: https://www.encoremetals.com/assets/images/logos/encore-metals-logo.png
Url: https://www.encoremetals.com/ Url: https://www.encoremetals.com/
DescriptionAboutSponsor: Metal supplier DescriptionAboutSponsor: Metal supplier
- Name: CNOOC - CNOOC:
LogoUrl: https://cnoocinternational.com/img/cnooc-logo.png LogoUrl: https://cnoocinternational.com/img/cnooc-logo.png
Url: https://cnoocinternational.com/ Url: https://cnoocinternational.com/
DescriptionAboutSponsor: DescriptionAboutSponsor:
Bronze Tier: Bronze Tier:
- Name: Redbull - Redbull:
LogoUrl: "https://img.redbull.com/redbullcom/static/redbullcom-logo_double-with-text.svg" LogoUrl: "https://img.redbull.com/redbullcom/static/redbullcom-logo_double-with-text.svg"
Url: https://www.redbull.com/ca-en/ Url: https://www.redbull.com/ca-en/
DescriptionAboutSponsor: DescriptionAboutSponsor:
- Name: Canada Action - Canada Action:
LogoUrl: LogoUrl:
Url: I dont know Url: I dont know
DescriptionAboutSponsor: DescriptionAboutSponsor:

View File

@ -36,6 +36,7 @@ const OurSponsors = () => {
setCurrentSponsorsDict(yamlDict); setCurrentSponsorsDict(yamlDict);
} catch (error) { } catch (error) {
//error checking //error checking
console.log(error);
console.error("Error recieving data from server:"); console.error("Error recieving data from server:");
} }
}; };
@ -61,10 +62,12 @@ const OurSponsors = () => {
if (!currentSponsorsDict && !pastSponsorsDict) { if (!currentSponsorsDict && !pastSponsorsDict) {
//awaiting for a resposne from the backend //awaiting for a resposne from the backend
//add loading notification to user //add loading notification to user
console.log(currentSponsorsDict);
return <p>Loading...</p>; return <p>Loading...</p>;
} }
if (currentSponsorsDict && pastSponsorsDict) { if (currentSponsorsDict && pastSponsorsDict) {
//maps out the dictionary and displays the content //maps out the dictionary and displays the content
console.log(currentSponsorsDict);
return ( return (
<div id="OurSponsors"> <div id="OurSponsors">
<div id="BecomeASponsors"> <div id="BecomeASponsors">
@ -76,61 +79,6 @@ const OurSponsors = () => {
<div> <div>
<h3 className="SponsorsTitle">Current Sponsors</h3> <h3 className="SponsorsTitle">Current Sponsors</h3>
{/* gets the outmost name of the Object {"Name of tier": {...}} */} {/* gets the outmost name of the Object {"Name of tier": {...}} */}
{Object.keys(currentSponsorsDict).map((sponsorTier) => (
<div
key={sponsorTier}
className={sponsorTier}>
<h2>{sponsorTier}</h2>
{/* gets the keys from the new inner object used so that no two html tags are the "same" */}
{Object.keys(currentSponsorsDict[sponsorTier]).map(
(sponsorKey) => {
const sponsor = currentSponsorsDict[sponsorTier][sponsorKey];
return (
<div key={sponsorKey}>
<div>
<div>
{sponsor.Name && <h3>{sponsor.Name}</h3>}
{sponsor.LogoUrl && (
<a
href={sponsor.Url}
rel="noreferrer"
target="_blank">
<img
src={sponsor.LogoUrl}
alt={
sponsor.Name +
"'s logo, one of the companies that sponsors Schulich Off-Road"
}
/>
</a>
)}
</div>
{/* puts this in the sponsor's section only if they are silver and above */}
{sponsor.DescriptionAboutSponsor !== undefined &&
sponsor.DecriptionOnHelp !== undefined &&
(sponsorTier !== "Bronze Tier" ||
sponsorTier !== "Silver Tier") && (
<p>Another Element</p>
)}
</div>
{/* puts this in the sponsor's section only if they are silver and above */}
{sponsor.DescriptionAboutSponsor !== undefined &&
(sponsorTier !== "Bronze Tier" ||
sponsorTier !== "Silver Tier") && (
<p>{sponsor.DescriptionAboutSponsor}</p>
)}
{/* puts this in the sponsor's section only if they are silver and above */}
{sponsor.DecriptionOnHelp !== undefined &&
(sponsorTier !== "Bronze Tier" ||
sponsorTier !== "Silver Tier") && (
<p>{sponsor.DecriptionOnHelp}</p>
)}
</div>
);
}
)}
</div>
))}
</div> </div>
<div> <div>
<h3 <h3
@ -138,58 +86,6 @@ const OurSponsors = () => {
id="SponsorFlexEnd"> id="SponsorFlexEnd">
Past Sponsors Past Sponsors
</h3> </h3>
{/* gets the outmost name of the Object {"Name of tier": {...}} */}
{Object.keys(pastSponsorsDict).map((sponsorTier) => (
<div
key={sponsorTier}
className={sponsorTier}>
<h2>{sponsorTier}</h2>
{/* gets the keys from the new inner object used so that no two html tags are the "same" */}
{Object.keys(pastSponsorsDict[sponsorTier]).map((sponsorKey) => {
const sponsor = pastSponsorsDict[sponsorTier][sponsorKey];
return (
<div key={sponsorKey}>
<div>
<div>
{sponsor.Name && (
<h3
onClick={() => window.open(sponsor.Url, "_blank")}>
{sponsor.Name}
</h3>
)}
{sponsor.LogoUrl && sponsorTier !== "Bronze Tier" && (
<a
href={sponsor.Url}
rel="noreferrer"
target="_blank">
<img
src={sponsor.LogoUrl}
alt={
sponsor.Name +
"'s logo, one of the companies that sponsors Schulich Off-Road"
}
/>
</a>
)}
</div>
</div>
{/* puts this in the sponsor's section only if they are silver and above */}
{sponsor.DescriptionAboutSponsor !== undefined &&
(sponsorTier !== "Bronze Tier" ||
sponsorTier !== "Silver Tier") && (
<p>{sponsor.DescriptionAboutSponsor}</p>
)}
{/* puts this in the sponsor's section only if they are silver and above */}
{sponsor.DecriptionOnHelp !== undefined &&
(sponsorTier !== "Bronze Tier" ||
sponsorTier !== "Silver Tier") && (
<p>{sponsor.DecriptionOnHelp}</p>
)}
</div>
);
})}
</div>
))}
</div> </div>
</div> </div>
); );