623 lines
27 KiB
TypeScript
623 lines
27 KiB
TypeScript
// WF-P8 S04 "Board-Einstellungen" — built against Davids Subframe export of
|
|
// 2026-07-28 (page 0b946683-2cca-4cd4-864d-f69ed1937fdb).
|
|
//
|
|
// This screen is the per-board half of the admin split: S07 lists the boards,
|
|
// S04 configures one. Pure/presentational — renders the server-built
|
|
// BoardSettingsData and turns every mutation into a typed
|
|
// onSubmit(intent, fields) the route POSTs. No useLoaderData/useFetcher, no
|
|
// server imports.
|
|
//
|
|
// Deliberate deltas against the export:
|
|
// * The export imports `@/ui/components/SettingsPage`, which the local ~/ui
|
|
// kit does not ship. The section headers are rendered with the same two
|
|
// lines of markup instead.
|
|
// * `Table.Cell variant="align-right"` only exists in the export; locally the
|
|
// variants are align-left/align-center, so right-aligned cells use a
|
|
// justify-end wrapper.
|
|
// * The column "Status" select offers the three real stage kinds
|
|
// (offen/gewonnen/verloren). The export's free-text statuses plus "Neuen
|
|
// Status eingeben …" would need a schema change that the kanban, the M01
|
|
// lost dialog and the win/loss numbers all read from — out of ticket scope.
|
|
// * The export shows a per-row pencil next to always-editable inputs. The
|
|
// inputs already are the edit affordance, so the row shows a save action
|
|
// when it is dirty rather than a pencil that toggles nothing.
|
|
// * Colour and win-% per column are kept although the export drops them: both
|
|
// are live data the board and the forecast render.
|
|
// * "Zugriff" has no section in the export but no other screen configures
|
|
// it; dropping it here would make a shipped feature unreachable.
|
|
// * The M04 successor board USED to sit at the bottom of this page for the
|
|
// same reason. It was taken out on request (acceptance 2026-07-31): the
|
|
// export does not show it here. Nothing else sets
|
|
// `Pipeline.nachfolgePipelineId` today, so the handover cannot be
|
|
// configured from the UI until it gets a new home — the write path
|
|
// (`updatePipeline`) is untouched and still accepts the field.
|
|
|
|
import { useEffect, useState, type CSSProperties } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { AppLink } from "~/components/app/AppLink";
|
|
import {
|
|
DndContext,
|
|
KeyboardSensor,
|
|
PointerSensor,
|
|
closestCenter,
|
|
useSensor,
|
|
useSensors,
|
|
type DragEndEvent,
|
|
} from "@dnd-kit/core";
|
|
import { SortableContext, arrayMove, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
import { CSS } from "@dnd-kit/utilities";
|
|
import type { BoardSettingsData, PipelineAdminItem, PipelineAdminStage } from "@hivegrid/view-models";
|
|
import {
|
|
FeatherArrowRightCircle,
|
|
FeatherCheck,
|
|
FeatherClipboardList,
|
|
FeatherGripVertical,
|
|
FeatherKanban,
|
|
FeatherPencil,
|
|
FeatherPlus,
|
|
FeatherTrash,
|
|
FeatherX,
|
|
} from "@subframe/core";
|
|
import { PAGE_HEADER_ICON_CLASS, PageBody, PageHeader, PageShell } from "../shared/PageShell";
|
|
import { Accordion } from "~/ui/components/Accordion";
|
|
import { Alert } from "~/ui/components/Alert";
|
|
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
|
import { Button } from "~/ui/components/Button";
|
|
import { IconButton } from "~/ui/components/IconButton";
|
|
import { Select } from "~/ui/components/Select";
|
|
import { Table } from "~/ui/components/Table";
|
|
import { TextInput } from "~/ui/components/TextInput";
|
|
import { useLocaleFormatters } from "~/locale/format";
|
|
|
|
export type BoardSettingsSubmit = (intent: string, fields: Record<string, string>) => void;
|
|
export type BoardSettingsPageProps = {
|
|
data: BoardSettingsData;
|
|
submitting: boolean;
|
|
errorKey?: string | null;
|
|
/** S05 detail-field template of this board. */
|
|
fieldTemplateHref: string;
|
|
actions: { onSubmit: BoardSettingsSubmit };
|
|
};
|
|
|
|
const STAGE_KINDS = ["offen", "gewonnen", "verloren"] as const;
|
|
|
|
const sectionTitle = "text-body-large font-body-large text-text-neutral-primary";
|
|
const sectionDescription = "text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary";
|
|
const mutedText = "text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary";
|
|
|
|
// Native <input type="color"> rendered as a round swatch (no padded border):
|
|
// it is both the colour dot the export draws and the way to change it, so the
|
|
// row does not need a second control. The webkit/moz pseudo-elements strip the
|
|
// default swatch padding and border.
|
|
const colorSwatchClass =
|
|
"h-3.5 w-3.5 shrink-0 cursor-pointer appearance-none rounded-full border-none bg-transparent p-0 [&::-webkit-color-swatch-wrapper]:p-0 [&::-webkit-color-swatch]:rounded-full [&::-webkit-color-swatch]:border-none [&::-moz-color-swatch]:rounded-full [&::-moz-color-swatch]:border-none";
|
|
|
|
function SectionHeader({ title, description }: { title: string; description: string }) {
|
|
return (
|
|
<div className="flex w-full flex-col items-start gap-1">
|
|
<h2 className={sectionTitle}>{title}</h2>
|
|
<p className={sectionDescription}>{description}</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
type StageDraft = { name: string; stageKind: string; winProbability: string; color: string };
|
|
|
|
function draftOf(stage: PipelineAdminStage): StageDraft {
|
|
return { name: stage.name, stageKind: stage.stageKind, winProbability: String(stage.winProbability), color: stage.color };
|
|
}
|
|
|
|
function draftDiffers(draft: StageDraft, stage: PipelineAdminStage): boolean {
|
|
return (
|
|
draft.name !== stage.name ||
|
|
draft.stageKind !== stage.stageKind ||
|
|
draft.winProbability !== String(stage.winProbability) ||
|
|
draft.color !== stage.color
|
|
);
|
|
}
|
|
|
|
/** One draggable column row. Name, kind, win-% and colour edit in place; the
|
|
* save action only appears once the row actually differs from the server state,
|
|
* so an untouched table has no buttons inviting a pointless write. */
|
|
function SortableStageRow({
|
|
stage,
|
|
pipelineId,
|
|
submit,
|
|
submitting,
|
|
}: {
|
|
stage: PipelineAdminStage;
|
|
pipelineId: string;
|
|
submit: BoardSettingsSubmit;
|
|
submitting: boolean;
|
|
}) {
|
|
const { t } = useTranslation();
|
|
const [draft, setDraft] = useState<StageDraft>(() => draftOf(stage));
|
|
useEffect(() => {
|
|
setDraft(draftOf(stage));
|
|
}, [stage]);
|
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: stage.id });
|
|
const style: CSSProperties = { transform: CSS.Transform.toString(transform), transition, opacity: isDragging ? 0.6 : 1 };
|
|
const idBase = `ui.projects.boardSettings.stage.${stage.id}`;
|
|
const dirty = draftDiffers(draft, stage);
|
|
// The export's row has Name, Status and Projektanzahl only. The win
|
|
// probability is live data (forecast, board) with no other screen to edit it,
|
|
// so the export's per-row pencil opens it instead of showing a fourth column.
|
|
const [expanded, setExpanded] = useState(false);
|
|
|
|
return (
|
|
<>
|
|
<Table.Row ref={setNodeRef} style={style} data-row-id={stage.id} data-ui-id={idBase}>
|
|
<Table.Cell className="w-12">
|
|
<div className="flex items-center gap-2">
|
|
<button
|
|
type="button"
|
|
className="inline-flex min-h-8 min-w-8 cursor-grab touch-none items-center justify-center text-icon-neutral-tertiary hover:text-icon-neutral-secondary focus:outline-none"
|
|
aria-label={t("projects.admin.dragStageAria", { name: stage.name })}
|
|
data-ui-id={`${idBase}.drag`}
|
|
{...listeners}
|
|
{...attributes}
|
|
>
|
|
<FeatherGripVertical aria-hidden />
|
|
</button>
|
|
<input
|
|
type="color"
|
|
value={draft.color}
|
|
onChange={(e) => setDraft((s) => ({ ...s, color: e.target.value }))}
|
|
className={colorSwatchClass}
|
|
aria-label={t("projects.fields.color")}
|
|
data-ui-id={`${idBase}.color`}
|
|
/>
|
|
</div>
|
|
</Table.Cell>
|
|
<Table.Cell>
|
|
<TextInput className="w-full min-w-0" size="small" variant="filled">
|
|
<TextInput.Input
|
|
value={draft.name}
|
|
placeholder={t("projects.fields.name")}
|
|
aria-label={t("projects.fields.name")}
|
|
onChange={(e) => setDraft((s) => ({ ...s, name: e.target.value }))}
|
|
data-ui-id={`${idBase}.name`}
|
|
/>
|
|
</TextInput>
|
|
</Table.Cell>
|
|
<Table.Cell>
|
|
<Select
|
|
className="w-full min-w-0"
|
|
size="small"
|
|
variant="filled"
|
|
triggerAriaLabel={t("projects.fields.stageKind")}
|
|
value={draft.stageKind}
|
|
onValueChange={(value) => setDraft((s) => ({ ...s, stageKind: value }))}
|
|
data-ui-id={`${idBase}.kind`}
|
|
>
|
|
{STAGE_KINDS.map((kind) => (
|
|
<Select.Item key={kind} value={kind}>
|
|
{t(kind === "gewonnen" ? "projects.outcome.won" : kind === "verloren" ? "projects.outcome.lost" : "projects.outcome.open")}
|
|
</Select.Item>
|
|
))}
|
|
</Select>
|
|
</Table.Cell>
|
|
<Table.Cell className="w-56">
|
|
<div className="flex w-full items-center justify-end gap-2">
|
|
<span
|
|
className="whitespace-nowrap text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary"
|
|
data-ui-id={`${idBase}.projects`}
|
|
>
|
|
{t("projects.boardSettings.columns.projectCount", { count: stage.projectCount })}
|
|
</span>
|
|
<IconButton
|
|
variant="ghost"
|
|
size="small"
|
|
square
|
|
icon={<FeatherPencil />}
|
|
aria-label={t("projects.actions.edit")}
|
|
aria-expanded={expanded}
|
|
onClick={() => setExpanded((value) => !value)}
|
|
data-ui-id={`${idBase}.edit`}
|
|
/>
|
|
{dirty ? (
|
|
<IconButton
|
|
variant="success"
|
|
size="small"
|
|
square
|
|
icon={<FeatherCheck />}
|
|
loading={submitting}
|
|
disabled={!draft.name.trim()}
|
|
aria-label={t("projects.actions.save")}
|
|
onClick={() =>
|
|
submit("upsertStage", {
|
|
pipelineId,
|
|
stageId: stage.id,
|
|
name: draft.name.trim(),
|
|
stageKind: draft.stageKind,
|
|
winProbability: draft.winProbability,
|
|
color: draft.color,
|
|
})
|
|
}
|
|
data-ui-id={`${idBase}.save`}
|
|
/>
|
|
) : null}
|
|
<IconButton
|
|
variant="ghost"
|
|
size="small"
|
|
square
|
|
icon={<FeatherTrash />}
|
|
aria-label={t("projects.actions.remove")}
|
|
onClick={() => submit("archiveStage", { stageId: stage.id })}
|
|
data-ui-id={`${idBase}.archive`}
|
|
/>
|
|
</div>
|
|
</Table.Cell>
|
|
</Table.Row>
|
|
{expanded ? (
|
|
<Table.Row data-ui-id={`${idBase}.details`}>
|
|
<Table.Cell colSpan={4} className="bg-surface-neutral-primary">
|
|
<div className="flex flex-wrap items-center gap-2 py-1">
|
|
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary">
|
|
{t("projects.fields.winProbability")}
|
|
</span>
|
|
<TextInput className="w-20 min-w-0" size="small" variant="filled">
|
|
<TextInput.Input
|
|
type="number"
|
|
value={draft.winProbability}
|
|
aria-label={t("projects.fields.winProbability")}
|
|
onChange={(e) => setDraft((s) => ({ ...s, winProbability: e.target.value }))}
|
|
data-ui-id={`${idBase}.winProbability`}
|
|
/>
|
|
</TextInput>
|
|
<span aria-hidden className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary">%</span>
|
|
</div>
|
|
</Table.Cell>
|
|
</Table.Row>
|
|
) : null}
|
|
</>
|
|
);
|
|
}
|
|
|
|
/** Drag&drop-orderable column list. On drop it persists the whole new
|
|
* top-to-bottom order via `reorderStages`; the service reassigns positions. */
|
|
function StageTable({ board, submit, submitting }: { board: PipelineAdminItem; submit: BoardSettingsSubmit; submitting: boolean }) {
|
|
const { t } = useTranslation();
|
|
const [order, setOrder] = useState<string[]>(() => board.stages.map((stage) => stage.id));
|
|
useEffect(() => {
|
|
setOrder(board.stages.map((stage) => stage.id));
|
|
}, [board.stages]);
|
|
const sensors = useSensors(
|
|
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),
|
|
);
|
|
const stageById = new Map(board.stages.map((stage) => [stage.id, stage]));
|
|
const ordered = order.map((id) => stageById.get(id)).filter((stage): stage is PipelineAdminStage => Boolean(stage));
|
|
|
|
function handleDragEnd(event: DragEndEvent) {
|
|
const { active, over } = event;
|
|
if (!over || active.id === over.id) return;
|
|
const oldIndex = order.indexOf(String(active.id));
|
|
const newIndex = order.indexOf(String(over.id));
|
|
if (oldIndex < 0 || newIndex < 0) return;
|
|
const next = arrayMove(order, oldIndex, newIndex);
|
|
setOrder(next);
|
|
submit("reorderStages", { pipelineId: board.id, stageIds: JSON.stringify(next) });
|
|
}
|
|
|
|
return (
|
|
<div className="flex w-full flex-col items-start overflow-hidden rounded-lg border border-solid border-border-default bg-surface-neutral-secondary shadow-sm overflow-x-auto">
|
|
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
|
|
<SortableContext items={order} strategy={verticalListSortingStrategy}>
|
|
<Table
|
|
className="border-none min-w-[640px]"
|
|
data-ui-id={`ui.projects.boardSettings.stageList.${board.id}`}
|
|
header={
|
|
<Table.HeaderRow>
|
|
<Table.HeaderCell className="w-12" />
|
|
<Table.HeaderCell>{t("projects.fields.name")}</Table.HeaderCell>
|
|
<Table.HeaderCell>{t("projects.boardSettings.columns.status")}</Table.HeaderCell>
|
|
<Table.HeaderCell className="w-56">{t("projects.boardSettings.columns.projects")}</Table.HeaderCell>
|
|
</Table.HeaderRow>
|
|
}
|
|
emptyText={t("projects.boardSettings.columns.empty")}
|
|
>
|
|
{ordered.map((stage) => (
|
|
<SortableStageRow key={stage.id} stage={stage} pipelineId={board.id} submit={submit} submitting={submitting} />
|
|
))}
|
|
</Table>
|
|
</SortableContext>
|
|
</DndContext>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
/** Create row for a new column. Resets to an empty draft after each write so the
|
|
* next column can be typed right away. */
|
|
function AddStageForm({ pipelineId, submit, submitting }: { pipelineId: string; submit: BoardSettingsSubmit; submitting: boolean }) {
|
|
const { t } = useTranslation();
|
|
const emptyDraft: StageDraft = { name: "", stageKind: "offen", winProbability: "0", color: "#6b7280" };
|
|
const [draft, setDraft] = useState<StageDraft>(emptyDraft);
|
|
const [open, setOpen] = useState(false);
|
|
const idBase = `ui.projects.boardSettings.addStage.${pipelineId}`;
|
|
|
|
if (!open) {
|
|
return (
|
|
<Button variant="tertiary" size="small" icon={<FeatherPlus />} onClick={() => setOpen(true)} data-ui-id={`${idBase}.open`}>
|
|
{t("projects.boardSettings.columns.add")}
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="grid w-full items-end gap-3 sm:grid-cols-2 lg:grid-cols-4" data-ui-id={idBase}>
|
|
<TextInput label={t("projects.fields.name")} showLabel>
|
|
<TextInput.Input
|
|
autoFocus
|
|
value={draft.name}
|
|
onChange={(e) => setDraft((s) => ({ ...s, name: e.target.value }))}
|
|
data-ui-id={`${idBase}.name`}
|
|
/>
|
|
</TextInput>
|
|
<Select
|
|
label={t("projects.fields.stageKind")}
|
|
showLabel
|
|
value={draft.stageKind}
|
|
onValueChange={(value) => setDraft((s) => ({ ...s, stageKind: value }))}
|
|
data-ui-id={`${idBase}.kind`}
|
|
>
|
|
{STAGE_KINDS.map((kind) => (
|
|
<Select.Item key={kind} value={kind}>
|
|
{t(kind === "gewonnen" ? "projects.outcome.won" : kind === "verloren" ? "projects.outcome.lost" : "projects.outcome.open")}
|
|
</Select.Item>
|
|
))}
|
|
</Select>
|
|
<TextInput label={t("projects.fields.winProbability")} showLabel>
|
|
<TextInput.Input
|
|
type="number"
|
|
value={draft.winProbability}
|
|
onChange={(e) => setDraft((s) => ({ ...s, winProbability: e.target.value }))}
|
|
data-ui-id={`${idBase}.winProbability`}
|
|
/>
|
|
</TextInput>
|
|
<div className="flex items-center gap-2">
|
|
<input
|
|
type="color"
|
|
value={draft.color}
|
|
onChange={(e) => setDraft((s) => ({ ...s, color: e.target.value }))}
|
|
className={`${colorSwatchClass} h-6 w-6`}
|
|
aria-label={t("projects.fields.color")}
|
|
data-ui-id={`${idBase}.color`}
|
|
/>
|
|
<Button
|
|
size="small"
|
|
icon={<FeatherPlus />}
|
|
disabled={!draft.name.trim()}
|
|
loading={submitting}
|
|
onClick={() => {
|
|
submit("upsertStage", {
|
|
pipelineId,
|
|
name: draft.name.trim(),
|
|
stageKind: draft.stageKind,
|
|
winProbability: draft.winProbability,
|
|
color: draft.color,
|
|
});
|
|
setDraft(emptyDraft);
|
|
}}
|
|
data-ui-id={`${idBase}.submit`}
|
|
>
|
|
{t("projects.actions.addStage")}
|
|
</Button>
|
|
<Button
|
|
variant="tertiary"
|
|
size="small"
|
|
onClick={() => {
|
|
setDraft(emptyDraft);
|
|
setOpen(false);
|
|
}}
|
|
>
|
|
{t("projects.actions.cancel")}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function BoardSettingsPage(props: BoardSettingsPageProps) {
|
|
const { t } = useTranslation();
|
|
const formatters = useLocaleFormatters();
|
|
const submit = props.actions.onSubmit;
|
|
const board = props.data.board;
|
|
const [renaming, setRenaming] = useState(false);
|
|
const [name, setName] = useState(board.name);
|
|
|
|
useEffect(() => {
|
|
setName(board.name);
|
|
setRenaming(false);
|
|
}, [board.name]);
|
|
|
|
/** Saves the board name and leaves the edit mode. Closing here rather than
|
|
* waiting for the loader matters when the name did not actually change:
|
|
* `board.name` stays the same, so the effect above never fires and the
|
|
* header would sit in the input forever. */
|
|
function saveName() {
|
|
const next = name.trim();
|
|
if (!next) return;
|
|
submit("updatePipeline", { pipelineId: board.id, name: next });
|
|
setRenaming(false);
|
|
}
|
|
|
|
const metaParts = [
|
|
// The export shows a short board id ("BRD-014") next to the status. Pipeline
|
|
// has no such number, so this is the real id — the value support and a
|
|
// deep link actually need — rather than an invented display number.
|
|
t("projects.boardSettings.meta.boardId", { id: board.id }),
|
|
t(board.typHintLabelKey),
|
|
t("projects.boardSettings.meta.projects", { count: board.projectCount }),
|
|
board.updatedAtIso
|
|
? t("projects.boardSettings.meta.updated", { date: formatters.dateTime(board.updatedAtIso) })
|
|
: t("projects.boardSettings.meta.neverUpdated"),
|
|
];
|
|
|
|
return (
|
|
<PageShell uiId="ui.projects.boardSettings" className="bg-surface-neutral-primary">
|
|
<PageHeader
|
|
icon={<FeatherKanban className={PAGE_HEADER_ICON_CLASS} />}
|
|
title={
|
|
renaming ? (
|
|
<span className="flex items-center gap-2">
|
|
<TextInput>
|
|
<TextInput.Input
|
|
autoFocus
|
|
value={name}
|
|
aria-label={t("projects.fields.name")}
|
|
onChange={(e) => setName(e.target.value)}
|
|
// Enter saves, Escape drops the draft — a one-field editor
|
|
// should not force the mouse onto the check mark.
|
|
onKeyDown={(event) => {
|
|
if (event.key === "Enter") {
|
|
event.preventDefault();
|
|
saveName();
|
|
}
|
|
if (event.key === "Escape") {
|
|
setName(board.name);
|
|
setRenaming(false);
|
|
}
|
|
}}
|
|
data-ui-id="ui.projects.boardSettings.rename.input"
|
|
/>
|
|
</TextInput>
|
|
<IconButton
|
|
variant="success"
|
|
size="small"
|
|
square
|
|
icon={<FeatherCheck />}
|
|
disabled={!name.trim()}
|
|
loading={props.submitting}
|
|
aria-label={t("projects.actions.save")}
|
|
onClick={saveName}
|
|
data-ui-id="ui.projects.boardSettings.rename.save"
|
|
/>
|
|
<IconButton
|
|
variant="ghost"
|
|
size="small"
|
|
square
|
|
icon={<FeatherX />}
|
|
aria-label={t("projects.actions.cancel")}
|
|
onClick={() => {
|
|
setName(board.name);
|
|
setRenaming(false);
|
|
}}
|
|
/>
|
|
</span>
|
|
) : (
|
|
<span className="flex items-center gap-2">
|
|
{board.name}
|
|
<IconButton
|
|
variant="ghost"
|
|
size="small"
|
|
square
|
|
icon={<FeatherPencil />}
|
|
aria-label={t("projects.actions.edit")}
|
|
onClick={() => setRenaming(true)}
|
|
data-ui-id="ui.projects.boardSettings.rename.open"
|
|
/>
|
|
<BadgeFeedback farbe={board.statusKey === "active" ? "subtle-positive" : "subtle-neutral"} size="small">
|
|
{t(`projects.boardSettings.status.${board.statusKey}`)}
|
|
</BadgeFeedback>
|
|
{board.isDefault ? (
|
|
<BadgeFeedback farbe="subtle-brand-primary" size="small">{t("projects.admin.defaultBadge")}</BadgeFeedback>
|
|
) : null}
|
|
</span>
|
|
)
|
|
}
|
|
subtitle={metaParts.join(" · ")}
|
|
/>
|
|
|
|
<PageBody>
|
|
{props.errorKey ? (
|
|
<Alert variant="error" notDismissible title={t(props.errorKey)} data-ui-id="ui.projects.boardSettings.error" />
|
|
) : null}
|
|
{!board.valid ? (
|
|
<Alert variant="warning" notDismissible title={t("projects.admin.invalidHint")} data-ui-id="ui.projects.boardSettings.invalid" />
|
|
) : null}
|
|
|
|
<section className="flex w-full flex-col items-start gap-4">
|
|
<SectionHeader title={t("projects.boardSettings.columns.title")} description={t("projects.boardSettings.columns.description")} />
|
|
<Alert variant="information" notDismissible description={t("projects.boardSettings.columns.hint")} />
|
|
<StageTable board={board} submit={submit} submitting={props.submitting} />
|
|
<AddStageForm pipelineId={board.id} submit={submit} submitting={props.submitting} />
|
|
</section>
|
|
|
|
<section className="flex w-full flex-col items-start gap-4">
|
|
<SectionHeader
|
|
title={t("projects.boardSettings.detailFields.title")}
|
|
description={t("projects.boardSettings.detailFields.description")}
|
|
/>
|
|
<div className="flex w-full items-stretch rounded-lg border border-solid border-border-default bg-surface-neutral-secondary shadow-sm mobile:flex-col">
|
|
<div className="flex grow shrink-0 basis-0 flex-col items-start gap-3 px-5 py-4">
|
|
<p className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">
|
|
{t("projects.boardSettings.detailFields.body")}
|
|
</p>
|
|
<div className="flex w-full flex-col items-start gap-2 border-t border-solid border-border-default pt-3">
|
|
<div className="flex w-full items-start gap-2">
|
|
<FeatherArrowRightCircle aria-hidden className="text-body-default-regular-0 text-icon-neutral-tertiary" />
|
|
<span className={sectionDescription}>{t("projects.boardSettings.detailFields.bulletOrder")}</span>
|
|
</div>
|
|
<div className="flex w-full items-start gap-2">
|
|
<FeatherClipboardList aria-hidden className="text-body-default-regular-0 text-icon-neutral-tertiary" />
|
|
<span className={sectionDescription}>{t("projects.boardSettings.detailFields.bulletRights")}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div className="flex w-80 flex-none flex-col items-start justify-center gap-3 border-l border-solid border-border-default px-5 py-4 mobile:w-full mobile:border-l-0 mobile:border-t">
|
|
<span className="text-body-small-semibold-150 font-body-small-semibold-150 text-text-neutral-primary">
|
|
{t("projects.boardSettings.detailFields.openTitle")}
|
|
</span>
|
|
<AppLink href={props.fieldTemplateHref} className="w-full no-underline" data-ui-id="ui.projects.boardSettings.fieldTemplate">
|
|
<Button className="w-full" iconRight={<FeatherArrowRightCircle />}>
|
|
{t("projects.admin.fieldTemplateLink")}
|
|
</Button>
|
|
</AppLink>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section className="flex w-full flex-col items-start gap-4">
|
|
<SectionHeader title={t("projects.admin.access")} description={t("projects.boardSettings.access.description")} />
|
|
{/* Same card as the sections above, but collapsed: the rules are read
|
|
here far less often than the columns are edited, so the section
|
|
states how many there are and opens on demand. */}
|
|
<Accordion
|
|
className="rounded-lg border-border-default bg-surface-neutral-secondary shadow-sm hover:bg-surface-neutral-secondary"
|
|
data-ui-id="ui.projects.boardSettings.access"
|
|
trigger={
|
|
<div className="flex w-full items-center gap-3 px-5 py-4">
|
|
<Accordion.Chevron />
|
|
<span className="text-body-small-semibold-150 font-body-small-semibold-150 text-text-neutral-primary">
|
|
{t("projects.boardSettings.access.toggle")}
|
|
</span>
|
|
<BadgeFeedback farbe="subtle-neutral" size="small">
|
|
{t("projects.boardSettings.access.count", { count: board.accessRules.length })}
|
|
</BadgeFeedback>
|
|
</div>
|
|
}
|
|
>
|
|
<div className="flex w-full flex-col items-start gap-2 border-t border-solid border-border-default px-5 py-4">
|
|
{board.accessRules.length === 0 ? (
|
|
<span className={mutedText}>{t("projects.admin.noAccessRules")}</span>
|
|
) : (
|
|
board.accessRules.map((rule) => (
|
|
<div key={rule.id} className="flex flex-wrap items-center gap-2" data-row-id={rule.id}>
|
|
<BadgeFeedback farbe="subtle-neutral" size="small">{t(rule.principalTypeLabelKey)}</BadgeFeedback>
|
|
<span className={mutedText}>{rule.principalId}</span>
|
|
{rule.kannSehen ? <BadgeFeedback farbe="subtle-positive" size="small">{t("projects.admin.canSee")}</BadgeFeedback> : null}
|
|
{rule.kannBearbeiten ? <BadgeFeedback farbe="subtle-positive" size="small">{t("projects.admin.canEdit")}</BadgeFeedback> : null}
|
|
</div>
|
|
))
|
|
)}
|
|
</div>
|
|
</Accordion>
|
|
</section>
|
|
</PageBody>
|
|
</PageShell>
|
|
);
|
|
}
|
|
|
|
export default BoardSettingsPage;
|