Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch full names of users #113

Merged
merged 298 commits into from
Jan 21, 2024
Merged
Changes from all commits
Commits
Show all changes
298 commits
Select commit Hold shift + click to select a range
be23aa7
Working through SuperToken Initialization Error: There was an error i…
Joshua-Jack Sep 27, 2023
fb39d1c
Done
Joshua-Jack Oct 4, 2023
bab1bc3
.
Joshua-Jack Oct 9, 2023
c970ba1
fix: hardhat lint
sirpy Sep 18, 2023
01c46c3
add: override reward
sirpy Oct 9, 2023
863df3a
add: deployed upgraded pool with override
sirpy Oct 9, 2023
7533234
fix: contracts types build
sirpy Oct 12, 2023
1d993cf
Merge branch 'master' into web3Integrations
sirpy Oct 19, 2023
ad6ed96
Merge branch 'master' into web3Integrations
sirpy Oct 23, 2023
59217a5
fix: ethers typescript errors
sirpy Oct 23, 2023
11237e5
fix: types
L03TJ3 Oct 24, 2023
5c9714a
update
Joshua-Jack Oct 25, 2023
916bd01
updated subgraph
Joshua-Jack Oct 30, 2023
4672d60
Put back functions lost
Joshua-Jack Oct 30, 2023
6d4f8c7
fix: deploy preview on udpates to PR
sirpy Nov 2, 2023
b8681b1
wip: test preview yml
sirpy Nov 2, 2023
3108d27
Merge branch 'master' into web3Integrations
sirpy Nov 2, 2023
f6c3def
fix: lock file
sirpy Nov 2, 2023
f4ce213
Update donor
Joshua-Jack Nov 3, 2023
7ca3da4
add: tsc lint-staged
sirpy Nov 5, 2023
aea46e5
fix: lock issue
sirpy Nov 5, 2023
20f9d23
fix: typescript jsx transform
sirpy Nov 5, 2023
f3b23e9
Update donor
Joshua-Jack Nov 6, 2023
cb25dc5
.
Joshua-Jack Nov 6, 2023
aacdbe4
.
Joshua-Jack Nov 6, 2023
c55272c
fix: unit tests
sirpy Nov 6, 2023
030aa49
.
Joshua-Jack Nov 8, 2023
0edf07e
update
Joshua-Jack Nov 8, 2023
566a28e
Fix: build
Joshua-Jack Nov 8, 2023
792e1ba
fix: unit tests
sirpy Nov 8, 2023
22f0314
fix: build correctly
sirpy Nov 9, 2023
d425432
wip: fix PR test
sirpy Nov 14, 2023
ad77a41
Update readme to clarify that packages must be built locally
benefacto Nov 22, 2023
57dc8a4
Attempt to port existing desktop wallet connection handling to mobile
benefacto Nov 24, 2023
03cb90d
fix: event quantity
sirpy Nov 29, 2023
b3044f1
refactor: package.json
sirpy Nov 29, 2023
2b506d9
Point to working subgraph
benefacto Nov 30, 2023
42b295d
refactored header and changed wallet connect buttons layout to menu
krisbitney Dec 11, 2023
ec46240
added todo item
krisbitney Dec 11, 2023
6126d7d
fixed wallet connector dropdown offset
krisbitney Dec 11, 2023
22a1e32
animated wallet connector menu button arrow
krisbitney Dec 12, 2023
d066df1
Collective Home Card description is now limited to 3 lines and expand…
krisbitney Dec 12, 2023
e4e5df0
reduced width of desktop home collective card containers so they more…
krisbitney Dec 12, 2023
a9ef6a9
fixed padding on ViewCollective page and did some touchups on steward…
krisbitney Dec 12, 2023
a7698fe
fixed CTA button size on DonationPage
krisbitney Dec 12, 2023
cf168b1
Merge pull request #48 from GoodDollar/kris/header
sirpy Dec 12, 2023
b7fb7f6
Merge pull request #47 from GoodDollar/kris/cards
sirpy Dec 12, 2023
8953763
fixed Breadcrumb on DonationPage
krisbitney Dec 12, 2023
5ee37d5
Merge pull request #51 from GoodDollar/kris/donation-page
sirpy Dec 12, 2023
4646d9b
Merge remote-tracking branch 'origin/web3Integrations' into kris/page…
krisbitney Dec 13, 2023
b17bb8c
fixed icon alignment on ViewCollective page
krisbitney Dec 13, 2023
2f7712b
added random profile pics for stewards
krisbitney Dec 13, 2023
4295612
fixes for layout of ViewStewards page on mobile
krisbitney Dec 13, 2023
efc955d
small refactors while trying to figure out why "see all stewards" but…
krisbitney Dec 13, 2023
9df6bf6
set gap between stewards and transactions to 32 on desktop ViewCollec…
krisbitney Dec 13, 2023
dccb681
Merge pull request #49 from GoodDollar/kris/page-padding
krisbitney Dec 14, 2023
b263e06
Merge remote-tracking branch 'origin/web3Integrations' into kris/view…
krisbitney Dec 14, 2023
230b00e
Merge pull request #55 from GoodDollar/kris/view-collective-icon-alig…
krisbitney Dec 14, 2023
0062840
refactored subgraph data fetching
krisbitney Dec 14, 2023
35335b8
fix: empty arrays, relations
sirpy Nov 29, 2023
321f623
wip: subgraph fixes
sirpy Dec 14, 2023
de08229
additional refactoring of models
krisbitney Dec 14, 2023
18c9811
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 14, 2023
9ee81fd
small progress made in adding dynamic data
krisbitney Dec 14, 2023
ab3b969
reworked subgraph; added entities for StewardCollective, Reward, Dono…
krisbitney Dec 15, 2023
60a8e69
updated pool creation in subgraph
krisbitney Dec 15, 2023
c2d2cd0
adjusted Collective schema
krisbitney Dec 16, 2023
3fbead3
made all fields non-nullable since they all have values when instanti…
krisbitney Dec 16, 2023
11aeeff
removed 'contributions' summary value from Collective
krisbitney Dec 16, 2023
eedc565
added summary statistics to Collective
krisbitney Dec 16, 2023
9eae142
updated contribution calculations for donors in subgraph
krisbitney Dec 18, 2023
60af1fc
added dev comments in schema for clarity
krisbitney Dec 18, 2023
a5fbfde
reworked subgraph queries and model transforms (build broken)
krisbitney Dec 18, 2023
c6db959
added dynamic data to ViewCollective and ViewStewards (build broken)
krisbitney Dec 18, 2023
59aefa7
updated wallet profile page
krisbitney Dec 19, 2023
6f442cc
removed unused pages and fixed build
krisbitney Dec 19, 2023
705543b
added ipfs data parsing and removed unused reward/donation code
krisbitney Dec 19, 2023
66c9df1
fixed ipfs collective id
krisbitney Dec 19, 2023
b264fcc
Add: Design system (#54)
L03TJ3 Dec 20, 2023
fcc2577
Update README.md
L03TJ3 Dec 20, 2023
d474c25
front end now obtains ipfs data from subgraph instead of fetching dir…
krisbitney Dec 20, 2023
2e275b7
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 20, 2023
8286e10
minor refactoring
krisbitney Dec 21, 2023
bcf8952
made event-claim relationship m:1
krisbitney Dec 21, 2023
03b00b4
fix: exluded deps from bundle
L03TJ3 Dec 21, 2023
cebd745
Merge pull request #60 from GoodDollar/kris/subgraph
krisbitney Dec 22, 2023
125aa5a
fix for desktop padding on view collective page
krisbitney Dec 22, 2023
3788ff3
added tsconfig for assemblyscript in subgraph package
krisbitney Dec 23, 2023
82d9eec
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 23, 2023
ca5cb86
updated ViewDonorsPage and its components
krisbitney Dec 23, 2023
cd0a251
added correct Collective metadata to donate page
krisbitney Dec 23, 2023
fcab1fd
added ipfs collective metadata update to handlePoolDetailsChanged
krisbitney Dec 23, 2023
9b53599
changed variable name 'nftAddress' to 'nftId' in subgraph pool.ts; ch…
krisbitney Dec 24, 2023
11dd18a
removed deriveFrom relationship from eventdata claim
krisbitney Dec 24, 2023
8e6c02c
reconfigured subgraph to recognize factory-template relationship betw…
krisbitney Dec 24, 2023
390b248
Merge pull request #64 from GoodDollar/kris/subgraph-fix
sirpy Dec 25, 2023
dcc77ea
fix: subgraph null, ipfs, mappings file
sirpy Dec 25, 2023
65ad04b
ensured required values in subgraph entities are populated
krisbitney Dec 25, 2023
6f11c00
Merge remote-tracking branch 'origin/web3Integrations' into kris/subg…
krisbitney Dec 25, 2023
b8421c3
update yarn.lock
krisbitney Dec 25, 2023
56bda67
fixed assemblyscript config extension path
krisbitney Dec 26, 2023
6a822e2
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 26, 2023
e9480d7
updated DonateComponent to determine if balance is sufficient; remove…
krisbitney Dec 26, 2023
0232d0c
added donation timestamp to DonorCollective (needed for superfluid re…
krisbitney Dec 26, 2023
af10f15
added donation timestamp to DonorCollective (needed for superfluid re…
krisbitney Dec 26, 2023
19e0433
removed missed usages of @constants folder
krisbitney Dec 26, 2023
75f6abc
Merge remote-tracking branch 'origin/kris/data-flow' into kris/realti…
krisbitney Dec 26, 2023
d3fb52b
Merge pull request #65 from GoodDollar/kris/subgraph-fix
sirpy Dec 26, 2023
3bdaa4a
fix: yarn lock
sirpy Dec 26, 2023
99ab3af
displaying realtime superfluid donations (untested)
krisbitney Dec 26, 2023
48f2507
Merge remote-tracking branch 'origin/web3Integrations' into kris/real…
krisbitney Dec 26, 2023
6546f68
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 26, 2023
1ddb3e7
fixed null values in handleRewardClaim NFT
krisbitney Dec 26, 2023
4d52ddb
Merge pull request #62 from GoodDollar/kris/view-collective-desktop-p…
krisbitney Dec 26, 2023
390931c
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 26, 2023
0df8bc3
Merge remote-tracking branch 'origin/web3Integrations' into kris/real…
krisbitney Dec 26, 2023
5c61ebb
updated yarn lock
krisbitney Dec 26, 2023
2ff7df1
Merge remote-tracking branch 'origin/web3Integrations' into kris/subg…
krisbitney Dec 26, 2023
2ad905f
updated yarn lock
krisbitney Dec 26, 2023
02a1d41
Merge pull request #67 from GoodDollar/kris/subgraph-fix
krisbitney Dec 26, 2023
f566657
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 26, 2023
698e3c5
Merge remote-tracking branch 'origin/web3Integrations' into kris/real…
krisbitney Dec 26, 2023
7e26eae
using hex string for pool project id due to invalid utf-8 data
krisbitney Dec 26, 2023
d49a0a9
removed ipfs retries since they don't seem to help
krisbitney Dec 26, 2023
100443d
fixed Claim totalRewards initialization
krisbitney Dec 26, 2023
324d63e
Merge pull request #68 from GoodDollar/kris/subgraph-fix
krisbitney Dec 26, 2023
f5b4a68
reworked ipfs usage in subgraph to use new data source feature
krisbitney Dec 26, 2023
2f9fe26
Merge pull request #69 from GoodDollar/kris/subgraph-ipfs
krisbitney Dec 26, 2023
e083172
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 26, 2023
a2ec1af
updated data flow to accomodate subgraph updates
krisbitney Dec 26, 2023
a92f646
add required fields to ipfs entity in subgraph
krisbitney Dec 27, 2023
7c55129
Merge pull request #70 from GoodDollar/kris/ipfs-required-fields
krisbitney Dec 27, 2023
ec9f982
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 27, 2023
e0d7da5
adjusted ipfs fetching in front end
krisbitney Dec 27, 2023
daab34d
renamed IpfsCollective.address to IpfsCollective.collective
krisbitney Dec 27, 2023
847f358
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 27, 2023
f14ce7a
removed IpfsCollective.collective
krisbitney Dec 27, 2023
035d327
Merge remote-tracking branch 'origin/web3Integrations' into kris/data…
krisbitney Dec 27, 2023
b24368a
fixes to subgraph ipfs fetching in front end
krisbitney Dec 27, 2023
77afd1f
removed several hard-coded SVG strings
krisbitney Dec 27, 2023
7c86aa6
several minor fixes
krisbitney Dec 27, 2023
264c582
various minor fixes
krisbitney Dec 27, 2023
cf6ba01
reworked wallet profile UI
krisbitney Dec 28, 2023
4b6d6ec
removed use of `window`
krisbitney Dec 28, 2023
a3fd122
refactored useGetBalance
krisbitney Dec 28, 2023
8c1641c
Merge remote-tracking branch 'origin/kris/data-flow' into kris/realti…
krisbitney Dec 28, 2023
25380e4
post-merge fixes
krisbitney Dec 28, 2023
8cc5c3f
removed unused constants
krisbitney Dec 28, 2023
60844f0
removed redundant view from ViewStewardsPage.tsx
krisbitney Dec 28, 2023
178e8d5
removed unused styles from ViewStewardsPage.tsx
krisbitney Dec 28, 2023
e014225
removed unused styles from ViewDonorsPage.tsx
krisbitney Dec 28, 2023
fed3a87
ui fixes ViewStewardsPage and ViewDonorsPage
krisbitney Dec 28, 2023
f803942
removed unused import and console log
krisbitney Dec 28, 2023
08d3d50
updated useContractCalls and much of DonateComponent
krisbitney Dec 29, 2023
90c99da
fixed double usage of insufficientLiquidity
krisbitney Dec 29, 2023
f3fedec
simplified DonorListItem ranks
krisbitney Dec 29, 2023
d65968b
ProfileView refactor
krisbitney Dec 29, 2023
b8d12ed
Merge remote-tracking branch 'origin/kris/data-flow' into kris/realti…
krisbitney Dec 29, 2023
89eb735
Merge pull request #71 from GoodDollar/kris/desktop-stewards-donors-l…
krisbitney Dec 29, 2023
2f93b78
Merge pull request #58 from GoodDollar/kris/data-flow
krisbitney Dec 29, 2023
9abd3c4
added useApproveSwapTokenCallback and useSwapRoute
krisbitney Dec 29, 2023
5a86cef
removed mock data
krisbitney Dec 29, 2023
4e02064
draft swap integration
krisbitney Dec 30, 2023
31ff9ae
added index to hooks/useContractCalls
krisbitney Dec 30, 2023
5d33d59
prevented swap from G$ to G$
krisbitney Dec 30, 2023
56cd466
fixed formatting and some swap bugs
krisbitney Dec 30, 2023
5404b97
removed unused function from lib
krisbitney Dec 30, 2023
1e2603e
Merge remote-tracking branch 'origin/kris/realtime-donation-flow' int…
krisbitney Dec 30, 2023
638593d
added flowing balances for total donation amounts for collectives and…
krisbitney Jan 4, 2024
e6f04a1
added useTokenList hook
krisbitney Jan 4, 2024
aafd807
Merge remote-tracking branch 'origin/kris/realtime-donation-flow' int…
krisbitney Jan 4, 2024
b9bbeb5
now using celo token list
krisbitney Jan 4, 2024
cb1e9aa
removed unused import
krisbitney Jan 4, 2024
c4b8201
made dropdown menu scrollable
krisbitney Jan 4, 2024
0a76140
Merge pull request #66 from GoodDollar/kris/realtime-donation-flow
krisbitney Jan 4, 2024
4e85141
Merge remote-tracking branch 'origin/web3Integrations' into kris/inte…
krisbitney Jan 4, 2024
96e19c2
added storage cache to apollo client
krisbitney Jan 4, 2024
e24a890
swap works!
krisbitney Jan 5, 2024
2fb34b3
adjustments to reflect uniswap default slippage tolerance
krisbitney Jan 5, 2024
b3ad4e1
fixed jsbi via vite configuration
krisbitney Jan 6, 2024
72e8905
changed priceImpact to number
krisbitney Jan 7, 2024
7688014
Merge remote-tracking branch 'origin/kris/integrate-swap' into kris/a…
krisbitney Jan 7, 2024
9e6b80a
updated default apollo client fetch policy to 'cache-and-network'
krisbitney Jan 7, 2024
cf67b5d
removed unused `WalletConnectionProvider` context
krisbitney Jan 8, 2024
f7cfdcf
by request, handleApproveToken is no longer memoized
krisbitney Jan 8, 2024
09dbb70
fixed GD formatting in Donor List
krisbitney Jan 9, 2024
f8b940e
Merge remote-tracking branch 'origin/kris/integrate-swap' into kris/a…
krisbitney Jan 9, 2024
4ee4e32
changed acceptable price impact percent to 5% and moved it to constan…
krisbitney Jan 9, 2024
6798a21
add swap and fix donate (#72)
krisbitney Jan 9, 2024
dbe2ec0
added steward verification check
krisbitney Jan 10, 2024
1438f46
added currentPool value fetching
krisbitney Jan 10, 2024
2ff9ee6
added "people supported" counts
krisbitney Jan 10, 2024
a24d8be
fixed for useIsStewardVerified and added FlowingDonationsRowItem to r…
krisbitney Jan 12, 2024
1d67a4e
fixes for currentPool, donor list
krisbitney Jan 12, 2024
162ab5f
fix for ens name support
krisbitney Jan 12, 2024
1dd9ca9
Merge pull request #74 from GoodDollar/kris/appolo-storage-cache
krisbitney Jan 12, 2024
4e1595b
Merge remote-tracking branch 'origin/web3Integrations' into kris/inte…
krisbitney Jan 12, 2024
3cae032
Merge pull request #82 from GoodDollar/kris/integrate-swap
krisbitney Jan 12, 2024
3f05ee7
Merge remote-tracking branch 'origin/web3Integrations' into kris/rema…
krisbitney Jan 12, 2024
ec0aeb3
fix social links and show only if available
krisbitney Jan 13, 2024
a229937
changed DonorListItem amount display from toFixed to toString
krisbitney Jan 13, 2024
5b5ea2d
sort connectors with WalletConnect before MetaMask
krisbitney Jan 13, 2024
5bf352c
added token symbol next to wallet balance and adjusted balance format…
krisbitney Jan 13, 2024
97c3686
update copy for on-time donation, added chain check to useEthersSigne…
krisbitney Jan 13, 2024
de210a0
one-time transfer now assumes token is already approved for transfer
krisbitney Jan 13, 2024
62f98f7
G$ donation now assumes token is already approved for transfer
krisbitney Jan 13, 2024
f7c8708
added infoButton property to ipfs meta data in subgraph
krisbitney Jan 13, 2024
0621868
increased slippage tolerance from 0.5% to 1%
krisbitney Jan 13, 2024
2340134
made it so only G$ shows in token list for one-time donations
krisbitney Jan 13, 2024
8509965
made it so selecting one-time donation changes currency to G$ and amo…
krisbitney Jan 13, 2024
944b7f3
fixed total donation usd value
krisbitney Jan 13, 2024
4be3b2e
swap errors will only show if donation amount is not zero
krisbitney Jan 13, 2024
70115a4
added infoLabel to front end
krisbitney Jan 13, 2024
61e129e
updated breadcrumb to show collective name and only go back to previo…
krisbitney Jan 13, 2024
c2f7412
updated breadcrumb to fix links and text
krisbitney Jan 13, 2024
42c5e4e
incremented subgraph starting block because prior block was failing
krisbitney Jan 13, 2024
ed70f56
donation is now disabled if swap required and token approval not yet …
krisbitney Jan 13, 2024
4a7fb25
breadcrumb formatting for '/'
krisbitney Jan 13, 2024
e9ce60c
adjusted G$ formatting in profile
krisbitney Jan 13, 2024
87dd162
modal and donation error formatting
krisbitney Jan 13, 2024
380eef8
added steward profile link to steward list item
krisbitney Jan 13, 2024
0d25888
added polling to donor in wallet; improved error message in donation …
krisbitney Jan 13, 2024
fa5314c
fix for error message in donation functions
krisbitney Jan 13, 2024
b115063
switched from supportSingleTransferAndCall to supportSingleBatch sinc…
krisbitney Jan 13, 2024
2009037
removed warnings for missing subgraph items
krisbitney Jan 13, 2024
527a3aa
set margin between collective cards on home page to 24
krisbitney Jan 13, 2024
c8d45d1
fixed transaction list UI
krisbitney Jan 14, 2024
3fe72fd
added useRecentTransactions hook
krisbitney Jan 14, 2024
124ddbe
fixed ViewCollective tablet portrait resolution
krisbitney Jan 14, 2024
3f2fa75
removed G$ fractional amount from connected wallet display, and added…
krisbitney Jan 14, 2024
aaf2a64
made sure G$ displayed amount is rounded down to nearest int
krisbitney Jan 14, 2024
9101bc2
fixed stop donation
krisbitney Jan 14, 2024
647653c
changed default gas price to 5 in @gooddollar/goodcollective-sdk
krisbitney Jan 14, 2024
6a84def
renamed enum value from celo to CELO
krisbitney Jan 14, 2024
93e55ab
currentPool is now a flowing balance
krisbitney Jan 14, 2024
d48eb53
refactor: dry up donate button styles, no inline arrow functions
L03TJ3 Jan 14, 2024
872f831
fix: getDonateStyles, does not stop loop after hitting first true
L03TJ3 Jan 14, 2024
0e7106c
fix: simplify getDonateStyles
L03TJ3 Jan 14, 2024
bdd7a25
inline lambdas to const
krisbitney Jan 15, 2024
ba8681e
memoized onChangeFrequency
krisbitney Jan 15, 2024
9522bab
added support for fetching full user names from mongodb
krisbitney Jan 15, 2024
82cfc75
Merge pull request #81 from GoodDollar/kris/remaining-details
krisbitney Jan 15, 2024
104e05b
added caching to useFetchFullName and fixed realm logout callback
krisbitney Jan 16, 2024
f112983
Bug fixes (#111)
krisbitney Jan 16, 2024
0cf7a08
Merge remote-tracking branch 'origin/web3Integrations' into kris/full…
krisbitney Jan 17, 2024
16ecd76
Merge branch 'master' of github.com:GoodDollar/GoodCollective into kr…
L03TJ3 Jan 18, 2024
f45e177
added apollo client for mongo db fetches
krisbitney Jan 18, 2024
0c91c96
changed apollo client cache policies
krisbitney Jan 18, 2024
65dd675
Merge remote-tracking branch 'origin/master' into kris/full-names
krisbitney Jan 19, 2024
53b762e
added full name fetching to transactions list items
krisbitney Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
"@gooddollar/good-design": "^0.1.31",
"@gooddollar/goodcollective-sdk": "^1.0.15",
"@gooddollar/web3sdk-v2": "^0.2.2",
"@nerdwallet/apollo-cache-policies": "^3.2.0",
"@react-native-aria/interactions": "0.2.3",
"@react-native-async-storage/async-storage": "^1.18.2",
"@react-native-firebase/analytics": "16.7.0",
@@ -67,6 +68,7 @@
"react-native-web": "0.18.*",
"react-router-dom": "^6.14.1",
"react-router-native": "^6.14.1",
"realm-web": "^2.0.0",
"viem": "^1.10.8",
"wagmi": "^1.4.5"
},
102 changes: 41 additions & 61 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -19,12 +19,11 @@ import { publicProvider } from 'wagmi/providers/public';
import { infuraProvider } from 'wagmi/providers/infura';
import { MetaMaskConnector } from 'wagmi/connectors/metaMask';
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect';
import { ApolloClient, ApolloProvider, InMemoryCache, NormalizedCacheObject } from '@apollo/client';
import { ApolloProvider } from '@apollo/client';

import { Colors } from './utils/colors';
import { AsyncStorageWrapper, persistCache } from 'apollo3-cache-persist';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { useEffect, useState } from 'react';
import { useCreateSubgraphApolloClient, useCreateMongoDbApolloClient } from './hooks/apollo';
import { MongoDbApolloProvider } from './components/providers/MongoDbApolloProvider';

function App(): JSX.Element {
const { publicClient, webSocketPublicClient } = configureChains(
@@ -44,77 +43,58 @@ function App(): JSX.Element {
}),
];

const [apolloClient, setApolloClient] = useState<ApolloClient<NormalizedCacheObject> | undefined>();

useEffect(() => {
async function initApollo() {
const cache = new InMemoryCache();
await persistCache({
cache,
storage: new AsyncStorageWrapper(AsyncStorage),
});
const client = new ApolloClient({
uri: 'https://api.thegraph.com/subgraphs/name/gooddollar/goodcollective',
cache,
defaultOptions: {
watchQuery: {
fetchPolicy: 'cache-and-network',
},
},
});
setApolloClient(client);
}

initApollo().catch(console.error);
}, []);

const wagmiConfig = createConfig({
autoConnect: true,
connectors,
publicClient,
webSocketPublicClient,
});

if (!apolloClient) {
const subgraphApolloClient = useCreateSubgraphApolloClient();
const mongoDbApolloClient = useCreateMongoDbApolloClient();

if (!subgraphApolloClient || !mongoDbApolloClient) {
return <Text>Loading...</Text>;
}

return (
<Providers>
<WagmiConfig config={wagmiConfig}>
<ApolloProvider client={apolloClient}>
<SafeAreaView style={styles.body}>
{Platform.OS !== 'web' && (
<MobileRoute.Router>
<MobileRoute.Routes>
<MobileRoute.Route path="/" element={<HomePage />} />
<MobileRoute.Route path="/about" element={<AboutPage />} />
<MobileRoute.Route path="/collective/:id" element={<ViewCollectivePage />} />
<MobileRoute.Route path="/collective/:id/stewards" element={<ViewStewardsPage />} />
<MobileRoute.Route path="/collective/:id/donors" element={<ViewDonorsPage />} />
<MobileRoute.Route path="/profile/:id" element={<WalletProfilePage />} />
<MobileRoute.Route path="/profile/:id/activity" element={<ActivityLogPage />} />
<MobileRoute.Route path="/donate" element={<DonatePage />} />
</MobileRoute.Routes>
</MobileRoute.Router>
)}
<ApolloProvider client={subgraphApolloClient}>
<MongoDbApolloProvider client={mongoDbApolloClient}>
<SafeAreaView style={styles.body}>
{Platform.OS !== 'web' && (
<MobileRoute.Router>
<MobileRoute.Routes>
<MobileRoute.Route path="/" element={<HomePage />} />
<MobileRoute.Route path="/about" element={<AboutPage />} />
<MobileRoute.Route path="/collective/:id" element={<ViewCollectivePage />} />
<MobileRoute.Route path="/collective/:id/stewards" element={<ViewStewardsPage />} />
<MobileRoute.Route path="/collective/:id/donors" element={<ViewDonorsPage />} />
<MobileRoute.Route path="/profile/:id" element={<WalletProfilePage />} />
<MobileRoute.Route path="/profile/:id/activity" element={<ActivityLogPage />} />
<MobileRoute.Route path="/donate" element={<DonatePage />} />
</MobileRoute.Routes>
</MobileRoute.Router>
)}

{Platform.OS === 'web' && (
<WebRoute.Router>
<WebRoute.Routes>
<WebRoute.Route path="/" element={<HomePage />} />
<WebRoute.Route path="/about" element={<AboutPage />} />
<WebRoute.Route path="/collective/:id" element={<ViewCollectivePage />} />
<WebRoute.Route path="/collective/:id/stewards" element={<ViewStewardsPage />} />
<WebRoute.Route path="/collective/:id/donors" element={<ViewDonorsPage />} />
<WebRoute.Route path="/profile/:id" element={<WalletProfilePage />} />
<WebRoute.Route path="/profile/:id/activity" element={<ActivityLogPage />} />
<WebRoute.Route path="/profile/" element={<WalletProfilePage />} />
<WebRoute.Route path="/donate/:id" element={<DonatePage />} />
</WebRoute.Routes>
</WebRoute.Router>
)}
</SafeAreaView>
{Platform.OS === 'web' && (
<WebRoute.Router>
<WebRoute.Routes>
<WebRoute.Route path="/" element={<HomePage />} />
<WebRoute.Route path="/about" element={<AboutPage />} />
<WebRoute.Route path="/collective/:id" element={<ViewCollectivePage />} />
<WebRoute.Route path="/collective/:id/stewards" element={<ViewStewardsPage />} />
<WebRoute.Route path="/collective/:id/donors" element={<ViewDonorsPage />} />
<WebRoute.Route path="/profile/:id" element={<WalletProfilePage />} />
<WebRoute.Route path="/profile/:id/activity" element={<ActivityLogPage />} />
<WebRoute.Route path="/profile/" element={<WalletProfilePage />} />
<WebRoute.Route path="/donate/:id" element={<DonatePage />} />
</WebRoute.Routes>
</WebRoute.Router>
)}
</SafeAreaView>
</MongoDbApolloProvider>
</ApolloProvider>
</WagmiConfig>
</Providers>
8 changes: 7 additions & 1 deletion packages/app/src/components/DonorsList/DonorsList.tsx
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import { DonorCollective } from '../../models/models';
import { DonorsListItem } from './DonorsListItem';
import { useMemo } from 'react';
import Decimal from 'decimal.js';
import { useFetchFullNames } from '../../hooks/useFetchFullName';

interface DonorsListProps {
donors: DonorCollective[];
@@ -20,10 +21,15 @@ function DonorsList({ donors, listStyle }: DonorsListProps) {
});
}, [donors]);

const userAddresses = useMemo(() => {
return donors.map((donor) => donor.donor as `0x${string}`);
}, [donors]);
const userFullNames = useFetchFullNames(userAddresses);

return (
<View style={[styles.list, { ...(listStyle ?? {}) }]}>
{sortedDonors.map((donor, index) => (
<DonorsListItem donor={donor} rank={index + 1} key={donor.donor} />
<DonorsListItem key={donor.donor} donor={donor} rank={index + 1} userFullName={userFullNames[index]} />
))}
</View>
);
5 changes: 3 additions & 2 deletions packages/app/src/components/DonorsList/DonorsListItem.tsx
Original file line number Diff line number Diff line change
@@ -11,16 +11,17 @@ import { useEnsName } from 'wagmi';
interface DonorsListItemProps {
donor: DonorCollective;
rank: number;
userFullName?: string;
}

export const DonorsListItem = (props: DonorsListItemProps) => {
const { donor, rank } = props;
const { donor, rank, userFullName } = props;
const { navigate } = useCrossNavigate();

const formattedDonations: string = new Decimal(ethers.utils.formatEther(donor.contribution) ?? 0).toString();

const { data: ensName } = useEnsName({ address: donor.donor as `0x${string}`, chainId: 1 });
const userIdentifier = ensName ? ensName : formatAddress(donor.donor, 5);
const userIdentifier = userFullName ?? ensName ?? formatAddress(donor.donor);

const circleBackgroundColor = rank === 1 ? Colors.yellow[100] : rank === 2 ? Colors.gray[700] : Colors.orange[400];
const circleTextColor = rank === 1 ? Colors.yellow[200] : rank === 2 ? Colors.blue[200] : Colors.brown[100];
7 changes: 7 additions & 0 deletions packages/app/src/components/StewardsList/StewardsList.tsx
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import { StewardCollective } from '../../models/models';
import { useMemo } from 'react';
import { profilePictures } from '../../utils/profilePictures';
import { StewardBlue, StewardGreen } from '../../assets';
import { useFetchFullNames } from '../../hooks/useFetchFullName';

interface StewardListProps {
listType: 'viewCollective' | 'viewStewards';
@@ -22,6 +23,11 @@ function StewardList({ listType, stewards, titleStyle, listStyle }: StewardListP
return profilePictures.sort(() => Math.random());
}, []);

const userAddresses = useMemo(() => {
return stewards.map((steward) => steward.steward as `0x${string}`);
}, [stewards]);
const userFullNames = useFetchFullNames(userAddresses);

return (
<View style={styles.stewardsListContainer}>
<View style={[styles.row, { marginBottom: 24, ...(titleStyle ?? {}) }]}>
@@ -35,6 +41,7 @@ function StewardList({ listType, stewards, titleStyle, listStyle }: StewardListP
showActions={listType === 'viewStewards'}
key={steward.steward}
profileImage={profileImages[index % profileImages.length]}
userFullName={userFullNames[index]}
/>
))}
</View>
5 changes: 3 additions & 2 deletions packages/app/src/components/StewardsList/StewardsListItem.tsx
Original file line number Diff line number Diff line change
@@ -12,16 +12,17 @@ interface StewardListItemProps {
steward: StewardCollective;
showActions: boolean;
profileImage: string;
userFullName?: string;
}

export const StewardsListItem = (props: StewardListItemProps) => {
const { showActions, steward, profileImage } = props;
const { showActions, steward, profileImage, userFullName } = props;
const { navigate } = useCrossNavigate();

const isVerified = useIsStewardVerified(steward.steward);

const { data: ensName } = useEnsName({ address: steward.steward as `0x${string}`, chainId: 1 });
const userIdentifier = ensName ? ensName : formatAddress(steward.steward, 5);
const userIdentifier = userFullName ?? ensName ?? formatAddress(steward.steward);

const onClickSteward = () => navigate(`/profile/${steward.steward}`);

Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import { ClaimTx } from '../../models/models';
import { formatAddress } from '../../lib/formatAddress';
import { useEnsName } from 'wagmi';
import TransactionListItem from './TransactionListItem';
import { useFetchFullName } from '../../hooks/useFetchFullName';

interface ClaimTransactionListItemProps {
transaction: ClaimTx;
@@ -20,8 +21,9 @@ export function ClaimTransactionListItem({ transaction }: ClaimTransactionListIt
}

const { data: ensName } = useEnsName({ address: userAddress, chainId: 1 });
// TODO: how to get first name and last name of users?
const userIdentifier = multipleStewardsText ?? ensName ?? (userAddress ? formatAddress(userAddress) : 'Unknown');
const userFullName = useFetchFullName(userAddress);
const userIdentifier =
multipleStewardsText ?? userFullName ?? ensName ?? (userAddress ? formatAddress(userAddress) : 'Unknown');

return (
<TransactionListItem
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import { useEnsName } from 'wagmi';
import Decimal from 'decimal.js';
import TransactionListItem from './TransactionListItem';
import { useFlowingBalance } from '../../hooks/useFlowingBalance';
import { useFetchFullName } from '../../hooks/useFetchFullName';

interface SupportTransactionListItemProps {
transaction: SupportTx;
@@ -12,10 +13,9 @@ interface SupportTransactionListItemProps {
export function SupportTransactionListItem({ transaction }: SupportTransactionListItemProps) {
const { hash, networkFee, timestamp, donor } = transaction;

// TODO: how to get first name and last name of users?
const userFullName: string | undefined = undefined;
const userAddress = donor as `0x${string}`;
const { data: ensName } = useEnsName({ address: userAddress, chainId: 1 });
const userFullName = useFetchFullName(userAddress);
const userIdentifier = userFullName ?? ensName ?? formatAddress(userAddress);

const { formatted: formattedAmount } = useFlowingBalance(
2 changes: 0 additions & 2 deletions packages/app/src/components/ViewCollective.tsx
Original file line number Diff line number Diff line change
@@ -39,8 +39,6 @@ interface ViewCollectiveProps {
collective: Collective;
}

// TODO: "See all Stewards" button doesn't work for me and I can't figure out why

function ViewCollective({ collective }: ViewCollectiveProps) {
const { navigate } = useCrossNavigate();
const [isDesktopResolution] = useMediaQuery({
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Text, View } from 'react-native';
import { Steward } from '../../models/models';
import { ethers } from 'ethers';
import { styles } from './styles';
import { calculateGoodDollarAmounts } from '../../lib/calculateGoodDollarAmounts';

20 changes: 20 additions & 0 deletions packages/app/src/components/providers/MongoDbApolloProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React, { createContext, PropsWithChildren, useContext } from 'react';
import { ApolloClient } from '@apollo/client';

type MongoDbApolloProviderProps = {
client: ApolloClient<any>;
};

const MongoDbApolloContext = createContext<ApolloClient<any> | undefined>(undefined);

export const MongoDbApolloProvider = ({ children, client }: PropsWithChildren<MongoDbApolloProviderProps>) => {
return <MongoDbApolloContext.Provider value={client}>{children}</MongoDbApolloContext.Provider>;
};

export const useMongoDbApolloClient = (): ApolloClient<any> => {
const context = useContext(MongoDbApolloContext);
if (!context) {
throw new Error('useMongoDbApollo must be used within a MongoDbApolloProvider');
}
return context;
};
2 changes: 2 additions & 0 deletions packages/app/src/hooks/apollo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './useCreateMongoDbApolloClient';
export * from './useCreateSubgraphApolloClient';
76 changes: 76 additions & 0 deletions packages/app/src/hooks/apollo/useCreateMongoDbApolloClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { ApolloClient, HttpLink, NormalizedCacheObject } from '@apollo/client';
import { useEffect, useState } from 'react';
import * as Realm from 'realm-web';
import { InvalidationPolicyCache, RenewalPolicy } from '@nerdwallet/apollo-cache-policies';
import { AsyncStorageWrapper, persistCache } from 'apollo3-cache-persist';
import AsyncStorage from '@react-native-async-storage/async-storage';

const APP_ID = 'wallet_prod-obclo';
const mongoDbUri = `https://realm.mongodb.com/api/client/v2.0/app/${APP_ID}/graphql`;

export const useCreateMongoDbApolloClient = (): ApolloClient<any> | undefined => {
const [apolloClient, setApolloClient] = useState<ApolloClient<NormalizedCacheObject> | undefined>();

useEffect(() => {
async function initApollo() {
const app = new Realm.App(APP_ID);

async function getValidAccessToken() {
if (!app.currentUser) {
await app.logIn(Realm.Credentials.anonymous());
} else {
await app.currentUser.refreshCustomData();
}
return app.currentUser?.accessToken;
}

const cache = new InvalidationPolicyCache({
invalidationPolicies: {
timeToLive: 3600 * 1000, // 24hr TTL on all types in the cache
renewalPolicy: RenewalPolicy.AccessAndWrite,
types: {
User_profile: {
timeToLive: 3600 * 1000 * 24, // 1 day
},
},
},
});

await persistCache({
cache,
storage: new AsyncStorageWrapper(AsyncStorage),
});

const client = new ApolloClient({
cache,
link: new HttpLink({
uri: mongoDbUri,
fetch: async (uri, options) => {
const accessToken = await getValidAccessToken();
if (!options) {
options = {};
}
if (!options.headers) {
options.headers = {};
}
(options.headers as Record<string, any>).Authorization = `Bearer ${accessToken}`;
return fetch(uri, options);
},
}),
defaultOptions: {
watchQuery: {
fetchPolicy: 'cache-and-network',
},
query: {
fetchPolicy: 'cache-first',
},
},
});
setApolloClient(client);
}

initApollo().catch(console.error);
}, []);

return apolloClient;
};
Loading