Update acrding review changes

This commit is contained in:
Rajat-Dabade 2022-08-19 11:18:58 +05:30
parent ede7ca0150
commit 207f95fcda

View file

@ -58,15 +58,13 @@ const Kanban = (props: Props) => {
const currentView = useAppSelector(getCurrentView)
const cardTemplates: Card[] = useAppSelector(getCurrentBoardTemplates)
const {board, activeView, cards, groupByProperty, visibleGroups, hiddenGroups, hiddenCardsCount} = props
const [defaultTemplateID, setDefaultTemplateID] = useState('')
const [defaultTemplateID, setDefaultTemplateID] = useState<string>()
useEffect(() => {
if(currentView.fields && currentView.fields.defaultTemplateId) {
cardTemplates.forEach((cardTemplate) => {
if(cardTemplate.id === currentView.fields.defaultTemplateId) {
setDefaultTemplateID(currentView.fields.defaultTemplateId)
}
})
if(currentView && currentView.fields && currentView.fields.defaultTemplateId) {
if(cardTemplates.find(ct => ct.id === currentView.fields.defaultTemplateId)) {
setDefaultTemplateID(currentView.fields.defaultTemplateId)
}
}
}, [currentView])
@ -310,7 +308,7 @@ const Kanban = (props: Props) => {
<BoardPermissionGate permissions={[Permission.ManageBoardCards]}>
<Button
onClick={() => {
if(defaultTemplateID !== '') {
if(defaultTemplateID) {
props.addCardFromTemplate(defaultTemplateID, group.option.id)
} else {
props.addCard(group.option.id, true)