mirror of
https://github.com/umami-software/umami.git
synced 2026-02-16 02:25:35 +01:00
Allow removing board component from column action
This commit is contained in:
parent
b816e951a5
commit
903cccee7c
1 changed files with 14 additions and 3 deletions
|
|
@ -48,6 +48,17 @@ export function BoardColumn({
|
|||
setShowSelect(false);
|
||||
};
|
||||
|
||||
const hasComponent = !!component;
|
||||
const canRemoveAction = hasComponent || canRemove;
|
||||
|
||||
const handleRemove = () => {
|
||||
if (hasComponent) {
|
||||
onSetComponent?.(id, null);
|
||||
} else {
|
||||
onRemove?.(id);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Column
|
||||
width="100%"
|
||||
|
|
@ -58,7 +69,7 @@ export function BoardColumn({
|
|||
position="relative"
|
||||
className={styles.column}
|
||||
>
|
||||
{editing && canRemove && (
|
||||
{editing && canRemoveAction && (
|
||||
<Box
|
||||
className={styles.columnAction}
|
||||
position="absolute"
|
||||
|
|
@ -67,12 +78,12 @@ export function BoardColumn({
|
|||
zIndex={100}
|
||||
>
|
||||
<TooltipTrigger delay={0}>
|
||||
<Button variant="outline" onPress={() => onRemove?.(id)}>
|
||||
<Button variant="outline" onPress={handleRemove} isDisabled={!canRemoveAction}>
|
||||
<Icon size="sm">
|
||||
<X />
|
||||
</Icon>
|
||||
</Button>
|
||||
<Tooltip>Remove column</Tooltip>
|
||||
<Tooltip>{hasComponent ? 'Remove component' : 'Remove column'}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
</Box>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue