feat: remove landing page, add 'New project' to sidebar
All checks were successful
Deploy Web Client / deploy (push) Successful in 36s

- / redirects to first project or /projects/new
- Sidebar has '+ Новый проект' link at top
- /projects/new shows create modal
This commit is contained in:
Markov 2026-02-15 20:36:03 +01:00
parent ec2e8502f8
commit 34db34c29c
3 changed files with 39 additions and 69 deletions

View File

@ -1,82 +1,25 @@
"use client"; "use client";
import { useEffect, useState } from "react"; import { useEffect } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { getProjects, Project } from "@/lib/api"; import { getProjects } from "@/lib/api";
import { logout } from "@/lib/auth-client";
import CreateProjectModal from "@/components/CreateProjectModal";
export default function Home() { export default function Home() {
const [projects, setProjects] = useState<Project[]>([]);
const [loading, setLoading] = useState(true);
const [showCreate, setShowCreate] = useState(false);
const router = useRouter(); const router = useRouter();
useEffect(() => { useEffect(() => {
getProjects() getProjects().then((projects) => {
.then(setProjects) if (projects.length > 0) {
.catch(() => {}) router.replace(`/projects/${projects[0].slug}`);
.finally(() => setLoading(false)); } else {
}, []); router.replace("/projects/new");
}
}).catch(() => {});
}, [router]);
return ( return (
<div className="flex h-screen"> <div className="flex h-screen items-center justify-center text-[var(--muted)]">
<main className="flex-1 flex items-center justify-center"> Загрузка...
<div className="text-center max-w-md w-full px-4">
<h1 className="text-4xl font-bold mb-2">Team Board</h1>
<p className="text-[var(--muted)] mb-8">AI Agent Collaboration Platform</p>
{loading ? (
<p className="text-[var(--muted)]">Загрузка...</p>
) : (
<>
{projects.length > 0 && (
<div className="flex flex-col gap-2 mb-6">
{projects.map((p) => (
<Link
key={p.id}
href={`/projects/${p.slug}`}
className="px-6 py-3 bg-[var(--card)] border border-[var(--border)] rounded-lg
hover:border-[var(--accent)] transition-colors text-left"
>
<div className="font-semibold">{p.name}</div>
{p.description && (
<div className="text-sm text-[var(--muted)]">{p.description}</div>
)}
</Link>
))}
</div>
)}
<button
onClick={() => setShowCreate(true)}
className="px-6 py-3 bg-[var(--accent)] text-white rounded-lg hover:opacity-90
transition-opacity text-sm font-medium"
>
+ Новый проект
</button>
</>
)}
<button
onClick={logout}
className="mt-8 block mx-auto text-xs text-[var(--muted)] hover:text-[var(--fg)] transition-colors"
>
Выйти
</button>
</div>
</main>
{showCreate && (
<CreateProjectModal
onClose={() => setShowCreate(false)}
onCreated={(project) => {
setShowCreate(false);
router.push(`/projects/${project.slug}`);
}}
/>
)}
</div> </div>
); );
} }

View File

@ -0,0 +1,17 @@
"use client";
import { useRouter } from "next/navigation";
import CreateProjectModal from "@/components/CreateProjectModal";
export default function NewProjectPage() {
const router = useRouter();
return (
<div className="flex h-screen items-center justify-center">
<CreateProjectModal
onCreated={(project) => router.push(`/projects/${project.slug}`)}
onClose={() => router.back()}
/>
</div>
);
}

View File

@ -29,6 +29,16 @@ export default function Sidebar({ projects, activeSlug }: Props) {
</div> </div>
<nav className="flex-1 overflow-y-auto p-2"> <nav className="flex-1 overflow-y-auto p-2">
<Link
href="/projects/new"
onClick={() => setOpen(false)}
className="flex items-center gap-2 px-3 py-2 mb-2 rounded text-sm text-[var(--accent)]
hover:bg-[var(--accent)]/10 transition-colors"
>
<span className="text-lg leading-none">+</span>
Новый проект
</Link>
<div className="text-xs uppercase text-[var(--muted)] px-2 py-1 mb-1">Проекты</div> <div className="text-xs uppercase text-[var(--muted)] px-2 py-1 mb-1">Проекты</div>
{projects.map((p) => ( {projects.map((p) => (
<Link <Link