You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.3 KiB
TypeScript

// frontend/components/automation/RulesView.tsx — auto.jsx RulesView 이식
"use client";
import { Icon } from "@/components/Icon";
import type { RuleOut } from "@/lib/types";
import { AU_CAT, AU_TONE, Flow } from "./Flow";
export function RulesView({ rules, toggle }: { rules: RuleOut[]; toggle: (id: string) => void }) {
const activeN = rules.filter((r) => r.on).length;
return (
<div className="board">
<section className="card sp2 r2">
<div className="ch">
<div className="ico">
<Icon name="zap" />
</div>
<div className="htext">
<h3> </h3>
<div className="sub"> </div>
</div>
<span className="count">
{activeN}/{rules.length}
</span>
</div>
<div className="rl-list">
{rules.map((r) => (
<div
key={r.id}
className={"rl-row" + (r.on ? "" : " off") + (r.fresh ? " rl-new" : "")}
>
<button
className={"sw" + (r.on ? " on" : "")}
onClick={() => toggle(r.id)}
aria-label={r.name + (r.on ? " 끄기" : " 켜기")}
/>
<div className="rl-body">
<div className="rl-top">
<span className="rl-name">{r.name}</span>
<span className="rl-cat" style={{ background: AU_TONE[r.cat] }}>
{AU_CAT[r.cat]}
</span>
</div>
<Flow small p={{ trigger: r.trigger, cond: r.cond, action: r.action }} />
<div className="rl-meta">
<span> {r.last}</span>
<span>·</span>
<span> {r.runs}</span>
</div>
</div>
</div>
))}
</div>
</section>
<section className="card sp2">
<div className="ch">
<div className="ico">
<Icon name="shield" />
</div>
<div className="htext">
<h3> </h3>
<div className="sub"> </div>
</div>
</div>
<div className="how-list">
<div className="how">
<span className="how-ic">
<Icon name="tick" />
</span>
<div>
<b> </b>
<span> .</span>
</div>
</div>
<div className="how">
<span className="how-ic">
<Icon name="shield" />
</span>
<div>
<b> </b>
<span>·· .</span>
</div>
</div>
<div className="how">
<span className="how-ic">
<Icon name="brain" />
</span>
<div>
<b> </b>
<span> .</span>
</div>
</div>
</div>
</section>
</div>
);
}