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

fix: Fix notifications popup styles

This commit is contained in:
Maksim Eltyshev 2022-11-20 15:30:07 +01:00
parent ed767e7664
commit 4aff3a702c
2 changed files with 46 additions and 19 deletions

View file

@ -1,3 +1,4 @@
import truncate from 'lodash/truncate';
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useTranslation, Trans } from 'react-i18next';
@ -47,23 +48,26 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
{activity.data.toList.name}
</Trans>
);
case ActivityTypes.COMMENT_CARD:
case ActivityTypes.COMMENT_CARD: {
const commentText = truncate(activity.data.text);
return (
<Trans
i18nKey="common.userLeftNewCommentToCard"
values={{
user: activity.user.name,
comment: activity.data.text,
comment: commentText,
card: card.name,
}}
>
{activity.user.name}
{` left a new comment «${activity.data.text}» to `}
{` left a new comment «${commentText}» to `}
<Link to={Paths.CARDS.replace(':id', card.id)} onClick={onClose}>
{card.name}
</Link>
</Trans>
);
}
default:
}
@ -80,9 +84,10 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
})}
</Popup.Header>
<Popup.Content>
{items.length > 0
? items.map((item) => (
<div key={item.id} className={styles.wrapper}>
{items.length > 0 ? (
<div className={styles.wrapper}>
{items.map((item) => (
<div key={item.id} className={styles.item}>
{item.card && item.activity ? (
<>
<User
@ -90,20 +95,23 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
avatarUrl={item.activity.user.avatarUrl}
size="large"
/>
<span className={styles.content}>{renderItemContent(item)}</span>
<span className={styles.itemContent}>{renderItemContent(item)}</span>
</>
) : (
<div className={styles.deletedContent}>{t('common.cardOrActionAreDeleted')}</div>
<div className={styles.itemDeleted}>{t('common.cardOrActionAreDeleted')}</div>
)}
<Button
type="button"
icon="close"
className={styles.button}
icon="trash alternate outline"
className={styles.itemButton}
onClick={() => handleDelete(item.id)}
/>
</div>
))
: t('common.noUnreadNotifications')}
))}
</div>
) : (
t('common.noUnreadNotifications')
)}
</Popup.Content>
</>
);

View file

@ -1,5 +1,13 @@
:global(#app) {
.button {
.item {
padding: 12px;
&:hover {
background: #f0f0f0;
}
}
.itemButton {
background: transparent;
box-shadow: none;
float: right;
@ -7,7 +15,7 @@
line-height: 20px;
margin: 0;
min-height: auto;
padding: 5px 0;
padding: 0;
transition: background 0.3s ease;
width: 20px;
@ -16,7 +24,7 @@
}
}
.content {
.itemContent {
display: inline-block;
font-size: 12px;
min-height: 36px;
@ -27,7 +35,7 @@
word-break: break-word;
}
.deletedContent {
.itemDeleted {
display: inline-block;
line-height: 20px;
min-height: 20px;
@ -38,10 +46,21 @@
.wrapper {
margin: 0 -12px;
padding: 12px;
max-height: 60vh;
overflow-x: hidden;
overflow-y: auto;
scrollbar-width: thin;
&:hover {
background: #f0f0f0;
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
border-radius: 3px;
}
}
}