Skip to content

Commit 7ab4503

Browse files
authored
Merge pull request #139 from YuStudy-Inc/finalfixes
Finalfixes
2 parents 86243cc + 917977d commit 7ab4503

File tree

15 files changed

+116
-47
lines changed

15 files changed

+116
-47
lines changed

Frontend/src/Components/LandingPage/LandingPageAboutUs.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ const LandingPageAboutUs = () => {
1313
</div>
1414
<div className="about-us-words">
1515
<h1 className="about-us-title">About Us</h1>
16-
<p>QuizSlayer is an interactive study app that turns your studying into an adventure.
17-
Create flashcards on your own or through AI features and test your knowledge in an idle fighting game. Win battles, earn prizes.
18-
Compete against friends or against others to the be the best adventurer there is!!!</p>
16+
<p>QuizSlayer is an interactive study app that turns your studying into an adventure.
17+
Create flashcards on your own or through AI features and test your knowledge in an idle fighting game.
18+
Win battles, earn prizes. Compete against friends or against others to the be the best adventurer there is!!!</p>
1919
</div>
2020
</div>
2121
</div>

Frontend/src/Components/LandingPage/LandingPageDevs.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ const LandingPageDevs = () => {
4141
<button onClick={handleClickLeft} className={disabled === "left" ? "disable" : ""}><h1>&lt;</h1></button>
4242
<div className="carousel">
4343
<div className="developer-box" style={{ '--developer': whoActive}}>
44-
<Developer imageOfThem={duckCharacter} name={"Nick Amancio"} description={"hello I am Nick"} LinkedIn={"https://www.linkedin.com/in/nicholas-amancio/"} GitHub={"https://github.com/Nickthecan"}/>
45-
<Developer imageOfThem={capyBaraCharacter} name={"Joshua Ho"} description={"hello I am Josh"} LinkedIn={"https://www.linkedin.com/in/joshua-h-ho/"} GitHub={"https://github.com/jhhocs"}/>
46-
<Developer imageOfThem={frogCharacter} name={"Thomas Tejedor"} description={"nah🥀she's🥀got🥀u🥀blushing🥀twin🥀ah🥀hell🥀nah🥀twin🥀u🥀gotta🥀lock🥀up🥀twin🥀bruh🥀this🥀not🥀even🥀u🥀twin🥀on🥀fonem🥀grave🥀bru🥀𝓮𝓾𝓪𝓪𝓱𝓱.😇"} LinkedIn={"https://www.linkedin.com/in/thomas-tejedor-576b952a7/"} GitHub={"https://github.com/ThomasTejedor"}/>
47-
<Developer imageOfThem={raccoonCharacter} name={"Alvan Zhuang"} description={"hello I am Alvan"} LinkedIn={"https://www.linkedin.com/in/alvanzhuang/"} GitHub={"https://github.com/AlvanZ"}/>
44+
<Developer imageOfThem={duckCharacter} name={"Nicholas Amancio"} description={"CEO Lead\nUI Design\nCharacter Design and Art\nFrontend\nBackend\nDevOps"} LinkedIn={"https://www.linkedin.com/in/nicholas-amancio/"} GitHub={"https://github.com/Nickthecan"}/>
45+
<Developer imageOfThem={capyBaraCharacter} name={"Joshua Ho"} description={"Frontend\nBackend"} LinkedIn={"https://www.linkedin.com/in/joshua-h-ho/"} GitHub={"https://github.com/jhhocs"}/>
46+
<Developer imageOfThem={frogCharacter} name={"Thomas Tejedor"} description={"AI Developer\nFrontend\nBackend\nDevOps"} LinkedIn={"https://www.linkedin.com/in/thomas-tejedor-576b952a7/"} GitHub={"https://github.com/ThomasTejedor"}/>
47+
<Developer imageOfThem={raccoonCharacter} name={"Alvan Zhuang"} description={"Game Developer\nFrontend\nBackend"} LinkedIn={"https://www.linkedin.com/in/alvanzhuang/"} GitHub={"https://github.com/AlvanZ"}/>
4848
</div>
4949
</div>
5050
<button onClick={handleClickRight} className={disabled === "right" ? "disable" : ""}><h1>&gt;</h1></button>

Frontend/src/Components/Podium.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { podium } from "../assets/Pictures"
77
import { useState, useEffect } from "react"
88

99
const Podium = ({character, hat, weapon}) => {
10-
1110
// Set podium to User's selected character/items first
1211
const [selectedCharacter, setSelectedCharacter] = useState(UserData.getSelectedCharacter());
1312
const [selectedHat, setSelectedHat] = useState(UserData.getSelectedHat());
@@ -21,14 +20,11 @@ const Podium = ({character, hat, weapon}) => {
2120

2221
useEffect(() => {
2322
if (!character && !hat && !weapon) {
24-
console.log("change to podium")
2523
updatePodium();
2624
}
2725
}, [character, hat, weapon]);
2826

2927
return(
30-
/* I guess Ill be drawing the Podium, it will look cooler */
31-
/* place holder for now */
3228
<>
3329
<div className="the-podium">
3430
<img className="weapon-on-podium" src={WeaponsEnum[weapon ?? selectedWeapon]} alt="" />

Frontend/src/Pages/LandingPage.jsx

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,53 @@
11
import "../Styles/Pages/LandingPage.css"
22
import { LandingPageTitle, LandingPageHowToPlay, LandingPageAboutUs, LandingPageDevs, LandingPageSpecialThanks, Footer } from "../Components/Components.js"
3-
import { logo } from "../assets/Pictures.js"
4-
import { useEffect, useState } from "react"
3+
import { logo, arrow } from "../assets/Pictures.js"
4+
import { useEffect, useState, useRef } from "react"
55

66
const LandingPage = () => {
77
const [showingTheLogo, setShowingTheLogo] = useState(false)
8+
const imageRef = useRef(null);
89

910
useEffect(() => {
1011
const handleScroll = () => {
1112
if (window.scrollY >= window.innerHeight) {
12-
setShowingTheLogo(true)
13+
setShowingTheLogo(true);
14+
} else {
15+
setShowingTheLogo(false);
1316
}
14-
else {
15-
setShowingTheLogo(false)
17+
18+
if (window.scrollY === 0 && imageRef.current) {
19+
imageRef.current.classList.remove('rotated');
20+
} else if (imageRef.current) {
21+
imageRef.current.classList.add('rotated');
1622
}
17-
}
23+
};
1824

19-
window.addEventListener("scroll", handleScroll)
20-
return () => window.removeEventListener("scroll", handleScroll)
21-
}, [])
25+
window.addEventListener("scroll", handleScroll);
26+
return () => window.removeEventListener("scroll", handleScroll);
27+
}, []);
28+
29+
const handleArrowClick = () => {
30+
const isScrolledDownByATeensyBit = imageRef.current?.classList.toggle("rotated");
31+
if (isScrolledDownByATeensyBit) {
32+
window.scrollBy({
33+
top: 950,
34+
behavior: "smooth"
35+
});
36+
} else {
37+
window.scrollTo({
38+
top: 0,
39+
behavior: "smooth"
40+
});
41+
}
42+
};
2243

2344
return (
2445
<>
2546
<div className="landing-page-container">
2647
<img className={`corner-logo ${showingTheLogo ? "visible" : ""}`} src={logo} alt="small-logo" />
48+
<button className="arrow" onClick={handleArrowClick}>
49+
<img ref={imageRef} src={arrow} alt="" />
50+
</button>
2751
<LandingPageTitle />
2852
<LandingPageHowToPlay />
2953
<LandingPageAboutUs />

Frontend/src/Pages/MainMenu/Collection.jsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import CharacterEnum from "../../assets/Characters/CharacterEnum.js"
44
import "../../Styles/Pages/MainMenu/Collection.css"
55
import { useNavigate } from "react-router-dom"
66
import UserData from "../../UserData.js"
7-
import { useState } from "react"
7+
import { useState, useEffect } from "react"
88
import HatsEnum from "../../assets/Hats/HatsEnum.js"
99
import WeaponsEnum from "../../assets/Weapons/WeaponsEnum.js"
1010

@@ -19,6 +19,20 @@ const Collection = () => {
1919
const [selectedHat, setSelectedHat] = useState(UserData.getSelectedHat());
2020
const [selectedWeapon, setSelectedWeapon] = useState(UserData.getSelectedWeapon());
2121

22+
useEffect(() => {
23+
axios.get(URI + "users/getUser", { withCredentials: true })
24+
.then((res) => {
25+
UserData.updateUserData(res.data.user);
26+
setSelectedCharacter(res.data.user.selectedCharacter);
27+
setSelectedHat(res.data.user.selectedHat);
28+
setSelectedWeapon(res.data.user.selectedWeapon);
29+
})
30+
.catch((err) => {
31+
console.error("Failed to fetch user data:", err);
32+
});
33+
}, []); //vibe coded
34+
35+
2236
const updateCharacter = (direction) => {
2337
const characters = Object.keys(CharacterEnum);
2438
const currentIndex = characters.indexOf(""+selectedCharacter);

Frontend/src/Pages/MainMenu/CreateQuizPage.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ const CreateQuizPage = () => {
7171
quizId: quizId
7272
}))
7373

74-
console.log(updatedQuestionsWithNewId)
75-
7674
const questionsResponse = await axios.post(`${URI}questions/createQuestions`, {
7775
questions: updatedQuestionsWithNewId,
7876
},

Frontend/src/Pages/MainMenu/EditQuizPage.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const URI = import.meta.env.VITE_APP_URI
1010
const EditQuizPage = () => {
1111
//I need to find a way to make sure the owner of the quiz can edit it, we don't want people to write to other's quizzes
1212
const { quizId } = useParams();
13-
console.log(quizId)
1413
const [quizData, setQuizData] = useState({
1514
title: "",
1615
description: "",
@@ -120,8 +119,6 @@ const EditQuizPage = () => {
120119
quizId: updatedQuizId
121120
}))
122121

123-
console.log(updatedQuestionsWithNewId)
124-
125122
const editedQuestionsResponse = await axios.put(`${URI}questions/editQuestions`, {
126123
questions: cardsEdited
127124
},

Frontend/src/Pages/MainMenu/Friends.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const Friends = () => {
3737
}
3838

3939
const handleFriendClick = (friend) => {
40-
console.log(friend)
4140
setSelectedFriend(friend)
4241
};
4342

Frontend/src/Pages/MainMenu/Gacha.jsx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const Gacha = () => {
6969
const [itemName, setItemName] = useState(null)
7070
const [theResultsPageOfTheGacha, setTheResultsPageOfTheGacha] = useState(false)
7171
const [coinsTextIfTheyAlreadyWonThatItem, setCoinsTextIfTheyAlreadyWonThatItem] = useState(null)
72+
const [isRolling, setIsRolling] = useState(false)
7273

7374
const navigate = useNavigate()
7475

@@ -91,6 +92,10 @@ const Gacha = () => {
9192
}, [URI, userId])
9293

9394
const handleRoll = async () => {
95+
if (isRolling) return
96+
97+
setIsRolling(true)
98+
9499
setTheResultsPageOfTheGacha(false)
95100
setCoinsTextIfTheyAlreadyWonThatItem(null)
96101

@@ -112,7 +117,6 @@ const Gacha = () => {
112117
setItemWon(randomItem)
113118
setItemName(nameOfTheRandomItem)
114119
setStars(whichStar)
115-
console.log("item won", randomItem)
116120

117121
//one star = 50, two stars = 75, three = 100 four == 300
118122
try {
@@ -124,14 +128,10 @@ const Gacha = () => {
124128
})
125129
setUsersCharacterList(characterData.data.characterList)
126130
setUsersInventory(inventoryData.data.inventory)
127-
console.log(characterData.data.characterList)
128-
console.log(inventoryData.data.inventory)
129131
}
130132
catch (e) {
131133
console.error("failed to fetch the player's inventory")
132134
}
133-
134-
console.log("item won", randomItem)
135135

136136
if (usersCharacterList.includes(randomItem) || usersInventory.includes(randomItem)) {
137137
switch (whichStar) {
@@ -154,14 +154,10 @@ const Gacha = () => {
154154
default:
155155
setCoinsTextIfTheyAlreadyWonThatItem(null)
156156
}
157-
console.log("users coins because they already had the item", coinsIfTheyAlreadyWonThatItem)
158157
}
159-
console.log("item won", randomItem)
160158

161159
if (coinsTextIfTheyAlreadyWonThatItem === null && whichStar === fourStar) {
162-
console.log("it was a character", randomItem)
163160
const characterEnumKey = lookUpItemFromTheEnums(CharacterEnum, randomItem)
164-
console.log(characterEnumKey)
165161
if (characterEnumKey !== undefined) {
166162
try {
167163
const response = await axios.put(`${URI}users/addCharacter/${userId}`, {
@@ -178,9 +174,7 @@ const Gacha = () => {
178174
}
179175
}
180176
else if (coinsTextIfTheyAlreadyWonThatItem === null && (whichStar === threeStar || whichStar === twoStar)) {
181-
console.log("it was a item", randomItem)
182177
let itemEnumKey = lookUpItemFromTheEnums(HatsEnum, randomItem) ?? lookUpItemFromTheEnums(WeaponsEnum, randomItem);
183-
console.log(itemEnumKey)
184178
if (itemEnumKey !== undefined) {
185179
try {
186180
const response = await axios.put(`${URI}users/addItem/${userId}`, {
@@ -197,7 +191,6 @@ const Gacha = () => {
197191
}
198192
}
199193
else if (whichStar === oneStar) {
200-
console.log("it was just coins", randomItem)
201194
try {
202195
const response = await axios.put(`${URI}users/updateCoins/${userId}`, {
203196
coins: 50
@@ -212,7 +205,6 @@ const Gacha = () => {
212205
}
213206
}
214207
else {
215-
console.log("it was just coins", randomItem)
216208
try {
217209
const response = await axios.put(`${URI}users/updateCoins/${userId}`, {
218210
coins: 50
@@ -240,6 +232,9 @@ const Gacha = () => {
240232
catch (e) {
241233
console.error("error buying lootbox", e)
242234
}
235+
finally {
236+
setTimeout(() => setIsRolling(false), 2000)
237+
}
243238
}
244239
}
245240

@@ -295,7 +290,7 @@ const Gacha = () => {
295290
<h1>&lt;</h1>
296291
</button>
297292
</div>) : null }
298-
{alertForInsufficientFunds && (<Alert text={"Insufficient Funds!"} buttonOneText={"Ok"} functionButtonOne={() => {setAlertForInsufficientFunds(false)}}/>)}
293+
{alertForInsufficientFunds && (<Alert text={"Insufficient Funds!"} buttonOneText={"Ok"} functionButtonOne={() => {setAlertForInsufficientFunds(false)}} show={true}/>)}
299294
<div className="stuff-in-gacha">
300295
{theResultsPageOfTheGacha ? (
301296
<>
@@ -309,7 +304,7 @@ const Gacha = () => {
309304
<h1>{itemName} {coinsTextIfTheyAlreadyWonThatItem !== null ? `:${coinsTextIfTheyAlreadyWonThatItem}` : ""}</h1>
310305
</div>
311306
<div className="button-for-gacha">
312-
<button onClick={handleRoll}>Buy Again? : 100 coins</button>
307+
<button onClick={handleRoll} disabled={isRolling}>Buy Again? : 100 coins</button>
313308
</div>
314309
</>
315310
) : (
@@ -331,7 +326,7 @@ const Gacha = () => {
331326
<h1>Your coins: {usersCoins}</h1>
332327
</div>
333328
<div className="button-for-gacha">
334-
<button onClick={handleRoll}>Buy: 100 coins</button>
329+
<button onClick={handleRoll} disabled={isRolling}>Buy: 100 coins</button>
335330
</div>
336331
</>
337332
)}

Frontend/src/Pages/MainMenu/Quizzes.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ const Quizzes = () => {
3434
navigate(`/editquiz/${id}`)
3535
}
3636
const playThatQuiz = async (quizId) =>{
37-
console.log(quizId);
3837
localStorage.setItem('quizId', quizId);
3938
}
4039
const deleteThatQuiz = async (quizId) => {
41-
console.log(quizId)
4240
try {
4341
const response = await axios.delete(`${URI}quizzes/deleteQuiz`, {
4442
data: { quizId },

0 commit comments

Comments
 (0)