feat: MUI test
This commit is contained in:
@@ -41,7 +41,6 @@ export const useIsoChartLoader = () => {
|
||||
)};${formatDate(bisDatum)};${slotNumber};${type};`;
|
||||
}
|
||||
|
||||
console.log("API URL:", url);
|
||||
return url;
|
||||
};
|
||||
|
||||
@@ -143,19 +142,10 @@ export const useIsoDataLoader = () => {
|
||||
const waitTime = Math.max(0, MIN_LOADING_TIME_MS - elapsedTime);
|
||||
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
||||
|
||||
console.log("▶️ Automatisches Laden - Isolationswiderstand-Daten für:");
|
||||
console.log(" Slot:", slotNumber);
|
||||
console.log(" Modus:", selectedMode);
|
||||
console.log(" Von:", vonDatum);
|
||||
console.log(" Bis:", bisDatum);
|
||||
|
||||
if (Array.isArray(jsonData) && jsonData.length > 0) {
|
||||
dispatch(setIsoMeasurementCurveChartData(jsonData));
|
||||
dispatch(setChartOpen(true));
|
||||
} else {
|
||||
console.log(
|
||||
"⚠️ Keine Messdaten im gewählten Zeitraum gefunden (automatisches Laden)"
|
||||
);
|
||||
dispatch(setIsoMeasurementCurveChartData([]));
|
||||
dispatch(setChartOpen(false));
|
||||
}
|
||||
@@ -170,8 +160,6 @@ export const useIsoDataLoader = () => {
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------IsoChartActionBar
|
||||
// ...existing code...
|
||||
|
||||
const IsoChartActionBar = forwardRef((_props, ref) => {
|
||||
IsoChartActionBar.displayName = "IsoChartActionBar";
|
||||
const dispatch = useAppDispatch();
|
||||
@@ -281,33 +269,36 @@ const IsoChartActionBar = forwardRef((_props, ref) => {
|
||||
}
|
||||
};
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
handleFetchData,
|
||||
}));
|
||||
useImperativeHandle(ref, () => ({ handleFetchData }));
|
||||
|
||||
const hiddenWhenMeldungen = chartTitle !== "Messkurve";
|
||||
|
||||
return (
|
||||
<div className="flex justify-between items-center p-2 bg-gray-100 rounded-lg space-x-2">
|
||||
<div className="flex items-center">
|
||||
<label className="text-sm font-semibold">
|
||||
KÜ {slotNumber !== null ? slotNumber + 1 : "-"}
|
||||
</label>
|
||||
<div className="toolbar w-full justify-between flex-wrap">
|
||||
<div className="flex items-center gap-2 pr-4">
|
||||
<span className=" font-semibold uppercase tracking-wide text-muted">
|
||||
KÜ
|
||||
</span>
|
||||
<span className=" font-medium px-2 py-0.5 rounded bg-surface-alt border border-base min-w-[3rem] text-center">
|
||||
{slotNumber !== null ? slotNumber + 1 : "-"}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center space-x-2">
|
||||
{/* DateRangePicker – für beide Ansichten sichtbar, da Meldungen auch datumsabhängig sind */}
|
||||
<div className="flex items-center gap-2 flex-1 justify-end">
|
||||
<div
|
||||
style={{
|
||||
visibility: chartTitle === "Messkurve" ? "visible" : "hidden",
|
||||
}}
|
||||
className={
|
||||
hiddenWhenMeldungen
|
||||
? "opacity-0 pointer-events-none"
|
||||
: "opacity-100"
|
||||
}
|
||||
>
|
||||
<DateRangePicker />
|
||||
</div>
|
||||
|
||||
{/* DIA0-DIA2 Dropdown - Platz reservieren, aber ausblenden wenn Meldungen */}
|
||||
<div
|
||||
style={{
|
||||
visibility: chartTitle === "Messkurve" ? "visible" : "hidden",
|
||||
}}
|
||||
className={`transition-opacity ${
|
||||
hiddenWhenMeldungen
|
||||
? "opacity-0 pointer-events-none"
|
||||
: "opacity-100"
|
||||
}`}
|
||||
>
|
||||
<Listbox
|
||||
value={selectedMode}
|
||||
@@ -317,39 +308,29 @@ const IsoChartActionBar = forwardRef((_props, ref) => {
|
||||
}}
|
||||
>
|
||||
<div className="relative w-48">
|
||||
<Listbox.Button className="w-full border px-3 py-1 rounded text-left bg-white flex justify-between items-center text-sm">
|
||||
<span>
|
||||
<Listbox.Button className="dropdown-surface w-full flex items-center justify-between">
|
||||
<span className="dropdown-text-fix">
|
||||
{
|
||||
{
|
||||
DIA0: "Alle Messwerte",
|
||||
DIA1: "Stündliche Werte",
|
||||
DIA2: "Tägliche Werte",
|
||||
DIA1: "Stündlich",
|
||||
DIA2: "Täglich",
|
||||
}[selectedMode]
|
||||
}
|
||||
</span>
|
||||
<svg
|
||||
className="w-5 h-5 text-gray-400"
|
||||
viewBox="0 0 20 20"
|
||||
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>
|
||||
<i className="bi bi-chevron-down opacity-70" />
|
||||
</Listbox.Button>
|
||||
<Listbox.Options className="absolute z-50 mt-1 w-full border rounded bg-white shadow max-h-60 overflow-auto text-sm">
|
||||
<Listbox.Options className="dropdown-options absolute z-50 mt-1 w-full max-h-60 overflow-auto ">
|
||||
{["DIA0", "DIA1", "DIA2"].map((mode) => (
|
||||
<Listbox.Option
|
||||
key={mode}
|
||||
value={mode}
|
||||
className={({ selected, active }) =>
|
||||
`px-4 py-1 cursor-pointer ${
|
||||
`px-3 py-1.5 cursor-pointer rounded-sm m-0.5 ${
|
||||
selected
|
||||
? "bg-littwin-blue text-white"
|
||||
? "dropdown-option-active"
|
||||
: active
|
||||
? "bg-gray-200"
|
||||
? "dropdown-option-hover"
|
||||
: ""
|
||||
}`
|
||||
}
|
||||
@@ -357,9 +338,9 @@ const IsoChartActionBar = forwardRef((_props, ref) => {
|
||||
{
|
||||
{
|
||||
DIA0: "Alle Messwerte",
|
||||
DIA1: "Stündliche Werte",
|
||||
DIA2: "Tägliche Werte",
|
||||
}[mode]
|
||||
DIA1: "Stündlich",
|
||||
DIA2: "Täglich",
|
||||
}[mode as "DIA0" | "DIA1" | "DIA2"]
|
||||
}
|
||||
</Listbox.Option>
|
||||
))}
|
||||
@@ -367,17 +348,12 @@ const IsoChartActionBar = forwardRef((_props, ref) => {
|
||||
</div>
|
||||
</Listbox>
|
||||
</div>
|
||||
|
||||
{/* Dropdown für Auswahl zwischen "Messkurve" und "Meldungen" - immer anzeigen */}
|
||||
{/* Dropdown für Auswahl zwischen "Messkurve" und "Meldungen" entfernt */}
|
||||
|
||||
{/* Daten laden Button – lädt je nach Ansicht Messkurve oder Meldungen */}
|
||||
<button
|
||||
style={{
|
||||
visibility: chartTitle === "Messkurve" ? "visible" : "hidden",
|
||||
}}
|
||||
onClick={handleFetchData}
|
||||
className="px-4 py-1 bg-littwin-blue text-white rounded text-sm"
|
||||
className={`btn-primary h-8 font-medium px-3 ${
|
||||
hiddenWhenMeldungen ? "invisible" : "visible"
|
||||
}`}
|
||||
type="button"
|
||||
>
|
||||
Daten laden
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user