LoopChartActionBar verhält sich jetzt wie im ISO-Modal: Bei Auswahl „Meldungen“

This commit is contained in:
ISA
2025-08-11 13:08:34 +02:00
parent 806eaaeff7
commit 8d1b5ceddc
7 changed files with 137 additions and 84 deletions

View File

@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_EXPORT_STATIC=false
NEXT_PUBLIC_USE_CGI=false NEXT_PUBLIC_USE_CGI=false
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.684 NEXT_PUBLIC_APP_VERSION=1.6.685
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_EXPORT_STATIC=true
NEXT_PUBLIC_USE_CGI=true NEXT_PUBLIC_USE_CGI=true
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.684 NEXT_PUBLIC_APP_VERSION=1.6.685
NEXT_PUBLIC_CPL_MODE=production NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,8 @@
## [1.6.685] 2025-08-11
- Daten von 118. in mocks geholt
---
## [1.6.684] 2025-08-11 ## [1.6.684] 2025-08-11
- fix: KVZ Button style wie die anderen (ISO, RSL, TDR) und mit eigene Modal - fix: KVZ Button style wie die anderen (ISO, RSL, TDR) und mit eigene Modal

View File

@@ -6,7 +6,15 @@ import { RootState } from "@/redux/store";
import { setVonDatum, setBisDatum } from "@/redux/slices/dateRangePickerSlice"; import { setVonDatum, setBisDatum } from "@/redux/slices/dateRangePickerSlice";
import "react-datepicker/dist/react-datepicker.css"; import "react-datepicker/dist/react-datepicker.css";
const DateRangePicker: React.FC = () => { interface DateRangePickerProps {
compact?: boolean; // reduziert horizontale Breite
className?: string;
}
const DateRangePicker: React.FC<DateRangePickerProps> = ({
compact = false,
className = "",
}) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const reduxVonDatum = useSelector( const reduxVonDatum = useSelector(
@@ -38,10 +46,22 @@ const DateRangePicker: React.FC = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [dispatch, reduxVonDatum, reduxBisDatum]); }, [dispatch, reduxVonDatum, reduxBisDatum]);
const gapClass = compact ? "space-x-2" : "space-x-4";
const labelWidthClass = compact ? "w-6" : "w-auto";
const inputWidthClass = compact ? "w-32" : "w-44"; // ca. 128px vs 176px
return ( return (
<div className="flex space-x-4 items-center"> <div className={`flex ${gapClass} items-center ${className}`}>
<div className="flex items-center space-x-2"> <div
<label className="block text-sm font-semibold">Von</label> className={`flex items-center space-x-1 ${compact ? "text-xs" : ""}`}
>
<label
className={`block font-semibold ${
compact ? "text-xs" : "text-sm"
} ${labelWidthClass}`}
>
Von
</label>
<DatePicker <DatePicker
selected={reduxVonDatum ? parseISODate(reduxVonDatum) : thirtyDaysAgo} selected={reduxVonDatum ? parseISODate(reduxVonDatum) : thirtyDaysAgo}
onChange={(date) => { onChange={(date) => {
@@ -57,12 +77,21 @@ const DateRangePicker: React.FC = () => {
minDate={sixMonthsAgo} minDate={sixMonthsAgo}
maxDate={today} maxDate={today}
dateFormat="dd.MM.yyyy" dateFormat="dd.MM.yyyy"
className="border px-2 py-1 rounded" className={`border px-2 py-1 rounded ${inputWidthClass} ${
compact ? "text-xs" : "text-sm"
}`}
/> />
</div> </div>
<div
<div className="flex items-center space-x-2"> className={`flex items-center space-x-1 ${compact ? "text-xs" : ""}`}
<label className="block text-sm font-semibold">Bis</label> >
<label
className={`block font-semibold ${
compact ? "text-xs" : "text-sm"
} ${labelWidthClass}`}
>
Bis
</label>
<DatePicker <DatePicker
selected={reduxBisDatum ? parseISODate(reduxBisDatum) : today} selected={reduxBisDatum ? parseISODate(reduxBisDatum) : today}
onChange={(date) => { onChange={(date) => {
@@ -78,7 +107,9 @@ const DateRangePicker: React.FC = () => {
minDate={sixMonthsAgo} minDate={sixMonthsAgo}
maxDate={today} maxDate={today}
dateFormat="dd.MM.yyyy" dateFormat="dd.MM.yyyy"
className="border px-2 py-1 rounded" className={`border px-2 py-1 rounded ${inputWidthClass} ${
compact ? "text-xs" : "text-sm"
}`}
/> />
</div> </div>
</div> </div>

View File

@@ -214,7 +214,7 @@ const LoopChartActionBar: React.FC = () => {
}; };
return ( return (
<div className="flex justify-between items-center p-2 bg-gray-100 rounded-lg space-x-2"> <div className="flex justify-between p-1 bg-gray-100 rounded-lg ">
<div className="flex items-center"> <div className="flex items-center">
<label className="text-sm font-semibold"> <label className="text-sm font-semibold">
{slotNumber !== null ? slotNumber + 1 : "-"} {slotNumber !== null ? slotNumber + 1 : "-"}
@@ -222,65 +222,79 @@ const LoopChartActionBar: React.FC = () => {
</div> </div>
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<DateRangePicker /> {/* DateRangePicker wie bei ISO nur sichtbar bei Messkurve */}
<div
<Listbox style={{
value={selectedMode} visibility: chartTitle === "Messkurve" ? "visible" : "hidden",
onChange={(value) => {
dispatch(setSelectedMode(value));
dispatch(setBrushRange({ startIndex: 0, endIndex: 0 }));
}} }}
> >
<div className="relative w-48"> <DateRangePicker compact />
<Listbox.Button className="w-full border px-3 py-1 rounded text-left bg-white flex justify-between items-center text-sm"> </div>
<span>
{ {/* DIA0/DIA1/DIA2 Dropdown nur sichtbar bei Messkurve */}
{ <div
DIA0: "Alle Messwerte", style={{
DIA1: "Stündliche Werte", visibility: chartTitle === "Messkurve" ? "visible" : "hidden",
DIA2: "Tägliche Werte", }}
}[selectedMode] >
} <Listbox
</span> value={selectedMode}
<svg onChange={(value) => {
className="w-5 h-5 text-gray-400" dispatch(setSelectedMode(value));
viewBox="0 0 20 20" dispatch(setBrushRange({ startIndex: 0, endIndex: 0 }));
fill="currentColor" }}
> >
<path <div className="relative w-48">
fillRule="evenodd" <Listbox.Button className="w-full border px-3 py-1 rounded text-left bg-white flex justify-between items-center text-sm">
d="M5.23 7.21a.75.75 0 011.06.02L10 10.585l3.71-3.355a.75.75 0 111.02 1.1l-4.25 3.85a.75.75 0 01-1.02 0l-4.25-3.85a.75.75 0 01.02-1.06z" <span>
clipRule="evenodd"
/>
</svg>
</Listbox.Button>
<Listbox.Options className="absolute z-50 mt-1 w-full border rounded bg-white shadow max-h-60 overflow-auto text-sm">
{["DIA0", "DIA1", "DIA2"].map((mode) => (
<Listbox.Option
key={mode}
value={mode}
className={({ selected, active }) =>
`px-4 py-1 cursor-pointer ${
selected
? "bg-littwin-blue text-white"
: active
? "bg-gray-200"
: ""
}`
}
>
{ {
{ {
DIA0: "Alle Messwerte", DIA0: "Alle Messwerte",
DIA1: "Stündliche Werte", DIA1: "Stündliche Werte",
DIA2: "Tägliche Werte", DIA2: "Tägliche Werte",
}[mode] }[selectedMode]
} }
</Listbox.Option> </span>
))} <svg
</Listbox.Options> className="w-5 h-5 text-gray-400"
</div> viewBox="0 0 20 20"
</Listbox> fill="currentColor"
>
<path
fillRule="evenodd"
d="M5.23 7.21a.75.75 0 011.06.02L10 10.585l3.71-3.355a.75.75 0 111.02 1.1l-4.25 3.85a.75.75 0 01-1.02 0l-4.25-3.85a.75.75 0 01.02-1.06z"
clipRule="evenodd"
/>
</svg>
</Listbox.Button>
<Listbox.Options className="absolute z-50 mt-1 w-full border rounded bg-white shadow max-h-60 overflow-auto text-sm">
{["DIA0", "DIA1", "DIA2"].map((mode) => (
<Listbox.Option
key={mode}
value={mode}
className={({ selected, active }) =>
`px-4 py-1 cursor-pointer ${
selected
? "bg-littwin-blue text-white"
: active
? "bg-gray-200"
: ""
}`
}
>
{
{
DIA0: "Alle Messwerte",
DIA1: "Stündliche Werte",
DIA2: "Tägliche Werte",
}[mode]
}
</Listbox.Option>
))}
</Listbox.Options>
</div>
</Listbox>
</div>
{/* Dropdown für Messkurve / Meldungen (wie ISO) */} {/* Dropdown für Messkurve / Meldungen (wie ISO) */}
<Listbox <Listbox
value={chartTitle} value={chartTitle}
@@ -325,24 +339,27 @@ const LoopChartActionBar: React.FC = () => {
</div> </div>
</Listbox> </Listbox>
{/* Buttons nur bei Messkurve sichtbar */} {/* Buttons nur sichtbar bei Messkurve, Platz bleibt erhalten */}
{chartTitle === "Messkurve" && ( <div
<> style={{
<button visibility: chartTitle === "Messkurve" ? "visible" : "hidden",
onClick={handleStartRSL} }}
className="px-4 py-1 bg-littwin-blue text-white rounded text-sm whitespace-nowrap" className="flex items-center space-x-2"
disabled={isLoading} >
> <button
RSL starten onClick={handleStartRSL}
</button> className="px-4 py-1 bg-littwin-blue text-white rounded text-sm whitespace-nowrap"
<button disabled={isLoading}
onClick={handleFetchData} >
className="px-4 py-1 bg-littwin-blue text-white rounded text-sm whitespace-nowrap" RSL starten
> </button>
Daten laden <button
</button> onClick={handleFetchData}
</> className="px-4 py-1 bg-littwin-blue text-white rounded text-sm whitespace-nowrap"
)} >
Daten laden
</button>
</div>
</div> </div>
</div> </div>
); );

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.684", "version": "1.6.685",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.684", "version": "1.6.685",
"dependencies": { "dependencies": {
"@fontsource/roboto": "^5.1.0", "@fontsource/roboto": "^5.1.0",
"@headlessui/react": "^2.2.4", "@headlessui/react": "^2.2.4",

View File

@@ -1,6 +1,6 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.684", "version": "1.6.685",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",