'notification',
'hidden',
'expanded',
+ 'unread',
]
updateOnStates = [
import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { HotKeys } from 'react-hotkeys';
+import classNames from 'classnames';
// Our imports.
import Permalink from 'flavours/glitch/components/permalink';
id: PropTypes.string.isRequired,
account: ImmutablePropTypes.map.isRequired,
notification: ImmutablePropTypes.map.isRequired,
+ unread: PropTypes.bool,
};
handleMoveUp = () => {
}
render () {
- const { account, notification, hidden } = this.props;
+ const { account, notification, hidden, unread } = this.props;
// Links to the display name.
const displayName = account.get('display_name_html') || account.get('username');
// Renders.
return (
<HotKeys handlers={this.getHandlers()}>
- <div className='notification notification-follow focusable' tabIndex='0'>
+ <div className={classNames('notification notification-follow focusable', { unread })} tabIndex='0'>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon fixedWidth id='user-plus' />
import NotificationOverlayContainer from '../containers/overlay_container';
import { HotKeys } from 'react-hotkeys';
import Icon from 'flavours/glitch/components/icon';
+import classNames from 'classnames';
const messages = defineMessages({
authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' },
onReject: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
notification: ImmutablePropTypes.map.isRequired,
+ unread: PropTypes.bool,
};
handleMoveUp = () => {
}
render () {
- const { intl, hidden, account, onAuthorize, onReject, notification } = this.props;
+ const { intl, hidden, account, onAuthorize, onReject, notification, unread } = this.props;
if (!account) {
return <div />;
return (
<HotKeys handlers={this.getHandlers()}>
- <div className='notification notification-follow-request focusable' tabIndex='0'>
+ <div className={classNames('notification notification-follow-request focusable', { unread })} tabIndex='0'>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='user' fixedWidth />
onMoveDown={onMoveDown}
onMoveUp={onMoveUp}
onMention={onMention}
+ unread={this.props.unread}
/>
);
case 'follow_request':
onMoveDown={onMoveDown}
onMoveUp={onMoveUp}
onMention={onMention}
+ unread={this.props.unread}
/>
);
case 'mention':
cacheMediaWidth={this.props.cacheMediaWidth}
onUnmount={this.props.onUnmount}
withDismiss
+ unread={this.props.unread}
/>
);
case 'favourite':
cacheMediaWidth={this.props.cacheMediaWidth}
onUnmount={this.props.onUnmount}
withDismiss
+ unread={this.props.unread}
/>
);
case 'reblog':
cacheMediaWidth={this.props.cacheMediaWidth}
onUnmount={this.props.onUnmount}
withDismiss
+ unread={this.props.unread}
/>
);
case 'poll':
cacheMediaWidth={this.props.cacheMediaWidth}
onUnmount={this.props.onUnmount}
withDismiss
+ unread={this.props.unread}
/>
);
default:
import ScrollableList from 'flavours/glitch/components/scrollable_list';
import LoadGap from 'flavours/glitch/components/load_gap';
import Icon from 'flavours/glitch/components/icon';
+import compareId from 'flavours/glitch/util/compare_id';
import NotificationPurgeButtonsContainer from 'flavours/glitch/containers/notification_purge_buttons_container';
hasMore: state.getIn(['notifications', 'hasMore']),
numPending: state.getIn(['notifications', 'pendingItems'], ImmutableList()).size,
notifCleaningActive: state.getIn(['notifications', 'cleaningMode']),
+ lastReadId: state.getIn(['notifications', 'lastReadId']),
});
/* glitch */
onEnterCleaningMode: PropTypes.func,
onMount: PropTypes.func,
onUnmount: PropTypes.func,
+ lastReadId: PropTypes.string,
};
static defaultProps = {
}
render () {
- const { intl, notifications, shouldUpdateScroll, isLoading, isUnread, columnId, multiColumn, hasMore, numPending, showFilterBar } = this.props;
+ const { intl, notifications, shouldUpdateScroll, isLoading, isUnread, columnId, multiColumn, hasMore, numPending, showFilterBar, lastReadId } = this.props;
const { notifCleaning, notifCleaningActive } = this.props;
const { animatingNCD } = this.state;
const pinned = !!columnId;
accountId={item.get('account')}
onMoveUp={this.handleMoveUp}
onMoveDown={this.handleMoveDown}
+ unread={lastReadId && compareId(item.get('id'), lastReadId) > 0}
/>
));
} else {
text-decoration: underline;
}
}
+
+.notification,
+.status {
+ position: relative;
+
+ &.unread {
+ &::before {
+ content: "";
+ position: absolute;
+ top: 0;
+ left: 0;
+ pointer-events: 0;
+ width: 100%;
+ height: 100%;
+ border-left: 2px solid $highlight-text-color;
+ pointer-events: none;
+ }
+ }
+}