Don't open comment w/o new bet
This commit is contained in:
parent
65bc0f0f86
commit
bdb3bbd960
|
@ -69,9 +69,21 @@ export function FeedAnswerCommentGroup(props: {
|
||||||
user,
|
user,
|
||||||
answer.number.toString()
|
answer.number.toString()
|
||||||
)
|
)
|
||||||
const [usersMostRecentBetTimeAtLoad] = useState(
|
const [usersMostRecentBetTimeAtLoad, setUsersMostRecentBetTimeAtLoad] =
|
||||||
mostRecentCommentableBet?.createdTime ?? 0
|
useState<number | undefined>(
|
||||||
)
|
!user ? undefined : mostRecentCommentableBet?.createdTime ?? 0
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (user && usersMostRecentBetTimeAtLoad === undefined)
|
||||||
|
setUsersMostRecentBetTimeAtLoad(
|
||||||
|
mostRecentCommentableBet?.createdTime ?? 0
|
||||||
|
)
|
||||||
|
}, [
|
||||||
|
mostRecentCommentableBet?.createdTime,
|
||||||
|
user,
|
||||||
|
usersMostRecentBetTimeAtLoad,
|
||||||
|
])
|
||||||
|
|
||||||
const scrollAndOpenReplyInput = useEvent(
|
const scrollAndOpenReplyInput = useEvent(
|
||||||
(comment?: Comment, answer?: Answer) => {
|
(comment?: Comment, answer?: Answer) => {
|
||||||
|
@ -84,6 +96,7 @@ export function FeedAnswerCommentGroup(props: {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
mostRecentCommentableBet &&
|
mostRecentCommentableBet &&
|
||||||
|
usersMostRecentBetTimeAtLoad !== undefined &&
|
||||||
mostRecentCommentableBet.createdTime > usersMostRecentBetTimeAtLoad &&
|
mostRecentCommentableBet.createdTime > usersMostRecentBetTimeAtLoad &&
|
||||||
!showReply
|
!showReply
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user