-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into production
- Loading branch information
Showing
30 changed files
with
2,283 additions
and
3,689 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,12 @@ | ||
import 'leaflet/dist/leaflet.css' | ||
import React, {createElement as h, useState} from 'react' | ||
import './App.css' | ||
import {AggregatedAreaData} from './components/aggregated-area-data' | ||
import {AnyLogic} from './components/any-logic' | ||
import {BuurtPicker} from './components/buurt-picker' | ||
import {MainMap} from './components/main-map' | ||
import {PandDataDisplay} from './components/pand-display' | ||
import {useApp} from './services/appState' | ||
import {assertDefined} from './services/util' | ||
import {Buurt} from './services/wijkenbuurten/buurten' | ||
import {ZeroLayout} from "./components/zero-layout" | ||
|
||
function App() { | ||
const appHook = useApp() | ||
const {setGeometry, getPandData, bag2dPanden} = appHook | ||
|
||
const [currentPandId, setCurrentPandId] = useState('') | ||
|
||
const [buurt, setBuurt] = useState<Buurt | undefined>() | ||
import React, {FunctionComponent} from 'react' | ||
import {ZeroHeader} from "./components/zero-header"; | ||
import {Outlet} from "react-router-dom"; | ||
|
||
export const App: FunctionComponent = () => { | ||
return ( | ||
<ZeroLayout subtitle="Simuleer je buurt"> | ||
{/* Three-column layout*/} | ||
<div style={{display: "flex"}}> | ||
<div style={{width: '20rem', padding: '1rem', paddingTop: '5rem'}}> | ||
{h(AggregatedAreaData, {appHook: appHook})} | ||
<BuurtPicker onSelectBuurt={buurt => { | ||
setBuurt(buurt) | ||
setGeometry(buurt.geometry) | ||
}}/> | ||
</div> | ||
<div style={{ | ||
height: '100vh', | ||
flexGrow: 1, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
}}> | ||
<MainMap bag2dPanden={bag2dPanden} | ||
setGeometry={setGeometry} | ||
setCurrentPandId={setCurrentPandId} | ||
buurt={buurt} /> | ||
<AnyLogic appHook={appHook}/> | ||
</div> | ||
<div style={{width: '20rem', padding: '1rem'}}> | ||
{currentPandId && getPandData(currentPandId) && | ||
<PandDataDisplay pandData={assertDefined(getPandData(currentPandId))}/>} | ||
</div> | ||
</div> | ||
</ZeroLayout> | ||
) | ||
} | ||
|
||
export default App | ||
<> | ||
<ZeroHeader /> | ||
<Outlet /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import {FunctionComponent} from "react" | ||
import {useNavigate} from "react-router-dom" | ||
import {Button} from "primereact/button" | ||
import { SiMicrosoftexcel } from "react-icons/si"; | ||
import {PiMicrosoftExcelLogoFill} from "react-icons/pi" | ||
|
||
export const ImportExcelButton: FunctionComponent = () => { | ||
const navigate = useNavigate() | ||
|
||
return ( | ||
<Button onClick={() => navigate("/admin/import-excel")} aria-label="Importeer Excel"> | ||
<SiMicrosoftexcel /> | ||
<Button onClick={() => navigate("/admin/import-excel")} aria-label="Importeer Excel" style={{padding: "0 1em"}}> | ||
<PiMicrosoftExcelLogoFill size="1.6rem" /> | ||
| ||
Importeer Excel | ||
</Button> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 26 additions & 28 deletions
54
frontend/src/components/company-survey-v2/generic/label-row.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
import {css} from '@emotion/react' | ||
import {PropsWithChildren} from 'react' | ||
import {FunctionComponent, PropsWithChildren} from "react" | ||
import {flash} from '../flash' | ||
|
||
export const LabelRow = ({label, children}: PropsWithChildren<{label: any}>) => { | ||
return ( | ||
<label css={[css` | ||
display: flex; | ||
`, flash]}> | ||
<div css={css` | ||
text-align: right; | ||
width: 50%; | ||
padding: 0.3rem; | ||
export const LabelRow: FunctionComponent<PropsWithChildren<{ label: any }>> = ({label, children}) => ( | ||
<label css={[css` | ||
display: flex; | ||
`, flash]}> | ||
<div css={css` | ||
text-align: right; | ||
width: 50%; | ||
padding: 0.3rem; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
`}> | ||
{label} | ||
</div> | ||
<div css={css` | ||
width: 50%; | ||
padding: 0.3rem; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
`}> | ||
{label} | ||
</div> | ||
<div css={css` | ||
width: 50%; | ||
padding: 0.3rem; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
`}> | ||
{children} | ||
</div> | ||
</label> | ||
) | ||
} | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
`}> | ||
{children} | ||
</div> | ||
</label> | ||
) |
41 changes: 41 additions & 0 deletions
41
frontend/src/components/company-survey-v2/time-series/time-series-electricity.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {targetYear} from "./time-series-util" | ||
import {TimeSeriesTextareaAdapter} from "./time-series-textarea-adapter" | ||
import {FunctionComponent} from "react" | ||
import {UseFormReturn} from "react-hook-form" | ||
import {TimeSeriesType} from "zero-zummon" | ||
|
||
export const TimeSeriesElectricity: FunctionComponent<{form: UseFormReturn, prefix: string}> = ({form, prefix}) => { | ||
return ( | ||
<> | ||
<h2>2. Kwartierwaarden electriciteit</h2> | ||
|
||
<p>Richtlijnen</p> | ||
|
||
<ul> | ||
<li>Geef waarden op van het gehele jaar {targetYear}.</li> | ||
<li>De eerste waarde betreft het verbruik in het kwartier van 1 januari {targetYear} van 00:00 | ||
tot 00:15 CET. | ||
</li> | ||
<li>De laatste waarde betreft het verbruik in het kwartier van 31 december {targetYear} 23:45 | ||
tot 1 januari {targetYear + 1} om 00:00 CET. | ||
</li> | ||
<li>Een langere periode mag.</li> | ||
</ul> | ||
<h3>Kwartierwaarden levering</h3> | ||
<TimeSeriesTextareaAdapter | ||
timeSeries={form.watch(`${prefix}.quarterHourlyDelivery_kWh`)} | ||
timeSeriesType={TimeSeriesType.ELECTRICITY_DELIVERY} | ||
setTimeSeries={timeSeries => form.setValue(`${prefix}.quarterHourlyDelivery_kWh`, timeSeries)} /> | ||
<h3>Kwartierwaarden teruglevering</h3> | ||
<TimeSeriesTextareaAdapter | ||
timeSeries={form.watch(`${prefix}.quarterHourlyFeedIn_kWh`)} | ||
timeSeriesType={TimeSeriesType.ELECTRICITY_FEED_IN} | ||
setTimeSeries={timeSeries => form.setValue(`${prefix}.quarterHourlyFeedIn_kWh`, timeSeries)} /> | ||
<h3>Kwartierwaarden brutoproductiemeter</h3> | ||
<TimeSeriesTextareaAdapter | ||
timeSeries={form.watch(`${prefix}.quarterHourlyProduction_kWh`)} | ||
timeSeriesType={TimeSeriesType.ELECTRICITY_PRODUCTION} | ||
setTimeSeries={timeSeries => form.setValue(`${prefix}.quarterHourlyProduction_kWh`, timeSeries)} /> | ||
</> | ||
) | ||
} |
27 changes: 27 additions & 0 deletions
27
frontend/src/components/company-survey-v2/time-series/time-series-textarea-adapter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {FunctionComponent} from "react" | ||
import {targetYear} from "./time-series-util" | ||
import {TimeSeries, TimeSeriesType, timeSeriesFromJson, createEmptyTimeSeriesForYear} from "zero-zummon" | ||
import {TimeSeriesTextarea} from "./time-series-textarea" | ||
|
||
/** | ||
* Has a plain JS object as input and output. | ||
* Converts that objects to a {@link TimeSeries} domain object for use in {@link TimeSeriesTextarea} | ||
*/ | ||
export const TimeSeriesTextareaAdapter: FunctionComponent<{ | ||
timeSeries?: any, | ||
timeSeriesType?: TimeSeriesType, | ||
setTimeSeries?: (obj: any) => void | ||
}> = ({ | ||
timeSeries, | ||
timeSeriesType = TimeSeriesType.ELECTRICITY_DELIVERY, | ||
setTimeSeries = console.log, | ||
}) => { | ||
const timeSeriesDomainObject = timeSeries ? timeSeriesFromJson(JSON.stringify(timeSeries)) : createEmptyTimeSeriesForYear(timeSeriesType, targetYear) | ||
|
||
return ( | ||
<TimeSeriesTextarea | ||
timeSeries={timeSeriesDomainObject} setTimeSeries={(timeSeries: TimeSeries) => { | ||
setTimeSeries(JSON.parse(timeSeries.toJson())) | ||
}} /> | ||
) | ||
} |
Oops, something went wrong.