[212] Scroll to comment in article from user profile (#103)
* [212] Scroll to comment in article from user profile * [212] Scroll to comment from feed * Resolve conversation
This commit is contained in:
parent
cc48b68d38
commit
982df78cc4
|
@ -103,6 +103,7 @@ export const Comment = (props: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
|
id={`comment_${comment().id}`}
|
||||||
class={clsx(styles.comment, props.class, {
|
class={clsx(styles.comment, props.class, {
|
||||||
[styles.isNew]: !isCommentAuthor() && createdAt > props.lastSeen
|
[styles.isNew]: !isCommentAuthor() && createdAt > props.lastSeen
|
||||||
})}
|
})}
|
||||||
|
@ -144,7 +145,11 @@ export const Comment = (props: Props) => {
|
||||||
<Show when={props.showArticleLink}>
|
<Show when={props.showArticleLink}>
|
||||||
<div class={styles.articleLink}>
|
<div class={styles.articleLink}>
|
||||||
<Icon name="arrow-right" class={styles.articleLinkIcon} />
|
<Icon name="arrow-right" class={styles.articleLinkIcon} />
|
||||||
<a href={getPagePath(router, 'article', { slug: comment().shout.slug })}>
|
<a
|
||||||
|
href={`${getPagePath(router, 'article', { slug: comment().shout.slug })}?commentId=${
|
||||||
|
comment().id
|
||||||
|
}`}
|
||||||
|
>
|
||||||
{comment().shout.title}
|
{comment().shout.title}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
import { capitalize, formatDate } from '../../utils'
|
import { capitalize, formatDate } from '../../utils'
|
||||||
import { Icon } from '../_shared/Icon'
|
import { Icon } from '../_shared/Icon'
|
||||||
import { AuthorCard } from '../Author/AuthorCard'
|
import { AuthorCard } from '../Author/AuthorCard'
|
||||||
import { createEffect, createMemo, createSignal, For, Match, onMount, Show, Switch } from 'solid-js'
|
import {
|
||||||
|
createEffect,
|
||||||
|
createMemo,
|
||||||
|
createSignal,
|
||||||
|
For,
|
||||||
|
Match,
|
||||||
|
onCleanup,
|
||||||
|
onMount,
|
||||||
|
Show,
|
||||||
|
Switch
|
||||||
|
} from 'solid-js'
|
||||||
import type { Author, Shout } from '../../graphql/types.gen'
|
import type { Author, Shout } from '../../graphql/types.gen'
|
||||||
import MD from './MD'
|
import MD from './MD'
|
||||||
import { SharePopup } from './SharePopup'
|
import { SharePopup } from './SharePopup'
|
||||||
|
@ -99,6 +109,7 @@ export const FullArticle = (props: ArticleProps) => {
|
||||||
behavior: 'smooth'
|
behavior: 'smooth'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const { searchParams, changeSearchParam } = useRouter()
|
const { searchParams, changeSearchParam } = useRouter()
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
|
@ -114,6 +125,15 @@ export const FullArticle = (props: ArticleProps) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
if (searchParams().commentId && isReactionsLoaded()) {
|
||||||
|
const commentElement = document.querySelector(`[id='comment_${searchParams().commentId}']`)
|
||||||
|
if (commentElement) {
|
||||||
|
commentElement.scrollIntoView({ behavior: 'smooth' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const {
|
const {
|
||||||
actions: { loadReactionsBy }
|
actions: { loadReactionsBy }
|
||||||
} = useReactions()
|
} = useReactions()
|
||||||
|
@ -277,15 +297,17 @@ export const FullArticle = (props: ArticleProps) => {
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class={styles.topicsList}>
|
<Show when={props.article.topics.length}>
|
||||||
<For each={props.article.topics}>
|
<div class={styles.topicsList}>
|
||||||
{(topic) => (
|
<For each={props.article.topics}>
|
||||||
<div class={styles.shoutTopic}>
|
{(topic) => (
|
||||||
<a href={getPagePath(router, 'topic', { slug: topic.slug })}>{topic.title}</a>
|
<div class={styles.shoutTopic}>
|
||||||
</div>
|
<a href={getPagePath(router, 'topic', { slug: topic.slug })}>{topic.title}</a>
|
||||||
)}
|
</div>
|
||||||
</For>
|
)}
|
||||||
</div>
|
</For>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
|
||||||
<div class={styles.shoutAuthorsList}>
|
<div class={styles.shoutAuthorsList}>
|
||||||
<Show when={props.article.authors.length > 1}>
|
<Show when={props.article.authors.length > 1}>
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
background-color: white;
|
background-color: white;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
|
min-width: 32px;
|
||||||
|
max-width: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.anonymous {
|
.anonymous {
|
||||||
|
|
|
@ -277,7 +277,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 100%;
|
width: calc(100% - 180px);
|
||||||
|
|
||||||
@include media-breakpoint-down(md) {
|
@include media-breakpoint-down(md) {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -148,7 +148,14 @@ export const FeedView = () => {
|
||||||
{(comment) => {
|
{(comment) => {
|
||||||
return (
|
return (
|
||||||
<div class={styles.comment}>
|
<div class={styles.comment}>
|
||||||
<div class={clsx('text-truncate', styles.commentBody)} innerHTML={comment.body} />
|
<div class={clsx('text-truncate', styles.commentBody)}>
|
||||||
|
<a
|
||||||
|
href={`${getPagePath(router, 'article', {
|
||||||
|
slug: comment.shout.slug
|
||||||
|
})}?commentId=${comment.id}`}
|
||||||
|
innerHTML={comment.body}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<AuthorCard
|
<AuthorCard
|
||||||
author={comment.createdBy as Author}
|
author={comment.createdBy as Author}
|
||||||
isFeedMode={true}
|
isFeedMode={true}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user