Skip to content

Commit

Permalink
#99 #107 #119 #42 #92 Added missing translations, palettes, implement…
Browse files Browse the repository at this point in the history
…ed Carousel, page with JSON-LD for empty URL, refinements, and general bug fixes
  • Loading branch information
dev-marcoC committed Mar 4, 2024
1 parent 73419db commit 4492479
Show file tree
Hide file tree
Showing 30 changed files with 1,155 additions and 485 deletions.
353 changes: 260 additions & 93 deletions frontend/package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@testing-library/user-event": "^14.2.0",
"bootstrap-icons": "^1.9.0",
"bootstrap-scss": "^5.1.3",
"crypto-js": "^4.2.0",
"element-resize-event": "^3.0.3",
"geojson2h3": "^1.2.0",
"geolib": "^3.3.4",
Expand All @@ -37,9 +38,11 @@
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-swipeable-views": "^0.14.0",
"react-tabs": "^5.1.0",
"react-tether": "^3.0.0",
"react-tooltip": "^4.2.10",
"react18-json-view": "^0.2.7",
"sass": "^1.53.0",
"universal-cookie": "^6.1.1",
"web-vitals": "^2.1.4"
Expand Down
114 changes: 114 additions & 0 deletions frontend/src/components/home/CarouselPortals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import React, { useState } from "react";
import SwipeableViews from "react-swipeable-views";
import { autoPlay } from "react-swipeable-views-utils";
import Card from "@mui/material/Card";
import CardMedia from "@mui/material/CardMedia";
import Typography from "@mui/material/Typography";
import Grid from "@mui/material/Grid";
import Box from "@mui/material/Box";
import { CardActionArea } from "@mui/material";
import Container from "@mui/material/Container";
import IconButton from "@mui/material/IconButton";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
import { Link } from "react-router-dom";
import { PARTNERS } from "portability/configuration";

const AutoPlaySwipeableViews = autoPlay(SwipeableViews);
const CarouselPortals = () => {
const [index, setIndex] = useState(0);

const handleSlideChange = (index) => {
setIndex(index);
};

const handleNextSlide = () => {
setIndex((prevIndex) => (prevIndex + 1) % PARTNERS.length);
};

const handlePrevSlide = () => {
setIndex((prevIndex) => (prevIndex - 1 + 3) % PARTNERS.length);
};

const palette = "custom.homepage.carouselPortals.";
return (
<Container
maxWidth="xl"
sx={{
my: 6,
}}
>
<Grid container>
<Grid item xs={12} lg={12}>
<Typography
fontWeight={{ xs: 800, lg: 700 }}
sx={{ fontSize: "36px", color: palette + "colorTypography" }}
gutterBottom
>
Partners
</Typography>
</Grid>
<Grid item xs={5} lg={12} sx={{ position: "relative", mt: 4 }}>
<AutoPlaySwipeableViews
index={index}
onChangeIndex={handleSlideChange}
>
{PARTNERS.map((g) => {
return (
<Box
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
{g.map((p) => {
return (
<Card
sx={{
background: "transparent",
}}
elevation={0}
>
<CardActionArea
component={Link}
to={p.url}
target="_blank"
>
<CardMedia
component="img"
sx={{ height: "100%", width: "250px" }}
image={p.icon}
alt=""
/>
</CardActionArea>
</Card>
);
})}
</Box>
);
})}
</AutoPlaySwipeableViews>
<Box
sx={{
position: "absolute",
marginTop: "8px",
display: "flex",
gap: "9px",
right: 14,
}}
>
<IconButton onClick={handlePrevSlide}>
<ArrowBackIcon sx={{ color: palette + "colorArrows" }} />
</IconButton>
<IconButton onClick={handleNextSlide}>
<ArrowForwardIcon sx={{ color: palette + "colorArrows" }} />
</IconButton>
</Box>
</Grid>
</Grid>
</Container>
);
};

export default CarouselPortals;
12 changes: 7 additions & 5 deletions frontend/src/components/home/TypesCount.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Box from "@mui/material/Box";
import Search from "../search/Search";
import MapViewerEntrypoint from "./MapViewerEntrypoint";
import CardTopic from "./CardTopic";
import CarouselPortals from "./CarouselPortals";

const doc_types = [
"CreativeWork",
"Person",
Expand All @@ -33,15 +35,14 @@ export default function TypesCount() {
const [counts, setCounts] = useState(defaultCountState);
const navigate = useNavigate();
const [region] = useSearchParam("region");

const translationState = useAppTranslation();

const get_region_bounds = () => {
/* const get_region_bounds = () => {
let bounds;
if (region) bounds = regionBoundsMap[region.replaceAll(" ", "_")];
if (bounds) return bounds;
else return "[-90,-180 TO 90,180]";
};
}; */

useEffect(() => {
fetch(
Expand All @@ -52,7 +53,7 @@ export default function TypesCount() {
.then((response) => response.json())
.then((json) => setCounts((prev) => ({ ...prev, ...json.counts })));

fetch(
/* fetch(
`${dataServiceUrl}/search?rows=0&include_facets=false&facetType=the_geom&facetName=${get_region_bounds()}${
region ? "&region=" + region : ""
}`
Expand All @@ -63,7 +64,7 @@ export default function TypesCount() {
...prev,
SpatialData: Object.values(json.counts).reduce((x, y) => x + y, 0),
}))
);
); */
}, [region]);

const searchByType = (type) => (event) =>
Expand Down Expand Up @@ -123,6 +124,7 @@ export default function TypesCount() {
</Container>
</Container>
<MapViewerEntrypoint />
<CarouselPortals />
</Box>
</div>
</>
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/map-view/MapContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ const MapContainer = (props) => {
setFacetQuery("");
};

const palette = "custom.container.map.";

const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
return (
Expand Down
23 changes: 11 additions & 12 deletions frontend/src/components/map-view/components/ToolbarHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ToolbarHome = (props) => {
};

const navigate = useNavigate();

const palette = "custom.mapView.toolbarHome.";
const goToMap = () => {
navigate(`/map-viewer?lng=${center[0]}&lat=${center[1]}`);
};
Expand All @@ -33,16 +33,16 @@ const ToolbarHome = (props) => {
variant="contained"
sx={{
".MuiButton-root": {
background: "#FFFFFF",
color: "#2B498C",
backgroundColor: palette + "bgButton",
color: palette + "colorLayerButton",
padding: "6px",
borderRight: 0,
fontSize: "12px",
fontWeight: 600,
},

".MuiButton-root:hover": {
background: "#DEE2ED",
backgroundColor: palette + "bgLayerButtonHover",
},
}}
disableElevation
Expand All @@ -51,7 +51,7 @@ const ToolbarHome = (props) => {
<Box
sx={{
...(selectedLayer === EMODNET && {
background: "#DEE2ED",
backgroundColor: palette + "bgLayerButtonHover",
}),
paddingLeft: "6px",
paddingRight: "6px",
Expand All @@ -65,7 +65,7 @@ const ToolbarHome = (props) => {
<Box
sx={{
...(selectedLayer === ARCGIS && {
background: "#DEE2ED",
backgroundColor: palette + "bgLayerButtonHover",
}),
paddingLeft: "6px",
paddingRight: "6px",
Expand All @@ -79,7 +79,7 @@ const ToolbarHome = (props) => {
<Box
sx={{
...(selectedLayer === USGS && {
background: "#DEE2ED",
backgroundColor: palette + "bgLayerButtonHover",
}),
paddingLeft: "6px",
paddingRight: "6px",
Expand All @@ -94,19 +94,18 @@ const ToolbarHome = (props) => {
<Box sx={{ position: "absolute", bottom: 10, right: 12 }}>
<IconButton
sx={{
color: "white",
background: "#FFFFFF",
backgroundColor: palette + "bgButton",
borderRadius: "3px",
"&:hover": {
background: "#2B498C",
backgroundColor: palette + "bgGoToMapHover",
"& .MuiSvgIcon-root": {
color: "#FFFFFF",
color: palette + "colorIconGoToHover",
},
},
}}
onClick={() => goToMap()}
>
<OpenInFullIcon sx={{ color: "#2B498C" }} />
<OpenInFullIcon sx={{ color: palette + "colorIconGoTo" }} />
</IconButton>
</Box>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,16 @@ const DesktopMapView = (props) => {
region,
} = props;

const palette = "custom.mapView.desktop.";
return (
<>
<Box display={"flex"} alignItems={"center"}>
<Drawer
sx={{
width:
window.innerWidth < 1600 && window.innerWidth > 1400
? "20%"
: "30%",
width: window.innerWidth < 1400 ? "40%" : "30%",
flexShrink: 0,
"& .MuiDrawer-paper": {
width:
window.innerWidth < 1600 && window.innerWidth > 1400
? "20%"
: "30%",
width: window.innerWidth < 1400 ? "40%" : "30%",
boxSizing: "border-box",
},
}}
Expand Down Expand Up @@ -84,18 +79,15 @@ const DesktopMapView = (props) => {
sx={{
position: "absolute",
bottom: "70%",
left:
window.innerWidth < 1600 && window.innerWidth > 1400
? "20%"
: "30%",
background: "white",
left: window.innerWidth < 1400 ? "40%" : "30%",
backgroundColor: palette + "bgIconHandleDrawer",
borderRadius: "0 10px 10px 0",
paddingLeft: 0,
paddingRight: 0,
"&:hover": {
background: "#2B498C",
backgroundColor: palette + "bgIconHandleDrawerHover",
"& .MuiSvgIcon-root": {
color: "#FFFFFF",
color: palette + "colorIconHandleDrawerHover",
},
},
}}
Expand All @@ -109,14 +101,14 @@ const DesktopMapView = (props) => {
position: "absolute",
bottom: "70%",
left: "0%",
background: "white",
backgroundColor: palette + "bgIconHandleDrawer",
borderRadius: "0 10px 10px 0",
paddingLeft: 0,
paddingRight: 0,
"&:hover": {
background: "#2B498C",
backgroundColor: palette + "bgIconHandleDrawerHover",
"& .MuiSvgIcon-root": {
color: "#FFFFFF",
color: palette + "colorIconHandleDrawerHover",
},
},
}}
Expand All @@ -134,10 +126,7 @@ const DesktopMapView = (props) => {
position: "absolute",
zIndex: -1,
right: 0,
width:
window.innerWidth < 1600 && window.innerWidth > 1400
? "80%"
: "70%",
width: window.innerWidth < 1400 ? "60%" : "70%",
}),
}}
>
Expand Down
Loading

0 comments on commit 4492479

Please sign in to comment.