"use client"; import { useState, type ReactNode } from "react"; import { ChevronRight } from "lucide-react"; import { Input, Label } from "@/components/ui/input"; const RU: Record = { а: "a", б: "b", в: "v", г: "g", д: "d", е: "e", ё: "e", ж: "zh", з: "z", и: "i", й: "y", к: "k", л: "l", м: "m", н: "n", о: "o", п: "p", р: "r", с: "s", т: "t", у: "u", ф: "f", х: "h", ц: "ts", ч: "ch", ш: "sh", щ: "sch", ъ: "", ы: "y", ь: "", э: "e", ю: "yu", я: "ya", ә: "a", ғ: "g", қ: "k", ң: "n", ө: "o", ұ: "u", ү: "u", һ: "h", і: "i", }; const latin = (s: string) => [...s.toLowerCase()].map((c) => RU[c] ?? c).join(""); /** «Сервис бронирования столиков» → `servis-bronirovaniya-stolikov` (the code's address). */ export function slugFrom(name: string): string { return latin(name).replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40).replace(/-+$/, ""); } /** «Сервис бронирования столиков» → `SBS` (story numbers SBS-1, SBS-2…). */ export function keyFrom(name: string): string { const words = latin(name).split(/[^a-z0-9]+/).filter(Boolean); let key = words.length > 1 ? words.map((w) => w[0]).join("") : (words[0] ?? "").slice(0, 3); key = key.replace(/^[0-9]+/, "").slice(0, 5).toUpperCase(); return key.length >= 2 ? key : (key + "PRJ").slice(0, 3); } /** * PEP-102: a product manager types the product's name; the code's address and the short code of * story numbers fill in by themselves (editable under «Дополнительно» until touched). */ export function ProjectBasics({ children }: { children?: ReactNode }) { const [name, setName] = useState(""); const [slug, setSlug] = useState(null); const [key, setKey] = useState(null); const autoSlug = slugFrom(name) || "my-product"; const autoKey = keyFrom(name); return ( <>

Задачи проекта будут называться {key ?? autoKey}-1,{" "} {key ?? autoKey}-2 и так далее — по ним удобно говорить с агентами и ботом.

Дополнительно — можно не трогать
{children}
); }