Commit Graph

487 Commits

Author SHA1 Message Date
James Grugett
93287f8dc1
Answers in feed (#63)
* Compute answer group feed items

* Refactor feed code into 5 files under feed directory.

* Convert to typed ActivityItems

* Use feed "mode". Clean up cases.

* Implement feed answer groups!

* FR: Use nested comments/bets under answers for contract page. filter more items out of FR feed.

* Linkify answer text on activity feed

* Default feed excluded tags are case insensitive

* Show followed folds first

* Allow filtering your trades

* Store users's last sort in localstorage

* Use avatar of user that submitted answer and name instead of pencil icon. Spacing. Show up to 3 comments in asnwer group.

* Don't reveal market creator's bets

* Fix communites feed to be abbreviated

* Remove complicated answer group logic

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
2022-03-14 15:29:32 -05:00
Austin Chen
14e2071b1d Show followed folds first 2022-03-13 11:55:05 -07:00
Austin Chen
917e066a45 Add a searchbar over all folds 2022-03-10 10:14:06 -08:00
James Grugett
fe49ae4d5a Hide fast fold follow widget for now 2022-03-09 22:08:55 -06:00
James Grugett
79bd299b68 Enforce max question length, description length, and tag length. 2022-03-09 11:08:57 -06:00
Austin Chen
da4ce99755
Merge Manifold for Teams infra into main codebase (#61)
* Add dev target for TheoremOne

* Restrict signups to theoremone.co emails

* Add new indices

* Forbid reads from unauthenticated users

* Client-side render pages that need auth

These pages are now client-side rendered:
- /home
- /leaderboards
- /market/...
- /fold/...

* Hide 404 for private Manifolds

* Brand instance for TheoremOne

* Hide "Add Funds" and "Personalize your feed"

* "M$" =>  "T$"

* Hide Discord & About Page too

* Update placeholders for teams

* Update firestore.indexes.json

* Switch /analytics to propz

* Migrate per-env code into common/

* More migrations to PROJECT_ID

* Conditionally use SSG depending on public vs private instance

* Fix props to be empty object

* Move more logic into access

* Spin out config files for each environment

* Generify most of the customizable brand stuff

* Move IS_PRIVATE_MANIFOLD to access.ts

* Rename access.ts to envs/constants.ts

* Add "dev:dev" alias

* Rever firestore rules to existing settings

* Fixes according to James's review
2022-03-08 18:43:30 -08:00
Austin Chen
a32bb57167 Update about page 2022-03-07 10:40:53 -08:00
James Grugett
d7d8fb94c4
Trim activity feed (#60)
* Trim activity feed: show only items from last 24 hours, remove contract description, shorter width.

* Preserve feed ordering based on initial fetch of bets

* Add see more button, description to explore items
2022-03-04 18:06:11 -06:00
James Grugett
e49b64ee9f Flex shrink 0 on bet panel container 2022-03-04 10:33:38 -08:00
James Grugett
cb9fa0ceb2 Daily active users & comments 2022-03-03 12:59:12 -08:00
Austin Chen
ef77779cec Format Tailwind classes with Prettier
Not sure why Husky hooks aren't enforcing this 🤷
2022-03-03 01:09:32 -08:00
Austin Chen
d9fb2c0557 Tweak padding 2022-03-03 01:07:21 -08:00
James Grugett
c30962bf80 Create bet count and market count charts in our analytics 2022-03-02 17:52:41 -08:00
James Grugett
6abf235505 Show correct remaning balance for ante input when creating market 2022-03-02 13:50:19 -08:00
James Grugett
2a03751d49 Widen bet panel 2022-03-02 13:43:48 -08:00
James Grugett
985cdd2537
🏦 Per-market loans! (#57)
* Loan backend: Add loanAmount field to Bet, manage loans up to max loan amount per market -- buy, sell, and resolve.

* Loan frontend: show your loan amount in bet panel, answer bet panel

* Resolve emails include full payout not subtracting loan

* Exclude sold bets from current loan amount

* Handle bets table for loans. Sell dialog explains how you will repay your loan.

* Floor remaining balance

* Fix layout of create answer bet info

* Clean up Sell popup UI

* Fix bug where listen query was not updating data.

* Reword loan copy

* Adjust bet panel width

* Fix loan calc on front end

* Add comment for includeMetadataChanges.

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
2022-03-01 21:31:48 -06:00
James Grugett
ce30b34480 Fetch somewhat less data for fold static props 2022-03-01 18:08:46 -08:00
James Grugett
c372a0af9d Filter out undefined contracts in fold 2022-03-01 12:40:46 -08:00
James Grugett
71faee584c Add funds menu option, and Add funds page 2022-02-28 17:32:53 -08:00
Austin Chen
445e90f2b9 Link to analytics page from /about 2022-02-28 17:11:37 -08:00
James Grugett
a680d80793 Free response: Show invested and payouts on market page, don't show payout if yes/no 2022-02-28 15:58:13 -08:00
James Grugett
c6eb729e46 Remove border on feed tabs 2022-02-28 15:22:01 -08:00
James Grugett
8884f1beb9
Expose resolutionTime in API (#56)
* Expose resolutionTime. Compute closeTime to be the min of resolution and close time

* Rename settled to resolved, newest to most recent
2022-02-28 11:40:48 -08:00
James Grugett
0ccba20d5c Add explore tab on home feed that shows random inactive markets. 2022-02-27 13:37:11 -08:00
James Grugett
a3592f388b Fix feed to actually sort by last bet 2022-02-25 16:19:32 -06:00
James Grugett
ab5ea0181d Feed: Send only contracts with bets in last 24 hours. Instead of all contracts: 2.2MB => 0.8MB 2022-02-25 02:11:10 -06:00
James Grugett
cd590031e7 Feed updates: 1. Order by any bet instead of top 10 & comments 2. No resolved contracts 3. Show loading while fetching recent bets clientside so order preserved 4. Don't change order from new bets 2022-02-25 01:59:53 -06:00
James Grugett
185e68fa23 Fix 'undefined chance' in metatag description 2022-02-22 14:17:58 -06:00
James Grugett
207a12df55 Listen to followed folds. Follow button retreives from local storage. 2022-02-20 23:12:35 -06:00
James Grugett
8580698c15 Split answers panel into 5 files 2022-02-20 16:25:58 -06:00
mantikoros
42f88766b3 api: remove userId from bets 2022-02-19 22:51:51 -06:00
mantikoros
096a9e773a refactor /home logic to useActiveContracts 2022-02-19 18:02:40 -06:00
mantikoros
60f72fa6ab FastFoldFollowing: check if followedFoldIds is defined 2022-02-19 17:26:49 -06:00
mantikoros
2c572dd89a FastFoldFollowing: check if user defined 2022-02-19 17:23:03 -06:00
mantikoros
13727bb19f
Fast fold following (#51)
* fast follow folds

* FastFoldFollowing component on homepage
2022-02-19 17:17:36 -06:00
James Grugett
2a5172cb48 Switch to sending only recent bets and comments from static props 2022-02-18 12:43:13 -06:00
Austin Chen
a17342e55c
New, pretty user page (#48)
* Show bio, banner, and social links on user page

* Minor tweaks

* Allow edits to their user page

* Fix build; add a white ring around users

* From userpage, link to /profile (which is always editable now)

* Update userpage SEO

* Clean up Profile menu

* Fixes according to Stephen's code review
2022-02-17 17:16:58 -08:00
James Grugett
20ec09b7c6 Remove filter out of binary contracts 2022-02-17 18:39:06 -06:00
James Grugett
0a3b14883c Update SEO for non-binary markets 2022-02-17 18:34:17 -06:00
James Grugett
c48913d91e Sort bets/comments on client. Somehow server order is getting flipped? 2022-02-17 18:18:43 -06:00
Austin Chen
8f40350a75 API: Rename to LiteMarket/FullMarket; include creator avatar url 2022-02-17 16:04:05 -08:00
James Grugett
b2501d8145
Free response (#47)
* Answer datatype and MULTI outcome type for Contract

* Create free answer contract

* Automatically sort Tailwind classes with Prettier (#45)

* Add Prettier Tailwind plugin

* Autoformat Tailwind classes with Prettier

* Allow for non-binary contracts in contract page and related components

* logo with white inside, transparent bg

* Create answer

* Some UI for showing answers

* Answer bet panel

* Convert rest of calcuate file to generic multi contracts

* Working betting with ante'd NONE answer

* Numbered answers. Layout & calculation tweaks

* Can bet. More layout tweaks!

* Resolve answer UI

* Resolve multi market

* Resolved market UI

* Fix feed and cards for multi contracts

* Sell bets. Various fixes

* Tweaks for trades page

* Always dev mode

* Create answer bet has isAnte: true

* Fix  card showing 0% for multi contracts

* Fix grouped bets feed for multi outcomes

* None option converted to none of the above label at bottom of list. Button to resolve none.

* Tweaks to no answers yet, resolve button layout

* Show ante bets on new answers in the feed

* Update placeholder text for description

* Consolidate firestore rules for subcollections

* Remove Contract and Bet type params. Use string type for outcomes.

* Increase char limit to 10k for answers. Preserve line breaks.

* Don't show resolve options after answer chosen

* Fix type error in script

* Remove NONE resolution option

* Change outcomeType to include 'MULTI' and 'FREE_RESPONSE'

* Show bet probability change and payout when creating answer

* User info change: also change answers

* Append answers to contract field 'answers'

* sort trades by resolved

* Don't include trailing !:,.; in links

* Stop flooring inputs into formatMoney

* Revert "Stop flooring inputs into formatMoney"

This reverts commit 2f7ab18429.

* Consistently floor user.balance

* Expand create panel on focus

From Richard Hanania's feedback

* welcome email: include link to manifold

* Fix home page in dev on branches that are not free-response

* Close emails (#50)

* script init for stephen dev

* market close emails

* order of operations

* template email

* sendMarketCloseEmail: handle unsubscribe

* remove debugging

* marketCloseEmails: every hour

* sendMarketCloseEmails: check undefined

* marketCloseEmails: "every hour" => "every 1 hours"

* Set up a read API using Vercel serverless functions (#49)

* Set up read API using Vercel serverless functions

Featuring:
/api/v0/markets
/api/v0/market/[contractId]
/api/v0/slug/[contractSlug]

* Include tags in API

* Tweaks. Remove filter for only binary contract

* Fix bet probability change for NO bets

* Put back isProd calculation

Co-authored-by: Austin Chen <akrolsmir@gmail.com>
Co-authored-by: mantikoros <sgrugett@gmail.com>
Co-authored-by: mantikoros <95266179+mantikoros@users.noreply.github.com>
2022-02-17 17:00:19 -06:00
Austin Chen
51aa8df010
Set up a read API using Vercel serverless functions (#49)
* Set up read API using Vercel serverless functions

Featuring:
/api/v0/markets
/api/v0/market/[contractId]
/api/v0/slug/[contractSlug]

* Include tags in API
2022-02-17 12:56:24 -08:00
James Grugett
d6f15deff4 Fix home page in dev on branches that are not free-response 2022-02-17 01:02:48 -06:00
mantikoros
443acdbcf8 beautify trades page 2022-02-14 16:00:46 -06:00
Austin Chen
e4f1fbde3f Link to each question from Admin page 2022-02-13 16:09:30 -08:00
Austin Chen
7338bdd47a
Automatically sort Tailwind classes with Prettier (#45)
* Add Prettier Tailwind plugin

* Autoformat Tailwind classes with Prettier
2022-02-11 10:40:22 -08:00
James Grugett
dc0c9cf1d4 Filter undefined contracts 2022-02-10 17:06:27 -06:00
James Grugett
4150479aa3 Break words and linkify fold about text 2022-02-10 14:57:41 -06:00
James Grugett
00fbe711e5 Only show leaderboard scores that round up to M$ 1 or more 2022-02-10 14:51:14 -06:00
Austin Chen
bcc011c1fd Allow admins to edit questions 2022-02-09 10:58:33 -08:00
James Grugett
2d7c895964 Shrink about headers to h2 2022-02-08 00:21:47 -06:00
James Grugett
19baf86963 Sort fold & tag markets by 24-hour-vol 2022-02-07 23:03:55 -06:00
James Grugett
546005139b Fix recent activity label on mobile 2022-02-07 22:06:58 -06:00
James Grugett
2b5a0b1111 Require at least 2 follows to show a community (or show it if you are the curator) 2022-02-07 20:56:25 -06:00
James Grugett
faa49b750e Always show follow a community prompt 2022-02-06 20:03:42 -06:00
Austin Chen
ab6cfd2564 Show all recent activity if user has no folds 2022-02-06 16:03:36 -08:00
James Grugett
25e498ab3c Create market includes tags input. 2022-02-06 17:14:07 -06:00
James Grugett
63b7f64683 Listen for folds in contract page 2022-02-06 16:55:14 -06:00
Austin Chen
5aebd7eb41 Use font-weight: 600 for bold text 2022-02-06 01:23:45 -08:00
Austin Chen
516656f194 Clean up About page 2022-02-06 00:35:58 -08:00
Austin Chen
d2f5742231 Export all users to a CSV with name and email 2022-02-05 21:34:36 -08:00
mantikoros
dc2fada751 create: handle null 2022-02-05 19:10:26 -06:00
mantikoros
fae28fed7c create: don't replace undefined antes 2022-02-05 19:02:13 -06:00
James Grugett
1c8c2a4126 Fix home error after new contracts 2022-02-05 15:56:42 -06:00
James Grugett
d0a56cd1af Merge branch 'send-all-data' 2022-02-04 20:22:43 -06:00
James Grugett
31fbd6b900 Send all comments and bets to home page, so feed loads immediately 2022-02-04 20:09:34 -06:00
mantikoros
f7b981c55c "winnings" => "trader profits" 2022-02-04 17:42:08 -06:00
mantikoros
d439a2e1c0 create page: fix ante resetting 2022-02-04 17:40:03 -06:00
mantikoros
1ab7a4162c fix market close date time 2022-02-04 17:38:40 -06:00
James Grugett
637a76cf34 Cache first step of generating feed: folds you follow and contracts you bet on. 2022-02-04 17:24:54 -06:00
Austin Chen
a46c311a99 Clean up titles on /home 2022-02-04 10:30:13 -08:00
mantikoros
b4a68bf436 redirect signed out users on /profile and /trades to homepage 2022-02-03 21:19:42 -06:00
mantikoros
03f36cf954
User profile (#44)
* add id, userId to comment

* change user info cloud function and script; move cleanUsername to common

* change user info script

* fix rules

* add fund button: useLocation hook

* profile page

* merge

* profile stuff

* avatar uploading to storage bucket

* changeUserInfo: use transaction

* Styles for profile page

* Edit mode for profile, and more styles

Co-authored-by: James Grugett <jahooma@gmail.com>
2022-02-03 21:04:56 -06:00
James Grugett
ca89fd158d Make home communities look better on mobile. Add Covid & AI. 2022-02-03 19:00:17 -06:00
James Grugett
00f632ec47 Remove tw-elements for now 2022-02-03 18:10:19 -06:00
James Grugett
c36ce3e521 Change home tags to communities 2022-02-03 17:40:37 -06:00
James Grugett
e5f553fa1a Merge branch 'main' into custom-feed 2022-02-03 17:33:12 -06:00
James Grugett
587e1e5d61 Add loading spinner while feed loads 2022-02-03 17:12:09 -06:00
James Grugett
8e06e4351e Add tw-elements UI library 2022-02-03 17:11:38 -06:00
mantikoros
4294481b5b change fee structure 2022-02-03 16:59:59 -06:00
James Grugett
3cf4cb7a77 Show custom feed of contracts from folds your follow or have bet on. 2022-02-03 16:54:08 -06:00
James Grugett
6c9f566d3d Add hashtag in tags of fold card 2022-02-03 14:13:51 -06:00
Austin Chen
426d41ba44 Surface a list of tags on /home 2022-02-03 11:00:49 -08:00
Austin Chen
193b9ae6bf Restyle /folds page 2022-02-03 10:47:26 -08:00
James Grugett
a90e9b7083 Reorder fold page queries to be more in parallel 2022-02-03 00:19:59 -06:00
James Grugett
fdbaa5270b Show hot markets in fold feed 2022-02-02 23:58:27 -06:00
James Grugett
00ac581736 Show your performance in fold 2022-02-02 23:34:35 -06:00
James Grugett
95268844aa Add text to fold "about" explaining how markets are included. 2022-02-02 14:20:04 -06:00
James Grugett
f80ef1cd34 Add hot markets to home feed 2022-02-02 00:40:46 -06:00
James Grugett
b95f258763 Add package.json to common directory, and lodash dependency 2022-02-01 12:59:51 -06:00
James Grugett
96c1410f01 Rename Fold => Community in UI 2022-02-01 12:12:55 -06:00
James Grugett
565ded1063 Add folds links in market, hide tags behind Show tags toggle. 2022-02-01 12:06:42 -06:00
James Grugett
4e1174a4dc Option to disallow market creation from fold 2022-01-31 22:10:02 -06:00
James Grugett
5b5e6c78d6 Use expanding text area for description on make-predictions 2022-01-31 21:33:43 -06:00
James Grugett
3bbe6062e9 Change description input to use textarea 2022-01-31 21:31:49 -06:00
James Grugett
bc208df597 Add tags input for make-predictions 2022-01-31 21:13:37 -06:00
James Grugett
6525ffc6c3 Add ante and close date to make predictions 2022-01-31 20:58:41 -06:00
James Grugett
08eac5b0ef Add my calendly to about 2022-01-31 20:44:49 -06:00
James Grugett
2e1fdd7d7a Add border bottom back on fold page 2022-01-31 19:29:59 -06:00
mantikoros
d49656cb77 create: market close includes time 2022-01-30 23:20:27 -06:00
James Grugett
00b7f3505f Listen for contract updates in folds feed 2022-01-30 22:12:12 -06:00
James Grugett
9d2b99f237 Listen for updates of contracts on home 2022-01-30 22:03:20 -06:00
James Grugett
997f13d986 Make leaderboard not error on non-existant users 2022-01-30 21:25:52 -06:00
mantikoros
f06ca8305c
Resolve prob (#41)
* rename MKT to PROB; show resolved probability; move format utilities to common

* ProbabilitySelector

* resolve to PROB

* prob and mkt labels
2022-01-30 15:51:30 -06:00
jahooma
482654d06b Update folds SEO to include curator. 2022-01-28 13:45:32 -06:00
jahooma
f04d66d5c8 Don't focus feed create unless there's no question yet 2022-01-28 13:23:44 -06:00
jahooma
f75dc0200d Remove link create a market in placeholder 2022-01-28 12:54:15 -06:00
jahooma
53a6748c6d Hide negative earners on leaderboard. Show empty message if none on leaderboard. 2022-01-28 12:43:35 -06:00
jahooma
764790c1e1 Add simple Fold page SEO 2022-01-28 12:34:13 -06:00
jahooma
d5742900b0 Remove border on ask question form. Add padding to fold title on mobile 2022-01-28 12:13:12 -06:00
James Grugett
649c6f4642
Make navbar render signed in or signed out by page (#39) 2022-01-27 17:06:31 -06:00
mantikoros
bd6c215cd3
use img instead of next js image for avatar, logo (#38) 2022-01-27 16:50:55 -06:00
jahooma
9b59ea9fbe Bring back global leaderboards linked from profile menu 2022-01-27 16:43:45 -06:00
jahooma
f2c4d3e9c1 Change to white backgrounds for content. Remove page's margin, set individually. 2022-01-27 16:37:43 -06:00
jahooma
4ca1d33d65 Make tag page check lowercase tag field 2022-01-27 15:11:32 -06:00
mantikoros
f58126e630 create: remove default close date 2022-01-27 14:31:09 -06:00
mantikoros
9acb07aa14 home: remove hot, closing soon sections 2022-01-27 14:23:55 -06:00
jahooma
bb788d5201 Change placeholder in fold create question 2022-01-27 14:05:59 -06:00
mantikoros
d2e78eb5de markets: make 24hr vol default sort 2022-01-27 12:48:47 -06:00
jahooma
9764a03189 Add create market to top of fold activity. Auto-adds the primary tag of the fold. 2022-01-27 12:45:35 -06:00
jahooma
61d2557c35 Launch folds in nav bar, update copy. 2022-01-27 01:10:28 -06:00
jahooma
769763d006 Tweaks 2022-01-27 00:38:42 -06:00
Austin Chen
c047365bb4 Include "Buy" tag inside buttons 2022-01-26 16:28:57 -06:00
jahooma
b1abfcda8b Placeholder when no activity on folds page 2022-01-26 14:39:25 -06:00
jahooma
ef8157025f Compute fold follower count from cloud function. 2022-01-26 14:27:16 -06:00
Austin Chen
e4377ee3a3
Allow betting directly from the activity feed (#36)
* Show a popup for betting on the Activity feed

* Replace the popup with a YES/NO selector

* Autofocus the bet amount

* Hide BetRow when not appropriate

* Make bet modal larger on desktop

* Default to YES if no bet choice has been made yet
2022-01-26 14:08:03 -06:00
jahooma
76841e53b1 Follow and unfollow folds 2022-01-26 14:03:32 -06:00
jahooma
c3f49c44a0 Cardify folds in fold list 2022-01-26 12:44:16 -06:00
jahooma
8e511e7cc9 Add about to top of fold page on mobile. Layout tweaks 2022-01-26 12:02:53 -06:00
jahooma
2ea05f8913 Folds query on lowercase tags. Adding to description updates tags & lowercaseTags fields. 2022-01-25 17:52:21 -06:00
jahooma
8b0091f30d Split out create fold button. Show about description on /folds 2022-01-25 17:02:02 -06:00
jahooma
897eb0c27b Handle 404 errors for non-existent fold subpages 2022-01-25 15:44:32 -06:00
James Grugett
8b9d0e5dba
New fold page UI with tabs (#37)
* Tabbed fold page

* Implement market, leaderboard tab views for fold. And edit dialog

* Add about field to Fold
2022-01-25 14:47:25 -06:00
jahooma
ed9285dbc1 Make folds page more understandable. Add additional tags on fold creation 2022-01-24 16:58:51 -06:00
jahooma
705d5cada7 Add lowercaseTags field to contracts. ante / closeTime non-optional in new contract code 2022-01-24 16:33:10 -06:00
Austin Chen
13590bf5d1 Surface user emails in /admin 2022-01-24 00:48:10 -06:00
jahooma
0e3e4b8192 Show unresolved markets first in fold 2022-01-23 23:55:48 -06:00
jahooma
bc3e43802b Listen for new folds on /folds 2022-01-23 23:48:10 -06:00
jahooma
b059a44acc Use fold hook 2022-01-23 00:51:19 -06:00
jahooma
6cc2e6692e Fix DOM error for nested forms 2022-01-22 18:38:37 -06:00
mantikoros
fd03eb841f home: remove incomplete loading of contract data 2022-01-22 18:36:35 -06:00
mantikoros
7c124c1390 home: handle undefined props 2022-01-22 18:32:50 -06:00
jahooma
cff2611582 Add back dynamically loading feed 2022-01-22 18:26:56 -06:00
mantikoros
80776186aa
/home for signed in users (#35) 2022-01-22 18:16:23 -06:00
jahooma
aa1022546d Implement leaderboards for folds! 2022-01-22 17:59:50 -06:00
jahooma
bc1decdbfc Initialize folds with one primary tag 2022-01-22 15:47:24 -06:00
jahooma
789df9a76d Add some catches 2022-01-22 15:21:52 -06:00
jahooma
fe912921eb Use nicer tag component for folds 2022-01-22 14:52:49 -06:00
jahooma
be82406c4d Include older contracts in fold feed 2022-01-22 11:50:09 -06:00