loading first item when open morceaux. Pi j'ai enlevé le height du root parce que ça fait que le foot est par dessus du stock

This commit is contained in:
Victor Turgeon 2022-10-18 00:34:43 -07:00
parent cf3647fe73
commit b9787c7aff
6 changed files with 124 additions and 89 deletions

View File

@ -13,6 +13,7 @@
"@testing-library/user-event": "^13.5.0",
"axios": "^1.1.3",
"bootstrap": "^5.2.1",
"fa": "^1.0.1",
"font-awesome": "^4.7.0",
"react": "^18.2.0",
"react-bootstrap": "^2.5.0",
@ -8427,6 +8428,14 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
},
"node_modules/fa": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fa/-/fa-1.0.1.tgz",
"integrity": "sha512-9uU7yoeKcoXvONbZuoRAEzIz/v80RlS6QfN4sWWyrpy5rScGrDPxpeZ3AV6y+jssjFJUEQoZiR5lgXBLrtAHKQ==",
"engines": {
"node": "*"
}
},
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@ -24554,6 +24563,11 @@
}
}
},
"fa": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fa/-/fa-1.0.1.tgz",
"integrity": "sha512-9uU7yoeKcoXvONbZuoRAEzIz/v80RlS6QfN4sWWyrpy5rScGrDPxpeZ3AV6y+jssjFJUEQoZiR5lgXBLrtAHKQ=="
},
"fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",

View File

@ -8,6 +8,7 @@
"@testing-library/user-event": "^13.5.0",
"axios": "^1.1.3",
"bootstrap": "^5.2.1",
"fa": "^1.0.1",
"font-awesome": "^4.7.0",
"react": "^18.2.0",
"react-bootstrap": "^2.5.0",

View File

@ -9,6 +9,8 @@ import { Card } from "react-bootstrap";
// Discontinued
// }
function renderStatus(statusCode) {
if (statusCode !== undefined) {
switch (statusCode) {
case 0:
return (
@ -52,9 +54,13 @@ function renderStatus(statusCode) {
<></>
);
}
}
}
function renderPrice(price, newPrice, status) {
if (price !== undefined) {
if (status != 3 && status != 4) {
return (
@ -77,10 +83,12 @@ function renderPrice(price, newPrice, status) {
</Card.Text>
);
}
}
}
const Item = ({ imageUrl, name, price, newPrice, status }) => {
if (name !== undefined) {
return (
<Card className="item">
@ -101,6 +109,10 @@ const Item = ({ imageUrl, name, price, newPrice, status }) => {
</Card.Body>
</Card>
);
}
else {
return (<></>);
}
}
export default Item;

View File

@ -18,7 +18,7 @@ const MorceauDetail = () => {
}
fetchData();
setIsLoading(false);
});
},[]);
function renderPrice(price, newPrice, status) {
if (price !== undefined) {

View File

@ -6,11 +6,6 @@ import Sorting from "../components/Sorting"
const Morceaux = (startingProducts) => {
useEffect(() => {
document.title = 'Morceaux';
});
const [products, setProducts] = useState([]);
const [isLoading, setIsLoading] = useState(false);
@ -18,6 +13,19 @@ const Morceaux = (startingProducts) => {
var filterPrice = "";
var filterState = "";
useEffect(() => {
document.title = 'Morceaux';
setIsLoading(true);
async function fetchData() {
const response = await fetch(`https://localhost:7292/api/Inventory`);
const json = await response.json();
if (json.length > 0)
setProducts([...json]);
}
fetchData();
setIsLoading(false);
},[]);
const handleNextItems = async () => {
var url;
@ -57,7 +65,7 @@ const Morceaux = (startingProducts) => {
}
return (
<div className="morceaux"div>
<div className="morceaux">
<div className="sorting-container">
<Sorting onChange={handleOrder} />
</div>

View File

@ -1,5 +1,5 @@
#root {
height: 100vh;
min-height: 100vh;
}
body {