diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index 6a507be4..123b175e 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -44,6 +44,10 @@ import { Avatar } from './avatar' import { useAdmin } from '../hooks/use-admin' import { Answer } from '../../common/answer' +const canAddComment = (createdTime: number, isSelf: boolean) => { + return isSelf && Date.now() - createdTime < 60 * 60 * 1000 +} + function FeedComment(props: { activityItem: any moreHref: string @@ -100,7 +104,7 @@ function FeedBet(props: { activityItem: any; feedType: FeedType }) { const isSelf = user?.id == activityItem.userId const isCreator = contract.creatorId == activityItem.userId // You can comment if your bet was posted in the last hour - const canComment = isSelf && Date.now() - createdTime < 60 * 60 * 1000 + const canComment = canAddComment(createdTime, isSelf) const [comment, setComment] = useState('') async function submitComment() { @@ -132,42 +136,44 @@ function FeedBet(props: { activityItem: any; feedType: FeedType }) { )} -