Merge pull request 'PEP-70: маскот-мопс у вопросов агентов' (#61) from task/pep-70 into main
This commit is contained in:
commit
b6355a7ab5
@ -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 />)}
|
||||
|
||||
@ -101,3 +101,15 @@
|
||||
@apply bg-primary/30;
|
||||
}
|
||||
}
|
||||
|
||||
/* PEP-70: pug mascot — breathing while asleep, a curious head tilt and a blinking cursor when agents ask. */
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.pug-sleep .pug-body { 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; }
|
||||
.pug-alert .pug-cursor { animation: pug-blink 1s steps(1) infinite; }
|
||||
}
|
||||
@keyframes pug-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02, 0.985); } }
|
||||
@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(-7deg); } 85% { transform: rotate(4deg); } }
|
||||
@keyframes pug-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
|
||||
|
||||
147
apps/web/components/PugMascot.tsx
Normal file
147
apps/web/components/PugMascot.tsx
Normal file
@ -0,0 +1,147 @@
|
||||
// PEP-70: Peppa's mascot — a soft "clay" chibi pug with a terminal prompt (`> _`) glowing on its belly.
|
||||
// Pure SVG (no external images), fixed colours that read on both themes; motion only without
|
||||
// reduced-motion (see .pug-* in app.css).
|
||||
import { useId } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type Mood = "sleep" | "alert";
|
||||
|
||||
export function PugMascot({ mood, size = 96, className }: { mood: Mood; size?: number; className?: string }) {
|
||||
const awake = mood === "alert";
|
||||
const id = useId().replace(/[^a-zA-Z0-9]/g, "");
|
||||
const fur = `pf${id}`, furDark = `pd${id}`, ear = `pe${id}`, screen = `ps${id}`, glow = `pg${id}`, soft = `po${id}`;
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 120 140"
|
||||
width={(size * 120) / 140}
|
||||
height={size}
|
||||
role="img"
|
||||
aria-label={awake ? "Мопс Пеппы ждёт твоего ответа" : "Мопс Пеппы спит"}
|
||||
className={cn("shrink-0 overflow-visible", awake ? "pug-alert" : "pug-sleep", className)}
|
||||
>
|
||||
<defs>
|
||||
<radialGradient id={fur} cx="35%" cy="28%" r="80%">
|
||||
<stop offset="0" stopColor="#fbe6c4" />
|
||||
<stop offset="0.55" stopColor="#e8bd86" />
|
||||
<stop offset="1" stopColor="#b98550" />
|
||||
</radialGradient>
|
||||
<radialGradient id={furDark} cx="35%" cy="25%" r="85%">
|
||||
<stop offset="0" stopColor="#f3d3a4" />
|
||||
<stop offset="0.6" stopColor="#dcaa6e" />
|
||||
<stop offset="1" stopColor="#a77443" />
|
||||
</radialGradient>
|
||||
<radialGradient id={ear} cx="35%" cy="30%" r="80%">
|
||||
<stop offset="0" stopColor="#6b544b" />
|
||||
<stop offset="1" stopColor="#2a201d" />
|
||||
</radialGradient>
|
||||
<linearGradient id={screen} x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stopColor="#2b3157" />
|
||||
<stop offset="1" stopColor="#11142a" />
|
||||
</linearGradient>
|
||||
<filter id={glow} x="-50%" y="-50%" width="200%" height="200%">
|
||||
<feGaussianBlur stdDeviation="1.6" result="b" />
|
||||
<feMerge>
|
||||
<feMergeNode in="b" />
|
||||
<feMergeNode in="SourceGraphic" />
|
||||
</feMerge>
|
||||
</filter>
|
||||
<filter id={soft} x="-20%" y="-20%" width="140%" height="140%">
|
||||
<feDropShadow dx="0" dy="2" stdDeviation="1.5" floodColor="#000" floodOpacity="0.25" />
|
||||
</filter>
|
||||
</defs>
|
||||
|
||||
{/* floor shadow */}
|
||||
<ellipse cx="60" cy="135" rx="30" ry="4" fill="#000" opacity="0.28" />
|
||||
|
||||
<g className="pug-body" style={{ transformOrigin: "60px 135px" }} filter={`url(#${soft})`}>
|
||||
{/* curly tail */}
|
||||
<path d="M82 108 C99 108 103 92 93 89 C86 87 84 96 91 97" fill="none" stroke="#d29c63" strokeWidth="7" strokeLinecap="round" />
|
||||
{/* legs */}
|
||||
<rect x="42" y="110" width="15" height="22" rx="7.5" fill={`url(#${furDark})`} />
|
||||
<rect x="63" y="110" width="15" height="22" rx="7.5" fill={`url(#${furDark})`} />
|
||||
{/* body */}
|
||||
<ellipse cx="60" cy="102" rx="27" ry="22" fill={`url(#${fur})`} />
|
||||
{/* arms */}
|
||||
<ellipse cx="34" cy="101" rx="7" ry="11" transform="rotate(22 34 101)" fill={`url(#${furDark})`} />
|
||||
<ellipse cx="86" cy="101" rx="7" ry="11" transform="rotate(-22 86 101)" fill={`url(#${furDark})`} />
|
||||
{/* belly screen with the glowing prompt */}
|
||||
<rect x="45" y="94" width="30" height="20" rx="7" fill={`url(#${screen})`} stroke="#0b0d1c" strokeWidth="1.2" />
|
||||
<path d="M49 97.5 Q55 96 62 96.5" fill="none" stroke="#fff" strokeWidth="1.5" strokeLinecap="round" opacity="0.18" />
|
||||
<g filter={`url(#${glow})`} stroke="#a6f0ff" strokeWidth="3.2" strokeLinecap="round" strokeLinejoin="round" fill="none" opacity={awake ? 1 : 0.4}>
|
||||
<path d="M51 99.5 L56 104 L51 108.5" />
|
||||
<path className="pug-cursor" d="M60 108.5 L68 108.5" />
|
||||
</g>
|
||||
|
||||
<g className="pug-head" style={{ transformOrigin: "60px 88px" }}>
|
||||
{/* head */}
|
||||
<ellipse cx="60" cy="54" rx="47" ry="40" fill={`url(#${fur})`} />
|
||||
{/* folded button ears */}
|
||||
<path d="M34 22 C22 12 5 17 4 34 C3 43 10 47 16 41 C21 36 27 31 37 28 Z" fill={`url(#${ear})`} />
|
||||
<path d="M86 22 C98 12 115 17 116 34 C117 43 110 47 104 41 C99 36 93 31 83 28 Z" fill={`url(#${ear})`} />
|
||||
{/* forehead wrinkles */}
|
||||
<path d="M47 24 Q60 18 73 24" fill="none" stroke="#c08a55" strokeWidth="2.5" strokeLinecap="round" opacity="0.8" />
|
||||
<path d="M51 30 Q60 26 69 30" fill="none" stroke="#c08a55" strokeWidth="2.5" strokeLinecap="round" opacity="0.8" />
|
||||
{/* cheeks */}
|
||||
<ellipse cx="20" cy="66" rx="6" ry="3.5" fill="#f29aa3" opacity="0.6" />
|
||||
<ellipse cx="100" cy="66" rx="6" ry="3.5" fill="#f29aa3" opacity="0.6" />
|
||||
{/* black mask */}
|
||||
<ellipse cx="60" cy="70" rx="25" ry="18" fill={`url(#${ear})`} />
|
||||
{/* eyes */}
|
||||
{awake ? (
|
||||
<>
|
||||
<circle cx="38" cy="52" r="11" fill="#2b2220" />
|
||||
<circle cx="82" cy="52" r="11" fill="#2b2220" />
|
||||
<circle cx="42" cy="48" r="4.2" fill="#fff" />
|
||||
<circle cx="86" cy="48" r="4.2" fill="#fff" />
|
||||
<circle cx="35" cy="56" r="1.8" fill="#fff" />
|
||||
<circle cx="79" cy="56" r="1.8" fill="#fff" />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<path d="M28 53 Q38 59 48 53" fill="none" stroke="#2b2220" strokeWidth="3.5" strokeLinecap="round" />
|
||||
<path d="M72 53 Q82 59 92 53" fill="none" stroke="#2b2220" strokeWidth="3.5" strokeLinecap="round" />
|
||||
</>
|
||||
)}
|
||||
{/* nose, mouth, tongue */}
|
||||
<ellipse cx="60" cy="62" rx="8.5" ry="5" fill="#1d1716" />
|
||||
<ellipse cx="57.5" cy="60.5" rx="2.8" ry="1.3" fill="#fff" opacity="0.5" />
|
||||
<path d="M60 67 L60 72 M51.5 72 Q55.7 76.5 60 72 Q64.3 76.5 68.5 72" fill="none" stroke="#120d0c" strokeWidth="2.3" strokeLinecap="round" />
|
||||
{awake && <path d="M56 74.5 Q60 86 64 74.5 Z" fill="#f28b9b" stroke="#d96a7c" strokeWidth="1.3" />}
|
||||
</g>
|
||||
</g>
|
||||
|
||||
{!awake && (
|
||||
<g className="pug-zzz" fill="currentColor" fontWeight="700" opacity="0.55">
|
||||
<text x="104" y="16" fontSize="13">z</text>
|
||||
<text x="113" y="5" fontSize="9">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}`;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user