fix mini app bot father

This commit is contained in:
lendry
2026-06-26 11:18:07 +03:00
parent 7ed7cbdd16
commit d3ea470d02
12 changed files with 313 additions and 39 deletions

View File

@@ -2,7 +2,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useSearchParams } from 'next/navigation';
import { Copy, ImageIcon, LayoutGrid, Loader2, RefreshCw, TextQuote, UserCircle2 } from 'lucide-react';
import { Copy, ImageIcon, LayoutGrid, Loader2, RefreshCw, TextQuote, UserCircle2, ArrowLeft } from 'lucide-react';
import { usePublicSettings } from '@/components/id/public-settings-provider';
import { useToast } from '@/components/id/toast-provider';
import { Button } from '@/components/ui/button';
@@ -75,9 +75,17 @@ function SectionCard({
);
}
export function BotManageMiniAppContent() {
export function BotManageMiniAppContent({
botId: botIdProp,
onBack,
botHint
}: {
botId?: string;
onBack?: () => void;
botHint?: string;
} = {}) {
const searchParams = useSearchParams();
const botId = searchParams.get('botId') ?? '';
const botId = botIdProp ?? searchParams.get('botId') ?? '';
const { projectName } = usePublicSettings();
const { effectiveToken, canUse: canUseSession, authReady, waitingForBridge, isLoading } = useMiniAppAuth();
const { showToast } = useToast();
@@ -239,8 +247,20 @@ export function BotManageMiniAppContent() {
<div className="min-h-screen bg-[#f4f5f8] p-4 pb-8">
<div className="mx-auto max-w-lg space-y-4">
<div className="rounded-[24px] bg-white p-5 shadow-sm">
<h1 className="text-lg font-semibold">Настройки бота</h1>
<p className="text-sm text-[#667085]">Интерактивное управление профилем аналог команд BotFather</p>
<div className="flex items-start gap-3">
{onBack ? (
<Button type="button" variant="ghost" size="icon" className="mt-0.5 h-9 w-9 shrink-0" onClick={onBack}>
<ArrowLeft className="h-5 w-5" />
</Button>
) : null}
<div>
<h1 className="text-lg font-semibold">Настройки бота</h1>
<p className="text-sm text-[#667085]">
{botHint ? `@${botHint.replace(/_bot$/i, '')}_bot · ` : ''}
Полное управление как в BotFather
</p>
</div>
</div>
</div>
{loading ? (