1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00

feat: added button to delete all pending notifications

This commit is contained in:
HannesOberreiter 2025-01-15 09:12:52 +01:00
parent 871ae8f182
commit 223bd0a7c4
2 changed files with 30 additions and 0 deletions

View file

@ -22,6 +22,12 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
[onDelete], [onDelete],
); );
const handleDeleteAll = useCallback(() => {
items.forEach((item) => {
onDelete(item.id);
});
}, [items, onDelete]);
const renderItemContent = useCallback( const renderItemContent = useCallback(
({ activity, card }) => { ({ activity, card }) => {
switch (activity.type) { switch (activity.type) {
@ -85,6 +91,15 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
<Popup.Content> <Popup.Content>
{items.length > 0 ? ( {items.length > 0 ? (
<div className={styles.wrapper}> <div className={styles.wrapper}>
{items.length > 1 && (
<Button
type="button"
icon="trash alternate outline"
content={t('action.deleteNotifications')}
onClick={handleDeleteAll}
className={styles.deleteAllButton}
/>
)}
{items.map((item) => ( {items.map((item) => (
<div key={item.id} className={styles.item}> <div key={item.id} className={styles.item}>
{item.card && item.activity ? ( {item.card && item.activity ? (

View file

@ -62,4 +62,19 @@
border-radius: 3px; border-radius: 3px;
} }
} }
.deleteAllButton {
background: transparent;
box-shadow: none;
transition: background 0.3s ease;
display: block;
margin: 0 auto;
padding: 0.5em 1em;
font-size: 0.875em;
&:hover {
background: #e9e9e9;
}
}
} }