global update and global fix

This commit is contained in:
lendry
2026-06-25 23:48:57 +03:00
parent 3880c68d59
commit b0ea87e898
121 changed files with 13759 additions and 663 deletions

View File

@@ -0,0 +1,31 @@
'use client';
import { useEffect, useMemo, useState } from 'react';
import { buildBotExamples } from '@/lib/bot-examples';
import { fetchPublicSettingsClient } from '@/lib/api';
import { resolveOAuthApiBase } from '@/lib/oauth-url';
import { CodeExampleTabs } from '@/components/code-example-tabs';
export function BotCodeTabs() {
const [apiBase, setApiBase] = useState('http://localhost:3000');
useEffect(() => {
void fetchPublicSettingsClient()
.then((settings) => setApiBase(resolveOAuthApiBase(settings)))
.catch(() => undefined);
}, []);
const examples = useMemo(() => buildBotExamples(apiBase), [apiBase]);
return (
<div className="space-y-3">
<p className="text-sm text-zinc-500 dark:text-zinc-400">
Базовый URL Bot API:{' '}
<code className="rounded bg-zinc-100 px-1.5 py-0.5 dark:bg-zinc-800">{apiBase}/bot{'{token}'}/{'{method}'}</code>
{' — '}
подставляется из <strong>PUBLIC_API_URL</strong> (как для OAuth).
</p>
<CodeExampleTabs examples={examples} />
</div>
);
}