Remove unused & refactor
This commit is contained in:
parent
7044259144
commit
4f54225e16
|
@ -1,6 +1,6 @@
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
import { Answer, getNoneAnswer } from '../../../common/answer'
|
import { Answer } from '../../../common/answer'
|
||||||
import { Bet } from '../../../common/bet'
|
import { Bet } from '../../../common/bet'
|
||||||
import { getOutcomeProbability } from '../../../common/calculate'
|
import { getOutcomeProbability } from '../../../common/calculate'
|
||||||
import { Comment } from '../../../common/comment'
|
import { Comment } from '../../../common/comment'
|
||||||
|
|
|
@ -232,10 +232,6 @@ export function CommentInput(props: {
|
||||||
const [comment, setComment] = useState('')
|
const [comment, setComment] = useState('')
|
||||||
const [focused, setFocused] = useState(false)
|
const [focused, setFocused] = useState(false)
|
||||||
|
|
||||||
function setFocusedIfFreeResponse(focus: boolean) {
|
|
||||||
if (answerOutcome != undefined) setFocused(focus)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should this be oldest bet or most recent bet?
|
// Should this be oldest bet or most recent bet?
|
||||||
const mostRecentCommentableBet = betsByCurrentUser
|
const mostRecentCommentableBet = betsByCurrentUser
|
||||||
.filter((bet) => {
|
.filter((bet) => {
|
||||||
|
@ -305,8 +301,8 @@ export function CommentInput(props: {
|
||||||
className="textarea textarea-bordered w-full resize-none"
|
className="textarea textarea-bordered w-full resize-none"
|
||||||
placeholder="Add a comment..."
|
placeholder="Add a comment..."
|
||||||
rows={answerOutcome == undefined || focused ? 3 : 1}
|
rows={answerOutcome == undefined || focused ? 3 : 1}
|
||||||
onFocus={() => setFocusedIfFreeResponse(true)}
|
onFocus={() => setFocused(true)}
|
||||||
onBlur={() => !comment && setFocusedIfFreeResponse(false)}
|
onBlur={() => !comment && setFocused(false)}
|
||||||
maxLength={MAX_COMMENT_LENGTH}
|
maxLength={MAX_COMMENT_LENGTH}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
|
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
|
||||||
|
@ -320,7 +316,7 @@ export function CommentInput(props: {
|
||||||
}
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
submitComment(id)
|
submitComment(id)
|
||||||
setFocusedIfFreeResponse(false)
|
setFocused(false)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{user ? 'Comment' : 'Sign in to comment'}
|
{user ? 'Comment' : 'Sign in to comment'}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user