Skip to content

Commit f95a734

Browse files
Merge pull request #495 from Itheum/stg
1.20: Gamer Passport, Analytics Page and Mini-BiTz Game Release
2 parents f8be45f + b7052b3 commit f95a734

File tree

39 files changed

+3133
-579
lines changed

39 files changed

+3133
-579
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "explorer-dapp",
33
"description": "Itheum Explorer is a DApp for the public to explore and visualize data within the Itheum protocol",
4-
"version": "1.18.5",
4+
"version": "1.20.0",
55
"author": "Itheum",
66
"license": "GPL-3.0-or-later",
77
"dependencies": {
@@ -52,11 +52,12 @@
5252
"react-dom": "18.2.0",
5353
"react-hot-toast": "2.4.1",
5454
"react-inlinesvg": "3.0.3",
55-
"react-pdf": "9.0.0",
55+
"react-pdf": "9.1.0",
5656
"react-router-dom": "6.23.1",
5757
"react-slick": "0.30.2",
5858
"react-vertical-timeline-component": "3.6.0",
5959
"react-zoom-pan-pinch": "3.4.4",
60+
"recharts": "2.12.7",
6061
"simplex-noise": "4.0.1",
6162
"slick-carousel": "1.8.1",
6263
"tailwind-merge": "2.3.0",

src/appsConfig.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const MULTIVERSX_INFOGRAPHICS_TOKENS: app_token[] = IS_DEVNET
2222
? [
2323
{ tokenIdentifier: "DATANFTFT-e0b917", nonce: 3 },
2424
{ tokenIdentifier: "COLNAMA-539838", nonce: 5 },
25+
{ tokenIdentifier: "DATANFTFT-e0b917", nonce: 454 },
2526
]
2627
: [{ tokenIdentifier: "DATANFTFT-e936d4", nonce: 3 }];
2728

@@ -95,6 +96,8 @@ export const SPREADSHEET_NFTS_TOKENS: app_token[] = IS_DEVNET
9596

9697
export const GET_BITZ_TOKEN: app_token = IS_DEVNET ? { tokenIdentifier: "DATANFTFT-e0b917", nonce: 198 } : { tokenIdentifier: "DATANFTFT-e936d4", nonce: 7 };
9798

99+
export const FEATURED_APPS = IS_DEVNET ? ["getbitz", "nftunes", "itheumtrailblazer"] : ["getbitz", "nftunes", "itheumtrailblazer"];
100+
98101
export const SUPPORTED_APPS = IS_DEVNET
99102
? [
100103
"itheumtrailblazer",
520 KB
Loading
3.94 KB
Loading
-1.21 KB
Binary file not shown.
-1.07 KB
Binary file not shown.
-4.32 KB
Binary file not shown.
-4.93 KB
Binary file not shown.
5.11 KB
Loading

src/components/AudioPlayer/AudioPlayer.tsx

Lines changed: 80 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useEffect, useState } from "react";
22
import { DataNft, ViewDataReturnType } from "@itheum/sdk-mx-data-nft/out";
33
import { ArrowBigLeft, Library, Loader2, Pause, Play, RefreshCcwDot, SkipBack, SkipForward, Volume1, Volume2, VolumeX, XCircle } from "lucide-react";
4+
import toast from "react-hot-toast";
45
import Slider from "react-slick";
56
import "slick-carousel/slick/slick.css";
67
import "slick-carousel/slick/slick-theme.css";
78
import "./AudioPlayer.css";
8-
import toast from "react-hot-toast";
99
import DEFAULT_SONG_IMAGE from "assets/img/audio-player-image.png";
1010
import DEFAULT_SONG_LIGHT_IMAGE from "assets/img/audio-player-light-image.png";
1111
import { decodeNativeAuthToken, getApiDataMarshal, toastError } from "libs/utils";
@@ -22,6 +22,50 @@ type AudioPlayerProps = {
2222
export const AudioPlayer = (props: AudioPlayerProps) => {
2323
const { dataNftToOpen, songs, tokenLogin, firstSongBlobUrl, previewUrl, chainID } = props;
2424

25+
const theme = localStorage.getItem("explorer-ui-theme");
26+
const [currentTrackIndex, setCurrentTrackIndex] = useState(0);
27+
const [currentTime, setCurrentTime] = useState("00:00");
28+
const [displayPlaylist, setDisplayPlaylist] = useState(false);
29+
const [audio] = useState(new Audio());
30+
const [isPlaying, setIsPlaying] = useState(false);
31+
const [volume, setVolume] = useState(0.5);
32+
const [progress, setProgress] = useState(0);
33+
const [duration, setDuration] = useState("00:00");
34+
const [isLoaded, setIsLoaded] = useState(false);
35+
const [songSource, setSongSource] = useState<{ [key: number]: string }>({}); // map to keep the already fetched songs
36+
const settings = {
37+
infinite: false,
38+
speed: 1000,
39+
slidesToShow: 4,
40+
responsive: [
41+
{
42+
breakpoint: 1800,
43+
settings: {
44+
slidesToShow: 3,
45+
},
46+
},
47+
{
48+
breakpoint: 980,
49+
settings: {
50+
slidesToShow: 3,
51+
},
52+
},
53+
54+
{
55+
breakpoint: 730,
56+
settings: {
57+
slidesToShow: 2,
58+
},
59+
},
60+
{
61+
breakpoint: 550,
62+
settings: {
63+
slidesToShow: 1,
64+
},
65+
},
66+
],
67+
};
68+
2569
useEffect(() => {
2670
if (firstSongBlobUrl)
2771
setSongSource((prevState) => ({
@@ -55,54 +99,35 @@ export const AudioPlayer = (props: AudioPlayerProps) => {
5599
};
56100
}, []);
57101

58-
let settings = {
59-
infinite: false,
60-
speed: 1000,
61-
slidesToShow: 4,
62-
responsive: [
63-
{
64-
breakpoint: 1800,
65-
settings: {
66-
slidesToShow: 3,
67-
},
68-
},
69-
{
70-
breakpoint: 980,
71-
settings: {
72-
slidesToShow: 3,
73-
},
74-
},
75-
76-
{
77-
breakpoint: 730,
78-
settings: {
79-
slidesToShow: 2,
80-
},
81-
},
82-
{
83-
breakpoint: 550,
84-
settings: {
85-
slidesToShow: 1,
86-
},
87-
},
88-
],
89-
};
90-
91-
const theme = localStorage.getItem("explorer-ui-theme");
92-
const [currentTrackIndex, setCurrentTrackIndex] = useState(0);
93-
const [currentTime, setCurrentTime] = useState("00:00");
94-
const [displayPlaylist, setDisplayPlaylist] = useState(false);
102+
useEffect(() => {
103+
updateProgress();
104+
}, [audio.src]);
95105

96-
const [audio] = useState(new Audio());
106+
useEffect(() => {
107+
if (firstSongBlobUrl)
108+
setSongSource((prevState) => ({
109+
...prevState, // keep all other key-value pairs
110+
[1]: firstSongBlobUrl, // update the value of the first index
111+
}));
112+
}, [firstSongBlobUrl]);
97113

98-
const [isPlaying, setIsPlaying] = useState(false);
99-
const [volume, setVolume] = useState(0.5);
100-
const [progress, setProgress] = useState(0);
101-
const [duration, setDuration] = useState("00:00");
102-
const [isLoaded, setIsLoaded] = useState(false);
114+
useEffect(() => {
115+
audio.pause();
116+
audio.src = "";
117+
setIsPlaying(false);
118+
setIsLoaded(false);
119+
handleChangeSong();
120+
}, [currentTrackIndex, songSource[songs[currentTrackIndex]?.idx]]);
103121

104-
// map to keep the already fetched songs
105-
const [songSource, setSongSource] = useState<{ [key: number]: string }>({});
122+
useEffect(() => {
123+
if (previewUrl) {
124+
audio.pause();
125+
audio.src = previewUrl;
126+
setIsPlaying(false);
127+
setIsLoaded(false);
128+
handleChangeSong();
129+
}
130+
}, [previewUrl]);
106131

107132
/// format time as minutes:seconds
108133
const formatTime = (_seconds: number) => {
@@ -172,18 +197,6 @@ export const AudioPlayer = (props: AudioPlayerProps) => {
172197
setProgress(_percentage);
173198
};
174199

175-
useEffect(() => {
176-
updateProgress();
177-
}, [audio.src]);
178-
179-
useEffect(() => {
180-
if (firstSongBlobUrl)
181-
setSongSource((prevState) => ({
182-
...prevState, // keep all other key-value pairs
183-
[1]: firstSongBlobUrl, // update the value of the first index
184-
}));
185-
}, [firstSongBlobUrl]);
186-
187200
const togglePlay = () => {
188201
if (isPlaying) {
189202
if (!audio.paused) {
@@ -263,24 +276,6 @@ export const AudioPlayer = (props: AudioPlayerProps) => {
263276
return true;
264277
};
265278

266-
useEffect(() => {
267-
audio.pause();
268-
audio.src = "";
269-
setIsPlaying(false);
270-
setIsLoaded(false);
271-
handleChangeSong();
272-
}, [currentTrackIndex, songSource[songs[currentTrackIndex]?.idx]]);
273-
274-
useEffect(() => {
275-
if (previewUrl) {
276-
audio.pause();
277-
audio.src = previewUrl;
278-
setIsPlaying(false);
279-
setIsLoaded(false);
280-
handleChangeSong();
281-
}
282-
}, [previewUrl]);
283-
284279
const showPlaylist = () => {
285280
if (previewUrl) {
286281
toast.error("This is just a preview. You have to buy the Music Data Nft to see all the songs.", {
@@ -327,11 +322,10 @@ export const AudioPlayer = (props: AudioPlayerProps) => {
327322
/>
328323
</div>
329324

330-
<div className="w-8/12 flex flex-col items-center justify-center">
331-
<h6 className=" truncate text-base text-foreground">{song.title}</h6>
332-
333-
<p className="truncate text-sm text-center text-foreground">{song.artist}</p>
334-
<p className="text-xs text-center text-muted-foreground">{song.album}</p>
325+
<div className="w-8/12 flex flex-col items-center justify-center md:items-start">
326+
<h6 className="!w-[90px] md:!w-[90%] truncate !text-sm text-foreground">{song.title}</h6>
327+
<p className="!w-[90px] md:!w-[90%] truncate !text-sm text-foreground">{song.artist}</p>
328+
<p className="!w-[90px] md:!w-[90%] text-xs text-muted-foreground">{song.album}</p>
335329
</div>
336330
</div>
337331
);
@@ -435,19 +429,19 @@ export const AudioPlayer = (props: AudioPlayerProps) => {
435429
setCurrentTrackIndex(index);
436430
}}
437431
className="mx-auto w-32 xl:w-64 select-none flex flex-col xl:flex-row items-center justify-center bg-[#fafafa]/25 dark:bg-[#0f0f0f]/25 cursor-pointer transition-shadow duration-300 shadow-xl hover:shadow-inner hover:shadow-teal-200 rounded-2xl text-foreground border-[1px] border-foreground/40">
438-
<div className="w-[80%] xl:w-[40%] justify-center">
432+
<div className="w-[70%] xl:w-[40%] justify-center">
439433
<img
440434
src={song.cover_art_url}
441435
alt="Album Cover"
442-
className="h-24 p-2 rounded-md"
436+
className="h-20 p-2 rounded-md m-auto"
443437
onError={({ currentTarget }) => {
444438
currentTarget.src = theme === "light" ? DEFAULT_SONG_LIGHT_IMAGE : DEFAULT_SONG_IMAGE;
445439
}}
446440
/>
447441
</div>
448-
<div className=" xl:w-[60%] flex flex-col justify-center text-center ">
449-
<h6 className=" text-base text-foreground truncate ">{song.title}</h6>
450-
<p className="font-sans text-base font-medium leading-6 text-muted-foreground truncate">{song.artist}</p>
442+
<div className="xl:w-[60%] flex flex-col justify-center text-center">
443+
<h6 className="!w-[90px] md:!w-auto !text-sm text-foreground truncate mr-2 text-center md:text-left">{song.title}</h6>
444+
<p className="font-sans text-sm font-medium leading-6 text-muted-foreground truncate text-center md:text-left">{song.artist}</p>
451445
</div>
452446
</div>
453447
</div>

0 commit comments

Comments
 (0)