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

@@ -1,7 +1,7 @@
'use client';
import { useMemo, useState } from 'react';
import { Check, Copy, Loader2, Bot } from 'lucide-react';
import { Check, Copy, Loader2, Bot, ArrowLeft } from 'lucide-react';
import { useToast } from '@/components/id/toast-provider';
import { usePublicSettings } from '@/components/id/public-settings-provider';
import { Button } from '@/components/ui/button';
@@ -12,7 +12,12 @@ import { cn } from '@/lib/utils';
type Step = 'name' | 'username' | 'done';
export function BotCreateMiniAppContent() {
interface BotCreateMiniAppContentProps {
onBack?: () => void;
onCreated?: (botId: string) => void;
}
export function BotCreateMiniAppContent({ onBack, onCreated }: BotCreateMiniAppContentProps = {}) {
const { projectName } = usePublicSettings();
const { effectiveToken, canUse, authReady, waitingForBridge, isLoading } = useMiniAppAuth();
const { showToast } = useToast();
@@ -84,6 +89,11 @@ export function BotCreateMiniAppContent() {
<div className="min-h-screen bg-[#17212b] p-4 text-white">
<div className="mx-auto max-w-md space-y-5 rounded-[24px] bg-[#242f3d] p-5 shadow-xl">
<div className="flex items-center gap-3">
{onBack ? (
<Button type="button" variant="ghost" size="icon" className="h-9 w-9 shrink-0 text-[#8b93a7] hover:bg-[#17212b] hover:text-white" onClick={onBack}>
<ArrowLeft className="h-5 w-5" />
</Button>
) : null}
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-[#3390ec]/20 text-[#3390ec]">
<Bot className="h-6 w-6" />
</div>
@@ -184,6 +194,11 @@ export function BotCreateMiniAppContent() {
>
Создать ещё одного бота
</Button>
{onCreated && createdBot.botId ? (
<Button className="w-full rounded-xl" onClick={() => onCreated(createdBot.botId)}>
Настройки бота
</Button>
) : null}
</div>
) : null}
</div>

View File

@@ -1,16 +1,20 @@
'use client';
import { Suspense } from 'react';
import { BotCreateMiniAppContent } from './content';
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { Loader2 } from 'lucide-react';
export default function BotCreateLegacyRedirectPage() {
const router = useRouter();
useEffect(() => {
router.replace('/mini-apps/bot-father?mode=create');
}, [router]);
export default function BotCreateMiniAppPage() {
return (
<Suspense
fallback={
<div className="flex min-h-screen items-center justify-center p-6 text-sm text-[#667085]">Загрузка...</div>
}
>
<BotCreateMiniAppContent />
</Suspense>
<div className="flex min-h-screen items-center justify-center p-6 text-sm text-[#667085]">
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Перенаправление...
</div>
);
}