Skip to content

Commit

Permalink
Remove unused deps, and small tsx warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TTalex committed Oct 31, 2023
1 parent 2640831 commit 8b57bd1
Show file tree
Hide file tree
Showing 30 changed files with 66 additions and 149 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/ChoiceModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useState, useEffect} from 'react'
import { Modal, Form, InputGroup, Button, Badge } from "react-bootstrap"
import { Modal, Form, InputGroup, Badge } from "react-bootstrap"

const ChoiceModal = (props: {
showModal: boolean,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/EditEmissionFactors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {useState, useEffect} from "react"
import { ProjectType, InputInventoryStep7, FuelType} from "../frontendTypes"
import {Table, Button, Badge, Form, Modal} from 'react-bootstrap'
import ChoiceModal from "./ChoiceModal"
import TdDiagonalBar from "./TdDiagonalBar"
import ValidSource from "./ValidSource"
import ItemWithOverlay from "./ItemWithOverlay"

Expand Down
83 changes: 37 additions & 46 deletions frontend/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,46 @@
import React from "react";
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';


const MyFooter = () => {
return (
<footer className="footer">
{/* <div className="container">
<Row>
<Col className=""> */}
<div className='partnerLine'>
<div className='group'>
<a href="https://commission.europa.eu/index_en" target="_blank">
<div className="img-wrapper">
<img src='/logos/logo-EU.png' className="logo-EU" alt="European Commission"></img>
</div>
</a>
<a href="https://www.afd.fr/en" target="_blank">
<div className="img-wrapper">
<img src='/logos/logo-AFD.png' className="logo-AFD" alt="AFD"></img>
</div>
</a>
</div>
<div className='group'>
<a href="https://www.ffem.fr/en" target="_blank">
<div className="img-wrapper">
<img src='/logos/logo-FFEM.png' className="logo-FFEM" alt="FFEM"></img>
</div>
</a>
<a href="https://www.ecologie.gouv.fr/en" target="_blank">
<div className="img-wrapper">
<img src='/logos/logo-MTE.png' className="logo-MTE" alt="Ministère de la transition écologique"></img>
</div>
</a>
</div>
<div className='group'>
<a href="https://www.bmz.de/en" target="_blank">
<div className="img-wrapper">
<img src='/logos/logo-FMECD.png' className="logo-FMECD" alt="BMZ"></img>
</div>
</a>
<a href="https://www.bmuv.de/en/" target="_blank">
<div className="img-wrapper">
<img src='/logos/logo-FMENCNSCP.png' className="logo-FMENCNSCP" alt="BMUV"></img>
</div>
</a>
</div>
<div className='partnerLine'>
<div className='group'>
<a href="https://commission.europa.eu/index_en" target="_blank" rel="noreferrer">
<div className="img-wrapper">
<img src='/logos/logo-EU.png' className="logo-EU" alt="European Commission"></img>
</div>
</a>
<a href="https://www.afd.fr/en" target="_blank" rel="noreferrer">
<div className="img-wrapper">
<img src='/logos/logo-AFD.png' className="logo-AFD" alt="AFD"></img>
</div>
</a>
</div>
<div className='group'>
<a href="https://www.ffem.fr/en" target="_blank" rel="noreferrer">
<div className="img-wrapper">
<img src='/logos/logo-FFEM.png' className="logo-FFEM" alt="FFEM"></img>
</div>
</a>
<a href="https://www.ecologie.gouv.fr/en" target="_blank" rel="noreferrer">
<div className="img-wrapper">
<img src='/logos/logo-MTE.png' className="logo-MTE" alt="Ministère de la transition écologique"></img>
</div>
</a>
</div>
<div className='group'>
<a href="https://www.bmz.de/en" target="_blank" rel="noreferrer">
<div className="img-wrapper">
<img src='/logos/logo-FMECD.png' className="logo-FMECD" alt="BMZ"></img>
</div>
</a>
<a href="https://www.bmuv.de/en/" target="_blank" rel="noreferrer">
<div className="img-wrapper">
<img src='/logos/logo-FMENCNSCP.png' className="logo-FMENCNSCP" alt="BMUV"></img>
</div>
{/* </Col>
</Row>
</div> */}
</a>
</div>
</div>
</footer>
);
};
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/ItemWithOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react"
import { useNavigate } from "react-router-dom"
import { OverlayTrigger, Tooltip } from 'react-bootstrap'

export default function ItemWithOverlay (props: {children: React.ReactNode, overlayContent: React.ReactNode}) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const MyNav = () => {
/* adrien : discriminate homepage nav */
const {pathname} = useLocation();
return (
<header className={pathname=="/" ? "homepage-header" : ""}>
<header className={pathname==="/" ? "homepage-header" : ""}>
<Container>
<Row className="justify-content-md-center">
<Col lg="12">
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/viz/EmissionsCompareBarChart.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, {useCallback, useState} from "react"
import React, {useCallback} from "react"
import { ProjectType } from "../../frontendTypes"
import { Bar, BarChart, LabelList, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
import { computePercentIncrease } from "../../utils/computePercentIncrease"
import { CSVLink } from "react-csv"
import { useCurrentPng } from "recharts-to-png"
import { saveAs } from 'file-saver'
import { Button, Col, Container, Row } from "react-bootstrap"
import { Button } from "react-bootstrap"

export default function EmissionsCompareBarChart (props: {
bauEmissionsData: {[key: string]: {co2: number[], energy: number[]}},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, {useCallback, useState} from "react"
import React, {useCallback} from "react"
import { ProjectType, TransportPerformance } from "../../frontendTypes"
import { Bar, BarChart, LabelList, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
import { computePercentIncrease } from "../../utils/computePercentIncrease"
import { CSVLink } from "react-csv"
import { useCurrentPng } from "recharts-to-png"
import { saveAs } from 'file-saver'
import { Button, Col, Row } from "react-bootstrap"
import { Button } from "react-bootstrap"

export default function EmissionsPerUkmCompareBarChart (props: {
title: string,
Expand Down
12 changes: 1 addition & 11 deletions frontend/src/components/viz/ModalShareCompareBarChart.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useCallback} from "react"
import { ProjectType, VehicleKilometresTravelledComputed } from "../../frontendTypes"
import { Bar, BarChart, LabelList, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
import { Button, Col, Row } from "react-bootstrap"
import { Button } from "react-bootstrap"
import { CSVLink } from "react-csv"
import { useCurrentPng } from "recharts-to-png"
import { saveAs } from 'file-saver'
Expand Down Expand Up @@ -125,13 +125,3 @@ const CustomLabel = (props: any) => {
</g>
);
}
const PercentLabel = (props: any) => {
const { x, width, value, className } = props
return (
<g className={className}>
<text x={x + width / 2} y={12} fontSize="12" fill="black" textAnchor="middle" dominantBaseline="middle">
{value}
</text>
</g>
);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, {useCallback, useState} from "react"
import React, {useCallback} from "react"
import { ProjectType, TransportPerformance } from "../../frontendTypes"
import { Bar, BarChart, LabelList, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
import { computePercentIncrease } from "../../utils/computePercentIncrease"
import { CSVLink } from "react-csv"
import { useCurrentPng } from "recharts-to-png"
import { saveAs } from 'file-saver'
import { Button, Col, Row } from "react-bootstrap"
import { Button } from "react-bootstrap"

export default function TransportPerformanceCompareBarChart (props: {
title: string,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/viz/VktCompareBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {useCallback} from "react"
import { ProjectType, VehicleKilometresTravelledComputed } from "../../frontendTypes"
import { Bar, BarChart, LabelList, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
import { computePercentIncrease } from "../../utils/computePercentIncrease"
import { Button, Col, Row } from "react-bootstrap"
import { Button } from "react-bootstrap"
import { CSVLink } from "react-csv"
import { useCurrentPng } from "recharts-to-png"
import { saveAs } from 'file-saver'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/BAU/BAUIntro.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import { Table, Container, Row, Col, Badge, OverlayTrigger, Tooltip } from 'react-bootstrap'
import { Table, Container, Row, Col, Badge } from 'react-bootstrap'
import { ProjectType} from '../../frontendTypes'

import '../Project.css'
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/pages/BAU/BAUStep1.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import {Table, Button, Badge, Modal, Form, Tabs, Tab, Alert} from 'react-bootstrap'
import {FuelType, InputBAUStep1, InputInventoryStep2, ProjectType} from '../../frontendTypes'
import {Table, Button, Badge, Modal, Tabs, Tab, Alert} from 'react-bootstrap'
import {InputBAUStep1, InputInventoryStep2, ProjectType} from '../../frontendTypes'
import ChoiceModal from '../../components/ChoiceModal'

import '../Project.css'
import DescAndNav from '../../components/DescAndNav'
import ValidSource from '../../components/ValidSource'
import TdDiagonalBar from '../../components/TdDiagonalBar'
import PercentInput from '../../components/PercentInput'
import ProjectStepContainerWrapper from '../../components/ProjectStepContainerWrapper'
import ItemWithOverlay from '../../components/ItemWithOverlay'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/BAU/BAUStep2.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import {Table, Button, Badge, Form, Tabs, Tab, Alert} from 'react-bootstrap'
import {Table, Button, Badge, Tabs, Tab, Alert} from 'react-bootstrap'
import {FuelType, InputBAUStep2, ProjectType} from '../../frontendTypes'
import ChoiceModal from '../../components/ChoiceModal'

Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/BAU/BAUStep5.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import {Button} from 'react-bootstrap'
import {EmissionsResults, InputInventoryStep7, ProjectType} from '../../frontendTypes'

import '../Project.css'
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/pages/Climate/ClimateIntro.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import { Table, Container, Row, Col, Badge, OverlayTrigger, Tooltip, Modal, Button, Dropdown } from 'react-bootstrap'
import { Table, Container, Row, Col, Badge, Modal, Button, Dropdown } from 'react-bootstrap'
import { ProjectType} from '../../frontendTypes'

import '../Project.css'
import DescAndNav from '../../components/DescAndNav'
import ChoiceModal from '../../components/ChoiceModal'
import Footer from "../../components/Footer"


Expand Down
4 changes: 1 addition & 3 deletions frontend/src/pages/Climate/ClimateWithUpstreamStep1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import {Table, Button, Badge, Modal, Form, Tabs, Tab, Alert} from 'react-bootstrap'
import {FuelType, InputClimateWithUpstreamStep1, InputInventoryStep2, ProjectType} from '../../frontendTypes'
import {InputClimateWithUpstreamStep1, ProjectType} from '../../frontendTypes'
import ChoiceModal from '../../components/ChoiceModal'

import '../Project.css'
import DescAndNav from '../../components/DescAndNav'
import ValidSource from '../../components/ValidSource'
import TdDiagonalBar from '../../components/TdDiagonalBar'
import PercentInput from '../../components/PercentInput'
import ProjectStepContainerWrapper from '../../components/ProjectStepContainerWrapper'
import ItemWithOverlay from '../../components/ItemWithOverlay'
import OutputNumberTd from '../../components/OutputNumberTd'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Climate/ClimateWithUpstreamStep3.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import {Table, Button, Badge, Form, Tabs, Tab, Alert} from 'react-bootstrap'
import {Table, Button, Badge, Tabs, Tab, Alert} from 'react-bootstrap'
import {FuelType, InputBAUStep2, InputClimateWithUpstreamStep1, ProjectType} from '../../frontendTypes'
import ChoiceModal from '../../components/ChoiceModal'

Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/Climate/ClimateWithUpstreamStep5.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import { Button, Modal} from 'react-bootstrap'
import {EmissionsResults, InputInventoryStep7, ProjectType} from '../../frontendTypes'

import '../Project.css'
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/pages/Climate/ClimateWithoutUpstreamStep5.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import {Table, Button, Badge, Form, Tabs, Tab, Alert} from 'react-bootstrap'
import {Table, Button, Badge, Tabs, Tab, Alert} from 'react-bootstrap'
import {FuelType, InputBAUStep2, InputClimateWithoutUpstreamStep1, InputClimateWithoutUpstreamStep2, InputClimateWithoutUpstreamStep3, InputClimateWithoutUpstreamStep4, InputInventoryStep1, InputInventoryStep6, InputInventoryStep8, ProjectType, VehicleStats} from '../../frontendTypes'
import ChoiceModal from '../../components/ChoiceModal'

Expand Down Expand Up @@ -172,9 +172,6 @@ export default function ClimateWithoutUpstreamStep5(){
.then(() => navigate('/project/' + projectId + '/Climate/' + climateScenarioId + '/Without/step/' + (stepNumber + 1)));
}
const inputInventoryStep1 : InputInventoryStep1 = project.stages?.Inventory[0].steps?.[1] || {}
const isVtypeFreight = (vtype: string) => {
return inputInventoryStep1.vtypes[vtype].type === "freight"
}
const inputClimateWithoutUpstreamStep1 : InputClimateWithoutUpstreamStep1 = project.stages?.Climate[climateScenarioId].steps?.[1]
const inputClimateWithoutUpstreamStep2 : InputClimateWithoutUpstreamStep2 = project.stages?.Climate[climateScenarioId].steps?.[2]
const inputClimateWithoutUpstreamStep3 : InputClimateWithoutUpstreamStep3 = project.stages?.Climate[climateScenarioId].steps?.[3]
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/pages/Climate/ClimateWithoutUpstreamStep7.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import {Badge, Button, Dropdown} from 'react-bootstrap'
import {EmissionsResults, InputInventoryStep7, ProjectType} from '../../frontendTypes'

import '../Project.css'
Expand All @@ -10,7 +9,6 @@ import ProjectStepContainerWrapper from '../../components/ProjectStepContainerWr
import EmissionsTable from '../../components/viz/EmissionsTable'
import EmissionsBarChart from '../../components/viz/EmissionsBarChart'
import EditEmissionFactors from '../../components/EditEmissionFactors'
import ChoiceModal from '../../components/ChoiceModal'
import TTWorWTWSelector from '../../components/TTWorWTWSelector'

export default function ClimateWithUpstreamStep7(){
Expand Down
10 changes: 1 addition & 9 deletions frontend/src/pages/CreateProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import React, {useState, useMemo, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { Navigate, useNavigate, useParams } from 'react-router-dom'
import countryList from 'react-select-country-list'
import { Button, Container, Row, Col, Form, InputGroup, OverlayTrigger, Tooltip, Badge, ButtonGroup } from 'react-bootstrap'
import { Button, Row, Col, Form, InputGroup, Badge } from 'react-bootstrap'
import { Typeahead } from 'react-bootstrap-typeahead'
import 'react-bootstrap-typeahead/css/Typeahead.css'
import { ProjectType } from '../frontendTypes'
import ChoiceModal from '../components/ChoiceModal'
import ProjectNav from '../components/ProjectNav'
import Footer from "../components/Footer"

export default function CreateProject(props : {project: ProjectType}) {
const navigate = useNavigate();
Expand All @@ -20,7 +18,6 @@ export default function CreateProject(props : {project: ProjectType}) {
const [ partnerLocation, setPartnerLocation ] = useState("")
const [ projectArea, setProjectArea ] = useState("")
const [ projectReferenceYears, setProjectReferenceYears ] = useState(["2020","2025","2030","2035","2040","2050"])
const [ geoData, setGeoData ] = useState("")
const [ isSump, setIsSump ] = useState(true)
const [validated, setValidated] = useState(false)
const [ createWarning, setCreateWarning ] = useState(false)
Expand Down Expand Up @@ -151,11 +148,6 @@ export default function CreateProject(props : {project: ProjectType}) {
});
}
}
const referenceYearTooltip = (props:any) => (
<Tooltip id="button-tooltip" {...props}>
You can choose the year of reference based on your needs
</Tooltip>
);
const setProjectReferenceYear = (index: number, year: string) => {
setProjectReferenceYears((prevProjectReferenceYears) => {
return prevProjectReferenceYears.map((e,i) => i === index ? year : e)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Inventory/InventoryIntro.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import { Table, Container, Row, Col, Badge, OverlayTrigger, Tooltip } from 'react-bootstrap'
import { Table, Container, Row, Col, Badge } from 'react-bootstrap'
import { ProjectType} from '../../frontendTypes'

import '../Project.css'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Inventory/InventoryStep1.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useState, useEffect} from 'react'
import { useKeycloak } from "@react-keycloak/web"
import { useParams, useNavigate } from "react-router-dom"
import {Table, Button, Badge, Modal, Alert, Stack} from 'react-bootstrap'
import {Table, Button, Badge, Modal, Alert} from 'react-bootstrap'
import {FuelType, InputInventoryStep1, ProjectType} from '../../frontendTypes'
import ChoiceModal from '../../components/ChoiceModal'

Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/Inventory/InventoryStep5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import DescAndNav from '../../components/DescAndNav'
import ValidSource from '../../components/ValidSource'
import ProjectStepContainerWrapper from '../../components/ProjectStepContainerWrapper'
import ItemWithOverlay from '../../components/ItemWithOverlay'
import EditEmissionFactors from '../../components/EditEmissionFactors'
import OutputNumberTd from '../../components/OutputNumberTd'

export default function InventoryStep5(){
Expand Down
Loading

0 comments on commit 8b57bd1

Please sign in to comment.