Skip to content

Commit

Permalink
upgradin' Vite & its plugins 🎹
Browse files Browse the repository at this point in the history
  • Loading branch information
dysbulic committed Jan 31, 2023
1 parent 8ea153b commit 1af1862
Show file tree
Hide file tree
Showing 14 changed files with 634 additions and 246 deletions.
3 changes: 1 addition & 2 deletions packages/contracts/metadata/assets/fire.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 21 additions & 67 deletions packages/contracts/metadata/assets/max.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 1 addition & 8 deletions packages/contracts/metadata/assets/purple mint.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 54 additions & 1 deletion packages/contracts/metadata/assets/reaper.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions packages/contracts/metadata/assets/scroll.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 2 additions & 11 deletions packages/contracts/metadata/assets/transfer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 11 additions & 52 deletions packages/contracts/metadata/assets/wrench & screwdriver.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"@chakra-ui/react": "^1.8.8",
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@react-three/fiber": "^8.10.1",
"@types/three": "^0.149.0",
"@walletconnect/web3-provider": "^1.8.0",
"dotenv": "^16.0.0",
"ethers": "^5.6.9",
Expand All @@ -36,14 +38,15 @@
"react-hook-form": "^7.34.0",
"react-markdown": "^8.0.3",
"react-router-dom": "^6.3.0",
"util": "^0.12.4",
"three": "^0.149.0",
"util": "^0.12.5",
"web3modal": "^1.9.8"
},
"devDependencies": {
"@babel/core": "^7.18.10",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/preset-flow": "^7.18.6",
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-inject": "^4.0.4",
Expand Down Expand Up @@ -81,8 +84,8 @@
"ts-loader": "^9.3.1",
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"typescript": "^4.7.4",
"vite": "^3.0.0",
"typescript": "^4.9.5",
"vite": "^4.0.4",
"webpack": "^5.74.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.10.0",
Expand Down
30 changes: 30 additions & 0 deletions packages/ui/src/components/ThreeDScene.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { Suspense } from 'react'
import { Canvas } from '@react-three/fiber'
import { Stage, OrbitControls, useGLTF } from '@react-three/drei'

export const Model = ({ model }: { model: string }) => {
const { scene } = useGLTF(model)

return (
<primitive object={scene} />
)
}

export const ThreeDScene = ({ model }: { model: string }) => {

return (
<Canvas>
<Suspense fallback={null}>
<Model {...{ model }}/>
<OrbitControls
autoRotate
autoRotateSpeed={0.05}
enableZoom={false}
makeDefault
minPolarAngle={Math.PI / 2}
maxPolarAngle={Math.PI / 2}
/>
</Suspense>
</Canvas>
)
}
2 changes: 1 addition & 1 deletion packages/ui/src/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const ipfsLinkPattern = (
(typeof IPFS_LINK_PATTERN !== 'undefined') ? (
IPFS_LINK_PATTERN
) : (
'https://{v1cid}.ipfs.nftstorage.link/{path}'
'https://nftstorage.link/{protocol}/{v1cid}/{path}'
)
)
)
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import JSON5 from 'json5'
import { NFTStorage } from 'nft.storage'

export const httpURL = (uri?: Maybe<string>) => {
const [, origCID, path] = (
uri?.match(/^(?:ipfs|dweb):(?:\/\/)?([^/]+)(?:\/(.*))?$/) ?? []
const [, protocol, origCID, path] = (
uri?.match(/^(ip[nf]s):(?:\/\/)?([^/]+)(?:\/(.*))?$/) ?? []
)

if(origCID) {
Expand All @@ -22,6 +22,7 @@ export const httpURL = (uri?: Maybe<string>) => {
return (
encodeURI(
pattern
.replace(/{protocol}/g, protocol)
.replace(/{cid}/g, origCID)
.replace(/{v0cid}/g, v0CID)
.replace(/{v1cid}/g, v1CID)
Expand Down
Loading

0 comments on commit 1af1862

Please sign in to comment.