42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { BotSettingsCard } from './BotSettingsCard';
|
|
import { apiFetch } from '../../_lib/api';
|
|
|
|
interface BotSummary {
|
|
id: string;
|
|
platform: string;
|
|
jid: string | null;
|
|
displayName: string | null;
|
|
status: 'ACTIVE' | 'DISCONNECTED' | 'BANNED' | 'PAIRING';
|
|
isBot: boolean;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
interface BotState {
|
|
bot: BotSummary | null;
|
|
shared: boolean;
|
|
}
|
|
|
|
export default async function BotSettingsPage() {
|
|
let state: BotState = { bot: null, shared: false };
|
|
try {
|
|
const res = await apiFetch('/admin/bot');
|
|
if (res.ok) {
|
|
state = (await res.json()) as BotState;
|
|
}
|
|
} catch {
|
|
state = { bot: null, shared: false };
|
|
}
|
|
|
|
return (
|
|
<div className="max-w-2xl">
|
|
<h1 className="text-xl font-semibold mb-6">Bot Settings</h1>
|
|
<p className="text-sm text-gray-600 mb-4">
|
|
TOWER runs on a dedicated WhatsApp number. Adding the bot to a group makes it eligible for
|
|
claim by any tenant admin. The bot number is hidden from members and the public web.
|
|
</p>
|
|
<BotSettingsCard initial={state} />
|
|
</div>
|
|
);
|
|
}
|