diff --git a/frontend/src/app/x/XOpsPanels.tsx b/frontend/src/app/x/XOpsPanels.tsx new file mode 100644 index 0000000..6ccb5fa --- /dev/null +++ b/frontend/src/app/x/XOpsPanels.tsx @@ -0,0 +1,807 @@ +"use client"; + +import { + Download, + Heart, + Radar, + UserMinus, + UserPlus, +} from "lucide-react"; +import { useMemo, useState } from "react"; + +import { + buildAdvancedSearch, + estimateEta, + parseHandles, +} from "@/lib/xOps"; + +export type CreateJobFn = (kind: string, params?: Record) => Promise; + +const panel = + "rounded-2xl border border-white/10 bg-gradient-to-b from-white/[0.07] to-black/30 p-4 shadow-[0_8px_32px_rgba(0,0,0,0.25)]"; +const title = "text-sm font-semibold text-white"; +const sub = "mt-0.5 text-[11px] text-slate-400"; +const field = "mt-1 w-full rounded-xl border border-white/10 bg-black/45 px-3 py-2 text-sm text-slate-100 outline-none focus:border-orange-400/50"; +const label = "block text-[11px] text-slate-400"; +const btn = + "inline-flex items-center justify-center gap-1.5 rounded-xl px-3 py-2 text-xs font-semibold transition hover:-translate-y-0.5"; +const primary = `${btn} bg-gradient-to-br from-orange-400 to-rose-500 text-[#1a1210] shadow-lg shadow-orange-500/20`; +const ghost = `${btn} border border-white/10 bg-white/5 text-slate-200 hover:bg-white/10`; +const danger = `${btn} border border-rose-400/40 bg-rose-500/15 text-rose-100`; +const chip = "rounded-lg border border-white/10 bg-white/5 px-2.5 py-1 text-[11px] text-slate-300 hover:bg-white/10"; +const chipOn = "rounded-lg border border-orange-400/40 bg-orange-400/15 px-2.5 py-1 text-[11px] text-orange-100"; +const actionCard = + "rounded-2xl border border-white/10 bg-black/35 p-3.5 text-left transition hover:-translate-y-1 hover:border-orange-400/35 hover:bg-black/50"; + +type Common = { + createJob: CreateJobFn; + toast: (msg: string, kind?: "ok" | "err") => void; + username: string; + setUsername: (v: string) => void; + limit: number; + setLimit: (n: number) => void; + minD: number; + setMinD: (n: number) => void; + maxD: number; + setMaxD: (n: number) => void; +}; + +export function WorkbenchPanel({ + createJob, + extOnline, + accountsN, + stats, + onGo, + lastKind, + rerun, + likeN, +}: Common & { + extOnline: boolean; + accountsN: number; + stats: Record; + onGo: (id: string) => void; + lastKind?: string; + rerun: () => void; + likeN: number; +}) { + return ( +
+
+ {[ + ["扩展状态", extOnline ? "已连接" : "未连接", extOnline ? "text-emerald-300" : "text-amber-300", "Chrome 插件链路"], + ["账号数", String(accountsN), "text-white", "已同步账号"], + ["已完成", String(stats.completed ?? 0), "text-emerald-200", "成功任务"], + ["进行中", String(stats.running ?? 0), "text-orange-200", `排队 ${stats.queued ?? 0} · 失败 ${stats.failed ?? 0}`], + ].map(([k, v, c, s]) => ( +
+
{k}
+
{v}
+
{s}
+
+ ))} +
+ + {!extOnline ? ( +
+ 扩展未连接 +
+ 加载 extensions/dylive-helper/dist + ,登录本站并打开本页即可自动配对。插件 X 页签仍可独立操作。 +
+
+ ) : null} + +
+
+
+

快捷入口

+

常用能力一键跳转或直接下发

+
+ +
+
+ {( + [ + ["cleanup", "🧹", "扫描不互关", "找出没回关的人"], + ["scrape", "📥", "采集数据", "画像 / 搜索 / 书签"], + ["engage", "⚡", "互动增长", "赞 · 关 · 回 · 转推"], + ["monitor", "📡", "粉丝监控", "掉粉 / 新粉对比"], + ["jobs", "📋", "任务与结果", "队列 · 大白话结果"], + ] as const + ).map(([id, ico, t, d]) => ( + + ))} + +
+
+
+ ); +} + +export function CleanupPanel({ + createJob, + toast, + limit, + setLimit, + minD, + setMinD, + maxD, + setMaxD, + cleanupList, + setCleanupList, + lastNonFollowers, +}: Common & { + cleanupList: string; + setCleanupList: (v: string) => void; + lastNonFollowers: string[]; +}) { + const [onlyNon, setOnlyNon] = useState(true); + const n = useMemo(() => parseHandles(cleanupList).length, [cleanupList]); + + return ( +
+
+

🧹 不互关扫描

+

对比关注与粉丝,找出没回关的人;结果可填入下方取关名单

+
+ {[50, 100, 200, 500].map((v) => ( + + ))} +
+
+ + +
+
+ +
+
+
+
+

👋 精确取关

+

粘贴名单,带随机间隔限速执行

+
+ {n ? `${n} 人 · ${estimateEta(n, minD, maxD)}` : "名单为空"} +
+