From cc91df581a681661207512b6982022d9497737cd Mon Sep 17 00:00:00 2001 From: darkicewolf50 Date: Sat, 16 Mar 2024 21:52:16 -0600 Subject: [PATCH] change(OurSponsors) removed a lot to reformat into better code --- src/MockDB/sponsorship.yml | 72 ++++++++++----------- src/OurSponsors/OurSponsors.js | 110 +-------------------------------- 2 files changed, 39 insertions(+), 143 deletions(-) diff --git a/src/MockDB/sponsorship.yml b/src/MockDB/sponsorship.yml index 51837f9..63bcbff 100644 --- a/src/MockDB/sponsorship.yml +++ b/src/MockDB/sponsorship.yml @@ -1,41 +1,41 @@ Diamond Tier: - - Name: Schulich School of Engineering - LogoUrl: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQj9L3ZGK6WtOmJbzxmCzRxwLXYKGC5SDcAKHb0ScfbUmbtG0IujQt6eQDaI_Pm9g4DZvc&usqp=CAU - 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. + - Schulich School of Engineering: + LogoUrl: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQj9L3ZGK6WtOmJbzxmCzRxwLXYKGC5SDcAKHb0ScfbUmbtG0IujQt6eQDaI_Pm9g4DZvc&usqp=CAU + 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. Platinum Tier: - - Name: Platinum Sponsor Name - LogoUrl: - Url: - DescriptionAboutSponsor: + - Platinum Sponsor Name: + LogoUrl: + Url: + DescriptionAboutSponsor: Gold Tier: - - Name: Suri - LogoUrl: https://lh5.googleusercontent.com/WJsBsmcLypQhY0MMOLQtJSGFXrLQqPKNc3502rYUGKPCq_SfS9CxuoB3n541Kn9bKPm2b5aixCnYsCVYZAts2Y8xvmOHWL3nnbKtWUkE1KoFYYQ4bXUlikfF0NPIynxhzQ=w1280 - Url: https://www.surimanufacturing.com/ - DescriptionAboutSponsor: - - Name: SKF - LogoUrl: https://www.skf.com/v2/assets/img/skf-logo-white.svg - Url: https://www.skf.com/ca/en - DescriptionAboutSponsor: I am not sure - - Name: WRMA - LogoUrl: https://wildrosemx.com/wp-content/uploads/2021/08/wild-rose-motocross-calgary-rasterized.png - Url: https://wildrosemx.com/ - DescriptionAboutSponsor: + - Suri: + LogoUrl: https://lh5.googleusercontent.com/WJsBsmcLypQhY0MMOLQtJSGFXrLQqPKNc3502rYUGKPCq_SfS9CxuoB3n541Kn9bKPm2b5aixCnYsCVYZAts2Y8xvmOHWL3nnbKtWUkE1KoFYYQ4bXUlikfF0NPIynxhzQ=w1280 + Url: https://www.surimanufacturing.com/ + DescriptionAboutSponsor: + - SKF: + LogoUrl: https://www.skf.com/v2/assets/img/skf-logo-white.svg + Url: https://www.skf.com/ca/en + DescriptionAboutSponsor: I am not sure + - WRMA: + LogoUrl: https://wildrosemx.com/wp-content/uploads/2021/08/wild-rose-motocross-calgary-rasterized.png + Url: https://wildrosemx.com/ + DescriptionAboutSponsor: Silver Tier: - - Name: Encore Metals - LogoUrl: https://www.encoremetals.com/assets/images/logos/encore-metals-logo.png - Url: https://www.encoremetals.com/ - DescriptionAboutSponsor: Metal supplier - - Name: CNOOC - LogoUrl: https://cnoocinternational.com/img/cnooc-logo.png - Url: https://cnoocinternational.com/ - DescriptionAboutSponsor: + - Encore Metals: + LogoUrl: https://www.encoremetals.com/assets/images/logos/encore-metals-logo.png + Url: https://www.encoremetals.com/ + DescriptionAboutSponsor: Metal supplier + - CNOOC: + LogoUrl: https://cnoocinternational.com/img/cnooc-logo.png + Url: https://cnoocinternational.com/ + DescriptionAboutSponsor: Bronze Tier: - - Name: Redbull - LogoUrl: "https://img.redbull.com/redbullcom/static/redbullcom-logo_double-with-text.svg" - Url: https://www.redbull.com/ca-en/ - DescriptionAboutSponsor: - - Name: Canada Action - LogoUrl: - Url: I dont know - DescriptionAboutSponsor: + - Redbull: + LogoUrl: "https://img.redbull.com/redbullcom/static/redbullcom-logo_double-with-text.svg" + Url: https://www.redbull.com/ca-en/ + DescriptionAboutSponsor: + - Canada Action: + LogoUrl: + Url: I dont know + DescriptionAboutSponsor: diff --git a/src/OurSponsors/OurSponsors.js b/src/OurSponsors/OurSponsors.js index 8c7519c..54eee29 100644 --- a/src/OurSponsors/OurSponsors.js +++ b/src/OurSponsors/OurSponsors.js @@ -36,6 +36,7 @@ const OurSponsors = () => { setCurrentSponsorsDict(yamlDict); } catch (error) { //error checking + console.log(error); console.error("Error recieving data from server:"); } }; @@ -61,10 +62,12 @@ const OurSponsors = () => { if (!currentSponsorsDict && !pastSponsorsDict) { //awaiting for a resposne from the backend //add loading notification to user + console.log(currentSponsorsDict); return

Loading...

; } if (currentSponsorsDict && pastSponsorsDict) { //maps out the dictionary and displays the content + console.log(currentSponsorsDict); return (
@@ -76,61 +79,6 @@ const OurSponsors = () => {

Current Sponsors

{/* gets the outmost name of the Object {"Name of tier": {...}} */} - {Object.keys(currentSponsorsDict).map((sponsorTier) => ( -
-

{sponsorTier}

- {/* 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 ( -
-
-
- {sponsor.Name &&

{sponsor.Name}

} - {sponsor.LogoUrl && ( - - { - - )} -
- {/* 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") && ( -

Another Element

- )} -
- {/* puts this in the sponsor's section only if they are silver and above */} - {sponsor.DescriptionAboutSponsor !== undefined && - (sponsorTier !== "Bronze Tier" || - sponsorTier !== "Silver Tier") && ( -

{sponsor.DescriptionAboutSponsor}

- )} - {/* puts this in the sponsor's section only if they are silver and above */} - {sponsor.DecriptionOnHelp !== undefined && - (sponsorTier !== "Bronze Tier" || - sponsorTier !== "Silver Tier") && ( -

{sponsor.DecriptionOnHelp}

- )} -
- ); - } - )} -
- ))}

{ id="SponsorFlexEnd"> Past Sponsors

- {/* gets the outmost name of the Object {"Name of tier": {...}} */} - {Object.keys(pastSponsorsDict).map((sponsorTier) => ( -
-

{sponsorTier}

- {/* 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 ( -
-
-
- {sponsor.Name && ( -

window.open(sponsor.Url, "_blank")}> - {sponsor.Name} -

- )} - {sponsor.LogoUrl && sponsorTier !== "Bronze Tier" && ( - - { - - )} -
-
- {/* puts this in the sponsor's section only if they are silver and above */} - {sponsor.DescriptionAboutSponsor !== undefined && - (sponsorTier !== "Bronze Tier" || - sponsorTier !== "Silver Tier") && ( -

{sponsor.DescriptionAboutSponsor}

- )} - {/* puts this in the sponsor's section only if they are silver and above */} - {sponsor.DecriptionOnHelp !== undefined && - (sponsorTier !== "Bronze Tier" || - sponsorTier !== "Silver Tier") && ( -

{sponsor.DecriptionOnHelp}

- )} -
- ); - })} -
- ))}
);