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);
|
setShowSelect(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hasComponent = !!component;
|
||||||
|
const canRemoveAction = hasComponent || canRemove;
|
||||||
|
|
||||||
|
const handleRemove = () => {
|
||||||
|
if (hasComponent) {
|
||||||
|
onSetComponent?.(id, null);
|
||||||
|
} else {
|
||||||
|
onRemove?.(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column
|
<Column
|
||||||
width="100%"
|
width="100%"
|
||||||
|
|
@ -58,7 +69,7 @@ export function BoardColumn({
|
||||||
position="relative"
|
position="relative"
|
||||||
className={styles.column}
|
className={styles.column}
|
||||||
>
|
>
|
||||||
{editing && canRemove && (
|
{editing && canRemoveAction && (
|
||||||
<Box
|
<Box
|
||||||
className={styles.columnAction}
|
className={styles.columnAction}
|
||||||
position="absolute"
|
position="absolute"
|
||||||
|
|
@ -67,12 +78,12 @@ export function BoardColumn({
|
||||||
zIndex={100}
|
zIndex={100}
|
||||||
>
|
>
|
||||||
<TooltipTrigger delay={0}>
|
<TooltipTrigger delay={0}>
|
||||||
<Button variant="outline" onPress={() => onRemove?.(id)}>
|
<Button variant="outline" onPress={handleRemove} isDisabled={!canRemoveAction}>
|
||||||
<Icon size="sm">
|
<Icon size="sm">
|
||||||
<X />
|
<X />
|
||||||
</Icon>
|
</Icon>
|
||||||
</Button>
|
</Button>
|
||||||
<Tooltip>Remove column</Tooltip>
|
<Tooltip>{hasComponent ? 'Remove component' : 'Remove column'}</Tooltip>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue