From fecc08e32441df259631eb3cf83e730ed8dc47bf Mon Sep 17 00:00:00 2001 From: ingawei Date: Wed, 15 Jan 2025 17:21:39 -0800 Subject: [PATCH 1/6] your bets --- mani/android/app/build.gradle | 4 +- mani/android/app/google-services.json | 36 ++-- mani/app.json | 6 +- mani/app/[contractId].tsx | 2 + mani/components/bet/bet-summary.tsx | 189 ++++++++---------- .../contract/overview/multi-overview.tsx | 4 - mani/ios/Mani/GoogleService-Info.plist | 16 +- mani/ios/Mani/Info.plist | 4 +- mani/ios/Mani/SplashScreen.storyboard | 8 + 9 files changed, 122 insertions(+), 147 deletions(-) diff --git a/mani/android/app/build.gradle b/mani/android/app/build.gradle index 17fbf03a78..7d5d860cac 100644 --- a/mani/android/app/build.gradle +++ b/mani/android/app/build.gradle @@ -93,8 +93,8 @@ android { applicationId 'com.manifold.mani' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 65 - versionName "2.0.57" + versionCode 66 + versionName "2.0.58" missingDimensionStrategy 'store', 'play' } signingConfigs { diff --git a/mani/android/app/google-services.json b/mani/android/app/google-services.json index 4730f5349a..2dbc695016 100644 --- a/mani/android/app/google-services.json +++ b/mani/android/app/google-services.json @@ -1,40 +1,40 @@ { "project_info": { - "project_number": "134303100058", - "project_id": "dev-mantic-markets", - "storage_bucket": "dev-mantic-markets.appspot.com" + "project_number": "128925704902", + "project_id": "mantic-markets", + "storage_bucket": "mantic-markets.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:134303100058:android:a25f644df416ca36f80323", + "mobilesdk_app_id": "1:128925704902:android:e5aa502d5a924350642dc7", "android_client_info": { "package_name": "com.manifold.mani" } }, "oauth_client": [ { - "client_id": "134303100058-2uvio555s8mnhde20b4old97ptjnji3u.apps.googleusercontent.com", + "client_id": "128925704902-bpcbnlp2gt73au3rrjjtnup6cskr89p0.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyCt982NE8yMv1t7DG28Zx1-ddNfPZfzoq8" + "current_key": "AIzaSyBtBF0n3q4XgHE2DWmAsMcsk0wmB1pcNss" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "134303100058-2uvio555s8mnhde20b4old97ptjnji3u.apps.googleusercontent.com", + "client_id": "128925704902-b9hug0habghrqtr7nbne1k88rs5qpjqp.apps.googleusercontent.com", "client_type": 3 }, { - "client_id": "134303100058-9464q86hhfloaij15dl9ekn6l39e3cv8.apps.googleusercontent.com", + "client_id": "128925704902-6ci48vjqud9ddcl436go5ma3m9ceei4k.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.manifold.mani" + "bundle_id": "com.markets.manifold" } } ] @@ -43,42 +43,42 @@ }, { "client_info": { - "mobilesdk_app_id": "1:134303100058:android:e1d339b176437b89f80323", + "mobilesdk_app_id": "1:128925704902:android:2f9207f92f6e48cf642dc7", "android_client_info": { "package_name": "com.markets.manifold" } }, "oauth_client": [ { - "client_id": "134303100058-mu6dbubhks8khpqi3dq0fokqnkbputiq.apps.googleusercontent.com", + "client_id": "128925704902-ur9hevfika2rs0sni6ju236u82hbct3i.apps.googleusercontent.com", "client_type": 1, "android_info": { "package_name": "com.markets.manifold", - "certificate_hash": "3104825dce04154e425833614535a9494de90b34" + "certificate_hash": "ed4172e8b4d70a7d7bd58bb4a748574fda7b942d" } }, { - "client_id": "134303100058-2uvio555s8mnhde20b4old97ptjnji3u.apps.googleusercontent.com", + "client_id": "128925704902-bpcbnlp2gt73au3rrjjtnup6cskr89p0.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyCt982NE8yMv1t7DG28Zx1-ddNfPZfzoq8" + "current_key": "AIzaSyBtBF0n3q4XgHE2DWmAsMcsk0wmB1pcNss" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "134303100058-2uvio555s8mnhde20b4old97ptjnji3u.apps.googleusercontent.com", + "client_id": "128925704902-b9hug0habghrqtr7nbne1k88rs5qpjqp.apps.googleusercontent.com", "client_type": 3 }, { - "client_id": "134303100058-9464q86hhfloaij15dl9ekn6l39e3cv8.apps.googleusercontent.com", + "client_id": "128925704902-6ci48vjqud9ddcl436go5ma3m9ceei4k.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.manifold.mani" + "bundle_id": "com.markets.manifold" } } ] @@ -87,4 +87,4 @@ } ], "configuration_version": "1" -} +} \ No newline at end of file diff --git a/mani/app.json b/mani/app.json index 6ceb303cb3..019f94704b 100644 --- a/mani/app.json +++ b/mani/app.json @@ -22,7 +22,7 @@ "slug": "mani", "owner": "manifold-markets", "jsEngine": "hermes", - "version": "2.0.57", + "version": "2.0.58", "orientation": "portrait", "icon": "./assets/images/logo.png", "userInterfaceStyle": "light", @@ -78,7 +78,7 @@ "backgroundColor": "#4337C9" }, "package": "com.manifold.mani", - "versionCode": 65 + "versionCode": 66 }, "ios": { "infoPlist": { @@ -94,7 +94,7 @@ "applinks:manifold.markets", "webcredentials:manifold.markets" ], - "buildNumber": "1.0.52" + "buildNumber": "1.0.53" }, "experiments": { "tsconfigPaths": true, diff --git a/mani/app/[contractId].tsx b/mani/app/[contractId].tsx index 98a8a19410..70317040d3 100644 --- a/mani/app/[contractId].tsx +++ b/mani/app/[contractId].tsx @@ -46,7 +46,9 @@ function ContractPageLoadingContent({ contractId }: ContractPageContentProps) { const { data } = useAPIGetter('get-market-props', { id: contractId, }) + const { manaContract, cashContract } = data ?? {} + if (!data || ![manaContract?.id, cashContract?.id].includes(contractId)) return diff --git a/mani/components/bet/bet-summary.tsx b/mani/components/bet/bet-summary.tsx index 557a76844e..0d71dade67 100644 --- a/mani/components/bet/bet-summary.tsx +++ b/mani/components/bet/bet-summary.tsx @@ -1,143 +1,112 @@ -import { Contract } from 'common/contract' +import { Contract, isBinaryMulti, tradingAllowed } from 'common/contract' import { ContractMetric } from 'common/contract-metric' -import { StyleSheet } from 'react-native' -import { User } from 'common/user' import { useSavedContractMetrics } from 'hooks/use-saved-contract-metrics' import { Col } from 'components/layout/col' import { Row } from 'components/layout/row' import { ThemedText } from 'components/themed-text' import { useColor } from 'hooks/use-color' -import { IconSymbol } from 'components/ui/icon-symbol' import { TokenNumber } from 'components/token/token-number' +import { ExpandableContent } from 'components/layout/expandable-content' +import { floatingEqual } from 'common/util/math' -export function UserBetsSummary(props: { - contract: Contract - initialMetrics?: ContractMetric - includeSellButton?: User | null | undefined -}) { - const { contract, includeSellButton } = props - const metrics = useSavedContractMetrics(contract) ?? props.initialMetrics +export function UserBetsSummary(props: { contract: Contract }) { + const { contract } = props + const metrics = useSavedContractMetrics(contract) if (!metrics) return null return ( - } + modalContent={undefined} /> ) } -export function BetsSummary(props: { +export function YourBetsPreview(props: { contract: Contract metrics: ContractMetric - includeSellButton?: User | null | undefined }) { const { contract, metrics } = props - const { resolution, outcomeType } = contract - const color = useColor() + const isBinaryMc = isBinaryMulti(contract) + const isMultipleChoice = + contract.outcomeType == 'MULTIPLE_CHOICE' && !isBinaryMc + + console.log(metrics) - const { payout, invested, totalShares = {}, profit, profitPercent } = metrics + return ( + + + Your Position + + + {isMultipleChoice ? ( + + {contract.answers?.map((answer) => ( + + ))} + + ) : ( + + )} + + + ) +} + +export function PositionRow(props: { contract: Contract; answer?: Answer }) { + const { contract, answer } = props + const metric = useSavedContractMetrics(contract, answer.id) + const { invested, totalShares } = metric ?? { + invested: 0, + totalShares: { YES: 0, NO: 0 }, + } + const color = useColor() const yesWinnings = totalShares.YES ?? 0 const noWinnings = totalShares.NO ?? 0 + const canSell = tradingAllowed(contract, answer) const position = yesWinnings - noWinnings const exampleOutcome = position < 0 ? 'NO' : 'YES' + const won = + (position > 1e-7 && answer.resolution === 'YES') || + (position < -1e-7 && answer.resolution === 'NO') - const isBinary = outcomeType === 'BINARY' - // const mainBinaryMCAnswer = getMainBinaryMCAnswer(contract) - - if (metrics.invested === 0 && metrics.profit === 0) return null + if ( + !metric || + (floatingEqual(yesWinnings, 0) && floatingEqual(noWinnings, 0)) + ) + return null return ( - - - {resolution ? ( - - - Payout - - - - = 0 ? color.profitText : color.textSecondary - } - size="sm" - > - ({profitPercent >= 0 ? '+' : ''} - {Math.round(profitPercent)}%) - - - - ) : isBinary ? ( - - - Payout - - - - - - on {exampleOutcome} - - - - ) : null} - - - - Spent - - - - - - - - Profit - + + + + {exampleOutcome} + + {answer && ( + + {' '} + • {answer.text} - - - = 0 ? color.profitText : color.textSecondary - } - size="sm" - > - ({profitPercent >= 0 ? '+' : ''} - {Math.round(profitPercent)}%) - - - + )} - + + + + {canSell ? ' payout' : won ? ' paid out' : ' unrealized'} + + + ) } - -const styles = StyleSheet.create({ - container: { - marginBottom: 32, - }, - statsRow: { - flexWrap: 'wrap', - gap: 24, - }, -}) diff --git a/mani/components/contract/overview/multi-overview.tsx b/mani/components/contract/overview/multi-overview.tsx index 9e64053005..c9e2f37174 100644 --- a/mani/components/contract/overview/multi-overview.tsx +++ b/mani/components/contract/overview/multi-overview.tsx @@ -5,7 +5,6 @@ import { Col } from 'components/layout/col' import { AnswerProbability } from 'components/contract/probability' import { useColor } from 'hooks/use-color' import { MultiBetButtons } from 'components/contract/bet/multi-bet-buttons' -import { AnswerPosition } from '../bet/answer-position' import { useUser } from 'hooks/use-user' export function MultiOverview(props: { contract: CPMMMultiContract }) { @@ -50,9 +49,6 @@ export function MultiOverview(props: { contract: CPMMMultiContract }) { answerId={answer.id} gap={12} /> - {user && ( - - )} ))} diff --git a/mani/ios/Mani/GoogleService-Info.plist b/mani/ios/Mani/GoogleService-Info.plist index ebfba83bd3..aad0574512 100644 --- a/mani/ios/Mani/GoogleService-Info.plist +++ b/mani/ios/Mani/GoogleService-Info.plist @@ -3,23 +3,23 @@ CLIENT_ID - 134303100058-9464q86hhfloaij15dl9ekn6l39e3cv8.apps.googleusercontent.com + 128925704902-k6d8219pss8nubk1bb1n5kisn5l8fv1a.apps.googleusercontent.com REVERSED_CLIENT_ID - com.googleusercontent.apps.134303100058-9464q86hhfloaij15dl9ekn6l39e3cv8 + com.googleusercontent.apps.128925704902-k6d8219pss8nubk1bb1n5kisn5l8fv1a ANDROID_CLIENT_ID - 134303100058-mu6dbubhks8khpqi3dq0fokqnkbputiq.apps.googleusercontent.com + 128925704902-1prt50kd7uuvfasmrbmflgssd1rakvil.apps.googleusercontent.com API_KEY - AIzaSyDUe3lBu-IihYoMIP6cycsFzQ3ur69XfjM + AIzaSyAVI_IzxthTmFT8Fnl5Kj6BYPZMb8eOWa4 GCM_SENDER_ID - 134303100058 + 128925704902 PLIST_VERSION 1 BUNDLE_ID com.manifold.mani PROJECT_ID - dev-mantic-markets + mantic-markets STORAGE_BUCKET - dev-mantic-markets.appspot.com + mantic-markets.appspot.com IS_ADS_ENABLED IS_ANALYTICS_ENABLED @@ -31,6 +31,6 @@ IS_SIGNIN_ENABLED GOOGLE_APP_ID - 1:134303100058:ios:d5f9cb57334d38bcf80323 + 1:128925704902:ios:aaa3b62bb6e850db642dc7 \ No newline at end of file diff --git a/mani/ios/Mani/Info.plist b/mani/ios/Mani/Info.plist index 91db053e97..fc5fb9b4fe 100644 --- a/mani/ios/Mani/Info.plist +++ b/mani/ios/Mani/Info.plist @@ -21,7 +21,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 2.0.57 + 2.0.58 CFBundleSignature ???? CFBundleURLTypes @@ -40,7 +40,7 @@ CFBundleVersion - 1.0.52 + 1.0.53 LSMinimumSystemVersion 12.0 LSRequiresIPhoneOS diff --git a/mani/ios/Mani/SplashScreen.storyboard b/mani/ios/Mani/SplashScreen.storyboard index f54b70332e..7522a453c8 100644 --- a/mani/ios/Mani/SplashScreen.storyboard +++ b/mani/ios/Mani/SplashScreen.storyboard @@ -31,6 +31,8 @@ + + @@ -52,5 +54,11 @@ + + + + + + \ No newline at end of file From fe39548531204acfd5282f294559724007577dcf Mon Sep 17 00:00:00 2001 From: ingawei Date: Thu, 16 Jan 2025 14:54:46 -0800 Subject: [PATCH 2/6] changess --- mani/app.json | 8 -------- mani/components/bet/bet-summary.tsx | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/mani/app.json b/mani/app.json index 9553a0bfc8..daf278b79b 100644 --- a/mani/app.json +++ b/mani/app.json @@ -22,11 +22,7 @@ "slug": "mani", "owner": "manifold-markets", "jsEngine": "hermes", -<<<<<<< HEAD - "version": "2.0.58", -======= "version": "2.0.59", ->>>>>>> main "orientation": "portrait", "icon": "./assets/images/logo.png", "userInterfaceStyle": "light", @@ -98,11 +94,7 @@ "applinks:manifold.markets", "webcredentials:manifold.markets" ], -<<<<<<< HEAD - "buildNumber": "1.0.53" -======= "buildNumber": "1.0.54" ->>>>>>> main }, "experiments": { "tsconfigPaths": true, diff --git a/mani/components/bet/bet-summary.tsx b/mani/components/bet/bet-summary.tsx index 0d71dade67..71ab1b82ab 100644 --- a/mani/components/bet/bet-summary.tsx +++ b/mani/components/bet/bet-summary.tsx @@ -15,6 +15,7 @@ export function UserBetsSummary(props: { contract: Contract }) { if (!metrics) return null return ( + // TODO: make this a modal } modalContent={undefined} From 5ebcf2066a356b87131656c6c3c1f3eecaad510b Mon Sep 17 00:00:00 2001 From: ingawei Date: Thu, 16 Jan 2025 14:57:52 -0800 Subject: [PATCH 3/6] yeah --- mani/ios/Mani/Info.plist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mani/ios/Mani/Info.plist b/mani/ios/Mani/Info.plist index 8a93aa2080..481867a590 100644 --- a/mani/ios/Mani/Info.plist +++ b/mani/ios/Mani/Info.plist @@ -40,11 +40,7 @@ CFBundleVersion -<<<<<<< HEAD - 1.0.53 -======= 1.0.54 ->>>>>>> main LSMinimumSystemVersion 12.0 LSRequiresIPhoneOS From e0cb972e49a6a9c866b888e70f6041f7126f915f Mon Sep 17 00:00:00 2001 From: ingawei Date: Thu, 16 Jan 2025 16:26:22 -0800 Subject: [PATCH 4/6] bet ui --- mani/components/bet/bet-summary.tsx | 19 ++- mani/components/contract/bets.tsx | 255 ++++++++++++++-------------- mani/components/user/user-link.tsx | 20 +++ mani/constants/colors.ts | 2 + 4 files changed, 162 insertions(+), 134 deletions(-) create mode 100644 mani/components/user/user-link.tsx diff --git a/mani/components/bet/bet-summary.tsx b/mani/components/bet/bet-summary.tsx index 71ab1b82ab..362cf9f8fa 100644 --- a/mani/components/bet/bet-summary.tsx +++ b/mani/components/bet/bet-summary.tsx @@ -8,6 +8,7 @@ import { useColor } from 'hooks/use-color' import { TokenNumber } from 'components/token/token-number' import { ExpandableContent } from 'components/layout/expandable-content' import { floatingEqual } from 'common/util/math' +import { Answer } from 'common/answer' export function UserBetsSummary(props: { contract: Contract }) { const { contract } = props @@ -15,7 +16,7 @@ export function UserBetsSummary(props: { contract: Contract }) { if (!metrics) return null return ( - // TODO: make this a modal + // TODO: INGA make a your bets modal } modalContent={undefined} @@ -32,8 +33,6 @@ export function YourBetsPreview(props: { const isMultipleChoice = contract.outcomeType == 'MULTIPLE_CHOICE' && !isBinaryMc - console.log(metrics) - return ( @@ -41,7 +40,7 @@ export function YourBetsPreview(props: { {isMultipleChoice ? ( - + {contract.answers?.map((answer) => ( 1e-7 && answer.resolution === 'YES') || - (position < -1e-7 && answer.resolution === 'NO') + (position > 1e-7 && + (answer ? answer.resolution === 'YES' : contract.resolution === 'YES')) || + (position < -1e-7 && + (answer ? answer.resolution === 'NO' : contract.resolution === 'NO')) if ( !metric || @@ -83,6 +84,8 @@ export function PositionRow(props: { contract: Contract; answer?: Answer }) { ) return null + const payout = position > 1e-7 ? position : -position + return ( @@ -103,7 +106,7 @@ export function PositionRow(props: { contract: Contract; answer?: Answer }) { )} - + {canSell ? ' payout' : won ? ' paid out' : ' unrealized'} diff --git a/mani/components/contract/bets.tsx b/mani/components/contract/bets.tsx index 8d08922937..34e80da293 100644 --- a/mani/components/contract/bets.tsx +++ b/mani/components/contract/bets.tsx @@ -1,17 +1,19 @@ -import { StyleSheet } from 'react-native' import { Bet } from 'common/bet' import { Contract, getBinaryMCProb, isBinaryMulti } from 'common/contract' import { getFormattedMappedValue } from 'common/pseudo-numeric' -import { BETTOR } from 'common/user' -import { floatingEqual, floatingLesserEqual } from 'common/util/math' import { Row } from 'components/layout/row' import { Col } from 'components/layout/col' import { ThemedText } from 'components/themed-text' -import { useDisplayUserById, useUser } from 'hooks/use-user' +import { useDisplayUserById } from 'hooks/use-user' import { useContractBets } from 'client-common/hooks/use-bets' import { api } from 'lib/api' import { useIsPageVisible } from 'hooks/use-is-page-visibile' import { TokenNumber } from 'components/token/token-number' +import { ExpandableContent } from 'components/layout/expandable-content' +import { fromNow } from 'util/time' +import { useColor } from 'hooks/use-color' +import { AvatarCircle } from 'components/user/avatar-circle' +import { UserLink } from 'components/user/user-link' export function Bets(props: { contract: Contract; totalBets: number }) { const { contract } = props @@ -26,25 +28,56 @@ export function Bets(props: { contract: Contract; totalBets: number }) { (params) => api('bets', params) ) + if (!bets || bets.length === 0) { + return null + } + return ( - - {bets.map((bet) => ( - - ))} + + } + modalContent={} + modalTitle="Activity" + /> + ) +} + +export function BetsPreview(props: { contract: Contract; latestBet: Bet }) { + const { contract, latestBet } = props + const color = useColor() + return ( + + + + Activity + + + + + {' '} + volume + + + + ) } -// Skeleton component for RelativeTimestamp -export function RelativeTimestamp(props: { - time: number - shortened?: boolean -}) { - // TODO: Implement proper timestamp formatting +export function BetsModal(props: { contract: Contract; bets: Bet[] }) { + const { contract, bets } = props return ( - - {new Date(props.time).toLocaleDateString()} - + + {bets.map((bet) => ( + + ))} + ) } @@ -56,62 +89,47 @@ export function OutcomeLabel(props: { truncate?: 'short' }) { const { outcome, answer } = props + const color = useColor() return ( - - {answer?.text ?? ''} {outcome} - - ) -} - -// Skeleton component for UserLink -export function UserLink(props: { - user: { username: string } | null | undefined - className?: string -}) { - const { user } = props - return {user?.username ?? 'Anonymous'} -} - -export function FeedBet(props: { contract: Contract; bet: Bet }) { - const { contract, bet } = props - // const { createdTime, userId } = bet - // const user = useDisplayUserById(userId) - - return ( - - + + + {outcome} + + {answer && ( + + {' '} + • {answer.text} + + )} ) } -export function BetStatusText(props: { - contract: Contract - bet: Bet - hideUser?: boolean - className?: string -}) { - const { bet, contract, hideUser } = props +export function FeedBet(props: { contract: Contract; bet: Bet }) { + const color = useColor() + const { bet, contract } = props const betUser = useDisplayUserById(bet.userId) - const self = useUser() - const { amount, outcome, createdTime, answerId } = bet + const { amount, outcome, answerId } = bet const getProb = (prob: number) => !isBinaryMulti(contract) ? prob : getBinaryMCProb(prob, outcome) const probBefore = getProb(bet.probBefore) - const probAfter = getProb(bet.probAfter) + const limitProb = bet.limitProb === undefined || !isBinaryMulti(contract) ? bet.limitProb : getBinaryMCProb(bet.limitProb, outcome) const bought = amount >= 0 ? 'bought' : 'sold' const absAmount = Math.abs(amount) - const money = + const orderAmount = bet.limitProb !== undefined && bet.orderAmount !== undefined ? ( ) : null - const anyFilled = !floatingLesserEqual(amount, 0) - const allFilled = floatingEqual(amount, bet.orderAmount ?? amount) const hadPoolMatch = (bet.limitProb === undefined || @@ -122,90 +140,75 @@ export function BetStatusText(props: { ? getFormattedMappedValue(contract, probBefore) : getFormattedMappedValue(contract, limitProb ?? probBefore) - const toProb = hadPoolMatch - ? getFormattedMappedValue(contract, probAfter) - : getFormattedMappedValue(contract, limitProb ?? probAfter) - const answer = contract.mechanism === 'cpmm-multi-1' ? contract.answers?.find((a) => a.id === answerId) : undefined + // ignore limit orders or if user doesn't exist + if (orderAmount || !betUser) { + return null + } return ( - - {!hideUser ? ( - - ) : ( - - {self?.id === bet.userId ? 'You' : `A ${BETTOR}`} - - )} - {orderAmount ? ( - - {anyFilled ? ( - - filled limit order {money}/{orderAmount} - - ) : ( - - created limit order for {orderAmount} + + + + + + + + + {' '} + {bought}{' '} - )} - - at {toProb} - {bet.isCancelled && !allFilled ? ( - (cancelled) - ) : null} - - ) : ( - - - {bought} {money}{' '} + + + + + {fromNow(bet.createdTime, true)} - + + - - {fromProb === toProb - ? `at ${fromProb}` - : `from ${fromProb} to ${toProb}`} + + {' '} + at{' '} + + + {fromProb} - )} - + ) } - -const styles = StyleSheet.create({ - container: { - gap: 16, - marginBottom: 16, - }, - row: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - gap: 8, - }, - betStatusContainer: { - flexDirection: 'row', - alignItems: 'center', - flexWrap: 'wrap', - gap: 4, - }, - betStatusRow: { - flexDirection: 'row', - alignItems: 'center', - gap: 4, - flexWrap: 'wrap', - }, -}) diff --git a/mani/components/user/user-link.tsx b/mani/components/user/user-link.tsx new file mode 100644 index 0000000000..0f07c36265 --- /dev/null +++ b/mani/components/user/user-link.tsx @@ -0,0 +1,20 @@ +import { ThemedText, ThemedTextProps } from 'components/themed-text' + +export function UserLink({ + username, + name, + limit, + ...rest +}: { + username?: string + name?: string + limit?: number +} & ThemedTextProps) { + const displayText = name ?? username ?? 'Anonymous' + const truncatedText = + limit && displayText.length > limit + ? `${displayText.slice(0, limit)}...` + : displayText + + return {truncatedText} +} diff --git a/mani/constants/colors.ts b/mani/constants/colors.ts index b0a681b958..f9dc31110a 100644 --- a/mani/constants/colors.ts +++ b/mani/constants/colors.ts @@ -194,6 +194,8 @@ export const Colors = { blue: blue[500], profitText: emerald[400], modalOverlay: withOpacity(gray[950], 0.9), + manaText: purple[300], + cashText: emerald[300], } as const // Mode-specific colors (used for game modes) From 529ec06ccd841ee0d1f8d7040ec247f6dad4542b Mon Sep 17 00:00:00 2001 From: ingawei Date: Thu, 16 Jan 2025 16:28:50 -0800 Subject: [PATCH 5/6] activitiee --- mani/components/contract/bets.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mani/components/contract/bets.tsx b/mani/components/contract/bets.tsx index 34e80da293..79ff9b88a5 100644 --- a/mani/components/contract/bets.tsx +++ b/mani/components/contract/bets.tsx @@ -73,7 +73,7 @@ export function BetsPreview(props: { contract: Contract; latestBet: Bet }) { export function BetsModal(props: { contract: Contract; bets: Bet[] }) { const { contract, bets } = props return ( - + {bets.map((bet) => ( ))} From f2868729c3f7a0f20f24c085de37e215852d8d3f Mon Sep 17 00:00:00 2001 From: ingawei Date: Thu, 16 Jan 2025 16:34:34 -0800 Subject: [PATCH 6/6] yup --- mani/components/contract/bets.tsx | 19 ++++++++++++++----- .../contract/contract-description.tsx | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/mani/components/contract/bets.tsx b/mani/components/contract/bets.tsx index 79ff9b88a5..42c71c26ca 100644 --- a/mani/components/contract/bets.tsx +++ b/mani/components/contract/bets.tsx @@ -14,6 +14,7 @@ import { fromNow } from 'util/time' import { useColor } from 'hooks/use-color' import { AvatarCircle } from 'components/user/avatar-circle' import { UserLink } from 'components/user/user-link' +import { ScrollView } from 'react-native' export function Bets(props: { contract: Contract; totalBets: number }) { const { contract } = props @@ -73,11 +74,19 @@ export function BetsPreview(props: { contract: Contract; latestBet: Bet }) { export function BetsModal(props: { contract: Contract; bets: Bet[] }) { const { contract, bets } = props return ( - - {bets.map((bet) => ( - - ))} - + + + {(() => { + const elements = [] + for (let i = bets.length - 1; i >= 0; i--) { + elements.push( + + ) + } + return elements + })()} + + ) } diff --git a/mani/components/contract/contract-description.tsx b/mani/components/contract/contract-description.tsx index bbe2fa60fc..4e0c5b5392 100644 --- a/mani/components/contract/contract-description.tsx +++ b/mani/components/contract/contract-description.tsx @@ -22,7 +22,7 @@ export function ContractDescription({ contract }: { contract: Contract }) { Description - + {extractTextFromContent(contract.description)}