zigbee2mqtt-windfront
Version:
[](https://npmjs.org/package/zigbee2mqtt-windfront) [](https://github.com/Nerivec/zigbee2mqtt-windf
2 lines (1 loc) • 3.4 kB
JavaScript
import{b as A,r as o,s as t,H as _,aa as d,ab as f,ac as u,ad as h,ae as I,J as k,af as w,ag as K,ah as O,ai as Y,aj as L,ak as M,al as F,j as s,M as R,N as H,T as E}from"./index-Cg_dwqpD.js";import{C as x}from"./CheckboxField-D0wHGmUZ.js";import{N as b}from"./NumberField-Bz4sSMOV.js";import{S as W}from"./SelectField-dfeWrxvV.js";import"./envs-CSqIi4cL.js";function G(){const{t:a}=A(["settings","navbar","network","common"]),[i,p]=o.useState(t.get(_,"devices")),[r,N]=o.useState(t.get(d,254)),[l,g]=o.useState(t.get(f,3)),[m,S]=o.useState(t.get(u,!1)),[c,T]=o.useState(t.get(h,!0));o.useEffect(()=>{t.set(_,i)},[i]),o.useEffect(()=>{t.set(d,r)},[r]),o.useEffect(()=>{t.set(f,l)},[l]),o.useEffect(()=>{t.set(u,m)},[m]),o.useEffect(()=>{t.set(h,c)},[c]);const v=o.useCallback(()=>{const e=t.keys();t.remove(I),t.remove(_),t.remove(d),t.remove(f),t.remove(u),t.remove(k),t.remove(w),t.remove(h),t.remove(K);for(const n of e)(n.startsWith(O)||n.startsWith(Y)||n.startsWith(L))&&t.remove(n);window.location.reload()},[]),C=o.useCallback(()=>{const e=t.keys();for(const n of e)(n.startsWith(M)||n.startsWith(F))&&t.remove(n);window.location.reload()},[]),j=o.useCallback(()=>{t.clearAll(),window.location.reload()},[]);return s.jsxs(s.Fragment,{children:[s.jsx(H,{children:s.jsxs("div",{className:"flex flex-row flex-wrap flex-1 gap-1.5",children:[s.jsx(E,{className:"btn btn-sm btn-outline btn-error tooltip-bottom",onClick:v,title:a(e=>e.reset_settings),modalDescription:a(e=>e.dialog_confirmation_prompt,{ns:"common"}),modalCancelLabel:a(e=>e.cancel,{ns:"common"}),children:a(e=>e.reset_settings)}),s.jsx(E,{className:"btn btn-sm btn-outline btn-error tooltip-bottom",onClick:C,title:a(e=>e.reset_auth),modalDescription:a(e=>e.dialog_confirmation_prompt,{ns:"common"}),modalCancelLabel:a(e=>e.cancel,{ns:"common"}),children:a(e=>e.reset_auth)}),s.jsx(E,{className:"btn btn-sm btn-outline btn-error tooltip-bottom",onClick:j,title:a(e=>e.reset_all),modalDescription:a(e=>e.dialog_confirmation_prompt,{ns:"common"}),modalCancelLabel:a(e=>e.cancel,{ns:"common"}),children:a(e=>e.reset_all)})]})}),s.jsx("div",{className:"alert alert-info alert-vertical sm:alert-horizontal",children:a(e=>e.frontend_notice)}),s.jsxs("div",{className:"flex flex-row flex-wrap gap-4 mt-3",children:[s.jsxs(W,{name:"homepage",label:a(e=>e.homepage),onChange:e=>!e.target.validationMessage&&p(e.target.value),value:i,required:!0,children:[s.jsx("option",{value:"devices",children:a(e=>e.devices,{ns:"navbar"})}),s.jsx("option",{value:"dashboard",children:a(e=>e.dashboard,{ns:"navbar"})})]}),s.jsx(b,{type:"number",name:"permit_join_time",label:a(e=>e.permit_join_time),min:10,max:254,required:!0,minimal:!0,initialValue:r,onSubmit:(e,n)=>n&&e!==""&&N(e)}),s.jsx(b,{type:"number",name:"max_on_screen_notifications",label:a(e=>e.max_on_screen_notifications),min:1,max:5,required:!0,minimal:!0,initialValue:l,onSubmit:(e,n)=>n&&e!==""&&g(e)}),s.jsx(x,{name:"hide_static_info_alerts",label:a(e=>e.hide_static_info_alerts,{ns:"common"}),onChange:e=>S(e.target.checked),defaultChecked:m})]}),R&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"text-lg mt-2",children:a(e=>e.multi_instance,{ns:"common"})}),s.jsx("div",{className:"flex flex-row flex-wrap gap-4",children:s.jsx(x,{name:"show_source_name",label:a(e=>e.show_source_name,{ns:"common"}),onChange:e=>T(e.target.checked),defaultChecked:c})})]})]})}export{G as default};