peppa/apps/web/app/(app)/projects/page.tsx
Асель d039a8ac79 PEP-74: a superadmin opens any project; «Проекты других» on the projects page
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-14 18:39:36 +05:00

41 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Link from "next/link";
import { Plus } from "lucide-react";
import { listOtherProjects, listUserProjects } from "@peppa/core";
import { ProjectList } from "@/components/cards";
import { Flash, PageHeader, Section } from "@/components/common";
import { Button } from "@/components/ui/button";
import { Workspace } from "@/components/Workspace";
import { requireUser } from "@/lib/auth";
import { db } from "@/lib/db";
export default async function Projects({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
const user = await requireUser();
const { error } = await searchParams;
const [projects, others] = await Promise.all([listUserProjects(db, user.id), listOtherProjects(db, user.id)]);
return (
<Workspace>
<Flash error={error} />
<PageHeader
title="Проекты"
actions={
<Button asChild variant="default" size="sm">
<Link href="/projects/new">
<Plus />
Новый проект
</Link>
</Button>
}
>
Свои и общие проекты: доска стори, код, PR, релизы, ошибки из прода, участники.
</PageHeader>
<ProjectList projects={projects} userId={user.id} />
{others.length > 0 && (
<Section title="Проекты других" count={others.length}>
<p className="m-0 text-sm text-muted-foreground">Видны вам как суперадмину. Вопросы агентов и уведомления этих проектов к вам не приходят.</p>
<ProjectList projects={others} userId={user.id} />
</Section>
)}
</Workspace>
);
}