Merge branch 'main' into close-emails
This commit is contained in:
commit
4264985591
|
@ -86,7 +86,8 @@ Questions? Feedback? I'd love to hear from you - just reply to this email!
|
|||
Or come chat with us on Discord: https://discord.gg/eHQBNBqXuh
|
||||
|
||||
Best,
|
||||
Austin from Manifold`
|
||||
Austin from Manifold
|
||||
https://manifold.markets/`
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import { sellBet } from '../lib/firebase/api-call'
|
|||
import { ConfirmationButton } from './confirmation-button'
|
||||
import { OutcomeLabel, YesLabel, NoLabel } from './outcome-label'
|
||||
|
||||
type BetSort = 'newest' | 'profit'
|
||||
type BetSort = 'newest' | 'profit' | 'resolved'
|
||||
|
||||
export function BetsList(props: { user: User }) {
|
||||
const { user } = props
|
||||
|
@ -111,6 +111,8 @@ export function BetsList(props: { user: User }) {
|
|||
(c) => c.isResolved
|
||||
)
|
||||
|
||||
const displayedContracts = sort === 'resolved' ? resolved : unresolved
|
||||
|
||||
const currentInvestment = _.sumBy(
|
||||
unresolved,
|
||||
(c) => contractsInvestment[c.id]
|
||||
|
@ -142,7 +144,7 @@ export function BetsList(props: { user: User }) {
|
|||
<Col>
|
||||
<div className="text-sm text-gray-500">Balance</div>
|
||||
<div className="whitespace-nowrap text-lg">
|
||||
{formatMoney(user.balance)}{' '}
|
||||
{formatMoney(Math.floor(user.balance))}{' '}
|
||||
</div>
|
||||
</Col>
|
||||
<Col>
|
||||
|
@ -161,10 +163,11 @@ export function BetsList(props: { user: User }) {
|
|||
>
|
||||
<option value="profit">By profit</option>
|
||||
<option value="newest">Newest</option>
|
||||
<option value="resolved">Resolved</option>
|
||||
</select>
|
||||
</Col>
|
||||
|
||||
{[...unresolved, ...resolved].map((contract) => (
|
||||
{displayedContracts.map((contract) => (
|
||||
<MyContractBets
|
||||
key={contract.id}
|
||||
contract={contract}
|
||||
|
|
|
@ -61,6 +61,7 @@ export default function FeedCreate(props: {
|
|||
}) {
|
||||
const { user, tag, className } = props
|
||||
const [question, setQuestion] = useState('')
|
||||
const [focused, setFocused] = useState(false)
|
||||
|
||||
const placeholders = [
|
||||
'Will anyone I know get engaged this year?',
|
||||
|
@ -81,7 +82,11 @@ export default function FeedCreate(props: {
|
|||
|
||||
return (
|
||||
<div
|
||||
className={clsx('mt-2 w-full bg-white p-4 shadow-md', className)}
|
||||
className={clsx(
|
||||
'mt-2 w-full rounded bg-white p-4 shadow-md',
|
||||
question || focused ? 'ring-2 ring-indigo-300' : '',
|
||||
className
|
||||
)}
|
||||
onClick={() => !question && inputRef.current?.focus()}
|
||||
>
|
||||
<div className="relative flex items-start space-x-3">
|
||||
|
@ -99,17 +104,19 @@ export default function FeedCreate(props: {
|
|||
value={question}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onChange={(e) => setQuestion(e.target.value.replace('\n', ''))}
|
||||
onFocus={() => setFocused(true)}
|
||||
onBlur={() => setFocused(false)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Hide component instead of deleting, so edits to NewContract don't get lost */}
|
||||
<div className={question ? '' : 'hidden'}>
|
||||
<div className={question || focused ? '' : 'hidden'}>
|
||||
<NewContract question={question} tag={tag} />
|
||||
</div>
|
||||
|
||||
{/* Show a fake "Create Market" button, which gets replaced with the NewContract one*/}
|
||||
{!question && (
|
||||
{!(question || focused) && (
|
||||
<div className="flex justify-end">
|
||||
<button className="btn btn-sm" disabled>
|
||||
Create Market
|
||||
|
|
|
@ -2,9 +2,11 @@ import { Fragment } from 'react'
|
|||
import { SiteLink } from './site-link'
|
||||
|
||||
// Return a JSX span, linkifying @username, #hashtags, and https://...
|
||||
// TODO: Use a markdown parser instead of rolling our own here.
|
||||
export function Linkify(props: { text: string; gray?: boolean }) {
|
||||
const { text, gray } = props
|
||||
const regex = /(?:^|\s)(?:[@#][a-z0-9_]+|https?:\/\/\S+)/gi
|
||||
const regex =
|
||||
/(?:^|\s)(?:[@#][a-z0-9_]+|https?:\/\/[-A-Za-z0-9+&@#\/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#\/%=~_()|])/gi
|
||||
const matches = text.match(regex) || []
|
||||
const links = matches.map((match) => {
|
||||
// Matches are in the form: " @username" or "https://example.com"
|
||||
|
|
|
@ -25,11 +25,15 @@ import { useFollowedFolds } from '../hooks/use-fold'
|
|||
import { SiteLink } from '../components/site-link'
|
||||
|
||||
export async function getStaticProps() {
|
||||
const [contracts, folds] = await Promise.all([
|
||||
let [contracts, folds] = await Promise.all([
|
||||
listAllContracts().catch((_) => []),
|
||||
listAllFolds().catch(() => []),
|
||||
])
|
||||
|
||||
// TODO(James): Remove this line. We are filtering out non-binary contracts so that
|
||||
// branches other than free-response work.
|
||||
contracts = contracts.filter((contract) => contract.outcomeType === 'BINARY')
|
||||
|
||||
const [contractBets, contractComments] = await Promise.all([
|
||||
Promise.all(contracts.map((contract) => listAllBets(contract.id))),
|
||||
Promise.all(contracts.map((contract) => listAllComments(contract.id))),
|
||||
|
|
Loading…
Reference in New Issue
Block a user