3030 'is-12 is-theatre': viewMode === 'theatre',
3131 'is-6 is-offset-3': viewMode === 'default',
3232 }"
33+ @mouseenter =" showNavigation = true"
34+ @mouseleave =" showNavigation = false"
3335 >
3436 <div
3537 v-orientation ="
6365 :mimeType =" mimeType"
6466 />
6567 </div >
68+ <Navigation v-if =" nftsFromSameCollection && nftsFromSameCollection.length > 1" :showNavigation =" showNavigation" :items =" nftsFromSameCollection" :currentId =" nft.id" />
69+
6670 </div >
6771 <button
6872 id =" fullscreen-view"
@@ -191,6 +195,7 @@ import { notificationTypes, showNotification } from '@/utils/notification';
191195
192196import isShareMode from ' @/utils/isShareMode' ;
193197import nftById from ' @/queries/nftById.graphql' ;
198+ import nftListIdsByCollection from ' @/queries/nftListIdsByCollection.graphql' ;
194199import { fetchNFTMetadata } from ' ../utils' ;
195200import { get , set } from ' idb-keyval' ;
196201import { MediaType } from ' ../types' ;
@@ -237,6 +242,7 @@ import Orientation from '@/directives/DeviceOrientation';
237242 History : () => import (' @/components/rmrk/Gallery/History.vue' ),
238243 Money : () => import (' @/components/shared/format/Money.vue' ),
239244 Name : () => import (' @/components/rmrk/Gallery/Item/Name.vue' ),
245+ Navigation : () => import (' @/components/rmrk/Gallery/Item/Navigation.vue' ),
240246 Sharing : () => import (' @/components/rmrk/Gallery/Item/Sharing.vue' ),
241247 Appreciation : () => import (' ./Appreciation.vue' ),
242248 MediaResolver : () => import (' ../Media/MediaResolver.vue' ),
@@ -255,6 +261,7 @@ export default class GalleryItem extends Vue {
255261 // private accountId: string = '';
256262 private passsword = ' ' ;
257263 private nft: NFT = emptyObject <NFT >();
264+ private nftsFromSameCollection: NFT [] = [];
258265 private imageVisible = true ;
259266 private viewMode = ' default' ;
260267 private isFullScreenView = false ;
@@ -264,6 +271,7 @@ export default class GalleryItem extends Vue {
264271 public emotes: Emote [] = [];
265272 public message = ' ' ;
266273 public priceChartData: [Date , number ][][] = [];
274+ public showNavigation = false ;
267275
268276 get accountId() {
269277 return this .$store .getters .getAuthAddress ;
@@ -278,7 +286,7 @@ export default class GalleryItem extends Vue {
278286
279287 try {
280288 // const nft = await rmrkService.getNFT(this.id);
281- this .$apollo .addSmartQuery (' nft' , {
289+ await this .$apollo .addSmartQuery (' nft' , {
282290 query: nftById ,
283291 variables: {
284292 id: this .id ,
@@ -287,7 +295,12 @@ export default class GalleryItem extends Vue {
287295 ... nFTEntity ,
288296 emotes: nFTEntity ?.emotes ?.nodes ,
289297 }),
290- result : () => this .fetchMetadata (),
298+ result : () => {
299+ Promise .all ([
300+ this .fetchMetadata (),
301+ this .fetchCollectionItems ()
302+ ]);
303+ },
291304 pollInterval: 5000 ,
292305 });
293306 } catch (e ) {
@@ -305,6 +318,36 @@ export default class GalleryItem extends Vue {
305318 this .priceChartData = data ;
306319 }
307320
321+ public async fetchCollectionItems() {
322+ const collectionId = (this .nft as any )?.collectionId ;
323+ if (collectionId ) {
324+ // cancel request and get ids from store in case we already fetched collection data before
325+ if (this .$store .state .history ?.currentCollection ?.id === collectionId ) {
326+ this .nftsFromSameCollection = this .$store .state .history .currentCollection ?.nftIds || []
327+ return
328+ }
329+ try {
330+ const nfts = await this .$apollo .query ({
331+ query: nftListIdsByCollection ,
332+ variables: {
333+ id: collectionId ,
334+ },
335+ })
336+
337+ const {
338+ data : {
339+ nFTEntities
340+ }
341+ } = nfts
342+
343+ this .nftsFromSameCollection = nFTEntities ?.nodes .map ((n : { id: string }) => n .id ) || []
344+ this .$store .dispatch (' history/setCurrentCollection' , { id: collectionId , nftIds: this .nftsFromSameCollection })
345+ } catch (e ) {
346+ showNotification (` ${e } ` , notificationTypes .warn );
347+ }
348+ }
349+ }
350+
308351 public async fetchMetadata() {
309352 if (this .nft [' metadata' ] && ! this .meta [' image' ]) {
310353 const m = await get (this .nft .metadata );
0 commit comments