More absolute imports (#156)

* Configure functions module to allow absolute imports

* Convert common imports in functions to be absolute

* Convert common imports in web to be absolute

* Convert lib imports in web to be absolute

* Convert hooks imports in web to be absolute

* Convert components imports in web to be absolute
This commit is contained in:
Marshall Polaris 2022-05-09 06:04:36 -07:00 committed by GitHub
parent dd2366458d
commit acc9c84e2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
148 changed files with 671 additions and 710 deletions

View File

@ -1,11 +1,11 @@
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { Contract } from '../../common/contract'
import { User } from '../../common/user'
import { removeUndefinedProps } from '../../common/util/object'
import { Contract } from 'common/contract'
import { User } from 'common/user'
import { removeUndefinedProps } from 'common/util/object'
import { redeemShares } from './redeem-shares'
import { getNewLiquidityProvision } from '../../common/add-liquidity'
import { getNewLiquidityProvision } from 'common/add-liquidity'
export const addLiquidity = functions.runWith({ minInstances: 1 }).https.onCall(
async (

View File

@ -2,12 +2,12 @@ import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { getUser } from './utils'
import { Contract } from '../../common/contract'
import { Comment } from '../../common/comment'
import { User } from '../../common/user'
import { cleanUsername } from '../../common/util/clean-username'
import { removeUndefinedProps } from '../../common/util/object'
import { Answer } from '../../common/answer'
import { Contract } from 'common/contract'
import { Comment } from 'common/comment'
import { User } from 'common/user'
import { cleanUsername } from 'common/util/clean-username'
import { removeUndefinedProps } from 'common/util/object'
import { Answer } from 'common/answer'
export const changeUserInfo = functions
.runWith({ minInstances: 1 })

View File

@ -1,18 +1,13 @@
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import {
Contract,
DPM,
FreeResponse,
FullContract,
} from '../../common/contract'
import { User } from '../../common/user'
import { getLoanAmount, getNewMultiBetInfo } from '../../common/new-bet'
import { Answer, MAX_ANSWER_LENGTH } from '../../common/answer'
import { Contract, DPM, FreeResponse, FullContract } from 'common/contract'
import { User } from 'common/user'
import { getLoanAmount, getNewMultiBetInfo } from 'common/new-bet'
import { Answer, MAX_ANSWER_LENGTH } from 'common/answer'
import { getContract, getValues } from './utils'
import { sendNewAnswerEmail } from './emails'
import { Bet } from '../../common/bet'
import { Bet } from 'common/bet'
export const createAnswer = functions.runWith({ minInstances: 1 }).https.onCall(
async (

View File

@ -13,10 +13,10 @@ import {
MAX_QUESTION_LENGTH,
MAX_TAG_LENGTH,
outcomeType,
} from '../../common/contract'
import { slugify } from '../../common/util/slugify'
import { randomString } from '../../common/util/random'
import { getNewContract } from '../../common/new-contract'
} from 'common/contract'
import { slugify } from 'common/util/slugify'
import { randomString } from 'common/util/random'
import { getNewContract } from 'common/new-contract'
import {
FIXED_ANTE,
getAnteBets,
@ -24,8 +24,8 @@ import {
getFreeAnswerAnte,
HOUSE_LIQUIDITY_PROVIDER_ID,
MINIMUM_ANTE,
} from '../../common/antes'
import { getNoneAnswer } from '../../common/answer'
} from 'common/antes'
import { getNoneAnswer } from 'common/answer'
export const createContract = functions
.runWith({ minInstances: 1 })

View File

@ -3,10 +3,10 @@ import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { getUser } from './utils'
import { Contract } from '../../common/contract'
import { slugify } from '../../common/util/slugify'
import { randomString } from '../../common/util/random'
import { Fold } from '../../common/fold'
import { Contract } from 'common/contract'
import { slugify } from 'common/util/slugify'
import { randomString } from 'common/util/random'
import { Fold } from 'common/fold'
export const createFold = functions.runWith({ minInstances: 1 }).https.onCall(
async (

View File

@ -6,15 +6,12 @@ import {
STARTING_BALANCE,
SUS_STARTING_BALANCE,
User,
} from '../../common/user'
} from 'common/user'
import { getUser, getUserByUsername } from './utils'
import { randomString } from '../../common/util/random'
import {
cleanDisplayName,
cleanUsername,
} from '../../common/util/clean-username'
import { randomString } from 'common/util/random'
import { cleanDisplayName, cleanUsername } from 'common/util/clean-username'
import { sendWelcomeEmail } from './emails'
import { isWhitelisted } from '../../common/envs/constants'
import { isWhitelisted } from 'common/envs/constants'
export const createUser = functions
.runWith({ minInstances: 1 })

View File

@ -1,14 +1,14 @@
import * as _ from 'lodash'
import { DOMAIN, PROJECT_ID } from '../../common/envs/constants'
import { Answer } from '../../common/answer'
import { Bet } from '../../common/bet'
import { getProbability } from '../../common/calculate'
import { Comment } from '../../common/comment'
import { Contract, FreeResponseContract } from '../../common/contract'
import { CREATOR_FEE } from '../../common/fees'
import { PrivateUser, User } from '../../common/user'
import { formatMoney, formatPercent } from '../../common/util/format'
import { DOMAIN, PROJECT_ID } from 'common/envs/constants'
import { Answer } from 'common/answer'
import { Bet } from 'common/bet'
import { getProbability } from 'common/calculate'
import { Comment } from 'common/comment'
import { Contract, FreeResponseContract } from 'common/contract'
import { CREATOR_FEE } from 'common/fees'
import { PrivateUser, User } from 'common/user'
import { formatMoney, formatPercent } from 'common/util/format'
import { sendTemplateEmail, sendTextEmail } from './send-email'
import { getPrivateUser, getUser } from './utils'

View File

@ -1,7 +1,7 @@
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { Contract } from '../../common/contract'
import { Contract } from 'common/contract'
import { getPrivateUser, getUserByUsername } from './utils'
import { sendMarketCloseEmail } from './emails'

View File

@ -3,7 +3,7 @@ import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { getContract } from './utils'
import { Bet } from '../../common/bet'
import { Bet } from 'common/bet'
const firestore = admin.firestore()

View File

@ -3,10 +3,10 @@ import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { getContract, getUser, getValues } from './utils'
import { Comment } from '../../common/comment'
import { Comment } from 'common/comment'
import { sendNewCommentEmail } from './emails'
import { Bet } from '../../common/bet'
import { Answer } from '../../common/answer'
import { Bet } from 'common/bet'
import { Answer } from 'common/answer'
const firestore = admin.firestore()

View File

@ -1,6 +1,6 @@
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { View } from '../../common/tracking'
import { View } from 'common/tracking'
const firestore = admin.firestore()

View File

@ -1,18 +1,18 @@
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { Contract } from '../../common/contract'
import { User } from '../../common/user'
import { Contract } from 'common/contract'
import { User } from 'common/user'
import {
getNewBinaryCpmmBetInfo,
getNewBinaryDpmBetInfo,
getNewMultiBetInfo,
getLoanAmount,
} from '../../common/new-bet'
import { addObjects, removeUndefinedProps } from '../../common/util/object'
import { Bet } from '../../common/bet'
} from 'common/new-bet'
import { addObjects, removeUndefinedProps } from 'common/util/object'
import { Bet } from 'common/bet'
import { redeemShares } from './redeem-shares'
import { Fees } from '../../common/fees'
import { Fees } from 'common/fees'
export const placeBet = functions.runWith({ minInstances: 1 }).https.onCall(
async (

View File

@ -1,12 +1,12 @@
import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { Bet } from '../../common/bet'
import { getProbability } from '../../common/calculate'
import { Bet } from 'common/bet'
import { getProbability } from 'common/calculate'
import { Binary, CPMM, FullContract } from '../../common/contract'
import { noFees } from '../../common/fees'
import { User } from '../../common/user'
import { Binary, CPMM, FullContract } from 'common/contract'
import { noFees } from 'common/fees'
import { User } from 'common/user'
export const redeemShares = async (userId: string, contractId: string) => {
return await firestore.runTransaction(async (transaction) => {

View File

@ -2,14 +2,14 @@ import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { Contract } from '../../common/contract'
import { User } from '../../common/user'
import { Bet } from '../../common/bet'
import { Contract } from 'common/contract'
import { User } from 'common/user'
import { Bet } from 'common/bet'
import { getUser, isProd, payUser } from './utils'
import { sendMarketResolutionEmail } from './emails'
import { getLoanPayouts, getPayouts } from '../../common/payouts'
import { removeUndefinedProps } from '../../common/util/object'
import { LiquidityProvision } from '../../common/liquidity-provision'
import { getLoanPayouts, getPayouts } from 'common/payouts'
import { removeUndefinedProps } from 'common/util/object'
import { LiquidityProvision } from 'common/liquidity-provision'
export const resolveMarket = functions
.runWith({ minInstances: 1 })

View File

@ -5,9 +5,9 @@ import { initAdmin } from './script-init'
initAdmin()
import { getValues } from '../utils'
import { View } from '../../../common/tracking'
import { User } from '../../../common/user'
import { batchedWaitAll } from '../../../common/util/promise'
import { View } from 'common/tracking'
import { User } from 'common/user'
import { batchedWaitAll } from 'common/util/promise'
const firestore = admin.firestore()

View File

@ -4,9 +4,9 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Bet } from '../../../common/bet'
import { getDpmProbability } from '../../../common/calculate-dpm'
import { Binary, Contract, DPM, FullContract } from '../../../common/contract'
import { Bet } from 'common/bet'
import { getDpmProbability } from 'common/calculate-dpm'
import { Binary, Contract, DPM, FullContract } from 'common/contract'
type DocRef = admin.firestore.DocumentReference
const firestore = admin.firestore()

View File

@ -4,7 +4,7 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { PrivateUser, STARTING_BALANCE, User } from '../../../common/user'
import { PrivateUser, STARTING_BALANCE, User } from 'common/user'
const firestore = admin.firestore()

View File

@ -5,10 +5,10 @@ import * as fs from 'fs'
import { initAdmin } from './script-init'
initAdmin()
import { Bet } from '../../../common/bet'
import { Contract } from '../../../common/contract'
import { Bet } from 'common/bet'
import { Contract } from 'common/contract'
import { getValues } from '../utils'
import { Comment } from '../../../common/comment'
import { Comment } from 'common/comment'
const firestore = admin.firestore()

View File

@ -5,7 +5,7 @@ import { initAdmin } from './script-init'
initAdmin()
import { getValues } from '../utils'
import { Fold } from '../../../common/fold'
import { Fold } from 'common/fold'
async function lowercaseFoldTags() {
const firestore = admin.firestore()

View File

@ -4,7 +4,7 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Contract } from '../../../common/contract'
import { Contract } from 'common/contract'
const firestore = admin.firestore()

View File

@ -4,8 +4,8 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Bet } from '../../../common/bet'
import { Contract } from '../../../common/contract'
import { Bet } from 'common/bet'
import { Contract } from 'common/contract'
type DocRef = admin.firestore.DocumentReference

View File

@ -4,22 +4,13 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import {
Binary,
Contract,
CPMM,
DPM,
FullContract,
} from '../../../common/contract'
import { Bet } from '../../../common/bet'
import {
calculateDpmPayout,
getDpmProbability,
} from '../../../common/calculate-dpm'
import { User } from '../../../common/user'
import { getCpmmInitialLiquidity } from '../../../common/antes'
import { noFees } from '../../../common/fees'
import { addObjects } from '../../../common/util/object'
import { Binary, Contract, CPMM, DPM, FullContract } from 'common/contract'
import { Bet } from 'common/bet'
import { calculateDpmPayout, getDpmProbability } from 'common/calculate-dpm'
import { User } from 'common/user'
import { getCpmmInitialLiquidity } from 'common/antes'
import { noFees } from 'common/fees'
import { addObjects } from 'common/util/object'
type DocRef = admin.firestore.DocumentReference

View File

@ -4,14 +4,11 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Binary, Contract, DPM, FullContract } from '../../../common/contract'
import { Bet } from '../../../common/bet'
import {
calculateDpmShares,
getDpmProbability,
} from '../../../common/calculate-dpm'
import { getSellBetInfo } from '../../../common/sell-bet'
import { User } from '../../../common/user'
import { Binary, Contract, DPM, FullContract } from 'common/contract'
import { Bet } from 'common/bet'
import { calculateDpmShares, getDpmProbability } from 'common/calculate-dpm'
import { getSellBetInfo } from 'common/sell-bet'
import { User } from 'common/user'
type DocRef = admin.firestore.DocumentReference

View File

@ -4,10 +4,10 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Bet } from '../../../common/bet'
import { Contract } from '../../../common/contract'
import { getLoanPayouts, getPayouts } from '../../../common/payouts'
import { filterDefined } from '../../../common/util/array'
import { Bet } from 'common/bet'
import { Contract } from 'common/contract'
import { getLoanPayouts, getPayouts } from 'common/payouts'
import { filterDefined } from 'common/util/array'
type DocRef = admin.firestore.DocumentReference

View File

@ -4,8 +4,8 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Bet } from '../../../common/bet'
import { Contract } from '../../../common/contract'
import { Bet } from 'common/bet'
import { Contract } from 'common/contract'
type DocRef = admin.firestore.DocumentReference

View File

@ -4,8 +4,8 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Bet } from '../../../common/bet'
import { Contract } from '../../../common/contract'
import { Bet } from 'common/bet'
import { Contract } from 'common/contract'
import { getValues } from '../utils'
async function removeAnswerAnte() {

View File

@ -4,7 +4,7 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Contract } from '../../../common/contract'
import { Contract } from 'common/contract'
import { getValues } from '../utils'
const firestore = admin.firestore()

View File

@ -4,8 +4,8 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Contract } from '../../../common/contract'
import { parseTags } from '../../../common/util/parse'
import { Contract } from 'common/contract'
import { parseTags } from 'common/util/parse'
import { getValues } from '../utils'
async function updateContractTags() {

View File

@ -5,9 +5,9 @@ import { initAdmin } from './script-init'
initAdmin()
import { getValues } from '../utils'
import { User } from '../../../common/user'
import { batchedWaitAll } from '../../../common/util/promise'
import { Contract } from '../../../common/contract'
import { User } from 'common/user'
import { batchedWaitAll } from 'common/util/promise'
import { Contract } from 'common/contract'
import { updateWordScores } from '../update-recommendations'
import { getFeedContracts, doUserFeedUpdate } from '../update-feed'

View File

@ -4,9 +4,9 @@ import * as _ from 'lodash'
import { initAdmin } from './script-init'
initAdmin()
import { Contract } from '../../../common/contract'
import { Contract } from 'common/contract'
import { getValues } from '../utils'
import { Comment } from '../../../common/comment'
import { Comment } from 'common/comment'
async function updateLastCommentTime() {
const firestore = admin.firestore()

View File

@ -1,12 +1,12 @@
import * as admin from 'firebase-admin'
import * as functions from 'firebase-functions'
import { Contract } from '../../common/contract'
import { User } from '../../common/user'
import { Bet } from '../../common/bet'
import { getSellBetInfo } from '../../common/sell-bet'
import { addObjects, removeUndefinedProps } from '../../common/util/object'
import { Fees } from '../../common/fees'
import { Contract } from 'common/contract'
import { User } from 'common/user'
import { Bet } from 'common/bet'
import { getSellBetInfo } from 'common/sell-bet'
import { addObjects, removeUndefinedProps } from 'common/util/object'
import { Fees } from 'common/fees'
export const sellBet = functions.runWith({ minInstances: 1 }).https.onCall(
async (

View File

@ -2,12 +2,12 @@ import * as _ from 'lodash'
import * as admin from 'firebase-admin'
import * as functions from 'firebase-functions'
import { Binary, CPMM, FullContract } from '../../common/contract'
import { User } from '../../common/user'
import { getCpmmSellBetInfo } from '../../common/sell-bet'
import { addObjects, removeUndefinedProps } from '../../common/util/object'
import { Binary, CPMM, FullContract } from 'common/contract'
import { User } from 'common/user'
import { getCpmmSellBetInfo } from 'common/sell-bet'
import { addObjects, removeUndefinedProps } from 'common/util/object'
import { getValues } from './utils'
import { Bet } from '../../common/bet'
import { Bet } from 'common/bet'
export const sellShares = functions.runWith({ minInstances: 1 }).https.onCall(
async (

View File

@ -1,9 +1,9 @@
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { User } from '../../common/user'
import { Txn } from '../../common/txn'
import { removeUndefinedProps } from '../../common/util/object'
import { User } from 'common/user'
import { Txn } from 'common/txn'
import { removeUndefinedProps } from 'common/util/object'
export const transact = functions
.runWith({ minInstances: 1 })

View File

@ -2,7 +2,7 @@ import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { getUser } from './utils'
import { PrivateUser } from '../../common/user'
import { PrivateUser } from 'common/user'
export const unsubscribe = functions
.runWith({ minInstances: 1 })

View File

@ -3,9 +3,9 @@ import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { getValues } from './utils'
import { Contract } from '../../common/contract'
import { Bet } from '../../common/bet'
import { batchedWaitAll } from '../../common/util/promise'
import { Contract } from 'common/contract'
import { Bet } from 'common/bet'
import { batchedWaitAll } from 'common/util/promise'
const firestore = admin.firestore()

View File

@ -3,21 +3,21 @@ import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { getValue, getValues } from './utils'
import { Contract } from '../../common/contract'
import { logInterpolation } from '../../common/util/math'
import { DAY_MS } from '../../common/util/time'
import { Contract } from 'common/contract'
import { logInterpolation } from 'common/util/math'
import { DAY_MS } from 'common/util/time'
import {
getProbability,
getOutcomeProbability,
getTopAnswer,
} from '../../common/calculate'
import { Bet } from '../../common/bet'
import { Comment } from '../../common/comment'
import { User } from '../../common/user'
} from 'common/calculate'
import { Bet } from 'common/bet'
import { Comment } from 'common/comment'
import { User } from 'common/user'
import {
getContractScore,
MAX_FEED_CONTRACTS,
} from '../../common/recommended-contracts'
} from 'common/recommended-contracts'
import { callCloudFunction } from './call-cloud-function'
const firestore = admin.firestore()

View File

@ -3,12 +3,12 @@ import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { getValue, getValues } from './utils'
import { Contract } from '../../common/contract'
import { Bet } from '../../common/bet'
import { User } from '../../common/user'
import { ClickEvent } from '../../common/tracking'
import { getWordScores } from '../../common/recommended-contracts'
import { batchedWaitAll } from '../../common/util/promise'
import { Contract } from 'common/contract'
import { Bet } from 'common/bet'
import { User } from 'common/user'
import { ClickEvent } from 'common/tracking'
import { getWordScores } from 'common/recommended-contracts'
import { batchedWaitAll } from 'common/util/promise'
import { callCloudFunction } from './call-cloud-function'
const firestore = admin.firestore()

View File

@ -3,11 +3,11 @@ import * as admin from 'firebase-admin'
import * as _ from 'lodash'
import { getValues } from './utils'
import { Contract } from '../../common/contract'
import { Bet } from '../../common/bet'
import { User } from '../../common/user'
import { batchedWaitAll } from '../../common/util/promise'
import { calculatePayout } from '../../common/calculate'
import { Contract } from 'common/contract'
import { Bet } from 'common/bet'
import { User } from 'common/user'
import { batchedWaitAll } from 'common/util/promise'
import { calculatePayout } from 'common/calculate'
const firestore = admin.firestore()

View File

@ -1,7 +1,7 @@
import * as admin from 'firebase-admin'
import { Contract } from '../../common/contract'
import { PrivateUser, User } from '../../common/user'
import { Contract } from 'common/contract'
import { PrivateUser, User } from 'common/user'
export const isProd =
admin.instanceId().app.options.projectId === 'mantic-markets'

View File

@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl": "../",
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "lib",

View File

@ -1,8 +1,8 @@
import clsx from 'clsx'
import { useEffect, useState } from 'react'
import { useUser } from '../hooks/use-user'
import { checkoutURL } from '../lib/service/stripe'
import { useUser } from 'web/hooks/use-user'
import { checkoutURL } from 'web/lib/service/stripe'
import { FundsSelector } from './yes-no-selector'
export function AddFundsButton(props: { className?: string }) {

View File

@ -1,10 +1,10 @@
import clsx from 'clsx'
import { useState } from 'react'
import { Contract } from '../../common/contract'
import { formatMoney } from '../../common/util/format'
import { useUser } from '../hooks/use-user'
import { addLiquidity } from '../lib/firebase/api-call'
import { Contract } from 'common/contract'
import { formatMoney } from 'common/util/format'
import { useUser } from 'web/hooks/use-user'
import { addLiquidity } from 'web/lib/firebase/api-call'
import { AmountInput } from './amount-input'
import { Row } from './layout/row'

View File

@ -1,13 +1,13 @@
import clsx from 'clsx'
import _ from 'lodash'
import { useUser } from '../hooks/use-user'
import { formatMoney, formatWithCommas } from '../../common/util/format'
import { useUser } from 'web/hooks/use-user'
import { formatMoney, formatWithCommas } from 'common/util/format'
import { Col } from './layout/col'
import { Row } from './layout/row'
import { Bet } from '../../common/bet'
import { Bet } from 'common/bet'
import { Spacer } from './layout/spacer'
import { calculateCpmmSale } from '../../common/calculate-cpmm'
import { Binary, CPMM, FullContract } from '../../common/contract'
import { calculateCpmmSale } from 'common/calculate-cpmm'
import { Binary, CPMM, FullContract } from 'common/contract'
import { SiteLink } from './site-link'
export function AmountInput(props: {

View File

@ -1,7 +1,7 @@
import { ResponsiveLine } from '@nivo/line'
import dayjs from 'dayjs'
import _ from 'lodash'
import { useWindowSize } from '../../hooks/use-window-size'
import { useWindowSize } from 'web/hooks/use-window-size'
export function DailyCountChart(props: {
startDate: number

View File

@ -3,28 +3,28 @@ import _ from 'lodash'
import { useEffect, useRef, useState } from 'react'
import { XIcon } from '@heroicons/react/solid'
import { Answer } from '../../../common/answer'
import { DPM, FreeResponse, FullContract } from '../../../common/contract'
import { Answer } from 'common/answer'
import { DPM, FreeResponse, FullContract } from 'common/contract'
import { BuyAmountInput } from '../amount-input'
import { Col } from '../layout/col'
import { placeBet } from '../../lib/firebase/api-call'
import { placeBet } from 'web/lib/firebase/api-call'
import { Row } from '../layout/row'
import { Spacer } from '../layout/spacer'
import {
formatMoney,
formatPercent,
formatWithCommas,
} from '../../../common/util/format'
} from 'common/util/format'
import { InfoTooltip } from '../info-tooltip'
import { useUser } from '../../hooks/use-user'
import { useUser } from 'web/hooks/use-user'
import {
getDpmOutcomeProbability,
calculateDpmShares,
calculateDpmPayoutAfterCorrectBet,
getDpmOutcomeProbabilityAfterBet,
} from '../../../common/calculate-dpm'
import { firebaseLogin } from '../../lib/firebase/users'
import { Bet } from '../../../common/bet'
} from 'common/calculate-dpm'
import { firebaseLogin } from 'web/lib/firebase/users'
import { Bet } from 'common/bet'
export function AnswerBetPanel(props: {
answer: Answer

View File

@ -1,15 +1,15 @@
import clsx from 'clsx'
import _ from 'lodash'
import { Answer } from '../../../common/answer'
import { DPM, FreeResponse, FullContract } from '../../../common/contract'
import { Answer } from 'common/answer'
import { DPM, FreeResponse, FullContract } from 'common/contract'
import { Col } from '../layout/col'
import { Row } from '../layout/row'
import { Avatar } from '../avatar'
import { SiteLink } from '../site-link'
import { formatPercent } from '../../../common/util/format'
import { getDpmOutcomeProbability } from '../../../common/calculate-dpm'
import { tradingAllowed } from '../../lib/firebase/contracts'
import { formatPercent } from 'common/util/format'
import { getDpmOutcomeProbability } from 'common/calculate-dpm'
import { tradingAllowed } from 'web/lib/firebase/contracts'
import { Linkify } from '../linkify'
export function AnswerItem(props: {

View File

@ -2,13 +2,13 @@ import clsx from 'clsx'
import _ from 'lodash'
import { useState } from 'react'
import { DPM, FreeResponse, FullContract } from '../../../common/contract'
import { DPM, FreeResponse, FullContract } from 'common/contract'
import { Col } from '../layout/col'
import { resolveMarket } from '../../lib/firebase/api-call'
import { resolveMarket } from 'web/lib/firebase/api-call'
import { Row } from '../layout/row'
import { ChooseCancelSelector } from '../yes-no-selector'
import { ResolveConfirmationButton } from '../confirmation-button'
import { removeUndefinedProps } from '../../../common/util/object'
import { removeUndefinedProps } from 'common/util/object'
export function AnswerResolvePanel(props: {
contract: FullContract<DPM, FreeResponse>

View File

@ -4,11 +4,11 @@ import dayjs from 'dayjs'
import _ from 'lodash'
import { memo } from 'react'
import { Bet } from '../../../common/bet'
import { DPM, FreeResponse, FullContract } from '../../../common/contract'
import { getOutcomeProbability } from '../../../common/calculate'
import { useBets } from '../../hooks/use-bets'
import { useWindowSize } from '../../hooks/use-window-size'
import { Bet } from 'common/bet'
import { DPM, FreeResponse, FullContract } from 'common/contract'
import { getOutcomeProbability } from 'common/calculate'
import { useBets } from 'web/hooks/use-bets'
import { useWindowSize } from 'web/hooks/use-window-size'
const NUM_LINES = 6

View File

@ -1,21 +1,21 @@
import _ from 'lodash'
import { useLayoutEffect, useState } from 'react'
import { DPM, FreeResponse, FullContract } from '../../../common/contract'
import { DPM, FreeResponse, FullContract } from 'common/contract'
import { Col } from '../layout/col'
import { useUser } from '../../hooks/use-user'
import { getDpmOutcomeProbability } from '../../../common/calculate-dpm'
import { useAnswers } from '../../hooks/use-answers'
import { tradingAllowed } from '../../lib/firebase/contracts'
import { useUser } from 'web/hooks/use-user'
import { getDpmOutcomeProbability } from 'common/calculate-dpm'
import { useAnswers } from 'web/hooks/use-answers'
import { tradingAllowed } from 'web/lib/firebase/contracts'
import { AnswerItem } from './answer-item'
import { CreateAnswerPanel } from './create-answer-panel'
import { AnswerResolvePanel } from './answer-resolve-panel'
import { Spacer } from '../layout/spacer'
import { FeedItems } from '../feed/feed-items'
import { ActivityItem } from '../feed/activity-items'
import { User } from '../../../common/user'
import { getOutcomeProbability } from '../../../common/calculate'
import { Answer } from '../../../common/answer'
import { User } from 'common/user'
import { getOutcomeProbability } from 'common/calculate'
import { Answer } from 'common/answer'
export function AnswersPanel(props: {
contract: FullContract<DPM, FreeResponse>

View File

@ -3,26 +3,26 @@ import _ from 'lodash'
import { useState } from 'react'
import Textarea from 'react-expanding-textarea'
import { DPM, FreeResponse, FullContract } from '../../../common/contract'
import { DPM, FreeResponse, FullContract } from 'common/contract'
import { BuyAmountInput } from '../amount-input'
import { Col } from '../layout/col'
import { createAnswer } from '../../lib/firebase/api-call'
import { createAnswer } from 'web/lib/firebase/api-call'
import { Row } from '../layout/row'
import {
formatMoney,
formatPercent,
formatWithCommas,
} from '../../../common/util/format'
} from 'common/util/format'
import { InfoTooltip } from '../info-tooltip'
import { useUser } from '../../hooks/use-user'
import { useUser } from 'web/hooks/use-user'
import {
calculateDpmShares,
calculateDpmPayoutAfterCorrectBet,
getDpmOutcomeProbabilityAfterBet,
} from '../../../common/calculate-dpm'
import { firebaseLogin } from '../../lib/firebase/users'
import { Bet } from '../../../common/bet'
import { MAX_ANSWER_LENGTH } from '../../../common/answer'
} from 'common/calculate-dpm'
import { firebaseLogin } from 'web/lib/firebase/users'
import { Bet } from 'common/bet'
import { MAX_ANSWER_LENGTH } from 'common/answer'
export function CreateAnswerPanel(props: {
contract: FullContract<DPM, FreeResponse>

View File

@ -1,8 +1,8 @@
import clsx from 'clsx'
import React, { useEffect, useState } from 'react'
import { useUser } from '../hooks/use-user'
import { Binary, CPMM, DPM, FullContract } from '../../common/contract'
import { useUser } from 'web/hooks/use-user'
import { Binary, CPMM, DPM, FullContract } from 'common/contract'
import { Col } from './layout/col'
import { Row } from './layout/row'
import { Spacer } from './layout/spacer'
@ -11,11 +11,11 @@ import {
formatMoney,
formatPercent,
formatWithCommas,
} from '../../common/util/format'
} from 'common/util/format'
import { Title } from './title'
import { firebaseLogin, User } from '../lib/firebase/users'
import { Bet } from '../../common/bet'
import { placeBet, sellShares } from '../lib/firebase/api-call'
import { firebaseLogin, User } from 'web/lib/firebase/users'
import { Bet } from 'common/bet'
import { placeBet, sellShares } from 'web/lib/firebase/api-call'
import { BuyAmountInput, SellAmountInput } from './amount-input'
import { InfoTooltip } from './info-tooltip'
import { BinaryOutcomeLabel } from './outcome-label'
@ -24,13 +24,10 @@ import {
calculateShares,
getProbability,
getOutcomeProbabilityAfterBet,
} from '../../common/calculate'
import { useFocus } from '../hooks/use-focus'
import { useUserContractBets } from '../hooks/use-user-bets'
import {
calculateCpmmSale,
getCpmmProbability,
} from '../../common/calculate-cpmm'
} from 'common/calculate'
import { useFocus } from 'web/hooks/use-focus'
import { useUserContractBets } from 'web/hooks/use-user-bets'
import { calculateCpmmSale, getCpmmProbability } from 'common/calculate-cpmm'
import { SellRow } from './sell-row'
import { useSaveShares } from './use-save-shares'

View File

@ -3,11 +3,11 @@ import { useState } from 'react'
import { BetPanelSwitcher } from './bet-panel'
import { Row } from './layout/row'
import { YesNoSelector } from './yes-no-selector'
import { Binary, CPMM, DPM, FullContract } from '../../common/contract'
import { Binary, CPMM, DPM, FullContract } from 'common/contract'
import { Modal } from './layout/modal'
import { SellButton } from './sell-button'
import { useUser } from '../hooks/use-user'
import { useUserContractBets } from '../hooks/use-user-bets'
import { useUser } from 'web/hooks/use-user'
import { useUserContractBets } from 'web/hooks/use-user-bets'
import { useSaveShares } from './use-save-shares'
// Inline version of a bet panel. Opens BetPanel in a new modal.

View File

@ -4,14 +4,14 @@ import dayjs from 'dayjs'
import { useEffect, useState } from 'react'
import clsx from 'clsx'
import { useUserBets } from '../hooks/use-user-bets'
import { Bet } from '../lib/firebase/bets'
import { User } from '../lib/firebase/users'
import { useUserBets } from 'web/hooks/use-user-bets'
import { Bet } from 'web/lib/firebase/bets'
import { User } from 'web/lib/firebase/users'
import {
formatMoney,
formatPercent,
formatWithCommas,
} from '../../common/util/format'
} from 'common/util/format'
import { Col } from './layout/col'
import { Spacer } from './layout/spacer'
import {
@ -19,13 +19,13 @@ import {
getContractFromId,
contractPath,
getBinaryProbPercent,
} from '../lib/firebase/contracts'
} from 'web/lib/firebase/contracts'
import { Row } from './layout/row'
import { UserLink } from './user-page'
import { sellBet } from '../lib/firebase/api-call'
import { sellBet } from 'web/lib/firebase/api-call'
import { ConfirmationButton } from './confirmation-button'
import { OutcomeLabel, YesLabel, NoLabel } from './outcome-label'
import { filterDefined } from '../../common/util/array'
import { filterDefined } from 'common/util/array'
import { LoadingIndicator } from './loading-indicator'
import { SiteLink } from './site-link'
import {
@ -36,9 +36,9 @@ import {
getContractBetMetrics,
resolvedPayout,
getContractBetNullMetrics,
} from '../../common/calculate'
import { useTimeSinceFirstRender } from '../hooks/use-time-since-first-render'
import { trackLatency } from '../lib/firebase/tracking'
} from 'common/calculate'
import { useTimeSinceFirstRender } from 'web/hooks/use-time-since-first-render'
import { trackLatency } from 'web/lib/firebase/tracking'
type BetSort = 'newest' | 'profit' | 'closeTime' | 'value'
type BetFilter = 'open' | 'closed' | 'resolved' | 'all'

View File

@ -2,8 +2,8 @@ import { StarIcon } from '@heroicons/react/solid'
import _ from 'lodash'
import Link from 'next/link'
import Image from 'next/image'
import { Charity } from '../../../common/charity'
import { useCharityTxns } from '../../hooks/use-charity-txns'
import { Charity } from 'common/charity'
import { useCharityTxns } from 'web/hooks/use-charity-txns'
import { manaToUSD } from '../../pages/charity/[charitySlug]'
import { Row } from '../layout/row'

View File

@ -1,6 +1,6 @@
import { Txn } from '../../../common/txn'
import { Txn } from 'common/txn'
import { Avatar } from '../avatar'
import { useUserById } from '../../hooks/use-users'
import { useUserById } from 'web/hooks/use-users'
import { UserLink } from '../user-page'
import { manaToUSD } from '../../pages/charity/[charitySlug]'
import { RelativeTimestamp } from '../relative-timestamp'

View File

@ -1,12 +1,12 @@
import { Comment } from '../../common/comment'
import { Contract } from '../../common/contract'
import { contractPath } from '../lib/firebase/contracts'
import { Comment } from 'common/comment'
import { Contract } from 'common/contract'
import { contractPath } from 'web/lib/firebase/contracts'
import { SiteLink } from './site-link'
import { Row } from './layout/row'
import { Avatar } from './avatar'
import { RelativeTimestamp } from './relative-timestamp'
import { UserLink } from './user-page'
import { User } from '../../common/user'
import { User } from 'common/user'
import { Col } from './layout/col'
import { Linkify } from './linkify'

View File

@ -2,12 +2,12 @@ import clsx from 'clsx'
import Link from 'next/link'
import _ from 'lodash'
import { Row } from '../layout/row'
import { formatPercent } from '../../../common/util/format'
import { formatPercent } from 'common/util/format'
import {
Contract,
contractPath,
getBinaryProbPercent,
} from '../../lib/firebase/contracts'
} from 'web/lib/firebase/contracts'
import { Col } from '../layout/col'
import { Spacer } from '../layout/spacer'
import {
@ -17,13 +17,13 @@ import {
FreeResponse,
FreeResponseContract,
FullContract,
} from '../../../common/contract'
} from 'common/contract'
import {
AnswerLabel,
BinaryContractOutcomeLabel,
FreeResponseOutcomeLabel,
} from '../outcome-label'
import { getOutcomeProbability, getTopAnswer } from '../../../common/calculate'
import { getOutcomeProbability, getTopAnswer } from 'common/calculate'
import { AbbrContractDetails } from './contract-details'
export function ContractCard(props: {

View File

@ -3,10 +3,10 @@ import dayjs from 'dayjs'
import { useState } from 'react'
import Textarea from 'react-expanding-textarea'
import { Contract } from '../../../common/contract'
import { parseTags } from '../../../common/util/parse'
import { useAdmin } from '../../hooks/use-admin'
import { updateContract } from '../../lib/firebase/contracts'
import { Contract } from 'common/contract'
import { parseTags } from 'common/util/parse'
import { useAdmin } from 'web/hooks/use-admin'
import { updateContract } from 'web/lib/firebase/contracts'
import { Row } from '../layout/row'
import { Linkify } from '../linkify'

View File

@ -3,21 +3,21 @@ import _ from 'lodash'
import { ClockIcon, DatabaseIcon, PencilIcon } from '@heroicons/react/outline'
import { TrendingUpIcon } from '@heroicons/react/solid'
import { Row } from '../layout/row'
import { formatMoney } from '../../../common/util/format'
import { formatMoney } from 'common/util/format'
import { UserLink } from '../user-page'
import {
Contract,
contractMetrics,
updateContract,
} from '../../lib/firebase/contracts'
} from 'web/lib/firebase/contracts'
import { Col } from '../layout/col'
import dayjs from 'dayjs'
import { DateTimeTooltip } from '../datetime-tooltip'
import { fromNow } from '../../lib/util/time'
import { fromNow } from 'web/lib/util/time'
import { Avatar } from '../avatar'
import { useState } from 'react'
import { ContractInfoDialog } from './contract-info-dialog'
import { Bet } from '../../../common/bet'
import { Bet } from 'common/bet'
import NewContractBadge from '../new-contract-badge'
export function AbbrContractDetails(props: {

View File

@ -3,14 +3,11 @@ import clsx from 'clsx'
import dayjs from 'dayjs'
import _ from 'lodash'
import { useState } from 'react'
import { Bet } from '../../../common/bet'
import { Bet } from 'common/bet'
import { Contract } from '../../../common/contract'
import { formatMoney } from '../../../common/util/format'
import {
contractPath,
getBinaryProbPercent,
} from '../../lib/firebase/contracts'
import { Contract } from 'common/contract'
import { formatMoney } from 'common/util/format'
import { contractPath, getBinaryProbPercent } from 'web/lib/firebase/contracts'
import { AddLiquidityPanel } from '../add-liquidity-panel'
import { CopyLinkButton } from '../copy-link-button'
import { Col } from '../layout/col'

View File

@ -1,8 +1,8 @@
import { Contract, tradingAllowed } from '../../lib/firebase/contracts'
import { Contract, tradingAllowed } from 'web/lib/firebase/contracts'
import { Col } from '../layout/col'
import { Spacer } from '../layout/spacer'
import { ContractProbGraph } from './contract-prob-graph'
import { useUser } from '../../hooks/use-user'
import { useUser } from 'web/hooks/use-user'
import { Row } from '../layout/row'
import { Linkify } from '../linkify'
import clsx from 'clsx'
@ -10,11 +10,11 @@ import {
FreeResponseResolutionOrChance,
BinaryResolutionOrChance,
} from './contract-card'
import { Bet } from '../../../common/bet'
import { Comment } from '../../../common/comment'
import { Bet } from 'common/bet'
import { Comment } from 'common/comment'
import BetRow from '../bet-row'
import { AnswersGraph } from '../answers/answers-graph'
import { DPM, FreeResponse, FullContract } from '../../../common/contract'
import { DPM, FreeResponse, FullContract } from 'common/contract'
import { ContractDescription } from './contract-description'
import { ContractDetails } from './contract-details'
import { ShareMarket } from '../share-market'

View File

@ -2,11 +2,11 @@ import { DatumValue } from '@nivo/core'
import { ResponsiveLine } from '@nivo/line'
import dayjs from 'dayjs'
import { memo } from 'react'
import { Bet } from '../../../common/bet'
import { getInitialProbability } from '../../../common/calculate'
import { Binary, CPMM, DPM, FullContract } from '../../../common/contract'
import { useBetsWithoutAntes } from '../../hooks/use-bets'
import { useWindowSize } from '../../hooks/use-window-size'
import { Bet } from 'common/bet'
import { getInitialProbability } from 'common/calculate'
import { Binary, CPMM, DPM, FullContract } from 'common/contract'
import { useBetsWithoutAntes } from 'web/hooks/use-bets'
import { useWindowSize } from 'web/hooks/use-window-size'
export const ContractProbGraph = memo(function ContractProbGraph(props: {
contract: FullContract<DPM | CPMM, Binary>

View File

@ -1,8 +1,8 @@
import { Bet } from '../../../common/bet'
import { Contract } from '../../../common/contract'
import { Comment } from '../../lib/firebase/comments'
import { User } from '../../../common/user'
import { useBets } from '../../hooks/use-bets'
import { Bet } from 'common/bet'
import { Contract } from 'common/contract'
import { Comment } from 'web/lib/firebase/comments'
import { User } from 'common/user'
import { useBets } from 'web/hooks/use-bets'
import { ContractActivity } from '../feed/contract-activity'
import { ContractBetsTable, MyBetsSummary } from '../bets-list'
import { Spacer } from '../layout/spacer'

View File

@ -8,16 +8,16 @@ import {
Contract,
listContracts,
getBinaryProb,
} from '../../lib/firebase/contracts'
import { User } from '../../lib/firebase/users'
} from 'web/lib/firebase/contracts'
import { User } from 'web/lib/firebase/users'
import { Col } from '../layout/col'
import { SiteLink } from '../site-link'
import { ContractCard } from './contract-card'
import {
Sort,
useQueryAndSortParams,
} from '../../hooks/use-sort-and-query-params'
import { Answer } from '../../../common/answer'
} from 'web/hooks/use-sort-and-query-params'
import { Answer } from 'common/answer'
import { LoadingIndicator } from '../loading-indicator'
export function ContractsGrid(props: {

View File

@ -2,10 +2,10 @@ import { Fragment } from 'react'
import { LinkIcon } from '@heroicons/react/outline'
import { Menu, Transition } from '@headlessui/react'
import clsx from 'clsx'
import { Contract } from '../../common/contract'
import { copyToClipboard } from '../lib/util/copy'
import { contractPath } from '../lib/firebase/contracts'
import { ENV_CONFIG } from '../../common/envs/constants'
import { Contract } from 'common/contract'
import { copyToClipboard } from 'web/lib/util/copy'
import { contractPath } from 'web/lib/firebase/contracts'
import { ENV_CONFIG } from 'common/envs/constants'
function copyContractUrl(contract: Contract) {
copyToClipboard(`https://${ENV_CONFIG.domain}${contractPath(contract)}`)

View File

@ -3,13 +3,13 @@ import { Avatar } from './avatar'
import { useEffect, useRef, useState } from 'react'
import { Spacer } from './layout/spacer'
import { NewContract } from '../pages/create'
import { firebaseLogin, User } from '../lib/firebase/users'
import { firebaseLogin, User } from 'web/lib/firebase/users'
import { ContractsGrid } from './contract/contracts-list'
import { Contract, MAX_QUESTION_LENGTH } from '../../common/contract'
import { Contract, MAX_QUESTION_LENGTH } from 'common/contract'
import { Col } from './layout/col'
import clsx from 'clsx'
import { Row } from './layout/row'
import { ENV_CONFIG } from '../../common/envs/constants'
import { ENV_CONFIG } from 'common/envs/constants'
import _ from 'lodash'
import { SiteLink } from './site-link'

View File

@ -1,10 +1,10 @@
import _ from 'lodash'
import { Contract } from '../../lib/firebase/contracts'
import { Comment } from '../../lib/firebase/comments'
import { Contract } from 'web/lib/firebase/contracts'
import { Comment } from 'web/lib/firebase/comments'
import { Col } from '../layout/col'
import { Bet } from '../../../common/bet'
import { useUser } from '../../hooks/use-user'
import { Bet } from 'common/bet'
import { useUser } from 'web/hooks/use-user'
import { ContractActivity } from './contract-activity'
export function ActivityFeed(props: {

View File

@ -1,17 +1,12 @@
import _ from 'lodash'
import { Answer } from '../../../common/answer'
import { Bet } from '../../../common/bet'
import { getOutcomeProbability } from '../../../common/calculate'
import { Comment } from '../../../common/comment'
import {
Contract,
DPM,
FreeResponse,
FullContract,
} from '../../../common/contract'
import { User } from '../../../common/user'
import { mapCommentsByBetId } from '../../lib/firebase/comments'
import { Answer } from 'common/answer'
import { Bet } from 'common/bet'
import { getOutcomeProbability } from 'common/calculate'
import { Comment } from 'common/comment'
import { Contract, DPM, FreeResponse, FullContract } from 'common/contract'
import { User } from 'common/user'
import { mapCommentsByBetId } from 'web/lib/firebase/comments'
export type ActivityItem =
| DescriptionItem

View File

@ -1,15 +1,15 @@
import { Contract } from '../../lib/firebase/contracts'
import { Comment } from '../../lib/firebase/comments'
import { Bet } from '../../../common/bet'
import { useBets } from '../../hooks/use-bets'
import { useComments } from '../../hooks/use-comments'
import { Contract } from 'web/lib/firebase/contracts'
import { Comment } from 'web/lib/firebase/comments'
import { Bet } from 'common/bet'
import { useBets } from 'web/hooks/use-bets'
import { useComments } from 'web/hooks/use-comments'
import {
getAllContractActivityItems,
getRecentContractActivityItems,
getSpecificContractActivityItems,
} from './activity-items'
import { FeedItems } from './feed-items'
import { User } from '../../../common/user'
import { User } from 'common/user'
export function ContractActivity(props: {
contract: Contract

View File

@ -19,44 +19,38 @@ import {
Contract,
contractPath,
tradingAllowed,
} from '../../lib/firebase/contracts'
import { useUser } from '../../hooks/use-user'
} from 'web/lib/firebase/contracts'
import { useUser } from 'web/hooks/use-user'
import { Linkify } from '../linkify'
import { Row } from '../layout/row'
import { createComment, MAX_COMMENT_LENGTH } from '../../lib/firebase/comments'
import { formatMoney, formatPercent } from '../../../common/util/format'
import { Comment } from '../../../common/comment'
import { createComment, MAX_COMMENT_LENGTH } from 'web/lib/firebase/comments'
import { formatMoney, formatPercent } from 'common/util/format'
import { Comment } from 'common/comment'
import { BinaryResolutionOrChance } from '../contract/contract-card'
import { SiteLink } from '../site-link'
import { Col } from '../layout/col'
import { UserLink } from '../user-page'
import { DateTimeTooltip } from '../datetime-tooltip'
import { Bet } from '../../lib/firebase/bets'
import { Bet } from 'web/lib/firebase/bets'
import { JoinSpans } from '../join-spans'
import { fromNow } from '../../lib/util/time'
import { fromNow } from 'web/lib/util/time'
import BetRow from '../bet-row'
import { Avatar } from '../avatar'
import { Answer } from '../../../common/answer'
import { Answer } from 'common/answer'
import { ActivityItem, GENERAL_COMMENTS_OUTCOME_ID } from './activity-items'
import {
Binary,
CPMM,
DPM,
FreeResponse,
FullContract,
} from '../../../common/contract'
import { Binary, CPMM, DPM, FreeResponse, FullContract } from 'common/contract'
import { BuyButton } from '../yes-no-selector'
import { getDpmOutcomeProbability } from '../../../common/calculate-dpm'
import { getDpmOutcomeProbability } from 'common/calculate-dpm'
import { AnswerBetPanel } from '../answers/answer-bet-panel'
import { useSaveSeenContract } from '../../hooks/use-seen-contracts'
import { User } from '../../../common/user'
import { useSaveSeenContract } from 'web/hooks/use-seen-contracts'
import { User } from 'common/user'
import { Modal } from '../layout/modal'
import { trackClick } from '../../lib/firebase/tracking'
import { firebaseLogin } from '../../lib/firebase/users'
import { DAY_MS } from '../../../common/util/time'
import { trackClick } from 'web/lib/firebase/tracking'
import { firebaseLogin } from 'web/lib/firebase/users'
import { DAY_MS } from 'common/util/time'
import NewContractBadge from '../new-contract-badge'
import { RelativeTimestamp } from '../relative-timestamp'
import { calculateCpmmSale } from '../../../common/calculate-cpmm'
import { calculateCpmmSale } from 'common/calculate-cpmm'
export function FeedItems(props: {
contract: Contract

View File

@ -1,7 +1,7 @@
import _ from 'lodash'
import { Contract } from '../../lib/firebase/contracts'
import { Comment } from '../../lib/firebase/comments'
import { Bet } from '../../../common/bet'
import { Contract } from 'web/lib/firebase/contracts'
import { Comment } from 'web/lib/firebase/comments'
import { Bet } from 'common/bet'
const MAX_ACTIVE_CONTRACTS = 75

View File

@ -2,10 +2,10 @@ import clsx from 'clsx'
import { useRouter } from 'next/router'
import { useState } from 'react'
import { PlusCircleIcon } from '@heroicons/react/solid'
import { parseWordsAsTags } from '../../../common/util/parse'
import { createFold } from '../../lib/firebase/api-call'
import { foldPath } from '../../lib/firebase/folds'
import { toCamelCase } from '../../../common/util/format'
import { parseWordsAsTags } from 'common/util/parse'
import { createFold } from 'web/lib/firebase/api-call'
import { foldPath } from 'web/lib/firebase/folds'
import { toCamelCase } from 'common/util/format'
import { ConfirmationButton } from '../confirmation-button'
import { Col } from '../layout/col'
import { Spacer } from '../layout/spacer'

View File

@ -3,10 +3,10 @@ import _ from 'lodash'
import clsx from 'clsx'
import { PencilIcon } from '@heroicons/react/outline'
import { Fold } from '../../../common/fold'
import { parseWordsAsTags } from '../../../common/util/parse'
import { deleteFold, updateFold } from '../../lib/firebase/folds'
import { toCamelCase } from '../../../common/util/format'
import { Fold } from 'common/fold'
import { parseWordsAsTags } from 'common/util/parse'
import { deleteFold, updateFold } from 'web/lib/firebase/folds'
import { toCamelCase } from 'common/util/format'
import { Spacer } from '../layout/spacer'
import { TagsList } from '../tags-list'
import { useRouter } from 'next/router'

View File

@ -2,11 +2,11 @@ import clsx from 'clsx'
import { useState } from 'react'
import { SearchIcon } from '@heroicons/react/outline'
import { User } from '../../../common/user'
import { User } from 'common/user'
import {
followFoldFromSlug,
unfollowFoldFromSlug,
} from '../../lib/firebase/folds'
} from 'web/lib/firebase/folds'
import { Row } from '../layout/row'
import { Spacer } from '../layout/spacer'

View File

@ -1,5 +1,5 @@
import clsx from 'clsx'
import { Fold } from '../../../common/fold'
import { Fold } from 'common/fold'
export function FoldTag(props: { fold: Fold }) {
const { fold } = props

View File

@ -1,8 +1,8 @@
import clsx from 'clsx'
import { Fold } from '../../../common/fold'
import { useFollowedFoldIds } from '../../hooks/use-fold'
import { useUser } from '../../hooks/use-user'
import { followFold, unfollowFold } from '../../lib/firebase/folds'
import { Fold } from 'common/fold'
import { useFollowedFoldIds } from 'web/hooks/use-fold'
import { useUser } from 'web/hooks/use-user'
import { followFold, unfollowFold } from 'web/lib/firebase/folds'
export function FollowFoldButton(props: { fold: Fold; className?: string }) {
const { fold, className } = props

View File

@ -1,5 +1,5 @@
import clsx from 'clsx'
import { User } from '../../common/user'
import { User } from 'common/user'
import { Avatar } from './avatar'
import { Row } from './layout/row'
import { SiteLink } from './site-link'

View File

@ -1,8 +1,8 @@
import Link from 'next/link'
import clsx from 'clsx'
import { useUser } from '../../hooks/use-user'
import { ENV_CONFIG } from '../../../common/envs/constants'
import { useUser } from 'web/hooks/use-user'
import { ENV_CONFIG } from 'common/envs/constants'
export function ManifoldLogo(props: {
className?: string

View File

@ -10,8 +10,8 @@ import {
import { Transition, Dialog } from '@headlessui/react'
import { useState, Fragment } from 'react'
import Sidebar from './sidebar'
import { useUser } from '../../hooks/use-user'
import { formatMoney } from '../../../common/util/format'
import { useUser } from 'web/hooks/use-user'
import { formatMoney } from 'common/util/format'
import { Avatar } from '../avatar'
// From https://codepen.io/chris__sev/pen/QWGvYbL

View File

@ -1,7 +1,7 @@
import { firebaseLogout, User } from '../../lib/firebase/users'
import { formatMoney } from '../../../common/util/format'
import { firebaseLogout, User } from 'web/lib/firebase/users'
import { formatMoney } from 'common/util/format'
import { Avatar } from '../avatar'
import { IS_PRIVATE_MANIFOLD } from '../../../common/envs/constants'
import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants'
import { Row } from '../layout/row'
export function getNavigationOptions(user?: User | null) {

View File

@ -14,13 +14,13 @@ import clsx from 'clsx'
import _ from 'lodash'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useFollowedFolds } from '../../hooks/use-fold'
import { useUser } from '../../hooks/use-user'
import { firebaseLogin, firebaseLogout } from '../../lib/firebase/users'
import { useFollowedFolds } from 'web/hooks/use-fold'
import { useUser } from 'web/hooks/use-user'
import { firebaseLogin, firebaseLogout } from 'web/lib/firebase/users'
import { ManifoldLogo } from './manifold-logo'
import { MenuButton } from './menu'
import { getNavigationOptions, ProfileSummary } from './profile-menu'
import { useHasCreatedContractToday } from '../../hooks/use-has-created-contract-today'
import { useHasCreatedContractToday } from 'web/hooks/use-has-created-contract-today'
// Create an icon from the url of an image
function IconFromUrl(url: string): React.ComponentType<{ className?: string }> {
@ -46,8 +46,16 @@ const signedOutNavigation = [
const signedOutMobileNavigation = [
{ name: 'Charity', href: '/charity', icon: HeartIcon },
{ name: 'Leaderboards', href: '/leaderboards', icon: CakeIcon },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh', icon: IconFromUrl("/discord-logo.svg") },
{ name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets', icon: IconFromUrl("/twitter-logo.svg") },
{
name: 'Discord',
href: 'https://discord.gg/eHQBNBqXuh',
icon: IconFromUrl('/discord-logo.svg'),
},
{
name: 'Twitter',
href: 'https://twitter.com/ManifoldMarkets',
icon: IconFromUrl('/twitter-logo.svg'),
},
{ name: 'About', href: 'https://docs.manifold.markets', icon: BookOpenIcon },
]

View File

@ -1,6 +1,6 @@
import clsx from 'clsx'
import { Answer } from '../../common/answer'
import { getProbability } from '../../common/calculate'
import { Answer } from 'common/answer'
import { getProbability } from 'common/calculate'
import {
Binary,
Contract,
@ -9,8 +9,8 @@ import {
FreeResponse,
FreeResponseContract,
FullContract,
} from '../../common/contract'
import { formatPercent } from '../../common/util/format'
} from 'common/contract'
import { formatPercent } from 'common/util/format'
import { ClientRender } from './client-render'
export function OutcomeLabel(props: {

View File

@ -1,5 +1,5 @@
import { DateTimeTooltip } from './datetime-tooltip'
import { fromNow } from '../lib/util/time'
import { fromNow } from 'web/lib/util/time'
import React from 'react'
export function RelativeTimestamp(props: { time: number }) {

View File

@ -3,16 +3,16 @@ import React, { useEffect, useState } from 'react'
import { Col } from './layout/col'
import { Title } from './title'
import { User } from '../lib/firebase/users'
import { User } from 'web/lib/firebase/users'
import { YesNoCancelSelector } from './yes-no-selector'
import { Spacer } from './layout/spacer'
import { ResolveConfirmationButton } from './confirmation-button'
import { resolveMarket } from '../lib/firebase/api-call'
import { resolveMarket } from 'web/lib/firebase/api-call'
import { ProbabilitySelector } from './probability-selector'
import { DPM_CREATOR_FEE } from '../../common/fees'
import { getProbability } from '../../common/calculate'
import { Binary, CPMM, DPM, FullContract } from '../../common/contract'
import { formatMoney } from '../../common/util/format'
import { DPM_CREATOR_FEE } from 'common/fees'
import { getProbability } from 'common/calculate'
import { Binary, CPMM, DPM, FullContract } from 'common/contract'
import { formatMoney } from 'common/util/format'
export function ResolutionPanel(props: {
creator: User

View File

@ -1,6 +1,6 @@
import { Binary, CPMM, DPM, FullContract } from '../../common/contract'
import { User } from '../../common/user'
import { useUserContractBets } from '../hooks/use-user-bets'
import { Binary, CPMM, DPM, FullContract } from 'common/contract'
import { User } from 'common/user'
import { useUserContractBets } from 'web/hooks/use-user-bets'
import { useState } from 'react'
import { Col } from './layout/col'
import clsx from 'clsx'

View File

@ -1,10 +1,10 @@
import { Binary, CPMM, FullContract } from '../../common/contract'
import { Bet } from '../../common/bet'
import { User } from '../../common/user'
import { Binary, CPMM, FullContract } from 'common/contract'
import { Bet } from 'common/bet'
import { User } from 'common/user'
import { Modal } from './layout/modal'
import { Col } from './layout/col'
import { Title } from './title'
import { formatWithCommas } from '../../common/util/format'
import { formatWithCommas } from 'common/util/format'
import { OutcomeLabel } from './outcome-label'
import { SellPanel } from './bet-panel'

View File

@ -1,11 +1,11 @@
import { Binary, CPMM, DPM, FullContract } from '../../common/contract'
import { User } from '../../common/user'
import { Binary, CPMM, DPM, FullContract } from 'common/contract'
import { User } from 'common/user'
import { useState } from 'react'
import { Col } from './layout/col'
import { Row } from './layout/row'
import { formatWithCommas } from '../../common/util/format'
import { formatWithCommas } from 'common/util/format'
import { OutcomeLabel } from './outcome-label'
import { useUserContractBets } from '../hooks/use-user-bets'
import { useUserContractBets } from 'web/hooks/use-user-bets'
import { useSaveShares } from './use-save-shares'
import { SellSharesModal } from './sell-modal'

View File

@ -1,10 +1,10 @@
import { Fragment } from 'react'
import { CodeIcon } from '@heroicons/react/outline'
import { Menu, Transition } from '@headlessui/react'
import { Contract } from '../../common/contract'
import { contractPath } from '../lib/firebase/contracts'
import { DOMAIN } from '../../common/envs/constants'
import { copyToClipboard } from '../lib/util/copy'
import { Contract } from 'common/contract'
import { contractPath } from 'web/lib/firebase/contracts'
import { DOMAIN } from 'common/envs/constants'
import { copyToClipboard } from 'web/lib/util/copy'
function copyEmbedCode(contract: Contract) {
const title = contract.question

View File

@ -1,5 +1,5 @@
import clsx from 'clsx'
import { Contract, contractUrl } from '../lib/firebase/contracts'
import { Contract, contractUrl } from 'web/lib/firebase/contracts'
import { CopyLinkButton } from './copy-link-button'
import { Col } from './layout/col'
import { Row } from './layout/row'

View File

@ -1,7 +1,7 @@
import clsx from 'clsx'
import { useState } from 'react'
import { parseWordsAsTags } from '../../common/util/parse'
import { Contract, updateContract } from '../lib/firebase/contracts'
import { parseWordsAsTags } from 'common/util/parse'
import { Contract, updateContract } from 'web/lib/firebase/contracts'
import { Col } from './layout/col'
import { Row } from './layout/row'
import { TagsList } from './tags-list'

View File

@ -1,5 +1,5 @@
import { Binary, CPMM, DPM, FullContract } from '../../common/contract'
import { Bet } from '../../common/bet'
import { Binary, CPMM, DPM, FullContract } from 'common/contract'
import { Bet } from 'common/bet'
import { useEffect, useState } from 'react'
import _ from 'lodash'

View File

@ -1,5 +1,5 @@
import clsx from 'clsx'
import { User } from '../lib/firebase/users'
import { User } from 'web/lib/firebase/users'
import { CreatorContractsList } from './contract/contracts-list'
import { SEO } from './SEO'
import { Page } from './page'
@ -10,14 +10,14 @@ import { Linkify } from './linkify'
import { Spacer } from './layout/spacer'
import { Row } from './layout/row'
import { LinkIcon } from '@heroicons/react/solid'
import { genHash } from '../../common/util/random'
import { genHash } from 'common/util/random'
import { PencilIcon } from '@heroicons/react/outline'
import { Tabs } from './layout/tabs'
import { UserCommentsList } from './comments-list'
import { useEffect, useState } from 'react'
import { Comment, getUsersComments } from '../lib/firebase/comments'
import { Contract } from '../../common/contract'
import { getContractFromId, listContracts } from '../lib/firebase/contracts'
import { Comment, getUsersComments } from 'web/lib/firebase/comments'
import { Contract } from 'common/contract'
import { getContractFromId, listContracts } from 'web/lib/firebase/contracts'
import { LoadingIndicator } from './loading-indicator'
import { useRouter } from 'next/router'
import _ from 'lodash'

View File

@ -1,6 +1,6 @@
import clsx from 'clsx'
import React from 'react'
import { formatMoney } from '../../common/util/format'
import { formatMoney } from 'common/util/format'
import { Col } from './layout/col'
import { Row } from './layout/row'

View File

@ -1,4 +1,4 @@
import { isAdmin } from '../../common/envs/constants'
import { isAdmin } from 'common/envs/constants'
import { usePrivateUser, useUser } from './use-user'
export const useAdmin = () => {

View File

@ -1,17 +1,17 @@
import _ from 'lodash'
import { useState, useEffect } from 'react'
import { Bet } from '../../common/bet'
import { Comment } from '../../common/comment'
import { Contract } from '../../common/contract'
import { Bet } from 'common/bet'
import { Comment } from 'common/comment'
import { Contract } from 'common/contract'
import { useTimeSinceFirstRender } from './use-time-since-first-render'
import { trackLatency } from '../lib/firebase/tracking'
import { User } from '../../common/user'
import { getUserFeed } from '../lib/firebase/users'
import { trackLatency } from 'web/lib/firebase/tracking'
import { User } from 'common/user'
import { getUserFeed } from 'web/lib/firebase/users'
import { useUpdatedContracts } from './use-contracts'
import {
getRecentBetsAndComments,
getTopWeeklyContracts,
} from '../lib/firebase/contracts'
} from 'web/lib/firebase/contracts'
type feed = {
contract: Contract

View File

@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'
import { Answer } from '../../common/answer'
import { listenForAnswers } from '../lib/firebase/answers'
import { Answer } from 'common/answer'
import { listenForAnswers } from 'web/lib/firebase/answers'
export const useAnswers = (contractId: string) => {
const [answers, setAnswers] = useState<Answer[] | undefined>()

View File

@ -1,11 +1,11 @@
import { useEffect, useState } from 'react'
import { Contract } from '../../common/contract'
import { Contract } from 'common/contract'
import {
Bet,
listenForBets,
listenForRecentBets,
withoutAnteBets,
} from '../lib/firebase/bets'
} from 'web/lib/firebase/bets'
export const useBets = (contractId: string) => {
const [bets, setBets] = useState<Bet[] | undefined>()

View File

@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'
import { Txn } from '../../common/txn'
import { listenForCharityTxns } from '../lib/firebase/txns'
import { Txn } from 'common/txn'
import { listenForCharityTxns } from 'web/lib/firebase/txns'
export const useCharityTxns = (charityId: string) => {
const [txns, setTxns] = useState<Txn[]>([])

View File

@ -3,7 +3,7 @@ import {
Comment,
listenForComments,
listenForRecentComments,
} from '../lib/firebase/comments'
} from 'web/lib/firebase/comments'
export const useComments = (contractId: string) => {
const [comments, setComments] = useState<Comment[] | undefined>()

View File

@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import { Contract, listenForContract } from '../lib/firebase/contracts'
import { Contract, listenForContract } from 'web/lib/firebase/contracts'
import { useStateCheckEquality } from './use-state-check-equality'
export const useContract = (contractId: string) => {

Some files were not shown because too many files have changed in this diff Show More