From 34db34c29ce7cb342b79333362419cd90016d07a Mon Sep 17 00:00:00 2001 From: Markov Date: Sun, 15 Feb 2026 20:36:03 +0100 Subject: [PATCH] feat: remove landing page, add 'New project' to sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - / redirects to first project or /projects/new - Sidebar has '+ Новый проект' link at top - /projects/new shows create modal --- src/app/(protected)/page.tsx | 81 ++++------------------- src/app/(protected)/projects/new/page.tsx | 17 +++++ src/components/Sidebar.tsx | 10 +++ 3 files changed, 39 insertions(+), 69 deletions(-) create mode 100644 src/app/(protected)/projects/new/page.tsx diff --git a/src/app/(protected)/page.tsx b/src/app/(protected)/page.tsx index 02c1ffb..1e2e724 100644 --- a/src/app/(protected)/page.tsx +++ b/src/app/(protected)/page.tsx @@ -1,82 +1,25 @@ "use client"; -import { useEffect, useState } from "react"; -import Link from "next/link"; +import { useEffect } from "react"; import { useRouter } from "next/navigation"; -import { getProjects, Project } from "@/lib/api"; -import { logout } from "@/lib/auth-client"; -import CreateProjectModal from "@/components/CreateProjectModal"; +import { getProjects } from "@/lib/api"; export default function Home() { - const [projects, setProjects] = useState([]); - const [loading, setLoading] = useState(true); - const [showCreate, setShowCreate] = useState(false); const router = useRouter(); useEffect(() => { - getProjects() - .then(setProjects) - .catch(() => {}) - .finally(() => setLoading(false)); - }, []); + getProjects().then((projects) => { + if (projects.length > 0) { + router.replace(`/projects/${projects[0].slug}`); + } else { + router.replace("/projects/new"); + } + }).catch(() => {}); + }, [router]); return ( -
-
-
-

Team Board

-

AI Agent Collaboration Platform

- - {loading ? ( -

Загрузка...

- ) : ( - <> - {projects.length > 0 && ( -
- {projects.map((p) => ( - -
{p.name}
- {p.description && ( -
{p.description}
- )} - - ))} -
- )} - - - - )} - - -
-
- - {showCreate && ( - setShowCreate(false)} - onCreated={(project) => { - setShowCreate(false); - router.push(`/projects/${project.slug}`); - }} - /> - )} +
+ Загрузка...
); } diff --git a/src/app/(protected)/projects/new/page.tsx b/src/app/(protected)/projects/new/page.tsx new file mode 100644 index 0000000..f587e29 --- /dev/null +++ b/src/app/(protected)/projects/new/page.tsx @@ -0,0 +1,17 @@ +"use client"; + +import { useRouter } from "next/navigation"; +import CreateProjectModal from "@/components/CreateProjectModal"; + +export default function NewProjectPage() { + const router = useRouter(); + + return ( +
+ router.push(`/projects/${project.slug}`)} + onClose={() => router.back()} + /> +
+ ); +} diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 13f2e84..33b7370 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -29,6 +29,16 @@ export default function Sidebar({ projects, activeSlug }: Props) {