PEP-70: pug mascot next to the agents' questions

Cartoon pug (inline SVG) on Home: sleeps when nothing waits, perks up with
a speech bubble and question count when agents ask. Motion only without
prefers-reduced-motion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Асель 2026-11-14 16:27:14 +05:00
parent 90c47b12fe
commit 5f1b1b4212
3 changed files with 102 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import { listUserProjects, onboardingChecklist } from "@peppa/core";
import { OnboardingChecklist } from "@/components/Onboarding";
import { PugBanner } from "@/components/PugMascot";
import { LiveRefresh } from "@/components/LiveRefresh";
import { ActivityAside } from "@/components/ActivityAside";
import { ProjectList, QuestionCard, SessionCard } from "@/components/cards";
@ -20,7 +21,8 @@ export default async function Home({ searchParams }: { searchParams: Promise<{ e
<PageHeader title="Главная">{items.length ? "Агенты ждут твоего решения — ответь здесь, в Telegram или через MCP." : "Всё идёт само: агентам от тебя ничего не нужно."}</PageHeader>
{onboarding.visible && <OnboardingChecklist data={onboarding} />}
<Section title="Вопросы агентов" count={items.length}>
{items.length === 0 ? <Empty>Агентам от тебя ничего не нужно.</Empty> : items.map((q) => <QuestionCard key={q.id} q={q} taskKey={q.taskKey} taskStatus={q.taskStatus} back="/" />)}
<PugBanner count={items.length} />
{items.map((q) => <QuestionCard key={q.id} q={q} taskKey={q.taskKey} taskStatus={q.taskStatus} back="/" />)}
</Section>
<Section title="Активные раннеры" actions={<MoreLink href="/runners">все раннеры</MoreLink>}>
{sessions.length === 0 ? <Empty>Сейчас ничего не запущено.</Empty> : sessions.map((s) => <SessionCard key={s.id} s={s} back="/" showTitle />)}

View File

@ -101,3 +101,13 @@
@apply bg-primary/30;
}
}
/* PEP-70: pug mascot — gentle breathing while asleep, a curious head tilt when agents ask. */
@media (prefers-reduced-motion: no-preference) {
.pug-sleep .pug-head { animation: pug-breathe 3.2s ease-in-out infinite; }
.pug-sleep .pug-zzz { animation: pug-zzz 3.2s ease-in-out infinite; }
.pug-alert .pug-head { animation: pug-tilt 2.4s ease-in-out infinite; }
}
@keyframes pug-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03, 0.98); } }
@keyframes pug-zzz { 0%, 100% { opacity: 0.25; transform: translateY(2px); } 50% { opacity: 0.6; transform: translateY(-2px); } }
@keyframes pug-tilt { 0%, 60%, 100% { transform: rotate(0deg); } 70% { transform: rotate(-9deg); } 85% { transform: rotate(5deg); } }

View File

@ -0,0 +1,89 @@
// PEP-70: Peppa's mascot — a cartoon pug next to the agents' questions. Pure SVG (no external
// images), fixed fawn/black colours that read on both themes; motion only without reduced-motion.
import { cn } from "@/lib/utils";
type Mood = "sleep" | "alert";
export function PugMascot({ mood, size = 72, className }: { mood: Mood; size?: number; className?: string }) {
const awake = mood === "alert";
return (
<svg
viewBox="0 0 120 120"
width={size}
height={size}
role="img"
aria-label={awake ? "Мопс Пеппы ждёт твоего ответа" : "Мопс Пеппы спит"}
className={cn("shrink-0 overflow-visible", awake ? "pug-alert" : "pug-sleep", className)}
>
<g className="pug-head" style={{ transformOrigin: "60px 70px" }}>
{/* head */}
<ellipse cx="60" cy="66" rx="45" ry="41" fill="#ebcb9e" stroke="#c9a06e" strokeWidth="2" />
{/* folded "button" ears flop over the head */}
<path d="M38 30 C26 22 10 26 9 42 C9 50 15 53 21 48 C26 43 31 39 40 36 Z" fill="#4a3a35" />
<path d="M82 30 C94 22 110 26 111 42 C111 50 105 53 99 48 C94 43 89 39 80 36 Z" fill="#4a3a35" />
{/* forehead wrinkles */}
<path d="M47 40 Q60 33 73 40" fill="none" stroke="#c49a68" strokeWidth="2.5" strokeLinecap="round" />
<path d="M51 47 Q60 42 69 47" fill="none" stroke="#c49a68" strokeWidth="2.5" strokeLinecap="round" />
{/* cheeks */}
<ellipse cx="25" cy="80" rx="7" ry="4" fill="#f4a3a8" opacity="0.7" />
<ellipse cx="95" cy="80" rx="7" ry="4" fill="#f4a3a8" opacity="0.7" />
{/* black mask */}
<ellipse cx="60" cy="83" rx="25" ry="19" fill="#4a3a35" />
{/* eyes */}
{awake ? (
<>
<circle cx="39" cy="62" r="12" fill="#2b2220" />
<circle cx="81" cy="62" r="12" fill="#2b2220" />
<circle cx="43.5" cy="57.5" r="4.5" fill="#fff" />
<circle cx="85.5" cy="57.5" r="4.5" fill="#fff" />
<circle cx="35.5" cy="66" r="2" fill="#fff" />
<circle cx="77.5" cy="66" r="2" fill="#fff" />
</>
) : (
<>
<path d="M28 63 Q39 70 50 63" fill="none" stroke="#2b2220" strokeWidth="3.5" strokeLinecap="round" />
<path d="M70 63 Q81 70 92 63" fill="none" stroke="#2b2220" strokeWidth="3.5" strokeLinecap="round" />
</>
)}
{/* nose */}
<ellipse cx="60" cy="75" rx="9" ry="5.5" fill="#1d1716" />
<ellipse cx="57" cy="73.5" rx="3" ry="1.5" fill="#fff" opacity="0.55" />
{/* mouth + tongue */}
<path d="M60 80 L60 85 M51 85 Q55.5 90 60 85 Q64.5 90 69 85" fill="none" stroke="#1d1716" strokeWidth="2.5" strokeLinecap="round" />
{awake && <path d="M55.5 88 Q60 101 64.5 88 Z" fill="#f28b9b" stroke="#d96a7c" strokeWidth="1.5" />}
</g>
{!awake && (
<g className="pug-zzz" fill="currentColor" fontFamily="inherit" fontWeight="700" opacity="0.55">
<text x="100" y="22" fontSize="14">z</text>
<text x="110" y="10" fontSize="10">z</text>
</g>
)}
</svg>
);
}
/** Mascot with a speech bubble: sleeps when nothing waits, perks up when agents ask. */
export function PugBanner({ count }: { count: number }) {
const awake = count > 0;
return (
<div className="flex items-center gap-3">
<PugMascot mood={awake ? "alert" : "sleep"} className="text-muted-foreground" />
<div className="relative rounded-2xl border bg-card px-4 py-2.5 text-sm shadow-xs before:absolute before:top-1/2 before:-left-[7px] before:size-3 before:-translate-y-1/2 before:rotate-45 before:border-b before:border-l before:bg-card">
{awake ? (
<>
<span className="font-medium">Гав! {count === 1 ? "Агент ждёт" : "Агенты ждут"} твоего ответа</span>
<span className="text-muted-foreground"> — {plural(count)} ниже.</span>
</>
) : (
<span className="text-muted-foreground">Тихо… Агентам от тебя ничего не нужно, мопс спит.</span>
)}
</div>
</div>
);
}
function plural(n: number) {
const m10 = n % 10, m100 = n % 100;
const w = m10 === 1 && m100 !== 11 ? "вопрос" : m10 >= 2 && m10 <= 4 && (m100 < 12 || m100 > 14) ? "вопроса" : "вопросов";
return `${n} ${w}`;
}