Skip to content

Commit

Permalink
Merge pull request #72 from CIAT-DAPA/develop
Browse files Browse the repository at this point in the history
EWP-278 Order fo the btns standarized
  • Loading branch information
Minotriz02 authored Jun 19, 2024
2 parents 74291ee + fbb164c commit 15d79be
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 105 deletions.
4 changes: 2 additions & 2 deletions src/src/components/navigationGroupBtns/NavigationGroupBtns.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function NavigationGroupBtns({
(noTooltip ? (
hasContentsWp && !monitoredData[i18n.language] ? (
<Button
className={`btn btn-primary text-white rounded-3 fw-medium d-flex align-items-center justify-content-between py-2 me-2 ${
className={`btn btn-primary text-white rounded-3 d-flex align-items-center justify-content-between me-2 ${
hasContentsWp ? "" : "disabled "
}`}
onClick={() => setShowWarning(true)}
Expand All @@ -182,7 +182,7 @@ function NavigationGroupBtns({
) : (
<Link
type="button"
className={`btn btn-primary text-white rounded-4 fw-medium d-flex align-items-center justify-content-between py-2 me-2 ${
className={`btn btn-primary text-white rounded-4 d-flex align-items-center justify-content-between me-2 ${
hasContentsWp ? "" : "disabled "
}`}
to={`/profile/${wpId}`}
Expand Down
100 changes: 47 additions & 53 deletions src/src/pages/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import { useParams, Link } from "react-router-dom";
import { useParams } from "react-router-dom";
import img404 from "../../assets/img/404.png";
import {
Button,
Expand Down Expand Up @@ -28,7 +28,6 @@ import {
IconBrandFacebook,
IconBrandX,
IconInfoCircleFilled,
IconCloudRain,
IconDownload,
} from "@tabler/icons-react";
import NavigationGroupBtns from "../../components/navigationGroupBtns/NavigationGroupBtns";
Expand All @@ -47,7 +46,6 @@ function HistoricalData() {
const [scaledDepthData, setScaledDepthData] = useState([]);
const [climaScaledDepthData, setClimaScaledDepthData] = useState([]);
const [rain, setRain] = useState([]);
const [climaRain, setClimaRain] = useState([]);
const [evap, setEvap] = useState([]);
const [value, setValue] = useState(null);
const [dataFilterByYearsToDownload, setDataFilterByYearsToDownload] =
Expand Down Expand Up @@ -146,7 +144,6 @@ function HistoricalData() {
});
setClimaDepthData(result[0]);
setClimaScaledDepthData(result[1]);
setClimaRain(result[2]);
}
}, [value]);

Expand Down Expand Up @@ -351,6 +348,13 @@ function HistoricalData() {
</div>
</Col>
<Col xs={6} className="d-flex justify-content-end">
<NavigationGroupBtns
forecast
profile
wp={wp}
wpId={wp.id}
positionTooltip="bottom"
/>
<OverlayTrigger
placement="bottom"
overlay={
Expand All @@ -360,19 +364,12 @@ function HistoricalData() {
<div>
<Button
onClick={downloadAllData}
className="rounded-4 mx-2"
className="rounded-4 me-2 h-100"
>
<IconDownload />
</Button>
</div>
</OverlayTrigger>
<NavigationGroupBtns
forecast
profile
wp={wp}
wpId={wp.id}
positionTooltip="bottom"
/>
<OverlayTrigger
placement="bottom"
overlay={
Expand All @@ -386,7 +383,7 @@ function HistoricalData() {
rootClose={true}
overlay={popoverShare}
>
<Button className="rounded-4">
<Button className="rounded-4 h-100">
<IconShare />
</Button>
</OverlayTrigger>
Expand Down Expand Up @@ -689,53 +686,50 @@ function HistoricalData() {
</Container>
<Container className="mb-2 mt-4">
<div className="d-flex align-items-center">
<NavigationGroupBtns
forecast
profile
wp={wp}
wpId={wp.id}
positionTooltip="bottom"
label
noTooltip
/>
<Button
className="me-2 rounded-4"
onClick={() => downloadAllData()}
>
<IconDownload className="me-2" />
{t("data.download")}
</Button>
<div className="d-flex align-items-center">
<NavigationGroupBtns
forecast
profile
wp={wp}
wpId={wp.id}
positionTooltip="bottom"
label
noTooltip
/>

<OverlayTrigger
trigger="click"
placement="right"
rootClose={true}
overlay={popoverShare}
>
<Button className="rounded-4 mb-2 mb-sm-0 me-2">
<IconShare className="me-2" />
{t("profile.share")}
</Button>
</OverlayTrigger>
<SubscriptionButton
idWater={idWp}
idUser={userInfo?.sub}
setShowToastSubscribe={setShowToastSubscribe}
setToastSuccess={setToastSuccess}
label
/>
<OverlayTrigger
placement="top"
overlay={
<Tooltip id={`tooltip-top`}>
{t("monitoring.subscription-info")}
</Tooltip>
}
>
<IconInfoCircleFilled />
</OverlayTrigger>
</div>
<OverlayTrigger
trigger="click"
placement="right"
rootClose={true}
overlay={popoverShare}
>
<Button className="rounded-4 mb-2 mb-sm-0 me-2">
<IconShare className="me-2" />
{t("profile.share")}
</Button>
</OverlayTrigger>
<SubscriptionButton
idWater={idWp}
idUser={userInfo?.sub}
setShowToastSubscribe={setShowToastSubscribe}
setToastSuccess={setToastSuccess}
label
/>
<OverlayTrigger
placement="top"
overlay={
<Tooltip id={`tooltip-top`}>
{t("monitoring.subscription-info")}
</Tooltip>
}
>
<IconInfoCircleFilled />
</OverlayTrigger>
</div>
</Container>
</>
Expand Down
46 changes: 20 additions & 26 deletions src/src/pages/forecast/forecast.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import { useParams, Link } from "react-router-dom";
import { useParams } from "react-router-dom";
import img404 from "../../assets/img/404.png";
import noDataImg from "../../assets/img/noSubscription.png";
import SubscriptionButton from "../../components/subscriptionButton/SubscriptionButton";
Expand All @@ -19,14 +19,10 @@ import {
Toast,
} from "react-bootstrap";
import {
IconDownload,
IconChartDonut,
IconShare,
IconBrandFacebook,
IconBrandX,
IconInfoCircleFilled,
IconInfoCircle,
IconCloudRain,
} from "@tabler/icons-react";
import ForecastItem from "../../components/forecastItem/ForecastItem";
import Services from "../../services/apiService";
Expand Down Expand Up @@ -231,25 +227,6 @@ function Forecast() {
wpId={wp.id}
positionTooltip="bottom"
/>

<OverlayTrigger
placement="bottom"
overlay={
<Tooltip id="subscription-tooltip">
{t("profile.subscribe-popup")}
</Tooltip>
}
>
<div>
<SubscriptionButton
idWater={idWp}
idUser={userInfo?.sub}
setShowToastSubscribe={setShowToastSubscribe}
setToastSuccess={setToastSuccess}
/>
</div>
</OverlayTrigger>

<OverlayTrigger
placement="bottom"
overlay={
Expand All @@ -265,12 +242,29 @@ function Forecast() {
rootClose={true}
overlay={popoverShare}
>
<Button className="rounded-4">
<Button className="rounded-4 h-100 me-2">
<IconShare />
</Button>
</OverlayTrigger>
</div>
</OverlayTrigger>
<OverlayTrigger
placement="bottom"
overlay={
<Tooltip id="subscription-tooltip">
{t("profile.subscribe-popup")}
</Tooltip>
}
>
<div>
<SubscriptionButton
idWater={idWp}
idUser={userInfo?.sub}
setShowToastSubscribe={setShowToastSubscribe}
setToastSuccess={setToastSuccess}
/>
</div>
</OverlayTrigger>
</div>
</Container>
</Row>
Expand Down Expand Up @@ -354,7 +348,7 @@ function Forecast() {
rootClose={true}
overlay={popoverShare}
>
<Button className="rounded-4 mb-2 mb-sm-0 me-3">
<Button className="rounded-4 mb-2 mb-sm-0 me-2">
<IconShare className="me-3" />
{t("profile.share")}
</Button>
Expand Down
46 changes: 22 additions & 24 deletions src/src/pages/profile/Profile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useParams } from "react-router-dom";
import img404 from "../../assets/img/404.png";
import bgImg from "../../assets/img/profilebg.jpg";
import L from "leaflet";
Expand Down Expand Up @@ -41,12 +41,10 @@ import Configuration from "../../conf/Configuration";

import {
IconDownload,
IconChartDonut,
IconShare,
IconBrandFacebook,
IconBrandX,
IconInfoCircleFilled,
IconCloudRain,
} from "@tabler/icons-react";
import SubscriptionButton from "../../components/subscriptionButton/SubscriptionButton";
import { useAuth } from "../../hooks/useAuth";
Expand Down Expand Up @@ -288,6 +286,8 @@ function Waterprofile() {
className="position-absolute z-3 d-flex "
style={{ top: "43%", right: "3vw" }}
>
<NavigationGroupBtns wp={wp} data forecast />

<OverlayTrigger
placement="top"
overlay={
Expand All @@ -303,25 +303,6 @@ function Waterprofile() {
<IconDownload />
</Button>
</OverlayTrigger>
<NavigationGroupBtns wp={wp} data forecast />
<OverlayTrigger
placement="top"
overlay={
<Tooltip id="subscription-tooltip">
{t("profile.subscribe-popup")}
</Tooltip>
}
>
<div>
<SubscriptionButton
idWater={idWater}
idUser={userInfo?.sub}
setShowToastSubscribe={setShowToastSubscribe}
setToastSuccess={setToastSuccess}
/>
</div>
</OverlayTrigger>

<OverlayTrigger
placement="top"
overlay={
Expand All @@ -335,12 +316,29 @@ function Waterprofile() {
rootClose={true}
overlay={popoverShare}
>
<Button className="rounded-4">
<Button className="rounded-4 me-2">
<IconShare />
</Button>
</OverlayTrigger>
</div>
</OverlayTrigger>
<OverlayTrigger
placement="top"
overlay={
<Tooltip id="subscription-tooltip">
{t("profile.subscribe-popup")}
</Tooltip>
}
>
<div>
<SubscriptionButton
idWater={idWater}
idUser={userInfo?.sub}
setShowToastSubscribe={setShowToastSubscribe}
setToastSuccess={setToastSuccess}
/>
</div>
</OverlayTrigger>
</div>
<Carousel
fade
Expand Down Expand Up @@ -617,14 +615,14 @@ function Waterprofile() {
</div>
<Container className="mb-2 mt-2 d-flex justify-content-between ">
<div className="d-flex align-items-center mb-2 mt-4">
<NavigationGroupBtns wp={wp} data forecast label noTooltip />
<Button
className="me-3 rounded-4 mb-2 mb-sm-0"
onClick={downloadProfileAsPdf}
>
<IconDownload className="me-3" />
{t("profile.download")}
</Button>
<NavigationGroupBtns wp={wp} data forecast label noTooltip />
<OverlayTrigger
trigger="click"
placement="right"
Expand Down

0 comments on commit 15d79be

Please sign in to comment.