- Icons input, login, output und switch lokal installiert und verwendet - Keine Internet-Abhängigkeit mehr für Icon-Anzeige - Projekt ist vollständig offlinefähig
65 lines
2.3 KiB
TypeScript
65 lines
2.3 KiB
TypeScript
"use client"; // /components/main/einausgaenge/DigitalOutputs.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 outputIcon from "@iconify/icons-mdi/output";
|
|
import switchIcon from "@iconify/icons-ion/switch";
|
|
|
|
export default function DigitalOutputs({ openOutputModal }) {
|
|
const digitalOutputs = useSelector(
|
|
(state: RootState) => state.digitalOutputsSlice.outputs
|
|
);
|
|
|
|
return (
|
|
<div className="bg-white shadow-md border border-gray-200 p-3 rounded-lg w-full h-fit max-h-[400px] overflow-auto">
|
|
<h2 className="text-sm font-bold mb-3 flex items-center">
|
|
<Icon icon={outputIcon} className="text-littwin-blue mr-2 text-xl" />
|
|
Digitale Ausgänge
|
|
</h2>
|
|
<table className="w-full text-xs border-collapse bg-white rounded-lg">
|
|
<thead className="bg-gray-100 border-b">
|
|
<tr>
|
|
<th className="px-1 py-1 text-left">Ausgang</th>
|
|
<th className="px-1 py-1 text-left">Bezeichnung</th>
|
|
<th className="px-1 py-1 text-left">Schalter</th>
|
|
<th className="px-1 py-1 text-left">Aktion</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{digitalOutputs.map((output) => (
|
|
<tr key={output.id} className="border-b">
|
|
<td className="flex items-center px-1 py-1">
|
|
<Icon
|
|
icon={outputIcon}
|
|
className="text-gray-600 mr-1 text-base"
|
|
/>
|
|
{output.id}
|
|
</td>
|
|
<td className="px-1 py-1">{output.label}</td>
|
|
<td className="px-1 py-1">
|
|
<Icon
|
|
icon="ion:switch"
|
|
className={`text-base ${
|
|
output.status
|
|
? "text-littwin-blue"
|
|
: "text-gray-500 scale-x-[-1]"
|
|
}`}
|
|
/>
|
|
</td>
|
|
<td className="px-1 py-1">
|
|
<Icon
|
|
icon={settingsIcon}
|
|
className="text-gray-400 text-base cursor-pointer"
|
|
onClick={() => openOutputModal(output)}
|
|
/>
|
|
</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
);
|
|
}
|