Skip to content

Commit

Permalink
Restore interval dropdown (#220)
Browse files Browse the repository at this point in the history
Was accidentally removed
  • Loading branch information
Erikvv authored Jan 22, 2025
1 parent 2b5a6f3 commit 754eb4f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {FunctionComponent} from "react"
import {Dropdown} from "primereact/dropdown"
import {isoStringToDateTimeUnit, dateTimeUnitToIsoString} from "zero-zummon"
import {SelectItem, SelectItemOptionsType} from "primereact/selectitem"

const options: SelectItemOptionsType = [
{
value: "PT15M",
label: "Kwartier",
},
{
value: "P1D",
label: "Dag",
},
{
value: "P1M",
label: "Maand",
},
]

export const IntervalDropdown: FunctionComponent<{
timeStep: any,
setTimeStep: (timeStep: any) => void
}> = ({timeStep, setTimeStep}) => {

return (
<Dropdown options={options} value={dateTimeUnitToIsoString(timeStep)} onChange={event => setTimeStep(isoStringToDateTimeUnit(event.value))}/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {LabelRow} from "../generic/label-row"
import {displayTimeZone, kotlinInstantToJsJodaInstant, prettyPrint} from "./time-series-util"
import {Dropdown} from "primereact/dropdown"
import {InputText} from "primereact/inputtext"
import {IntervalDropdown} from "./interval-dropdown"

const placeholder = `
bijvoorbeeld:
Expand Down Expand Up @@ -50,6 +51,9 @@ export const TimeSeriesTextarea: FunctionComponent<{timeSeries: TimeSeries, setT
<LabelRow label="Tijdzone">
<Dropdown options={[{ label: 'Nederlandse tijd', value: displayTimeZone }]} value={displayTimeZone}/>
</LabelRow>
<LabelRow label="Meetinterval">
<IntervalDropdown timeStep={internalTimeSeries.timeStep} setTimeStep={timeStep => setTimeSeriesImpl(internalTimeSeries.withTimeStep(timeStep))} />
</LabelRow>
<LabelRow label="Plak hier de waarden in kWh">
<InputTextarea
id="values"
Expand Down

0 comments on commit 754eb4f

Please sign in to comment.