diff --git a/apps/web/app/(app)/actions.ts b/apps/web/app/(app)/actions.ts
index 29f6a15c..e7e1b0ef 100644
--- a/apps/web/app/(app)/actions.ts
+++ b/apps/web/app/(app)/actions.ts
@@ -714,7 +714,8 @@ export async function connectOwnBotAction(f: FormData) {
const user = asWebActor(await requireUser());
await attempt(f, async () => {
await setUserBot(db, user.id, String(f.get("token") ?? ""));
- return "/settings?bot=connected#telegram";
+ // On the Home page the next step (Start) shows right there.
+ return str(f, "back") === "/" ? "/" : "/settings?bot=connected#telegram";
});
}
@@ -722,6 +723,6 @@ export async function disconnectOwnBotAction(f: FormData) {
const user = asWebActor(await requireUser());
await attempt(f, async () => {
await clearUserBot(db, user.id);
- return "/settings#telegram";
+ return str(f, "back") === "/" ? "/" : "/settings#telegram";
});
}
diff --git a/apps/web/app/(app)/page.tsx b/apps/web/app/(app)/page.tsx
index 454e7bd9..7d80470d 100644
--- a/apps/web/app/(app)/page.tsx
+++ b/apps/web/app/(app)/page.tsx
@@ -20,7 +20,7 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ e
{items.length ? "Агенты ждут твоего решения — ответь здесь, в Telegram или через MCP." : "Всё идёт само: агентам от тебя ничего не нужно."}
- {onboarding.visible && }
+ {onboarding.visible && }
{items.map((q) => )}
diff --git a/apps/web/app/(app)/settings/page.tsx b/apps/web/app/(app)/settings/page.tsx
index 29b61f42..f57ba0ce 100644
--- a/apps/web/app/(app)/settings/page.tsx
+++ b/apps/web/app/(app)/settings/page.tsx
@@ -5,23 +5,16 @@ import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Input, Label } from "@/components/ui/input";
import { EgovSign } from "@/components/EgovSign";
+import { OwnBotSteps } from "@/components/OwnBotSteps";
import { Workspace } from "@/components/Workspace";
import { publicOrigin, requireUser } from "@/lib/auth";
import { db } from "@/lib/db";
-import { connectOwnBotAction, disconnectOwnBotAction, pairTelegram, revokeConnectedApp, saveNotifyPrefsAction, unpairTelegramAction } from "../actions";
+import { disconnectOwnBotAction, revokeConnectedApp, saveNotifyPrefsAction, unpairTelegramAction } from "../actions";
import { PushNotifications } from "@/components/PushNotifications";
import { TimezoneField } from "@/components/TimezoneField";
const back = { back: "/settings" };
-function StepNum({ n, done }: { n: number; done: boolean }) {
- return (
-
- {done ? "✓" : n}
-
- );
-}
-
/** A connected thing: title + details on the left, actions on the right. */
function Row({ title, children, actions }: { title: React.ReactNode; children?: React.ReactNode; actions?: React.ReactNode }) {
return (
@@ -47,76 +40,7 @@ export default async function Settings({ searchParams }: { searchParams: Promise
const myProjects = await listUserProjects(db, user.id);
const pushSubs = await userPushSubscriptions(db, user.id);
const vapid = await vapidPublicKey(db);
- // PEP-85: the three steps of connecting an own bot (shown when Telegram is not paired, or to switch).
- const ownBotSteps = (
-
-
- Через Telegram фабрика зовёт вас, когда агенту нужен ответ или работа готова, — отвечать можно кнопками с телефона. У каждого пользователя свой бот: вы создаёте его за две минуты, без программирования.
-
-
-
-
-
- Создайте бота в Telegram
-
- Откройте @BotFather (официальный бот Telegram), отправьте ему /newbot, придумайте название и адрес — адрес должен заканчиваться на bot, например{" "}
- my_factory_bot.
-
- {!hasBot && (
-
- )}
-
-
-
-
-
- Вставьте токен бота
- {hasBot ? (
-
- Подключён @{user.telegramBotUsername}. Токен хранится зашифрованным.
-
- ) : (
- <>
- BotFather пришлёт сообщение с длинной строкой вида 1234567890:AAH… — это токен. Скопируйте его сюда. Пеппа хранит его зашифрованным и никому не показывает.
-
- >
- )}
-
-
-
-
-
- Откройте своего бота и нажмите Start
- Так бот узнает, куда вам писать. Удобнее сделать это на телефоне — там и будут приходить сообщения.
- {hasBot && (
-
- )}
-
diff --git a/apps/web/components/Onboarding.tsx b/apps/web/components/Onboarding.tsx
index e9959ceb..66f0ee1e 100644
--- a/apps/web/components/Onboarding.tsx
+++ b/apps/web/components/Onboarding.tsx
@@ -5,9 +5,10 @@ import type { Onboarding } from "@peppa/core";
import { dismissOnboardingAction } from "@/app/(app)/actions";
import { Hidden } from "@/components/cards";
import { Button } from "@/components/ui/button";
+import { OwnBotSteps } from "@/components/OwnBotSteps";
import { cn } from "@/lib/utils";
-export function OnboardingChecklist({ data }: { data: Onboarding }) {
+export function OnboardingChecklist({ data, botUsername = null }: { data: Onboarding; botUsername?: string | null }) {
const next = data.steps.find((s) => !s.done && !s.optional);
const fresh = data.done === 0;
return (
@@ -53,7 +54,12 @@ export function OnboardingChecklist({ data }: { data: Onboarding }) {
{s.title}
{!s.done && {s.hint}}
- {current && (
+ {current && s.id === "telegram" ? (
+ // PEP-85: the first thing to do — right here, not behind a link to Settings.
+