Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Commit

Permalink
Merge branch 'feature/glb-support' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Candinya committed Sep 7, 2021
2 parents 01fa350 + 0ce9ef5 commit 50ea158
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 17 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"homepage": "https://github.com/NaturalSelectionLabs/RSS3-Page#readme",
"dependencies": {
"@google/model-viewer": "1.8.0",
"@sentry/tracing": "6.11.0",
"@sentry/vue": "6.11.0",
"@walletconnect/web3-provider": "1.6.5",
Expand Down
59 changes: 42 additions & 17 deletions src/components/NFT/NFTItem.vue
Original file line number Diff line number Diff line change
@@ -1,35 +1,60 @@
<template>
<img
v-if="!(imageUrl?.endsWith('mp4') || imageUrl?.endsWith('mov'))"
<div
:style="{
width: size + 'px',
height: size + 'px',
}"
:src="imageUrl"
class="nft-item"
/>
<video
v-else
:style="{
width: size + 'px',
height: size + 'px',
}"
:src="imageUrl"
class="nft-item"
autoplay
loop
muted
/>
>
<video
v-if="imageUrl?.endsWith('mp4') || imageUrl?.endsWith('mov')"
:src="imageUrl"
class="nft-item"
:style="{
width: size + 'px',
height: size + 'px',
}"
autoplay
loop
muted
/>
<model-viewer
v-else-if="imageUrl?.endsWith('glb')"
:src="imageUrl"
class="nft-item"
:style="{
width: size + 'px',
height: size + 'px',
}"
ar
ar-modes="webxr scene-viewer quick-look"
environment-image="neutral"
auto-rotate
camera-controls
/>
<img
v-else
:src="imageUrl"
class="nft-item"
:style="{
width: size + 'px',
height: size + 'px',
}"
/>
</div>
</template>

<script lang="ts">
import { Vue, Options } from 'vue-class-component';
import * as viewer from '@google/model-viewer';
@Options({
props: {
size: Number,
imageUrl: String,
},
components: {
viewer,
},
})
export default class NFTItem extends Vue {
size!: Number;
Expand Down
4 changes: 4 additions & 0 deletions src/types/model-viewer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '@google/model-viewer' {
const viewer: any;
export default viewer;
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,11 @@
"@ethersproject/properties" "^5.4.0"
"@ethersproject/strings" "^5.4.0"

"@google/[email protected]":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@google/model-viewer/-/model-viewer-1.8.0.tgz#398c0d9bbd3281933a3a4e6ed8f02da6789df768"
integrity sha512-qUwlu4q+sEFs2XOztZpaT5sGdv9G76jyLzEOdttcfAFb0/ZE0HnXU1KPN3Pq5gvdg+jW7fDUUHhsMxM1OBnpUQ==

"@metamask/safe-event-emitter@^2.0.0":
version "2.0.0"
resolved "https://registry.npm.taobao.org/@metamask/safe-event-emitter/download/@metamask/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c"
Expand Down

0 comments on commit 50ea158

Please sign in to comment.