mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
only use new-comment tag if there's really new comment
This commit is contained in:
parent
fd8907dd3a
commit
42f8f96e34
3 changed files with 7 additions and 2 deletions
|
@ -22,7 +22,11 @@ const NodeHorizontalCard: FC<Props> = ({ node, hasNew, onClick }) => (
|
||||||
<Anchor
|
<Anchor
|
||||||
key={node.id}
|
key={node.id}
|
||||||
className={styles.item}
|
className={styles.item}
|
||||||
href={getNewCommentAnchor(URLS.NODE_URL(node.id))}
|
href={
|
||||||
|
hasNew
|
||||||
|
? getNewCommentAnchor(URLS.NODE_URL(node.id))
|
||||||
|
: URLS.NODE_URL(node.id)
|
||||||
|
}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -20,7 +20,7 @@ interface NotificationCommentProps {
|
||||||
|
|
||||||
const NotificationComment: FC<NotificationCommentProps> = ({ item, isNew }) => (
|
const NotificationComment: FC<NotificationCommentProps> = ({ item, isNew }) => (
|
||||||
<Anchor
|
<Anchor
|
||||||
href={isNew ? getCommentAnchor(item.url, item.itemId) : item.url}
|
href={getCommentAnchor(item.url, item.itemId)}
|
||||||
className={styles.link}
|
className={styles.link}
|
||||||
>
|
>
|
||||||
<div className={classNames(styles.message, { [styles.new]: isNew })}>
|
<div className={classNames(styles.message, { [styles.new]: isNew })}>
|
||||||
|
|
|
@ -68,6 +68,7 @@ const NodeComments: FC<Props> = observer(({ order }) => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Scrolls down to new comments or specific one from anchor */
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const anchor = location.hash?.replace('#', '');
|
const anchor = location.hash?.replace('#', '');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue