Files
dashboard/components/iotPanel/IotPanelExperienceTempCard.tsx
Alberto-Audrix 32a36cceff
CI / lint-and-test (push) Canceled after 0s
first commit
2026-07-28 08:55:05 +07:00

78 lines
2.4 KiB
TypeScript

import React from 'react';
import { baseCard } from './constants.tsx';
import type { IotComputedDashboard } from './types.ts';
export interface IotPanelExperienceTempCardProps {
computed: IotComputedDashboard;
}
const IotPanelExperienceTempCard: React.FC<IotPanelExperienceTempCardProps> = ({ computed }) => {
const calculationRows = [
{
label: 'Kipas aktif',
value: `${computed.experienceActiveFanCount} unit`,
note: 'Sumber angin',
},
{
label: 'Kecepatan angin',
value: computed.experienceWindSpeed,
note: 'Kipas aktif x 0,35',
},
{
label: 'Chill factor',
value: computed.chillFactor,
note: 'Berdasarkan grafik chill factor',
},
{
label: 'Koreksi RH',
value: computed.experienceHumidityAdjustment,
note: '(RH - 70) / 5',
},
{
label: 'Suhu rata-rata',
value: computed.avgTemp,
note: 'Suhu rata-rata dari Panel',
},
{
label: 'Chill effect',
value: computed.experienceChillEffect,
note: '(Angin x chill factor) - RH',
},
];
return (
<article
className={`${baseCard} rounded-xl border-sky-200 bg-gradient-to-br from-sky-50 to-blue-50`}
>
<div className="flex items-start justify-between gap-4">
<div>
<h3 className="text-base font-semibold text-slate-800">
<i className="fa-solid fa-temperature-half mr-2 text-sky-600"></i>
Experience Suhu
</h3>
<p className="mt-1 text-xs text-slate-500">Suhu yang dirasakan oleh ayam.</p>
</div>
<p className="shrink-0 text-3xl font-bold text-sky-600">{computed.experienceTemp}</p>
</div>
<div className="mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2">
{calculationRows.map((item) => (
<div key={item.label} className="rounded-lg border border-sky-100 bg-white/70 p-2">
<div className="flex items-center justify-between gap-2">
<span className="text-xs font-medium text-slate-500">{item.label}</span>
<strong className="text-sm text-slate-800">{item.value}</strong>
</div>
<p className="mt-1 text-[11px] text-slate-400">{item.note}</p>
</div>
))}
</div>
<div className="mt-3 rounded-lg bg-white/60 px-3 py-2 text-xs text-slate-500">
Experience suhu = Suhu rata-rata - chill effect.
</div>
</article>
);
};
export default IotPanelExperienceTempCard;