ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: заголовки чекеров в деталях задачи
This commit is contained in:
parent
b4f9c58eb5
commit
6da9818826
|
|
@ -132,6 +132,21 @@ export const IssueStructuredContentBlocks = observer(function IssueStructuredCon
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={block.title}
|
||||||
|
onChange={(event) => updateBlockDraft(block.id, { title: event.target.value })}
|
||||||
|
onBlur={() => {
|
||||||
|
const latestBlock = getLatestBlock(block.id);
|
||||||
|
if (latestBlock) saveBlocks(draftBlocks.map((item) => (item.id === block.id ? latestBlock : item)));
|
||||||
|
}}
|
||||||
|
placeholder="Название чекера"
|
||||||
|
className="nodedc-modal-input h-11 w-full px-4 text-13 text-primary placeholder:text-placeholder"
|
||||||
|
disabled={disabled}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="nodedc-structured-checklist">
|
<div className="nodedc-structured-checklist">
|
||||||
{block.items.map((item, index) => (
|
{block.items.map((item, index) => (
|
||||||
<div key={item.id} className="nodedc-structured-check-row">
|
<div key={item.id} className="nodedc-structured-check-row">
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ export type TIssueStructuredCheckerItem = {
|
||||||
export type TIssueStructuredCheckerBlock = {
|
export type TIssueStructuredCheckerBlock = {
|
||||||
id: string;
|
id: string;
|
||||||
type: "checker";
|
type: "checker";
|
||||||
|
title: string;
|
||||||
items: TIssueStructuredCheckerItem[];
|
items: TIssueStructuredCheckerItem[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -49,7 +50,7 @@ const normalizeDetailLayout = (value: unknown): TIssueDetailLayout =>
|
||||||
const sanitizeBlocks = (value: unknown): TIssueStructuredBlock[] => {
|
const sanitizeBlocks = (value: unknown): TIssueStructuredBlock[] => {
|
||||||
if (!Array.isArray(value)) return [];
|
if (!Array.isArray(value)) return [];
|
||||||
|
|
||||||
return value.flatMap((block) => {
|
return value.flatMap<TIssueStructuredBlock>((block) => {
|
||||||
if (!isRecord(block)) return [];
|
if (!isRecord(block)) return [];
|
||||||
|
|
||||||
if (block.type === "text") {
|
if (block.type === "text") {
|
||||||
|
|
@ -82,6 +83,7 @@ const sanitizeBlocks = (value: unknown): TIssueStructuredBlock[] => {
|
||||||
{
|
{
|
||||||
id: typeof block.id === "string" ? block.id : createLocalId(),
|
id: typeof block.id === "string" ? block.id : createLocalId(),
|
||||||
type: "checker",
|
type: "checker",
|
||||||
|
title: typeof block.title === "string" ? block.title : "",
|
||||||
items,
|
items,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
@ -96,6 +98,7 @@ export const createIssueStructuredBlock = (type: "checker" | "text"): TIssueStru
|
||||||
return {
|
return {
|
||||||
id: createLocalId(),
|
id: createLocalId(),
|
||||||
type: "checker",
|
type: "checker",
|
||||||
|
title: "",
|
||||||
items: [{ id: createLocalId(), text: "", checked: false }],
|
items: [{ id: createLocalId(), text: "", checked: false }],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue