Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
14cd904
Added: placeholder
DevLubab Oct 22, 2021
5fc6a4d
updated: metadata component
DevLubab Oct 22, 2021
daf09d0
New: NFTE component
DevLubab Oct 22, 2021
7b39548
code cleaning + new useViewNFTMethod hook
DevLubab Oct 25, 2021
8064163
new: useNFTContentType hook
DevLubab Oct 25, 2021
fa97bf9
new: MediaObject component
DevLubab Oct 25, 2021
f42caa4
removed: RenderIframe component
DevLubab Oct 25, 2021
ff0e320
updated: components index
DevLubab Oct 25, 2021
03b13b4
fixed: MediaObject component
DevLubab Oct 25, 2021
c0ad786
Switched to using MediaObject Component
DevLubab Oct 26, 2021
7ce8000
updated hooks index
DevLubab Oct 26, 2021
1f77753
added height and width prop to MediaObject component
DevLubab Oct 26, 2021
77adf3a
code cleaning
DevLubab Oct 26, 2021
37bd7ce
placeholder box for MediaObject Component
DevLubab Oct 26, 2021
208612d
new hooks and updates
DevLubab Oct 29, 2021
27ef10d
NFTE component updates
DevLubab Oct 29, 2021
bd3d58a
Frontend update to match components update
DevLubab Oct 29, 2021
480a488
quick fixes
DevLubab Oct 29, 2021
edfd244
Bugs fixes
DevLubab Oct 30, 2021
72b7f98
Story for Placeholder Component
DevLubab Nov 2, 2021
d397bbc
Updated useNFTViewMethod to use getContractMethods('nft')
DevLubab Nov 2, 2021
ca558cf
Updated frontend to not use gas with nft_token method
DevLubab Nov 2, 2021
477949f
useNFTContentType return media content if it's text
DevLubab Nov 3, 2021
75a19ba
Replaced fetching func from Text component with useNFTContentType
DevLubab Nov 3, 2021
c3e59ff
added hooks test to GitHub Workflow
DevLubab Nov 3, 2021
8d2a4d8
removed hooks README
DevLubab Nov 3, 2021
880af02
Lint
bestatigen Nov 5, 2021
5aff2e7
v0.0.13
bestatigen Nov 5, 2021
502649c
v0.0.5
bestatigen Nov 5, 2021
f5e3555
v0.0.6
bestatigen Nov 5, 2021
00508d8
Pass null as gas instead of undefined
bestatigen Nov 5, 2021
8572513
Update example @cura package
bestatigen Nov 5, 2021
2989cf4
Components | Updadte @cura/hooks
bestatigen Nov 5, 2021
6db39f6
Deploy
bestatigen Nov 5, 2021
0b4d68a
v0.0.14
bestatigen Nov 5, 2021
231a3ee
Examples | Update components
bestatigen Nov 5, 2021
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
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@ jobs:
run: |
yarn install
yarn test
test-hooks:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '15'
- name: 'Test hooks'
working-directory: ./packages/hooks
run: |
yarn install
yarn test
4 changes: 2 additions & 2 deletions examples/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "next start"
},
"dependencies": {
"@cura/components": "0.0.12",
"@cura/hooks": "0.0.4",
"@cura/components": "0.0.14",
"@cura/hooks": "0.0.6",
"@runwayml/hosted-models": "^0.3.0",
"@theme-ui/color": "^0.8.4",
"@theme-ui/match-media": "^0.6.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/frontend/pages/cc/[project]/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import { Button, Text } from 'theme-ui'
import { utils } from 'near-api-js'
import { useRouter } from 'next/router'
import Layout from '../../../containers/Layout'
import { Bidders, RenderIframe, CreatorShare } from '@cura/components'
import { Bidders, CreatorShare, MediaObject } from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../../state/recoil'
import { useSetRecoilState } from 'recoil'
import { mapPathToProject } from 'utils/path-to-project'
import { getFrameWidth } from 'utils/frame-width'
import { useNFTContract, useNFTMethod, useMarketMethod } from '@cura/hooks'
import { useStatusUpdate } from 'utils/hooks-helpers'

const CONTRACT_VIEW_GAS = utils.format.parseNearAmount('0.00000000010') // 100 Tgas
const CONTRACT_BURN_GAS = utils.format.parseNearAmount('0.00000000029') // 290 Tgas
const MARKET_ACCEPT_BID_GAS = utils.format.parseNearAmount('0.00000000025') // 250 Tgas
const YOCTO_NEAR = utils.format.parseNearAmount('0.000000000000000000000001')
Expand All @@ -39,7 +38,7 @@ const CCProjectID = ({}) => {
token_id: router.query.id,
limit: 2,
},
CONTRACT_VIEW_GAS,
undefined,
updateStatus
)

Expand Down Expand Up @@ -107,9 +106,10 @@ const CCProjectID = ({}) => {
}}
>
{media && (
<RenderIframe
<MediaObject
mediaURI={`https://arweave.net/${media.metadata.media}`}
width={frameDimension}
height={frameDimension}
/>
)}
</div>
Expand Down
11 changes: 7 additions & 4 deletions examples/frontend/pages/cc/[project]/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { utils } from 'near-api-js'
import { useRouter } from 'next/router'
import Layout from '../../../containers/Layout'

import { CreatorShare, RenderIframe } from '@cura/components'
import { CreatorShare } from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../../state/recoil'
import { useSetRecoilState } from 'recoil'
import { useNFTContract } from '@cura/hooks'
Expand Down Expand Up @@ -136,10 +136,13 @@ const MLProjectCreate = ({}) => {
}}
>
{creativeCode && (
<RenderIframe
code={creativeCode}
<iframe
srcDoc={creativeCode}
width={frameDimension}
></RenderIframe>
height={frameDimension}
frameBorder="0"
scrolling="no"
></iframe>
)}
</div>
<div
Expand Down
10 changes: 4 additions & 6 deletions examples/frontend/pages/cc/[project]/explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
BidCreate,
Metadata,
CreatorShare,
RenderIframe,
MediaObject,
} from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../../state/recoil'
import { useSetRecoilState } from 'recoil'
Expand Down Expand Up @@ -128,9 +128,10 @@ const Explore = ({}) => {
}}
>
{randomDesign?.metadata?.media && (
<RenderIframe
<MediaObject
mediaURI={`https://arweave.net/${randomDesign?.metadata.media}`}
width={frameDimension}
height={frameDimension}
/>
)}
</div>
Expand All @@ -141,10 +142,7 @@ const Explore = ({}) => {
alignItems: 'center',
}}
>
<Metadata
title={randomDesign?.id}
creator={randomDesign?.owner_id}
/>
<Metadata data={randomDesign} loading={false} />
</div>
<div
sx={{
Expand Down
5 changes: 3 additions & 2 deletions examples/frontend/pages/cc/[project]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Layout from '../../../containers/Layout'
import { useNFTMethod, useNearHooksContainer } from '@cura/hooks'
import Link from 'next/link'
import { mapPathToProject } from 'utils/path-to-project'
import { RenderIframe } from '@cura/components'
import { MediaObject } from '@cura/components'
import { getFrameWidth } from 'utils/frame-width'
import { useStatusUpdate } from 'utils/hooks-helpers'

Expand Down Expand Up @@ -77,9 +77,10 @@ const CCProject = ({}) => {
}}
>
{metadata?.media && (
<RenderIframe
<MediaObject
mediaURI={`https://arweave.net/${metadata.media}`}
width={frameDimension}
height={frameDimension}
/>
)}
</div>
Expand Down
11 changes: 5 additions & 6 deletions examples/frontend/pages/ml/[project]/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import { Button, Flex, Box, Text } from 'theme-ui'
import { utils } from 'near-api-js'
import { useRouter } from 'next/router'
import Layout from '../../../containers/Layout'
import { CreatorShare } from '@cura/components'
import { Bidders } from '@cura/components'
import { CreatorShare, Bidders, MediaObject } from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../../state/recoil'
import { useRecoilValue, useSetRecoilState } from 'recoil'
import { useNFTContract, useNFTMethod, useMarketMethod } from '@cura/hooks'
import { accountState } from 'state/account'
import { getFrameWidth } from 'utils/frame-width'
import { useStatusUpdate } from 'utils/hooks-helpers'
const CONTRACT_VIEW_GAS = utils.format.parseNearAmount('0.00000000010') // 100 Tgas
const CONTRACT_BURN_GAS = utils.format.parseNearAmount('0.00000000029') // 290 Tgas
const MARKET_ACCEPT_BID_GAS = utils.format.parseNearAmount('0.00000000025') // 250 Tgas
const YOCTO_NEAR = utils.format.parseNearAmount('0.000000000000000000000001')
Expand Down Expand Up @@ -42,7 +40,7 @@ const MLProject = ({}) => {
token_id: router.query.id,
limit: 2,
},
CONTRACT_VIEW_GAS,
null,
updateStatus
)

Expand Down Expand Up @@ -110,9 +108,10 @@ const MLProject = ({}) => {
}}
>
{media && (
<img
src={`https://arweave.net/${media.metadata.media}`}
<MediaObject
mediaURI={`https://arweave.net/${media.metadata.media}`}
width={frameDimension}
height={frameDimension}
/>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions examples/frontend/pages/ml/[project]/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { utils } from 'near-api-js'
import { useRouter } from 'next/router'
import Layout from '../../../containers/Layout'
import { HostedModel } from '@runwayml/hosted-models'
import { CreatorShare } from '@cura/components'
import { CreatorShare, MediaObject } from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../../state/recoil'
import { useRecoilValue, useSetRecoilState } from 'recoil'
import { useNFTContract } from '@cura/hooks'
Expand Down Expand Up @@ -170,7 +170,7 @@ const MLProjectCreate = ({}) => {
width: frameDimension,
}}
>
<img src={media} width={frameDimension} />
<MediaObject mediaURI={media} width={frameDimension} />
</div>
<div
sx={{
Expand Down
17 changes: 10 additions & 7 deletions examples/frontend/pages/ml/[project]/explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import { Button, Divider } from 'theme-ui'
import { utils } from 'near-api-js'
import { useRouter } from 'next/router'
import Layout from '../../../containers/Layout'
import { BidCreate, Metadata, CreatorShare } from '@cura/components'
import {
BidCreate,
Metadata,
CreatorShare,
MediaObject,
} from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../../state/recoil'
import { useRecoilValue, useSetRecoilState } from 'recoil'
import {
Expand Down Expand Up @@ -125,9 +130,10 @@ const Explore = ({}) => {
}}
>
{randomDesign?.metadata.media && (
<img
src={`https://arweave.net/${randomDesign?.metadata.media}`}
<MediaObject
mediaURI={`https://arweave.net/${randomDesign?.metadata.media}`}
width={frameDimension}
height={frameDimension}
/>
)}
</div>
Expand All @@ -138,10 +144,7 @@ const Explore = ({}) => {
alignItems: 'center',
}}
>
<Metadata
title={randomDesign?.id}
creator={randomDesign?.owner_id}
/>
<Metadata data={randomDesign} loading={false} />
</div>
<div
sx={{
Expand Down
6 changes: 4 additions & 2 deletions examples/frontend/pages/ml/[project]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useNFTMethod, useNearHooksContainer } from '@cura/hooks'
import Link from 'next/link'
import { getFrameWidth } from 'utils/frame-width'
import { useStatusUpdate } from 'utils/hooks-helpers'
import { MediaObject } from '@cura/components'

const CONTRACT_VIEW_GAS = utils.format.parseNearAmount('0.00000000010') // 100 Tgas

Expand Down Expand Up @@ -56,9 +57,10 @@ const MLProject = ({}) => {
},
}}
>
<img
src={`https://arweave.net/${metadata.media}`}
<MediaObject
mediaURI={`https://arweave.net/${metadata.media}`}
width={frameDimension}
height={frameDimension}
/>
</div>
</Link>
Expand Down
11 changes: 7 additions & 4 deletions examples/frontend/pages/share/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useState } from 'react'
import { Button, Text } from 'theme-ui'
import { utils } from 'near-api-js'
import Layout from '../../containers/Layout'
import { CreatorShare, RenderIframe } from '@cura/components'
import { CreatorShare } from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../state/recoil'
import { useSetRecoilState } from 'recoil'
import { useNFTContract } from '@cura/hooks'
Expand Down Expand Up @@ -128,10 +128,13 @@ const Create = ({}) => {
}}
>
{creativeCode && (
<RenderIframe
code={creativeCode}
<iframe
srcDoc={creativeCode}
width={frameDimension}
></RenderIframe>
height={frameDimension}
frameBorder="0"
scrolling="no"
></iframe>
)}
</div>
<div
Expand Down
10 changes: 4 additions & 6 deletions examples/frontend/pages/share/explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import Layout from '../../containers/Layout'
import {
BidCreate,
Metadata,
RenderIframe,
CreatorShare,
MediaObject,
} from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../state/recoil'
import { useSetRecoilState } from 'recoil'
Expand Down Expand Up @@ -121,9 +121,10 @@ const Explore = ({}) => {
}}
>
{randomDesign.metadata.media && (
<RenderIframe
<MediaObject
mediaURI={`https://arweave.net/${randomDesign.metadata.media}`}
width={designDimension}
height={designDimension}
/>
)}
</div>
Expand All @@ -134,10 +135,7 @@ const Explore = ({}) => {
alignItems: 'center',
}}
>
<Metadata
title={randomDesign?.metadata.title}
creator={randomDesign?.owner_id}
/>
<Metadata data={randomDesign} loading={false} />
</div>
<div
sx={{
Expand Down
7 changes: 3 additions & 4 deletions examples/frontend/pages/share/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
import { Button } from 'theme-ui'
import { utils } from 'near-api-js'
import Layout from '../../containers/Layout'
import { CreatorShare } from '@cura/components'
import { Bidders } from '@cura/components'
import { CreatorShare, Bidders, MediaObject } from '@cura/components'
import { alertMessageState, indexLoaderState } from '../../state/recoil'
import { useSetRecoilState } from 'recoil'
import { useNFTMethod, useNFTContract } from '@cura/hooks'
import { RenderIframe } from '@cura/components'
import { getFrameWidth } from 'utils/frame-width'
import { useNearHooksContainer, useMarketMethod } from '@cura/hooks'
import { useStatusUpdate } from 'utils/hooks-helpers'
Expand Down Expand Up @@ -104,9 +102,10 @@ const View = ({}) => {
}}
>
{media?.[0]?.metadata?.media && (
<RenderIframe
<MediaObject
mediaURI={`https://arweave.net/${media[0].metadata.media}`}
width={mediaDimension}
height={mediaDimension}
/>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cura/components",
"version": "0.0.12",
"version": "0.0.14",
"description": "Components for front-ends on NEAR blockchain",
"source": "src/index.ts",
"main": "dist/index.js",
Expand All @@ -18,6 +18,8 @@
"author": "Yassine",
"license": "MIT",
"dependencies": {
"@cura/hooks": "0.0.6",
"@theme-ui/match-media": "^0.12.0",
"@theme-ui/presets": "^0.6.0",
"near-api-js": "^0.42.0",
"react": "^17.0.1",
Expand Down
Loading