Skip to content

Commit

Permalink
ResourceToggleCreator disabled content button od canceled status
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrikMatiasko committed Jun 23, 2024
1 parent 78e75ac commit 060e997
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ const ResourceToggleCreator: FC<Props> = (props) => {
}
}, [resourceData.content])

const hasUpdateContent = useMemo(() => !!resourceData.resourceUpdated && !!resourceData.resourceUpdated.content, [resourceData.resourceUpdated])
const hasUpdateContent = useMemo(
() => !!resourceData.resourceUpdated && (!!resourceData.resourceUpdated.content || resourceData.resourceUpdated.status === 'CANCELED'),
[resourceData.resourceUpdated]
)

const setContentByType = useCallback((content: ResourceContentType) => {
if (typeof content === 'object') {
Expand Down Expand Up @@ -140,6 +143,7 @@ const ResourceToggleCreator: FC<Props> = (props) => {
attribute: i18n.content,
value: (
<Button
disabled={resourceData.resourceUpdated?.status === 'CANCELED'}
icon={getButtonIcon(hasContent, hasUpdateContent)}
onClick={(e) => {
e.preventDefault()
Expand Down

0 comments on commit 060e997

Please sign in to comment.