"use client"; import { useEffect, useState } from "react"; import { Col, Row, Tag } from "tiny-ui"; import { Automation, Layout, Notification } from "components"; import automation from "data/automation.json"; import config from "data/config.json"; import presets from "data/presets.json"; export default function Home() { const [names, setNames] = useState(null); const [clients, setClients] = useState(null); const [busy, setBusy] = useState(false); useEffect(() => { let c = []; let n = []; for (let client of Object.keys(config)) { c.push(client); n.push(config[client]); } setClients(c); setNames(n); }, []); const handleAutomation = (id) => { setBusy(true); fetch(`/api/automation/${id}`) .then((resp) => resp && resp.json()) .then((result) => { setBusy(false); Notification({ title: `Automation set to ${id}`, description: ( <> {result?.map((o, i) => (