mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Add user location marker to brewery map, Add beer sec. for brewery posts
This commit is contained in:
@@ -36,10 +36,10 @@ const CommentsComponent: FC<CommentsComponentProps> = ({
|
||||
setSize,
|
||||
size,
|
||||
}) => {
|
||||
const { ref: lastCommentRef } = useInView({
|
||||
const { ref: penultimateCommentRef } = useInView({
|
||||
/**
|
||||
* When the last comment comes into view, call setSize from useBeerPostComments to
|
||||
* load more comments.
|
||||
* When the second last comment comes into view, call setSize from useBeerPostComments
|
||||
* to load more comments.
|
||||
*/
|
||||
onChange: (visible) => {
|
||||
if (!visible || isAtEnd) return;
|
||||
@@ -52,7 +52,7 @@ const CommentsComponent: FC<CommentsComponentProps> = ({
|
||||
{!!comments.length && (
|
||||
<div className="card bg-base-300 pb-6">
|
||||
{comments.map((comment, index) => {
|
||||
const isPenulitmateComment = index === comments.length - 2;
|
||||
const isPenultimateComment = index === comments.length - 2;
|
||||
|
||||
/**
|
||||
* Attach a ref to the last comment in the list. When it comes into view, the
|
||||
@@ -60,7 +60,7 @@ const CommentsComponent: FC<CommentsComponentProps> = ({
|
||||
*/
|
||||
return (
|
||||
<div
|
||||
ref={isPenulitmateComment ? lastCommentRef : undefined}
|
||||
ref={isPenultimateComment ? penultimateCommentRef : undefined}
|
||||
key={comment.id}
|
||||
>
|
||||
<CommentCardBody comment={comment} mutate={mutate} />
|
||||
|
||||
Reference in New Issue
Block a user