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 functions from 'firebase-functions'
import * as admin from 'firebase-admin' import * as admin from 'firebase-admin'
import { Contract } from '../../common/contract' import { Contract } from 'common/contract'
import { User } from '../../common/user' import { User } from 'common/user'
import { removeUndefinedProps } from '../../common/util/object' import { removeUndefinedProps } from 'common/util/object'
import { redeemShares } from './redeem-shares' 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( export const addLiquidity = functions.runWith({ minInstances: 1 }).https.onCall(
async ( async (

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,12 @@
import * as admin from 'firebase-admin' import * as admin from 'firebase-admin'
import * as _ from 'lodash' import * as _ from 'lodash'
import { Bet } from '../../common/bet' import { Bet } from 'common/bet'
import { getProbability } from '../../common/calculate' import { getProbability } from 'common/calculate'
import { Binary, CPMM, FullContract } from '../../common/contract' import { Binary, CPMM, FullContract } from 'common/contract'
import { noFees } from '../../common/fees' import { noFees } from 'common/fees'
import { User } from '../../common/user' import { User } from 'common/user'
export const redeemShares = async (userId: string, contractId: string) => { export const redeemShares = async (userId: string, contractId: string) => {
return await firestore.runTransaction(async (transaction) => { 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 admin from 'firebase-admin'
import * as _ from 'lodash' import * as _ from 'lodash'
import { Contract } from '../../common/contract' import { Contract } from 'common/contract'
import { User } from '../../common/user' import { User } from 'common/user'
import { Bet } from '../../common/bet' import { Bet } from 'common/bet'
import { getUser, isProd, payUser } from './utils' import { getUser, isProd, payUser } from './utils'
import { sendMarketResolutionEmail } from './emails' import { sendMarketResolutionEmail } from './emails'
import { getLoanPayouts, getPayouts } from '../../common/payouts' import { getLoanPayouts, getPayouts } from 'common/payouts'
import { removeUndefinedProps } from '../../common/util/object' import { removeUndefinedProps } from 'common/util/object'
import { LiquidityProvision } from '../../common/liquidity-provision' import { LiquidityProvision } from 'common/liquidity-provision'
export const resolveMarket = functions export const resolveMarket = functions
.runWith({ minInstances: 1 }) .runWith({ minInstances: 1 })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,11 +3,11 @@ import { useState } from 'react'
import { BetPanelSwitcher } from './bet-panel' import { BetPanelSwitcher } from './bet-panel'
import { Row } from './layout/row' import { Row } from './layout/row'
import { YesNoSelector } from './yes-no-selector' 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 { Modal } from './layout/modal'
import { SellButton } from './sell-button' import { SellButton } from './sell-button'
import { useUser } from '../hooks/use-user' import { useUser } from 'web/hooks/use-user'
import { useUserContractBets } from '../hooks/use-user-bets' import { useUserContractBets } from 'web/hooks/use-user-bets'
import { useSaveShares } from './use-save-shares' import { useSaveShares } from './use-save-shares'
// Inline version of a bet panel. Opens BetPanel in a new modal. // 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 { useEffect, useState } from 'react'
import clsx from 'clsx' import clsx from 'clsx'
import { useUserBets } from '../hooks/use-user-bets' import { useUserBets } from 'web/hooks/use-user-bets'
import { Bet } from '../lib/firebase/bets' import { Bet } from 'web/lib/firebase/bets'
import { User } from '../lib/firebase/users' import { User } from 'web/lib/firebase/users'
import { import {
formatMoney, formatMoney,
formatPercent, formatPercent,
formatWithCommas, formatWithCommas,
} from '../../common/util/format' } from 'common/util/format'
import { Col } from './layout/col' import { Col } from './layout/col'
import { Spacer } from './layout/spacer' import { Spacer } from './layout/spacer'
import { import {
@ -19,13 +19,13 @@ import {
getContractFromId, getContractFromId,
contractPath, contractPath,
getBinaryProbPercent, getBinaryProbPercent,
} from '../lib/firebase/contracts' } from 'web/lib/firebase/contracts'
import { Row } from './layout/row' import { Row } from './layout/row'
import { UserLink } from './user-page' 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 { ConfirmationButton } from './confirmation-button'
import { OutcomeLabel, YesLabel, NoLabel } from './outcome-label' 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 { LoadingIndicator } from './loading-indicator'
import { SiteLink } from './site-link' import { SiteLink } from './site-link'
import { import {
@ -36,9 +36,9 @@ import {
getContractBetMetrics, getContractBetMetrics,
resolvedPayout, resolvedPayout,
getContractBetNullMetrics, getContractBetNullMetrics,
} from '../../common/calculate' } from 'common/calculate'
import { useTimeSinceFirstRender } from '../hooks/use-time-since-first-render' import { useTimeSinceFirstRender } from 'web/hooks/use-time-since-first-render'
import { trackLatency } from '../lib/firebase/tracking' import { trackLatency } from 'web/lib/firebase/tracking'
type BetSort = 'newest' | 'profit' | 'closeTime' | 'value' type BetSort = 'newest' | 'profit' | 'closeTime' | 'value'
type BetFilter = 'open' | 'closed' | 'resolved' | 'all' type BetFilter = 'open' | 'closed' | 'resolved' | 'all'

View File

@ -2,8 +2,8 @@ import { StarIcon } from '@heroicons/react/solid'
import _ from 'lodash' import _ from 'lodash'
import Link from 'next/link' import Link from 'next/link'
import Image from 'next/image' import Image from 'next/image'
import { Charity } from '../../../common/charity' import { Charity } from 'common/charity'
import { useCharityTxns } from '../../hooks/use-charity-txns' import { useCharityTxns } from 'web/hooks/use-charity-txns'
import { manaToUSD } from '../../pages/charity/[charitySlug]' import { manaToUSD } from '../../pages/charity/[charitySlug]'
import { Row } from '../layout/row' 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 { Avatar } from '../avatar'
import { useUserById } from '../../hooks/use-users' import { useUserById } from 'web/hooks/use-users'
import { UserLink } from '../user-page' import { UserLink } from '../user-page'
import { manaToUSD } from '../../pages/charity/[charitySlug]' import { manaToUSD } from '../../pages/charity/[charitySlug]'
import { RelativeTimestamp } from '../relative-timestamp' import { RelativeTimestamp } from '../relative-timestamp'

View File

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

View File

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

View File

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

View File

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

View File

@ -3,14 +3,11 @@ import clsx from 'clsx'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import _ from 'lodash' import _ from 'lodash'
import { useState } from 'react' import { useState } from 'react'
import { Bet } from '../../../common/bet' import { Bet } from 'common/bet'
import { Contract } from '../../../common/contract' import { Contract } from 'common/contract'
import { formatMoney } from '../../../common/util/format' import { formatMoney } from 'common/util/format'
import { import { contractPath, getBinaryProbPercent } from 'web/lib/firebase/contracts'
contractPath,
getBinaryProbPercent,
} from '../../lib/firebase/contracts'
import { AddLiquidityPanel } from '../add-liquidity-panel' import { AddLiquidityPanel } from '../add-liquidity-panel'
import { CopyLinkButton } from '../copy-link-button' import { CopyLinkButton } from '../copy-link-button'
import { Col } from '../layout/col' 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 { Col } from '../layout/col'
import { Spacer } from '../layout/spacer' import { Spacer } from '../layout/spacer'
import { ContractProbGraph } from './contract-prob-graph' 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 { Row } from '../layout/row'
import { Linkify } from '../linkify' import { Linkify } from '../linkify'
import clsx from 'clsx' import clsx from 'clsx'
@ -10,11 +10,11 @@ import {
FreeResponseResolutionOrChance, FreeResponseResolutionOrChance,
BinaryResolutionOrChance, BinaryResolutionOrChance,
} from './contract-card' } from './contract-card'
import { Bet } from '../../../common/bet' import { Bet } from 'common/bet'
import { Comment } from '../../../common/comment' import { Comment } from 'common/comment'
import BetRow from '../bet-row' import BetRow from '../bet-row'
import { AnswersGraph } from '../answers/answers-graph' 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 { ContractDescription } from './contract-description'
import { ContractDetails } from './contract-details' import { ContractDetails } from './contract-details'
import { ShareMarket } from '../share-market' import { ShareMarket } from '../share-market'

View File

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

View File

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

View File

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

View File

@ -2,10 +2,10 @@ import { Fragment } from 'react'
import { LinkIcon } from '@heroicons/react/outline' import { LinkIcon } from '@heroicons/react/outline'
import { Menu, Transition } from '@headlessui/react' import { Menu, Transition } from '@headlessui/react'
import clsx from 'clsx' import clsx from 'clsx'
import { Contract } from '../../common/contract' import { Contract } from 'common/contract'
import { copyToClipboard } from '../lib/util/copy' import { copyToClipboard } from 'web/lib/util/copy'
import { contractPath } from '../lib/firebase/contracts' import { contractPath } from 'web/lib/firebase/contracts'
import { ENV_CONFIG } from '../../common/envs/constants' import { ENV_CONFIG } from 'common/envs/constants'
function copyContractUrl(contract: Contract) { function copyContractUrl(contract: Contract) {
copyToClipboard(`https://${ENV_CONFIG.domain}${contractPath(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 { 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 'web/lib/firebase/users'
import { ContractsGrid } from './contract/contracts-list' 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 { 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' import _ from 'lodash'
import { SiteLink } from './site-link' import { SiteLink } from './site-link'

View File

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

View File

@ -1,17 +1,12 @@
import _ from 'lodash' import _ from 'lodash'
import { Answer } 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'
import { import { Contract, DPM, FreeResponse, FullContract } from 'common/contract'
Contract, import { User } from 'common/user'
DPM, import { mapCommentsByBetId } from 'web/lib/firebase/comments'
FreeResponse,
FullContract,
} from '../../../common/contract'
import { User } from '../../../common/user'
import { mapCommentsByBetId } from '../../lib/firebase/comments'
export type ActivityItem = export type ActivityItem =
| DescriptionItem | DescriptionItem

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,11 @@
import { Binary, CPMM, DPM, FullContract } from '../../common/contract' import { Binary, CPMM, DPM, FullContract } from 'common/contract'
import { User } from '../../common/user' import { User } from 'common/user'
import { useState } from 'react' import { useState } from 'react'
import { Col } from './layout/col' import { Col } from './layout/col'
import { Row } from './layout/row' import { Row } from './layout/row'
import { formatWithCommas } from '../../common/util/format' import { formatWithCommas } from 'common/util/format'
import { OutcomeLabel } from './outcome-label' 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 { useSaveShares } from './use-save-shares'
import { SellSharesModal } from './sell-modal' import { SellSharesModal } from './sell-modal'

View File

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

View File

@ -1,5 +1,5 @@
import clsx from 'clsx' 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 { CopyLinkButton } from './copy-link-button'
import { Col } from './layout/col' import { Col } from './layout/col'
import { Row } from './layout/row' import { Row } from './layout/row'

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import clsx from 'clsx' import clsx from 'clsx'
import React from 'react' import React from 'react'
import { formatMoney } from '../../common/util/format' import { formatMoney } from 'common/util/format'
import { Col } from './layout/col' import { Col } from './layout/col'
import { Row } from './layout/row' 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' import { usePrivateUser, useUser } from './use-user'
export const useAdmin = () => { export const useAdmin = () => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
import { useEffect, useState } from 'react' 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' import { useStateCheckEquality } from './use-state-check-equality'
export const useContract = (contractId: string) => { export const useContract = (contractId: string) => {

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