Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
626 changes: 313 additions & 313 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"react-select": "^0.9.1",
"react-stickynode": "^1.2.1",
"react-text-truncate": "^0.8.3",
"react-transition-group": "^2.5.0",
"recompose": "^0.26.0",
"redux": "^3.7.1",
"redux-promise-middleware": "4.2.1",
Expand Down
6 changes: 4 additions & 2 deletions src/components/NotificationItem/NotificationItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const formatDate = (date) => {
const NotificationItem = (props) => {
const { id, onLinkClick } = props
const notificationItem = (
<div className="notification-item">
<div className={cn('notification-item', props.goto ? '' : props.transitionState)}>
<div className="icon">
<NotificationIcons type={props.type} className={'icon-notification' + props.type }/>
</div>
Expand All @@ -90,6 +90,7 @@ const NotificationItem = (props) => {
<button
onClick={(evt) => {
evt.preventDefault()
evt.stopPropagation()
props.onReadToggleClick(props.id)
}}
>
Expand All @@ -101,7 +102,7 @@ const NotificationItem = (props) => {

return (
props.goto
? <Link className={cn('notification-item-link', {unseen: !props.seen})} to={props.goto} onClick={() => onLinkClick(id)}>{notificationItem}</Link>
? <Link className={cn('notification-item-link', {unseen: !props.seen}, props.transitionState)} to={props.goto} onClick={() => onLinkClick(id)}>{notificationItem}</Link>
: notificationItem
)
}
Expand All @@ -114,6 +115,7 @@ NotificationItem.propTypes = {
goTo: PropTypes.string,
date: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
transitionState: PropTypes.string.isRequired,
seen: PropTypes.bool,
onReadToggleClick: PropTypes.func.isRequired,
onLinkClick: PropTypes.func.isRequired,
Expand Down
18 changes: 18 additions & 0 deletions src/components/NotificationItem/NotificationItem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.notification-item-link {
display: block;
border-top: 1px solid $tc-gray-10;
overflow: hidden;

@media screen and (max-width: $screen-md - 1px) {
border-top: 0;
Expand All @@ -22,18 +23,35 @@
}
}
}

&.exiting {
opacity: 0;
transform: scaleY(0);
margin: -35px 0;
overflow: hidden;
transition: 500ms all ease-in;
}
}

.notification-item {
display: flex;
background-color: $tc-white;
justify-content: space-between;
transition: 150ms all;
overflow: hidden;

&:hover {
background-color: $tc-dark-blue-10;
}

&.exiting {
opacity: 0;
transform: scaleY(0);
margin: -35px 0;
overflow: hidden;
transition: 500ms all ease-in;
}

.icon {
align-items: center;
// border-left: 2px solid $tc-dark-blue-70;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React from 'react'
import { Link } from 'react-router-dom'
import { connect } from 'react-redux'
import _ from 'lodash'
import { TransitionGroup, Transition } from 'react-transition-group'
import { getNotifications, visitNotifications, toggleNotificationSeen, markAllNotificationsRead,
toggleNotificationRead, toggleBundledNotificationRead, viewOlderNotifications,
toggleNotificationsDropdownMobile, toggleNotificationsDropdownWeb, hideOlderNotifications } from '../../routes/notifications/actions'
Expand Down Expand Up @@ -156,30 +157,39 @@ class NotificationsDropdownContainer extends React.Component {
) : ([
<ScrollLock key="body">
<div className="notifications-dropdown-body">
{globalSource && globalSource.notifications.length &&
<NotificationsSection
{...globalSource}
isGlobal
isSimple
onReadToggleClick={toggleNotificationReadWithDelay}
onLinkClick={(notificationId) => {
toggleNotificationsDropdownWeb()
markNotificationSeen(notificationId)
}}
/>
}
{projectSources.filter(source => source.notifications.length > 0).map(source => (
<NotificationsSection
{...source}
key={source.id}
isSimple
onReadToggleClick={toggleNotificationReadWithDelay}
onLinkClick={(notificationId) => {
toggleNotificationsDropdownWeb()
markNotificationSeen(notificationId)
}}
/>
))}
<Transition in={globalSource && globalSource.notifications.length} timeout={500} unmountOnExit>
{state => (
<NotificationsSection
{...globalSource}
transitionState={state}
isGlobal
isSimple
onReadToggleClick={toggleNotificationReadWithDelay}
onLinkClick={(notificationId) => {
toggleNotificationsDropdownWeb()
markNotificationSeen(notificationId)
}}
/>
)}
</Transition>
<TransitionGroup>
{projectSources.filter(source => source.notifications.length > 0).map(source => (
<Transition timeout={500} key={source.id} unmountOnExit>
{state => (
<NotificationsSection
{...source}
transitionState={state}
isSimple
onReadToggleClick={toggleNotificationReadWithDelay}
onLinkClick={(notificationId) => {
toggleNotificationsDropdownWeb()
markNotificationSeen(notificationId)
}}
/>
)}
</Transition>
))}
</TransitionGroup>
</div>
</ScrollLock>,
<NotificationsReadAll key="footer" to="/notifications">
Expand Down Expand Up @@ -216,31 +226,40 @@ class NotificationsDropdownContainer extends React.Component {
notificationsEmpty
) : (
<div>
{globalSource && globalSource.notifications.length > 0 &&
<NotificationsSection
{...globalSource}
isGlobal
isSimple
onReadToggleClick={toggleNotificationReadWithDelay}
onViewOlderClick={() => viewOlderNotifications(globalSource.id)}
onLinkClick={(notificationId) => {
toggleNotificationsDropdownMobile()
markNotificationSeen(notificationId)
}}
/>}
{projectSources.filter(source => source.notifications.length).map(source => (
<NotificationsSection
{...source}
key={source.id}
isSimple
onReadToggleClick={toggleNotificationReadWithDelay}
onViewOlderClick={() => viewOlderNotifications(source.id)}
onLinkClick={(notificationId) => {
toggleNotificationsDropdownMobile()
markNotificationSeen(notificationId)
}}
/>
))}
<Transition in={globalSource && globalSource.notifications.length} timeout={500} unmountOnExit>
{state => (
<NotificationsSection
{...globalSource}
transitionState={state}
isGlobal
isSimple
onReadToggleClick={toggleNotificationReadWithDelay}
onViewOlderClick={() => viewOlderNotifications(globalSource.id)}
onLinkClick={(notificationId) => {
toggleNotificationsDropdownMobile()
markNotificationSeen(notificationId)
}}
/>
)}
</Transition>
<TransitionGroup>
{projectSources.filter(source => source.notifications.length).map(source => (
<Transition timeout={500} key={source.id} unmountOnExit>
{state => (
<NotificationsSection
{...source}
transitionState={state}
isSimple
onReadToggleClick={toggleNotificationReadWithDelay}
onLinkClick={(notificationId) => {
toggleNotificationsDropdownMobile()
markNotificationSeen(notificationId)
}}
/>
)}
</Transition>
))}
</TransitionGroup>
</div>
)}
</NotificationsMobilePage>
Expand Down
26 changes: 17 additions & 9 deletions src/components/NotificationsSection/NotificationsSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
import React from 'react'
import PropTypes from 'prop-types'
import { TransitionGroup, Transition } from 'react-transition-group'
import NotificationItem from '../NotificationItem/NotificationItem'
import NotificationsSectionTitle from '../NotificationsSectionTitle/NotificationsSectionTitle'
import LoadingIndicator from '../LoadingIndicator/LoadingIndicator'
Expand All @@ -13,22 +14,28 @@ import './NotificationsSection.scss'

const NotificationsSection = (props) => {
return (
<div className={cn('notifications-section', { 'is-simple': props.isSimple })}>
<div className={cn('notifications-section', { 'is-simple': props.isSimple }, props.transitionState)}>
{!(props.isSimple && props.isGlobal) &&
<NotificationsSectionTitle
title={props.title}
isGlobal={props.isGlobal}
onMarkAllClick={props.onMarkAllClick}
/>
}
{props.notifications.map(notification => (
<NotificationItem
key={notification.id}
{...notification}
onReadToggleClick={props.onReadToggleClick}
onLinkClick={props.onLinkClick}
/>
))}
<TransitionGroup className="notification-list">
{props.transitionState !== 'exiting' && props.notifications.map(notification => (
<Transition key={notification.id} className="fade" timeout={500} unmountOnExit>
{ state => (
<NotificationItem
{...notification}
transitionState={state}
onReadToggleClick={props.onReadToggleClick}
onLinkClick={props.onLinkClick}
/>
)}
</Transition>
))}
</TransitionGroup>
{props.onViewOlderClick && props.total > props.notifications.length && (
props.isLoading ? (
<div className="view-older"><LoadingIndicator isSmall /></div>
Expand All @@ -45,6 +52,7 @@ NotificationsSection.propTypes = {
isSimple: PropTypes.bool,
isGlobal: PropTypes.bool,
title: PropTypes.string.isRequired,
transitionState: PropTypes.string.isRequired,
onMarkAllClick: PropTypes.func,
onLinkClick: PropTypes.func.isRequired,
onReadToggleClick: PropTypes.func.isRequired,
Expand Down
5 changes: 5 additions & 0 deletions src/components/NotificationsSection/NotificationsSection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:global {
.notifications-section {
border: 1px solid $tc-gray-20;
overflow: hidden;

@media screen and (max-width: $screen-md - 1px) {
border: 0;
Expand All @@ -25,6 +26,10 @@
text-align: center;
width: 100%;
}

.notification-list {
overflow: hidden;
}
}

.notifications-section + .notifications-section {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@
@import '~tc-ui/src/styles/tc-includes';

:global {
.exiting {
.notifications-section-title {
opacity: 0;
margin: -15px 0;
transform: scaleY(0);
transition: 500ms all ease-in;
}
}

.notifications-section-title {
align-items: center;
background-color: $tc-gray-20;
// border-bottom: 1px solid $tc-gray-20;
display: flex;
justify-content: space-between;
margin: 0;
overflow: hidden;

@media screen and (max-width: $screen-md - 1px) {
background-color: $tc-gray-10;
Expand Down