Files
CPLv4.0/components/main/einausgaenge/DigitalInputs.tsx
ISA a898882103 fix: digitale Ein- und Ausgänge vollständig responsive – Tailwind Breakpoints für Icons und Textgrößen
- Anpassungen an laptop, xl, 2xl eingeführt
- Konsistente Darstellung bei Meldungseingängen und Schaltausgängen
- Offline-fähige lokale Icon-Imports für alle Symbole
2025-04-29 14:19:18 +02:00

96 lines
4.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client";
// /components/main/einausgaenge/DigitalInputs.tsx
import React from "react";
import { useSelector } from "react-redux";
import { RootState } from "../../../redux/store";
import { Icon } from "@iconify/react";
import settingsIcon from "@iconify/icons-mdi/settings";
import inputIcon from "@iconify/icons-mdi/input";
import loginIcon from "@iconify/icons-mdi/login";
type Props = {
openInputModal: (input: any) => void;
inputRange: { start: number; end: number };
};
export default function DigitalInputs({ openInputModal, inputRange }: Props) {
const digitalInputs = useSelector(
(state: RootState) => state.digitalInputsSlice.inputs
);
const inputs = digitalInputs.slice(inputRange.start, inputRange.end);
return (
<div className="bg-white shadow-md border border-gray-200 p-3 rounded-lg w-full laptop:p-1 xl:p-1">
<h2 className="text-sm laptop:text-xs font-bold mb-3 flex items-center">
<Icon
icon={inputIcon}
className="text-littwin-blue mr-2 text-xl laptop:text-lg xl:text-xl 2xl:text-2xl"
/>
Meldungseingänge {inputRange.start + 1} {inputRange.end}
</h2>
<table className="w-full text-xs laptop:text-[10px] xl:text-xs 2xl:text-sm border-collapse">
<thead className="bg-gray-100 border-b">
<tr>
<th className="px-1 py-1 text-left">Eingang</th>
<th className="px-1 py-1 text-left">Zustand</th>
<th className="px-1 py-1 text-left">Bezeichnung</th>
<th className="px-1 py-1 text-left">Aktion</th>
</tr>
</thead>
<tbody>
{inputs.map((input) => (
<tr key={input.id} className="border-b">
<td className="flex items-center px-1 py-1">
<Icon
icon={loginIcon}
className="text-gray-600 mr-1 text-base laptop:text-sm xl:text-sm 2xl:text-lg"
/>
{input.id}
</td>
<td className="px-1 py-1 ">
{input.eingangOffline ? (
<div className="relative group inline-block">
<span className="text-red-500 text-2xl laptop:text-sm font-bold xl:text-sm ">
</span>
<div className="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-max bg-gray-400 text-xs laptop:text-[10px] text-white rounded opacity-0 group-hover:opacity-100 transition p-1 z-10 xl:text-sm ">
Eingang inaktiv
</div>
</div>
) : input.status ? (
<div className="relative group inline-block">
<span className="text-red-500 text-2xl laptop:text-sm xl:text-sm ">
</span>
<div className="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-max bg-gray-400 text-xs laptop:text-[10px] text-white rounded opacity-0 group-hover:opacity-100 transition p-1 z-10 xl:text-sm ">
Eingang Aus
</div>
</div>
) : (
<div className="relative group inline-block">
<span className="text-green-500 text-2xl laptop:text-sm xl:text-sm ">
</span>
<div className="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-max bg-gray-400 text-xs laptop:text-[10px] text-white rounded opacity-0 group-hover:opacity-100 transition p-1 z-10">
Eingang Ein
</div>
</div>
)}
</td>
<td className="px-1 py-1">{input.label}</td>
<td className="px-1 py-1">
<Icon
icon={settingsIcon}
className="text-gray-400 text-base laptop:text-sm xl:text-sm 2xl:text-lg cursor-pointer"
onClick={() => openInputModal(input)}
/>
</td>
</tr>
))}
</tbody>
</table>
</div>
);
}