diff --git a/src/components/NavBar.js b/src/components/NavBar.js index f450038ed78c47106e0836e504cd34d31a4d4c6a..b7a04f8e32fea61cf1c48d839af65bf2a55681f9 100644 --- a/src/components/NavBar.js +++ b/src/components/NavBar.js @@ -3,6 +3,7 @@ import { Navbar, Nav } from "react-bootstrap"; import { NavLink } from "react-router-dom"; import AuthControl from "./auth/authControl"; import MyBasketButton from "./basket/MyBasketButton" +import SaveBasketButton from "./basket/SaveBasketButton" import { QueryContext } from "../contexts/QueryContext"; import { GlobalContext } from "../contexts/GlobalContext"; @@ -34,6 +35,7 @@ export default function NavBar() { <Nav.Link key="my basket" as={NavLink} to="/basket"> <MyBasketButton /> </Nav.Link> + <SaveBasketButton/> <Nav> <AuthControl /> diff --git a/src/components/basket/MyBasketButton.js b/src/components/basket/MyBasketButton.js index de2433f5c8a5007a69a990187ee8a97d6aa3faee..2c525a86cee5910487b9f646dc9c1ffae3228f66 100644 --- a/src/components/basket/MyBasketButton.js +++ b/src/components/basket/MyBasketButton.js @@ -5,7 +5,6 @@ import { BasketContext } from "../../contexts/BasketContext"; import { getShoppingIcon } from "../../utils/styling"; import { loadBasket } from "./LoadBasket"; - export default function MyBasketButton(props) { const { api_host, isAuthenticated } = useContext(GlobalContext); const basketContext = useContext(BasketContext); diff --git a/src/components/basket/MyBasketPage.js b/src/components/basket/MyBasketPage.js index 85ae62f596b5908d5a6dcb9562d56ba3ed67f06d..5f83ebc6e1c8f1cae4bff96165083f53678ab234 100644 --- a/src/components/basket/MyBasketPage.js +++ b/src/components/basket/MyBasketPage.js @@ -3,7 +3,6 @@ import { Table, Container, Alert } from "react-bootstrap"; import { IDAContext } from "../../contexts/IDAContext"; import { BasketContext } from "../../contexts/BasketContext"; -import SaveBasketButton from "./SaveBasketButton"; import AddToBasket from "./AddToBasketCheckBox"; export default function MyBasketPage() { @@ -40,7 +39,6 @@ export default function MyBasketPage() { <> <Container fluid> <h3>Data Checkout</h3> - <SaveBasketButton /> <Table className="mt-3" responsive> <thead> diff --git a/src/components/basket/SaveBasketButton.js b/src/components/basket/SaveBasketButton.js index 804d90e9018e3661fb4b7f74856d1e68c397726f..825ab540ba614e9bfe99115f52eca936b709da36 100644 --- a/src/components/basket/SaveBasketButton.js +++ b/src/components/basket/SaveBasketButton.js @@ -40,16 +40,19 @@ export default function SaveBasketButton(props) { //let authenticated = isAuthenticated || (process.env.NODE_ENV === "development") let authenticated = isAuthenticated - if(authenticated) { - - return ( - <Button - type="button" - variant="primary" - onClick={() => saveBasket(basketContext.datasets)} - {...props}> - {getShoppingIcon("save_cart")} Save Basket</Button> - ); + if (authenticated) { + if (hasChanged) { + return ( + <Button + type="button" + variant="primary" + onClick={() => saveBasket(basketContext.datasets)} + {...props}> + {getShoppingIcon("save_cart")} Save Basket</Button> + ) + } else { + return null + } } else{ return (<> diff --git a/src/components/query/ApertifResults.js b/src/components/query/ApertifResults.js index 419fcd5ed4760e9eb807074c165f81daa1dfe7b3..0e3b158f7930a3a71357bb506da925a5a4996c90 100644 --- a/src/components/query/ApertifResults.js +++ b/src/components/query/ApertifResults.js @@ -71,7 +71,7 @@ export default function ApertifResults({ catalog }) { numAdjacent={3} numPages={numPages} /> - <SaveBasketButton /> + <Table className="mt-3" responsive> <thead> <tr className="bg-light"> diff --git a/src/components/query/ZooniverseResults.js b/src/components/query/ZooniverseResults.js index 8d1f8a469b711b8897ab8dd4c2eaf33dcdd9e47f..b13e7015ad36a03a8177bd1f98b12764674a186e 100644 --- a/src/components/query/ZooniverseResults.js +++ b/src/components/query/ZooniverseResults.js @@ -140,7 +140,7 @@ function ZooniverseProjectResults(context) { numPages={numPages} /> <Form> - <SaveBasketButton /> + <Table className="mt-3" responsive> <thead> <tr className="bg-light"> diff --git a/src/components/query/samp/SampPage.js b/src/components/query/samp/SampPage.js index dfc3c1a47374369ec72a32f5ab62000ca7df7a89..a466459d3a53ec8c490151a4ba473577da77d9d1 100644 --- a/src/components/query/samp/SampPage.js +++ b/src/components/query/samp/SampPage.js @@ -96,7 +96,6 @@ export default function SampPage(props) { <p>Start a SAMP enabled application (like Topcat), register to the hub and transmit data from Topcat.</p> <button variant="outline-warning" onClick={() => register()}>register</button> <button variant="outline-warning" onClick={() => unregister()}>unregister</button> - <SaveBasketButton /> {renderSampGrid} </div> diff --git a/src/routes/Routes.js b/src/routes/Routes.js index 29b3ef05846f30e69c28b99d89d69697280d62ba..f0e087a4ff799427c18c5d8c02317d49986af111 100644 --- a/src/routes/Routes.js +++ b/src/routes/Routes.js @@ -64,7 +64,7 @@ export default function Routes() { </Switch> - <footer><small>esap-gui version 18 jun 2021 - 8:00</small></footer> + <footer><small>esap-gui version 18 jun 2021 - 12:00</small></footer> </Router> ); } diff --git a/src/utils/styling.js b/src/utils/styling.js index 52826ff7aef3e732180757a3fca53d24fd509081..05395604c7ace5781496199e1aebced2fb75399f 100644 --- a/src/utils/styling.js +++ b/src/utils/styling.js @@ -25,7 +25,7 @@ export const getShoppingIcon = (type) => { if (type === 'must_save_cart') { icon = faShoppingCart size = "md" - color = "yellow" + color = "red" } if (type === 'save_cart') {