Исправлен вывод тегов

This commit is contained in:
Pavel Gnedov 2023-06-16 21:12:37 +07:00
parent 6e2d8c25f9
commit ad61df57b9
2 changed files with 27 additions and 19 deletions

View file

@ -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 = (
<div>
{tagsParams.label || 'Tags'}: {tags.map(tag => <KanbanCardTag tag={tag.tag} style={tag.style} />)}

View file

@ -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(
export const CardParamsStore = types.optional(
types.model({
fields: types.array(
types.frozen<CardField>()
),
[
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: types.boolean
})),
],
autoCollapse: false,
}
);
export const CardStore = types.model({
issue: IssueStore,
params: CardParamsStore
});
export interface ICardStore extends Instance<typeof CardStore> {}