59db4c5b02
* Add colors and type and fix everywhere * fix text.tsx * Color and text adjustments * Further tweaks * Removed promotional gradient Changed to pink * Add new icons and tweak broken colors * Kill shadows Removes shadows from NFT cards, Pools and Tokens tables * Update icons Update filled and info icons to filled versions * Update bag icon Changed to fill style * Change share icon Changed to the new filled arrow * Fix merge errors * update tests * Complete find and replace old colors * Fix colors on pool pages * Update index.test.tsx.snap * fix header hover states * update test * Update connect button hover state * Update styles design bash * Update tests * Update fonts * fix buy button font weight * update tests * fix jumping input boxes * lint * lints * update tests * redo auth header * fix issues * fix snapshots * use individual weights instead of variable for nicer $ signn * update tests * make dark mode glow distinct * remove commented out code * icons in react * update textSecondary * fix feedback * port over token test fix * lint * fix: make popups appear above drawer and near top conditionally only when drawer is open * Revert "fix: make popups appear above drawer and near top conditionally only when drawer is open" This reverts commit 994697144374ae3fc0cdf9275bce538fda5fc8de. --------- Co-authored-by: Callil Capuozzo <callil.capuozzo@gmail.com> Co-authored-by: pp-hh-ii-ll <111304124+pp-hh-ii-ll@users.noreply.github.com> Co-authored-by: Callil Capuozzo <callil@uniswap.org> |
||
---|---|---|
.. | ||
__snapshots__ | ||
api/image | ||
components | ||
nfts | ||
tokens | ||
utils | ||
[[index]].ts | ||
babel.config.js | ||
client.ts | ||
constants.ts | ||
default.test.ts | ||
global-setup.ts | ||
global-teardown.ts | ||
global.d.ts | ||
jest.config.json | ||
README.md | ||
setupAfterEnv.ts | ||
tsconfig.json | ||
types.d.ts |
Cloudflare Cloud Functions
Purpose
These functions utilize Cloudflare Functions to dynamically inject meta tags server side for richer link sharing capabilities.
Functions
Currently, there are 2 types of cloudflare functions developed
- Meta Data Injectors - Workers that inject Open Graph standardized meta tags into the
header
of specific webpages.- Currently we support this functionaltiy for three separate webpages: NFT Assets, NFT Collections, and Token Detail Pages
- These functions query data from GraphQL and then formats them into HTML
meta
tags to be injected
- Dynamically Generated Images - Utilizes Vercel's Open Graph Image Generation Library to create custom thumbnails for specific webpages
- Currently supports NFT Assets, NFT Collections, and Token Detail Pages
- These functions query data from GraphQL, and utilize
Satori
to convert HTML into a png image response which is then returned when the api is called. - Can be found in the
api/image
folder.
Testing
Testing is done utilizing a custom jest environment as well as Cloudflare's local tester: wrangler
. Wrangler enables testing locally by running a proxy to wrap localhost
. Testing can be done the following ways.
- Manually by running
yarn start:cloud
to setup wrangler onlocalhost:3000
- Automated tests by running
yarn test:cloud
to setup both a jest and wrangler environment and automatically test features
Deployment
Functions will be deployed to Cloudlfare where they will be ran automatically when the appropriate route is hit.
Miscellaneous
- Caching: In order to speed up webpage requests, repeated GraphQL queries will be saved and pulled using Cloudflare's Cache API.
Scripts
-
yarn start:cloud
(NODE_OPTIONS=--dns-result-order=ipv4first PORT=3001 npx wrangler pages dev --node-compat --proxy=3001 --port=3000 -- yarn start), script to start local wrangler environmentnpx wrangler pages dev
: this basis of this command which starts a local instance of wrangler to test cloud functions--node-compat
: wrangler option that enables compatibility with Node.js modules--proxy:3001
: telling the proxy to listen on port 3001--port=3000
: telling wrangler to run our proxy on port 3000NODE_OPTIONS=--dns-result-order=ipv4first
: wrangler still serves to IPv4 which isn't compatible with Node 18 which default resolves to IPv6 so we need to specify to serve to IPv4PORT-3001 --yarn start
: runs default yarn start on port 3001
-
yarn test:cloud
(NODE_OPTIONS=--experimental-vm-modules yarn jest functions --watch --config=functions/jest.config.json), script to test cloud functions with jestNODE_OPTIONS=--experimental-vm-modules
: support for ES Modules and Web Assembly--config=functions/jest.config.json
: specifying which config file to use
Additional Documents