FeedCreate: change placeholders, cycle through randomly

This commit is contained in:
mantikoros 2022-01-27 14:40:46 -06:00
parent f58126e630
commit e697024f52

View File

@ -65,19 +65,17 @@ export default function FeedCreate(props: {
const [question, setQuestion] = useState('') const [question, setQuestion] = useState('')
const placeholders = [ const placeholders = [
'Will I make a new friend this week?',
'Will we discover that the world is a simulation?',
'Will anyone I know get engaged this year?', 'Will anyone I know get engaged this year?',
'Will humans set foot on Mars by the end of 2030?', 'Will humans set foot on Mars by the end of 2030?',
'If I switch jobs, will I have more free time in 6 months than I do now?', 'Will any cryptocurrency eclipse Bitcoin by market cap this year?',
'Will any cryptocurrency eclipse Bitcoin by market cap?', 'Will the Democrats win the 2024 presidential election?',
] ]
// 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 placeholder =
props.placeholder ?? const randIndex = Math.floor(Math.random() * 1e10) % placeholders.length
`e.g. ${placeholders[daysSinceEpoch % placeholders.length]}` const placeholder = props.placeholder ?? `e.g. ${placeholders[randIndex]}`
return ( return (
<div className={clsx('w-full bg-indigo-50 sm:rounded-md p-4', className)}> <div className={clsx('w-full bg-indigo-50 sm:rounded-md p-4', className)}>