chnged from dictionary to external yml file

This commit is contained in:
darkicewolf50 2024-03-09 18:15:50 -07:00
parent 6bdcdd57ca
commit 01c7a9d3da
5 changed files with 22220 additions and 22152 deletions

43931
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +1,45 @@
{
"name": "bajauofcwebsite",
"version": "0.1.0",
"private": true,
"dependencies": {
"@svgr/webpack": "^8.1.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "^0.72.6",
"react-router-dom": "^6.20.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
"name": "bajauofcwebsite",
"version": "0.1.0",
"private": true,
"dependencies": {
"@svgr/webpack": "^8.1.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"js-yaml": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "^0.72.6",
"react-router-dom": "^6.20.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"yaml-loader": "^0.8.1"
}
}

View File

@ -0,0 +1,50 @@
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.
DecriptionOnHelp: Money
Platinum Tier:
- Name: Platinum Sponsor Name
LogoUrl:
Url:
DescriptionAboutSponsor:
DescriptionOnHelp: Money
Gold Tier:
- Name: Suri
LogoUrl: https://lh5.googleusercontent.com/WJsBsmcLypQhY0MMOLQtJSGFXrLQqPKNc3502rYUGKPCq_SfS9CxuoB3n541Kn9bKPm2b5aixCnYsCVYZAts2Y8xvmOHWL3nnbKtWUkE1KoFYYQ4bXUlikfF0NPIynxhzQ=w1280
Url: https://www.surimanufacturing.com/
DescriptionAboutSponsor:
DescriptionOnHelp: I am not sure of the time of writing this
- 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
DescriptionOnHelp: I am not sure of the time of writing this
- Name: WRMA
LogoUrl: https://wildrosemx.com/wp-content/uploads/2021/08/wild-rose-motocross-calgary-rasterized.png
Url: https://wildrosemx.com/
DescriptionAboutSponsor:
DescriptionOnHelp: Lets us use their trak during the warm months
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
DescriptionOnHelp: Where we buy metals from at a discounted rate
- Name: CNOOC
LogoUrl: https://cnoocinternational.com/img/cnooc-logo.png
Url: https://cnoocinternational.com/
DescriptionAboutSponsor:
DescriptionOnHelp: Money
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:
DescriptionOnHelp: Free Energy Drinks
- Name: Canada Action
LogoUrl:
Url: I dont know
DescriptionAboutSponsor:
DescriptionOnHelp: Money

View File

@ -1,51 +1,50 @@
#OurSponsors {
display: flex;
flex-direction: column;
justify-content: center;
background-color: gray;
padding-left: 10%;
padding-right: 10%;
display: flex;
flex-direction: column;
justify-content: center;
background-color: gray;
padding-left: 10%;
padding-right: 10%;
}
#OurSponsors div div {
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
}
#OurSponsors div div div div img {
display: flex;
justify-content: left;
#OurSponsors div div div div div img {
display: flex;
justify-content: left;
}
#OurSponsors div div p {
display: flex;
justify-content: left;
#OurSponsors div div div p {
display: flex;
justify-content: left;
}
#OurSponsors div div div div div {
padding: 0%;
display: flex;
flex-direction: column;
justify-content: left;
}
#OurSponsors div div div div {
padding: 0%;
display: flex;
flex-direction: column;
justify-content: left;
}
#OurSponsors div div div {
display: flex;
flex-direction: row;
justify-content: end;
padding: 0%;
width: 100%;
display: flex;
flex-direction: row;
justify-content: end;
padding: 0%;
width: 100%;
}
#OurSponsors h2 {
background-color: aquamarine;
text-align: center;
margin: 0px;
background-color: aquamarine;
text-align: center;
margin: 0px;
}
#OurSponsors h3 {
text-align: left;
text-align: left;
}

View File

@ -1,9 +1,11 @@
import { useEffect } from 'react';
import { useState } from 'react';
import './OurSponsors.css'
import { useEffect } from "react";
import { useState } from "react";
import "./OurSponsors.css";
import sponsorData from "../MockDB/sponsorship.yml";
//can be removed later
import fakeDelay from '../TestingTools/fakeDelay';
import { useNavigate } from 'react-router-dom';
import fakeDelay from "../TestingTools/fakeDelay";
import { useNavigate } from "react-router-dom";
import yaml from "js-yaml";
/**
* @param {null} null - requires onthing
@ -13,145 +15,105 @@ import { useNavigate } from 'react-router-dom';
* @todo add link to become a sponsor at top, and thank you message
*/
const OurSponsors = () => {
const [sponsorsDict, setSponsorsDict] = useState(); //variable states for the dictionary of sponsors
const [sponsorsDict, setSponsorsDict] = useState(); //variable states for the dictionary of sponsors
useEffect(() => {
//get sponsors on startup of page not optimized
getSponsors();
}, []);
useEffect(() => { //get sponsors on startup of page not optimized
getSponsors();
}, []);
const OpenPage = (arg) => {
const navigate = useNavigate();
navigate(arg);
console.log(arg);
};
const OpenPage = (arg) => {
const navigate = useNavigate();
navigate(arg);
console.log(arg);
};
/**
* @param {null} null - requires nothing (link)
* @returns {Object} sponsorsDict - gets a Dictionary of our sponsors from synology drive
* @description Gets the list of sponsors from the synology drive (not implemented), converts the json file into a dictionary
* @author Brock <darkicewolf50@gmail.com>
* @todo add gPRC to backend and front end
*/
const getSponsors = async () => {
const tempListOfSponsors = {
"Main Tier": {
1:{
"Name":"Hello",
"LogoUrl":"",
"Url":"",
"DescriptionAboutSponsor":"this has text i dont care",
"DecriptionOnHelp":"this has text i dont care"
}
},
"Platnum Tier": {
1:{
"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. ",
"DecriptionOnHelp":"this has text i dont care"
},
2:{
"Name":"",
"LogoUrl":"",
"Url":"",
"DescriptionAboutSponsor":"this has text i dont care",
"DecriptionOnHelp":"this has text i dont care"
}
},
"Gold Tier":{
1:{
"Name":"",
"LogoUrl":"",
"Url":"",
"DescriptionAboutSponsor":"this has text i dont care",
"DecriptionOnHelp":"this has text i dont care"
},
2:{
"Name":"",
"LogoUrl":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAgVBMVEX///8BAAIAAABgYGG6urv8/Pzx8fHr6+v5+fnn5+ewsLDR0dFMTEzk5OTa2tqoqKjJycmSkpKenp7X19eJiYl6enopKSmkpKS/v7+Dg4NfX19ERETLy8twcHC0tLRWVlYaGhqWlpYkJCQ7OzsSEhMxMTFpaWlHR0c2NjcNDQ4YGBk5BvXSAAAItElEQVR4nO2daX/yIAzAJ9a2875Xz25ee7bv/wEfa9WZAJW2MMJ+/F/uoIlQEnLgy4vH4/F4PB6Px+PxeDwej8fj8Xg8Ho/H46FK+NofDpMgGa77vci2MJrpBaPNPwaZn6bBpGVbMh10Rp93rRo37j/pjtZOaxlum1AzTK7lILQtaEWCbrF6D0qmgW1hy/M6VdDuUctFz7bIpegs1dW7K5l2bIutTKdbVr+rjt2JbdGVeE0rqHdTckl/rcbTKvP3MI8z4tYjqaPfVcfEthIFxM2a+uU6nshOY6fuBN6ncW1bFTGjJ/oBt/TJX45sKyOgVbCF3r3tVdpcpml333ii59k4klup0U4mbu6WjZJJ+CN0K+4no2WRkmxHzFmdSES9eNZvfcl/9QapVEnGZP9lhaFYzLP0+ycHh3grc4AYI+TFBUIZVd3paCTWkbGhcckVSUQCnqX+iFVH2O7EQxBRUbREM/1KDTIQzSORhSraZM7uZemtcC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jMRX/PWDOh15YQBifZpQrzgmUXiv8l+/7Q8TokomYrnrRnR/nFGEUKCu4sfVCSfe3TpmWW6eoovsb4Lun+yUTIVLxpSQKZhJc+n6drIMIerEuo3Yihfo8+NZjydc0bN1U8+yfKdq1duNZpwsr5mJHQVaBMeQdT+KW1ZGHsUD4XEW+c0fFsqau1afWaLuh4lvFQvfYgmhXbV+tk4i3rRejjwZ6qkhfvZvXkG9vVJjL/7no6it6k2W0Cbee61mSQO/NUOJ6miYHoQ9Trr5PAMsmw06N6Ivd4PB6Px+PxeDwej8fj8Xg8Ho/H4/F43Oc/L3NkYgLc5HgAAAAASUVORK5CYII=",
"Url":"",
"DescriptionAboutSponsor":"1this has text i dont care",
"DecriptionOnHelp":"2this has text i dont care"
}
},
"Silver Tier": {
1:{
"Name":"Father",
"LogoUrl":"",
"Url":""
//"DescriptionAboutSponsor":"", //Dont get this
//"DecriptionOnHelp":"" //Dont get this
},
2:{
"Name":"Help",
"LogoUrl":"",
"Url":""
//"DescriptionAboutSponsor":"", //Dont get this
//"DecriptionOnHelp":"" //Dont get this
}
},
"Bronze Tier":{
1:{
"Name":"I'm",
//"LogoUrl":"", //Dont get this
"Url":""
//"DescriptionAboutSponsor":"", //Dont get this
//"DecriptionOnHelp":"" //Dont get this
},
2:{
"Name":"Stuck to a cactus",
//"LogoUrl":"", //Dont get this
"Url":""
//"DescriptionAboutSponsor":"", //Dont get this
//"DecriptionOnHelp":"" //Dont get this
}
}
};
try {
await fakeDelay(1000);
console.log("It ran");
let res = tempListOfSponsors;
setSponsorsDict(res);
} catch (error) { //error checking
console.error('Error sending data to server:', error);
}
}
if (!sponsorsDict) { //awaiting for a resposne from the backend
return <p>Loading...</p>
}
if(sponsorsDict) { //maps out the dictionary and displays the content
return (<div id='OurSponsors'>
<div id='BecomeASponsors'>
<button onClick={() => OpenPage('/BecomeASponsor')}>Become A Sponsor</button>
</div>
{Object.keys(sponsorsDict).map((sponsorTier) => (
<div key={sponsorTier} className={sponsorTier}>
<h2>{sponsorTier}</h2>
{Object.keys(sponsorsDict[sponsorTier]).map((sponsorKey) => {
const sponsor = sponsorsDict[sponsorTier][sponsorKey];
return (
<div key={sponsorKey}>
<div>
<div>
{sponsor.Name && <h3>{sponsor.Name}</h3>}
{sponsor.LogoUrl && <a href={sponsor.Url}><img src={sponsor.LogoUrl} alt="Sponsor Logo" /></a>}
</div>
{(sponsor.DescriptionAboutSponsor !== undefined && sponsor.DecriptionOnHelp !== undefined) && <p>Another Element</p>}
</div>
{sponsor.DescriptionAboutSponsor !== undefined && <p>{sponsor.DescriptionAboutSponsor}</p>}
{sponsor.DecriptionOnHelp !== undefined && <p>{sponsor.DecriptionOnHelp}</p>}
</div>
);
})}
</div>
))}
</div>);
}
/**
* @param {null} null - requires nothing (link)
* @returns {Object} sponsorsDict - gets a Dictionary of our sponsors from synology drive
* @description Gets the list of sponsors from the synology drive (not implemented), converts the json file into a dictionary
* @author Brock <darkicewolf50@gmail.com>
* @todo add gPRC to backend and front end
*/
const getSponsors = async () => {
const res = await fetch(sponsorData);
const rawText = await res.text();
const yamlDict = yaml.load(rawText);
try {
await fakeDelay(1000);
console.log("It ran");
let res = yamlDict;
setSponsorsDict(res);
} catch (error) {
//error checking
console.error("Error sending data to server:", error);
}
};
if (!sponsorsDict) {
//awaiting for a resposne from the backend
return <p>Loading...</p>;
}
if (sponsorsDict) {
//maps out the dictionary and displays the content
return (
<div id="OurSponsors">
<div id="BecomeASponsors">
<button onClick={() => OpenPage("/BecomeASponsor")}>
Become A Sponsor
</button>
</div>
<div>
<h3>Current Sponsors</h3>
{Object.keys(sponsorsDict).map((sponsorTier) => (
<div
key={sponsorTier}
className={sponsorTier}>
<h2>{sponsorTier}</h2>
{Object.keys(sponsorsDict[sponsorTier]).map((sponsorKey) => {
const sponsor = sponsorsDict[sponsorTier][sponsorKey];
return (
<div key={sponsorKey}>
<div>
<div>
{sponsor.Name && <h3>{sponsor.Name}</h3>}
{sponsor.LogoUrl && (
<a
href={sponsor.Url}
target="_blank">
<img
src={sponsor.LogoUrl}
alt="Sponsor Logo"
/>
</a>
)}
</div>
{sponsor.DescriptionAboutSponsor !== undefined &&
sponsor.DecriptionOnHelp !== undefined &&
(sponsorTier != "Bronze Tier" ||
sponsorTier != "Silver Tier") && (
<p>Another Element</p>
)}
</div>
{sponsor.DescriptionAboutSponsor !== undefined &&
(sponsorTier != "Bronze Tier" ||
sponsorTier != "Silver Tier") && (
<p>{sponsor.DescriptionAboutSponsor}</p>
)}
{sponsor.DecriptionOnHelp !== undefined &&
(sponsorTier != "Bronze Tier" ||
sponsorTier != "Silver Tier") && (
<p>{sponsor.DecriptionOnHelp}</p>
)}
</div>
);
})}
</div>
))}
</div>
</div>
);
}
};
export default OurSponsors;