UI: board in one row, project panel moved into a ⋯ settings dialog
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ee9dec9b60
commit
52d861bbc7
@ -11,6 +11,7 @@ import { IncidentsSection } from "@/components/Incidents";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input, Textarea } from "@/components/ui/input";
|
||||
import { SettingsDialog } from "@/components/SettingsDialog";
|
||||
import { Workspace } from "@/components/Workspace";
|
||||
import { requireUser } from "@/lib/auth";
|
||||
import { db } from "@/lib/db";
|
||||
@ -162,7 +163,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
|
||||
);
|
||||
|
||||
return (
|
||||
<Workspace aside={aside}>
|
||||
<Workspace aside={null} wide>
|
||||
<AutoRefresh />
|
||||
<Flash error={error} />
|
||||
{created && !error && (
|
||||
@ -174,6 +175,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
|
||||
</Notice>
|
||||
)}
|
||||
<PageHeader
|
||||
actions={<SettingsDialog title="Настройки проекта">{aside}</SettingsDialog>}
|
||||
crumbs={<a href="/projects" className="text-muted-foreground hover:text-foreground">Проекты</a>}
|
||||
title={
|
||||
<>
|
||||
|
||||
@ -45,7 +45,7 @@ export function Board({ cards, back }: { cards: Card[]; back: string }) {
|
||||
start(() => moveTaskCard(f));
|
||||
};
|
||||
return (
|
||||
<div className={cn("grid gap-3 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-2 min-[1600px]:grid-cols-4", pending && "pointer-events-none opacity-60")}>
|
||||
<div className={cn("grid gap-3 sm:grid-cols-2 lg:grid-cols-4", pending && "pointer-events-none opacity-60")}>
|
||||
{COLUMNS.map((c) => {
|
||||
const list = cards.filter((x) => x.column === c.id);
|
||||
return (
|
||||
|
||||
33
apps/web/components/SettingsDialog.tsx
Normal file
33
apps/web/components/SettingsDialog.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
"use client";
|
||||
|
||||
import { useRef, type ReactNode } from "react";
|
||||
import { Ellipsis, X } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
/** "⋯" button that opens a side dialog (native <dialog>) with page settings rendered on the server. */
|
||||
export function SettingsDialog({ title, children }: { title: string; children: ReactNode }) {
|
||||
const ref = useRef<HTMLDialogElement>(null);
|
||||
return (
|
||||
<>
|
||||
<Button variant="ghost" size="icon" aria-label={title} title={title} onClick={() => ref.current?.showModal()}>
|
||||
<Ellipsis />
|
||||
</Button>
|
||||
<dialog
|
||||
ref={ref}
|
||||
aria-label={title}
|
||||
onClick={(e) => e.target === ref.current && ref.current.close()}
|
||||
className="m-0 ml-auto h-dvh max-h-dvh w-[400px] max-w-full border-l bg-sidebar p-0 text-foreground backdrop:bg-black/50"
|
||||
>
|
||||
<div className="flex flex-col gap-4 px-4 py-5">
|
||||
<div className="flex items-center gap-2">
|
||||
<h2 className="m-0 text-[15px] font-semibold">{title}</h2>
|
||||
<Button variant="ghost" size="icon" className="ml-auto" aria-label="Закрыть" onClick={() => ref.current?.close()}>
|
||||
<X />
|
||||
</Button>
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
</dialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -6,14 +6,15 @@ import { cn } from "@/lib/utils";
|
||||
/**
|
||||
* Centre + right panel of the console (PEP-38). The page decides what the right panel shows;
|
||||
* without `aside` it gets the default activity panel, `aside={null}` hides it.
|
||||
* `wide` lets the centre grow past the reading width (the board page, with its panel moved into a dialog).
|
||||
* Below xl the panel goes under the page content (`asideWideOnly`: shown on xl only), the footer is always last.
|
||||
*/
|
||||
export function Workspace({ children, aside, asideWideOnly = false }: { children: ReactNode; aside?: ReactNode; asideWideOnly?: boolean }) {
|
||||
export function Workspace({ children, aside, asideWideOnly = false, wide = false }: { children: ReactNode; aside?: ReactNode; asideWideOnly?: boolean; wide?: boolean }) {
|
||||
const panel = aside === undefined ? <ActivityAside /> : aside;
|
||||
return (
|
||||
<div className="grid flex-1 xl:grid-cols-[minmax(0,1fr)_360px] xl:grid-rows-[1fr_auto]">
|
||||
<div className={cn("grid flex-1", panel && "xl:grid-cols-[minmax(0,1fr)_360px] xl:grid-rows-[1fr_auto]")}>
|
||||
<main className="min-w-0 px-4 py-5 md:px-8 md:py-7">
|
||||
<div className="mx-auto w-full max-w-5xl">{children}</div>
|
||||
<div className={cn("mx-auto w-full", wide ? "max-w-[1600px]" : "max-w-5xl")}>{children}</div>
|
||||
</main>
|
||||
{panel && (
|
||||
<aside aria-label="Панель" className={cn(asideWideOnly && "max-xl:hidden", "min-w-0 border-t bg-sidebar/60 px-4 py-5 xl:sticky xl:top-0 xl:col-start-2 xl:row-span-2 xl:row-start-1 xl:h-dvh xl:overflow-y-auto xl:border-t-0 xl:border-l")}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user