added scroll to comment
This commit is contained in:
parent
b8a095d853
commit
141856fd1f
|
@ -158,7 +158,7 @@ export function CommentInputTextArea(props: {
|
||||||
attrs: { label: replyTo.username, id: replyTo.id },
|
attrs: { label: replyTo.username, id: replyTo.id },
|
||||||
})
|
})
|
||||||
.insertContent(' ')
|
.insertContent(' ')
|
||||||
.focus()
|
.focus(undefined, { scrollIntoView: false })
|
||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
|
|
@ -107,7 +107,6 @@ const CommentsTabContent = memo(function CommentsTabContent(props: {
|
||||||
onCancelAnswerResponse?: () => void
|
onCancelAnswerResponse?: () => void
|
||||||
}) {
|
}) {
|
||||||
const { contract, answerResponse, onCancelAnswerResponse } = props
|
const { contract, answerResponse, onCancelAnswerResponse } = props
|
||||||
console.log(answerResponse)
|
|
||||||
const tips = useTipTxns({ contractId: contract.id })
|
const tips = useTipTxns({ contractId: contract.id })
|
||||||
const comments = useComments(contract.id) ?? props.comments
|
const comments = useComments(contract.id) ?? props.comments
|
||||||
const [sort, setSort] = usePersistentState<'Newest' | 'Best'>('Newest', {
|
const [sort, setSort] = usePersistentState<'Newest' | 'Best'>('Newest', {
|
||||||
|
@ -175,16 +174,6 @@ const CommentsTabContent = memo(function CommentsTabContent(props: {
|
||||||
</Row>
|
</Row>
|
||||||
)
|
)
|
||||||
|
|
||||||
// console.log('answer response:: ', answerResponse)
|
|
||||||
// sortedComments.map((comment, index) =>
|
|
||||||
// console.log(
|
|
||||||
// index,
|
|
||||||
// ',',
|
|
||||||
// comment.content.content[0].content[0].text,
|
|
||||||
// ':',
|
|
||||||
// dayjs(comment.createdTime).format('MM/DD/YY H:mm')
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
if (contract.outcomeType === 'FREE_RESPONSE') {
|
if (contract.outcomeType === 'FREE_RESPONSE') {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import { useRouter, NextRouter } from 'next/router'
|
import { useRouter, NextRouter } from 'next/router'
|
||||||
import { ReactNode, useState } from 'react'
|
import { ReactNode, useEffect, useState } from 'react'
|
||||||
import { track } from '@amplitude/analytics-browser'
|
import { track } from '@amplitude/analytics-browser'
|
||||||
import { Col } from './col'
|
import { Col } from './col'
|
||||||
import { Tooltip } from 'web/components/tooltip'
|
import { Tooltip } from 'web/components/tooltip'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { memo, useEffect, useMemo, useState } from 'react'
|
import React, { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { ArrowLeftIcon } from '@heroicons/react/outline'
|
import { ArrowLeftIcon } from '@heroicons/react/outline'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
|
@ -209,11 +209,11 @@ export function ContractPageContent(
|
||||||
const [answerResponse, setAnswerResponse] = useState<Answer | undefined>(
|
const [answerResponse, setAnswerResponse] = useState<Answer | undefined>(
|
||||||
undefined
|
undefined
|
||||||
)
|
)
|
||||||
|
|
||||||
const onAnswerCommentClick = useEvent((answer: Answer) => {
|
const onAnswerCommentClick = useEvent((answer: Answer) => {
|
||||||
setAnswerResponse(answer)
|
setAnswerResponse(answer)
|
||||||
|
answerRef.current.scrollIntoView({ behavior: 'smooth' })
|
||||||
})
|
})
|
||||||
|
const answerRef = useRef(null)
|
||||||
const onCancelAnswerResponse = useEvent(() => setAnswerResponse(undefined))
|
const onCancelAnswerResponse = useEvent(() => setAnswerResponse(undefined))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -293,6 +293,7 @@ export function ContractPageContent(
|
||||||
userBets={userBets}
|
userBets={userBets}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div ref={answerRef}>
|
||||||
<ContractTabs
|
<ContractTabs
|
||||||
contract={contract}
|
contract={contract}
|
||||||
bets={bets}
|
bets={bets}
|
||||||
|
@ -301,6 +302,7 @@ export function ContractPageContent(
|
||||||
answerResponse={answerResponse}
|
answerResponse={answerResponse}
|
||||||
onCancelAnswerResponse={onCancelAnswerResponse}
|
onCancelAnswerResponse={onCancelAnswerResponse}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
{!isCreator && <RecommendedContractsWidget contract={contract} />}
|
{!isCreator && <RecommendedContractsWidget contract={contract} />}
|
||||||
<ScrollToTopButton className="fixed bottom-16 right-2 z-20 lg:bottom-2 xl:hidden" />
|
<ScrollToTopButton className="fixed bottom-16 right-2 z-20 lg:bottom-2 xl:hidden" />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user