Skip to content

Commit

Permalink
Merge branch 'dev' into S03-US08
Browse files Browse the repository at this point in the history
  • Loading branch information
BarisRz authored Nov 6, 2023
2 parents 0d2e531 + 61fc37c commit fc71044
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 27 deletions.
69 changes: 65 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"dependencies": {
"axios": "^1.6.0",
"framer-motion": "^10.16.4",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ footer {
}
}
#bg {
min-height: 88vh;
background-image: url("./assets/potionclassroom.png");
background-size: cover;
background-repeat: no-repeat;
Expand All @@ -323,7 +324,7 @@ footer {
#bgTrue {
text-align: center;
width: 100%;
height: 130%;
height: 25vw;
background-image: url("./assets/potionclassroom-animation-ok.gif");
background-size: contain;
background-position: center;
Expand All @@ -336,7 +337,7 @@ footer {
#bgFalse {
text-align: center;
width: 100%;
height: 130%;
height: 25vw;
background-image: url("./assets/potionclassroom-animation-false.gif");
background-size: contain;
background-position: center;
Expand Down
15 changes: 13 additions & 2 deletions frontend/src/components/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import PropTypes from "prop-types";
import { motion } from "framer-motion";

function Card({ name, image, effect, ingredients }) {
return (
<div className="container-elixir bg-purple-800 grid text-white w-72 h-96 rounded-2xl p-4">
<motion.div
initial="hidden"
exit="hidden"
whileInView="visible"
viewport={{ once: true }}
variants={{
visible: { opacity: 1, scale: 1 },
hidden: { opacity: 0, scale: 0 },
}}
className="container-elixir bg-purple-800 grid text-white w-72 h-96 rounded-2xl p-4"
>
<div className="grid bg-purple-heart-400 rounded-xl h-44">
<h1 className="text-xl font-irish text-center">{name}</h1>
<div className="flex justify-center">
Expand All @@ -25,7 +36,7 @@ function Card({ name, image, effect, ingredients }) {
<p className="overflow-auto ingredients">
{ingredients || "Not known yet"}
</p>
</div>
</motion.div>
);
}

Expand Down
10 changes: 8 additions & 2 deletions frontend/src/components/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState } from "react";
import { motion } from "framer-motion";
import Contact from "./Modal/Contact";
import Modal from "./Modal/Login";

Expand Down Expand Up @@ -34,9 +35,14 @@ function Footer() {
</div>
)}
{openModal && (
<div className="blur-background">
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="blur-background flex items-center justify-center"
>
<Modal closeModal={() => setOpenModal(false)} />
</div>
</motion.div>
)}
</footer>
);
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/Ingredients.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ function Ingredients({
ingtransp,
setBg,
setImgIngredientClass,
setScore,
score,
gainScore,
}) {
const isTrue = () => {
function returnToTrueAnimation() {
Expand All @@ -33,6 +36,7 @@ function Ingredients({
} else {
setImgIngredient(ingredientImg);
setImgIngredientClass("imgIngredient");
setScore(score + gainScore);
endImgIngredient();
}
};
Expand All @@ -54,6 +58,9 @@ Ingredients.propTypes = {
setImgIngredient: PropTypes.func.isRequired,
ingtransp: PropTypes.string.isRequired,
setBg: PropTypes.func.isRequired,
setImgIngredientClass: PropTypes.string.isRequired,
setImgIngredientClass: PropTypes.func.isRequired,
setScore: PropTypes.number.isRequired,
gainScore: PropTypes.number.isRequired,
score: PropTypes.number.isRequired,
};
export default Ingredients;
12 changes: 10 additions & 2 deletions frontend/src/components/Jeu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ function Jeu() {
console.info(allIngredients);

const [imgIngredient, setImgIngredient] = useState(ingtransp);

const [imgIngredientClass, setImgIngredientClass] = useState("");

const [bg, setBg] = useState("bgTrue");

const [score, setScore] = useState(0);

const gainScore = 100 / ingredientsPotion.length;

return (
<div id="bg" className="h-screen w-full flex justify:center ">
<div id="bg" className="w-full flex justify:center ">
<div
className=" h-full w-full flex flex-col items-center p-3 justify-around max-sm:justify-normal
"
Expand Down Expand Up @@ -115,7 +120,7 @@ function Jeu() {
</div>
<div className="flex flex-row justify-around max-sm:justify-center">
<h3 className="font-irish">Score </h3>
<h4 className="font-irish">.../100</h4>
<h4 className="font-irish">{score}/200</h4>
</div>
</div>
</div>
Expand All @@ -134,6 +139,9 @@ function Jeu() {
setImgIngredient={setImgIngredient}
setBg={setBg}
setImgIngredientClass={setImgIngredientClass}
score={score}
setScore={setScore}
gainScore={gainScore}
/>
</div>
))}
Expand Down
29 changes: 16 additions & 13 deletions frontend/src/components/OngletElixir.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import axios from "axios";
import { AnimatePresence } from "framer-motion";
import searchIcon from "../assets/search.svg";
import Card from "./Card";
import loadingIcon from "../assets/loading.svg";
Expand Down Expand Up @@ -86,19 +87,21 @@ function OngletElixir() {
</button>
</div>
<div className="liste-elixir flex flex-wrap gap-10 justify-center">
{elixir
.filter((element) =>
element.attributes.name.toLowerCase().includes(searchValue)
)
.map((element) => (
<Card
key={element.id}
name={element.attributes.name}
image={element.attributes.image}
effect={element.attributes.effect}
ingredients={element.attributes.ingredients}
/>
))}
<AnimatePresence>
{elixir
.filter((element) =>
element.attributes.name.toLowerCase().includes(searchValue)
)
.map((element) => (
<Card
key={element.id}
name={element.attributes.name}
image={element.attributes.image}
effect={element.attributes.effect}
ingredients={element.attributes.ingredients}
/>
))}
</AnimatePresence>
</div>
</div>
);
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/components/Trophy.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import PropTypes from "prop-types";

function Trophy({ color }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill={color}
className="w-auto h-16 drop-shadow-lg stroke-black"
>
<path
fillRule="evenodd"
d="M5.166 2.621v.858c-1.035.148-2.059.33-3.071.543a.75.75 0 00-.584.859 6.753 6.753 0 006.138 5.6 6.73 6.73 0 002.743 1.346A6.707 6.707 0 019.279 15H8.54c-1.036 0-1.875.84-1.875 1.875V19.5h-.75a2.25 2.25 0 00-2.25 2.25c0 .414.336.75.75.75h15a.75.75 0 00.75-.75 2.25 2.25 0 00-2.25-2.25h-.75v-2.625c0-1.036-.84-1.875-1.875-1.875h-.739a6.706 6.706 0 01-1.112-3.173 6.73 6.73 0 002.743-1.347 6.753 6.753 0 006.139-5.6.75.75 0 00-.585-.858 47.077 47.077 0 00-3.07-.543V2.62a.75.75 0 00-.658-.744 49.22 49.22 0 00-6.093-.377c-2.063 0-4.096.128-6.093.377a.75.75 0 00-.657.744zm0 2.629c0 1.196.312 2.32.857 3.294A5.266 5.266 0 013.16 5.337a45.6 45.6 0 012.006-.343v.256zm13.5 0v-.256c.674.1 1.343.214 2.006.343a5.265 5.265 0 01-2.863 3.207 6.72 6.72 0 00.857-3.294z"
clipRule="evenodd"
/>
</svg>
);
}

Trophy.propTypes = {
color: PropTypes.string.isRequired,
};

export default Trophy;
Loading

0 comments on commit fc71044

Please sign in to comment.