From ad61df57b9fe86feb953746d32c5e7bff33ec4c4 Mon Sep 17 00:00:00 2001 From: Pavel Gnedov Date: Fri, 16 Jun 2023 21:12:37 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D1=82=D0=B5?= =?UTF-8?q?=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/kanban-board/kanban-card.tsx | 5 ++- frontend/src/kanban-board/store.ts | 41 +++++++++++++---------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/frontend/src/kanban-board/kanban-card.tsx b/frontend/src/kanban-board/kanban-card.tsx index 4402739..09d6e17 100644 --- a/frontend/src/kanban-board/kanban-card.tsx +++ b/frontend/src/kanban-board/kanban-card.tsx @@ -37,11 +37,14 @@ export const KanbanCard = observer((props: Props) => { } const timePassedClassName = `${KanbanCardCss.timepassedDot} ${timePassedColorClassName}`; let tagsSection = <>; - const tagsParams = props.store.params?.fields.find((field) => { + const tagsParams = props.store.params.fields.find((field) => { return field.component === 'tags'; }); + console.debug('Tag params:', tagsParams); // DEBUG + console.debug('Issue:', props.store.issue); // DEBUG if (tagsParams && props.store.issue[tagsParams.path]) { const tags = props.store.issue[tagsParams.path] as TagProps[]; + console.debug(`Tags:`, tags); // DEBUG tagsSection = (
{tagsParams.label || 'Tags'}: {tags.map(tag => )} diff --git a/frontend/src/kanban-board/store.ts b/frontend/src/kanban-board/store.ts index 3cc5977..e273b51 100644 --- a/frontend/src/kanban-board/store.ts +++ b/frontend/src/kanban-board/store.ts @@ -14,9 +14,9 @@ export const ColumnStore = types.model({ return { get cards(): ICardStore[] { return self.issues.map(issue => { - return { + return CardStore.create({ issue: issue - } as ICardStore; + }) }); } } @@ -77,24 +77,29 @@ export type CardField = { export const CardSettings = types.model({}); -export const CardStore = types.model({ - issue: IssueStore, - params: types.maybe(types.model({ - fields: types.optional( - types.array( - types.frozen() - ), - [ - { component: 'text', label: 'Исп.', path: 'current_user.name' }, - { component: 'text', label: 'Прио.', path: 'priority.name' }, - { component: 'text', label: 'Версия', path: 'fixed_version.name' }, - { component: 'text', label: 'Прогресс', path: 'done_ratio' }, - { component: 'labor_costs' }, - { component: 'tags', label: 'Tags', path: 'styledTags' } - ] +export const CardParamsStore = types.optional( + types.model({ + fields: types.array( + types.frozen() ), autoCollapse: types.boolean - })), + }), + { + fields: [ + { component: 'text', label: 'Исп.', path: 'current_user.name' }, + { component: 'text', label: 'Прио.', path: 'priority.name' }, + { component: 'text', label: 'Версия', path: 'fixed_version.name' }, + { component: 'text', label: 'Прогресс', path: 'done_ratio' }, + { component: 'labor_costs' }, + { component: 'tags', label: 'Tags', path: 'styledTags' } + ], + autoCollapse: false, + } +); + +export const CardStore = types.model({ + issue: IssueStore, + params: CardParamsStore }); export interface ICardStore extends Instance {}