just a few more todo items

This commit is contained in:
darkicewolf50 2023-12-09 12:46:26 -07:00
parent d8ca3be56a
commit 992bf5017b
3 changed files with 156 additions and 111 deletions

View File

@ -42,6 +42,7 @@
#OurSponsors h2 {
background-color: aquamarine;
text-align: center;
margin: 0px;
}
#OurSponsors h3 {

View File

@ -1,6 +1,16 @@
import { useEffect } from 'react';
import { useState } from 'react';
import './OurSponsors.css'
const OurSponsors = () => {
//can be removed later
import fakeDelay from '../TestingTools/fakeDelay';
/*
things to do
*add link to become a sponsor at top, and thank you message
*/
const OurSponsors = () => {
/*
OurSponsors Page
REQUIRES:
Nothing
@ -9,13 +19,19 @@ const OurSponsors = () => {
Develop in part by: Brock
Contact: darkicewolf50@gmail.com
*/
const getSponsors = () => {
const [sponsorsDict, setSponsorsDict] = useState(); //variable states for the dictionary of sponsors
useEffect(() => {
getSponsors(); //get sponsors on startup of page
}, []);
const getSponsors = async () => {
/*
Gets the list of sponsors from the synology drive (not implemented), converts the json file into a dictionary
REQUIRES:
constant html link to synology drive
PROMISES:
returns Dictionary list of all our sponsors
returns Dictionary list of all our sponsors in this format of json file
Develop in part by: Brock
Contact: darkicewolf50@gmail.com
*/
@ -94,18 +110,27 @@ const OurSponsors = () => {
}
}
};
try {
await fakeDelay(1000);
console.log("It ran");
return tempListOfSponsors;
let res = tempListOfSponsors;
setSponsorsDict(res);
} catch (error) { //error checking
console.error('Error sending data to server:', error);
}
}
const dictOfSponsors = getSponsors();
//to fix make each of these a function and return the proper
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'>
{Object.keys(dictOfSponsors).map((sponsorTier) => (
{Object.keys(sponsorsDict).map((sponsorTier) => (
<div key={sponsorTier} className={sponsorTier}>
<h2>{sponsorTier}</h2>
{Object.keys(dictOfSponsors[sponsorTier]).map((sponsorKey) => {
const sponsor = dictOfSponsors[sponsorTier][sponsorKey];
{Object.keys(sponsorsDict[sponsorTier]).map((sponsorKey) => {
const sponsor = sponsorsDict[sponsorTier][sponsorKey];
return (
<div key={sponsorKey}>
<div>
@ -123,6 +148,7 @@ const OurSponsors = () => {
</div>
))}
</div>);
}
};

View File

@ -0,0 +1,18 @@
function fakeDelay(ms) {
/*
useful for testing allows for a fake response, allow us to see what the program does while waiting for data from the backend
REQUIRES:
time in milliseconds
needs a line like this to run
await fakeDelay(5000);
PROMISES:
nothing
Develop in part by: Brock
Contact: darkicewolf50@gmial.com
*/
return new Promise(resolve => setTimeout(resolve, ms));
}
export default fakeDelay;