From 54182d0637383b08e0a1ab1e064bcf7474ae467f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=81=D0=B5=D0=BB=D1=8C?= Date: Sat, 14 Nov 2026 23:04:25 +0500 Subject: [PATCH 1/2] PEP-86: connecting your own Telegram bot is the first step, right on the Home page Co-Authored-By: Claude Fable 5.2 --- apps/web/app/(app)/actions.ts | 5 +- apps/web/app/(app)/page.tsx | 2 +- apps/web/app/(app)/settings/page.tsx | 82 +---------------------- apps/web/components/Onboarding.tsx | 10 ++- apps/web/components/OwnBotSteps.tsx | 97 ++++++++++++++++++++++++++++ packages/core/src/onboarding.ts | 2 +- 6 files changed, 113 insertions(+), 85 deletions(-) create mode 100644 apps/web/components/OwnBotSteps.tsx 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 фабрика зовёт вас, когда агенту нужен ответ или работа готова, — отвечать можно кнопками с телефона. У каждого пользователя свой бот: вы создаёте его за две минуты, без программирования. -

-
    -
  1. - -
    - Создайте бота в Telegram - - Откройте @BotFather (официальный бот Telegram), отправьте ему /newbot, придумайте название и адрес — адрес должен заканчиваться на bot, например{" "} - my_factory_bot. - - {!hasBot && ( - - )} -
    -
  2. -
  3. - -
    - Вставьте токен бота - {hasBot ? ( - - Подключён @{user.telegramBotUsername}. Токен хранится зашифрованным. - - ) : ( - <> - BotFather пришлёт сообщение с длинной строкой вида 1234567890:AAH… — это токен. Скопируйте его сюда. Пеппа хранит его зашифрованным и никому не показывает. -
    - - - - - - )} -
    -
  4. -
  5. - -
    - Откройте своего бота и нажмите Start - Так бот узнает, куда вам писать. Удобнее сделать это на телефоне — там и будут приходить сообщения. - {hasBot && ( -
    - - - - )} -
    -
  6. -
- {hasBot ? ( -
- - - - ) : ( -
- - Не хотите создавать бота? - - - )} -
- ); + const ownBotSteps = ; return (
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. +
+ +
+ ) : current && ( + + )} +
+ +
  • + +
    + Вставьте токен бота + {hasBot ? ( + + Подключён @{botUsername}. Токен хранится зашифрованным. + + ) : ( + <> + + BotFather пришлёт сообщение с длинной строкой вида 1234567890:AAH… — это токен. Скопируйте его сюда. Пеппа хранит его зашифрованным и никому не показывает. + +
    + + + + + + )} +
    +
  • +
  • + +
    + Откройте своего бота и нажмите Start + Так бот узнает, куда вам писать. Удобнее сделать это на телефоне — там и будут приходить сообщения. + {hasBot && ( +
    + + + + )} +
    +
  • + + {hasBot ? ( +
    + + + + ) : ( +
    + + Не хотите создавать бота? + + + )} +
    + ); +} diff --git a/packages/core/src/onboarding.ts b/packages/core/src/onboarding.ts index 03126708..c63929c4 100644 --- a/packages/core/src/onboarding.ts +++ b/packages/core/src/onboarding.ts @@ -54,7 +54,7 @@ export async function onboardingChecklist(db: Db, user: Pick Date: Sat, 14 Nov 2026 23:04:42 +0500 Subject: [PATCH 2/2] PEP-86: the Home page shows only the user's own projects Co-Authored-By: Claude Fable 5.2 --- apps/web/components/ProgressOverview.tsx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/apps/web/components/ProgressOverview.tsx b/apps/web/components/ProgressOverview.tsx index 88eddb60..d74a196d 100644 --- a/apps/web/components/ProgressOverview.tsx +++ b/apps/web/components/ProgressOverview.tsx @@ -1,7 +1,7 @@ import Link from "next/link"; import type { ProgressOverview as Overview, ProjectProgress } from "@peppa/core"; import { AgentBadge } from "@/components/AgentBadge"; -import { Disclosure, Empty, Key } from "@/components/common"; +import { Empty, Key } from "@/components/common"; import { cn } from "@/lib/utils"; const PARTS = [ @@ -85,9 +85,9 @@ function ProjectRow({ p }: { p: ProjectProgress }) { ); } -/** PEP-77: progress of all stories and projects on the Home page. */ +/** PEP-77: progress of the user's own projects on the Home page (other people's projects — on «Проекты», for a superadmin). */ export function ProgressOverview({ data }: { data: Overview }) { - if (!data.mine.length && !data.others.length) return Проектов пока нет — прогресс появится с первой стори.; + if (!data.mine.length) return Проектов пока нет — прогресс появится с первой стори.; const t = data.totals; return (
    @@ -108,15 +108,6 @@ export function ProgressOverview({ data }: { data: Overview }) { ))} - {data.others.length > 0 && ( - -
      - {data.others.map((p) => ( - - ))} -
    -
    - )}
    ); }