Use template icon for new cards if set

This commit is contained in:
Chen-I Lim 2020-11-17 11:17:44 -08:00
parent c41ec11d0a
commit e9e8818738
3 changed files with 11 additions and 3 deletions

View file

@ -511,7 +511,9 @@ class BoardComponent extends React.Component<Props, State> {
}
}
card.properties = {...card.properties, ...propertiesThatMeetFilters}
card.icon = BlockIcons.shared.randomIcon()
if (!card.icon) {
card.icon = BlockIcons.shared.randomIcon()
}
await mutator.insertBlocks(
blocksToInsert,
'add card',

View file

@ -327,7 +327,9 @@ class TableComponent extends React.Component<Props, State> {
}
card.parentId = boardTree.board.id
card.icon = BlockIcons.shared.randomIcon()
if (!card.icon) {
card.icon = BlockIcons.shared.randomIcon()
}
await mutator.insertBlocks(
blocksToInsert,
'add card',

View file

@ -399,11 +399,15 @@ class ViewHeader extends React.Component<Props, State> {
<Menu.Separator/>
{boardTree.cardTemplates.map((cardTemplate) => {
let displayName = cardTemplate.title || intl.formatMessage({id: 'ViewHeader.untitled', defaultMessage: 'Untitled'})
if (cardTemplate.icon) {
displayName = `${cardTemplate.icon} ${displayName}`
}
return (
<Menu.Text
key={cardTemplate.id}
id={cardTemplate.id}
name={cardTemplate.title || intl.formatMessage({id: 'ViewHeader.untitled', defaultMessage: 'Untitled'})}
name={displayName}
onClick={() => {
this.props.addCardFromTemplate(cardTemplate.id)
}}