UNPKG

zigbee2mqtt-windfront

Version:

[![Version](https://img.shields.io/npm/v/zigbee2mqtt-windfront.svg)](https://npmjs.org/package/zigbee2mqtt-windfront) [![CI](https://github.com/Nerivec/zigbee2mqtt-windfront/actions/workflows/ci.yml/badge.svg)](https://github.com/Nerivec/zigbee2mqtt-windf

2 lines (1 loc) 2.56 kB
import{r as f,b as y,j as s,L as u,S as w,F as N,b3 as L}from"./index-C9teBVht.js";import{F}from"./Feature-NdqklTM_.js";import{g as $}from"./index-Dm1jDR4v.js";import{L as _}from"./LastSeen-DpZtjfR1.js";import{L as v}from"./Lqi-BUi3mqI9.js";import{P as D}from"./PowerSource-DDICmrah.js";import{D as P}from"./DeviceImage-DGFxocTf.js";const K=f.memo(({onChange:m,onRead:c,sourceIdx:n,hideSourceDot:b,device:t,endpoint:o,deviceState:a,lastSeenConfig:j,features:x,featureWrapperClass:d,children:h})=>{const{t:r}=y(["zigbee","devicePage"]),i=o!=null?t.endpoints[o]?.name:void 0,g=f.useMemo(()=>{const e=[];for(const l of x){const p=o!=null&&!!l.endpoint;(!p||Number(l.endpoint)===o||l.endpoint===i)&&e.push(s.jsx(F,{feature:l,device:t,deviceState:a,onChange:m,onRead:c,featureWrapperClass:d,minimal:!0,parentFeatures:[],endpointSpecific:p},$(l)))}return e},[i,t,o,a,x,d,m,c]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"card-body p-2",children:[s.jsxs("div",{className:"flex flex-row items-center gap-3 w-full",children:[s.jsx("div",{className:"flex-none h-11 w-11 overflow-visible",children:s.jsx(P,{disabled:!1,device:t,otaState:a.update?.state})}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs(u,{to:`/device/${n}/${t.ieee_address}/info`,className:"link link-hover font-semibold",children:[t.friendly_name,o!=null?` (${r(e=>e.endpoint)}: ${i?`${i} / `:""}${o})`:""]}),t.description&&s.jsx("div",{className:"text-xs opacity-50 truncate",title:t.description,children:t.description}),s.jsx("div",{className:"text-xs opacity-50",title:r(e=>e.last_seen),children:s.jsx(_,{lastSeen:a.last_seen,config:j})}),!b&&s.jsx("span",{className:"absolute top-2 right-2",children:s.jsx(w,{idx:n,autoHide:!0})})]})]}),s.jsx("div",{className:"text-sm w-full p-2 max-h-125 overflow-y-auto",style:{scrollbarWidth:"thin"},children:g}),s.jsx("div",{className:"flex flex-row justify-end mb-2",children:s.jsxs(u,{to:`/device/${n}/${t.ieee_address}/exposes`,className:"btn btn-xs",children:[r(e=>e.exposes,{ns:"devicePage"})," ",s.jsx(N,{icon:L,size:"lg"})]})})]}),s.jsxs("div",{className:"flex flex-row flex-wrap gap-1 mx-2 mb-2 justify-around items-center",children:[s.jsx("span",{className:"badge badge-soft badge-ghost cursor-default tooltip","data-tip":r(e=>e.lqi),children:s.jsx(v,{value:a.linkquality})}),s.jsx("span",{className:"badge badge-soft badge-ghost cursor-default tooltip","data-tip":r(e=>e.power),children:s.jsx(D,{device:t,batteryPercent:a.battery,batteryState:a.battery_state,batteryLow:a.battery_low,showLevel:!0})}),h]})]})});export{K as D};