Fix generation of create market placeholder text (#92)
* Fix generation of create market placeholder text * Capitalize comment
This commit is contained in:
parent
8ac95b363d
commit
4d48c98975
|
@ -1,6 +1,6 @@
|
||||||
import { SparklesIcon, XIcon } from '@heroicons/react/solid'
|
import { SparklesIcon, XIcon } from '@heroicons/react/solid'
|
||||||
import { Avatar } from './avatar'
|
import { Avatar } from './avatar'
|
||||||
import { useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { Spacer } from './layout/spacer'
|
import { Spacer } from './layout/spacer'
|
||||||
import { NewContract } from '../pages/create'
|
import { NewContract } from '../pages/create'
|
||||||
import { firebaseLogin, User } from '../lib/firebase/users'
|
import { firebaseLogin, User } from '../lib/firebase/users'
|
||||||
|
@ -10,6 +10,7 @@ import { Col } from './layout/col'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
import { ENV_CONFIG } from '../../common/envs/constants'
|
import { ENV_CONFIG } from '../../common/envs/constants'
|
||||||
|
import _ from 'lodash'
|
||||||
|
|
||||||
export function FeedPromo(props: { hotContracts: Contract[] }) {
|
export function FeedPromo(props: { hotContracts: Contract[] }) {
|
||||||
const { hotContracts } = props
|
const { hotContracts } = props
|
||||||
|
@ -71,14 +72,19 @@ export default function FeedCreate(props: {
|
||||||
const [isExpanded, setIsExpanded] = useState(false)
|
const [isExpanded, setIsExpanded] = useState(false)
|
||||||
const inputRef = useRef<HTMLTextAreaElement | null>()
|
const inputRef = useRef<HTMLTextAreaElement | null>()
|
||||||
|
|
||||||
const placeholders = ENV_CONFIG.newQuestionPlaceholders
|
|
||||||
// Rotate through a new placeholder each day
|
// Rotate through a new placeholder each day
|
||||||
// Easter egg idea: click your own name to shuffle the placeholder
|
// Easter egg idea: click your own name to shuffle the placeholder
|
||||||
// const daysSinceEpoch = Math.floor(Date.now() / 1000 / 60 / 60 / 24)
|
// const daysSinceEpoch = Math.floor(Date.now() / 1000 / 60 / 60 / 24)
|
||||||
const [randIndex] = useState(
|
|
||||||
Math.floor(Math.random() * 1e10) % placeholders.length
|
// Take care not to produce a different placeholder on the server and client
|
||||||
)
|
const [defaultPlaceholder, setDefaultPlaceholder] = useState('')
|
||||||
const placeholder = props.placeholder ?? `e.g. ${placeholders[randIndex]}`
|
useEffect(() => {
|
||||||
|
setDefaultPlaceholder(
|
||||||
|
`e.g. ${_.sample(ENV_CONFIG.newQuestionPlaceholders)}`
|
||||||
|
)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const placeholder = props.placeholder ?? defaultPlaceholder
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in New Issue
Block a user