Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
33f2d497
Commit
33f2d497
authored
Sep 10, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
b903406f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
7 deletions
+107
-7
NftHtmlFullscreen.tsx
ui/shared/nft/NftHtmlFullscreen.tsx
+25
-0
NftImageFullscreen.tsx
ui/shared/nft/NftImageFullscreen.tsx
+22
-0
NftMedia.tsx
ui/shared/nft/NftMedia.tsx
+34
-7
NftVideoFullscreen.tsx
ui/shared/nft/NftVideoFullscreen.tsx
+26
-0
No files found.
ui/shared/nft/NftHtmlFullscreen.tsx
0 → 100644
View file @
33f2d497
import
{
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
NftMediaFullscreenModal
from
'
./NftMediaFullscreenModal
'
;
interface
Props
{
src
:
string
;
isOpen
:
boolean
;
onClose
:
()
=>
void
;
}
const
NftHtmlWithFullscreen
=
({
src
,
isOpen
,
onClose
}:
Props
)
=>
{
return
(
<
NftMediaFullscreenModal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
>
<
chakra
.
iframe
w=
"90vw"
h=
"90vh"
src=
{
src
}
sandbox=
"allow-scripts"
/>
</
NftMediaFullscreenModal
>
);
};
export
default
NftHtmlWithFullscreen
;
ui/shared/nft/NftImageFullscreen.tsx
0 → 100644
View file @
33f2d497
import
{
Image
,
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
NftMediaFullscreenModal
from
'
./NftMediaFullscreenModal
'
;
interface
Props
{
src
:
string
;
isOpen
:
boolean
;
onClose
:
()
=>
void
;
}
const
NftImageWithFullscreen
=
({
src
,
isOpen
,
onClose
}:
Props
)
=>
{
return
(
<
NftMediaFullscreenModal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
>
<
Image
src=
{
src
}
alt=
"Token instance image"
maxH=
"90vh"
maxW=
"90vw"
/>
</
NftMediaFullscreenModal
>
);
};
export
default
NftImageWithFullscreen
;
ui/shared/nft/NftMedia.tsx
View file @
33f2d497
import
{
AspectRatio
,
chakra
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
AspectRatio
,
chakra
,
Skeleton
,
useDisclosure
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
useInView
}
from
'
react-intersection-observer
'
;
import
{
useInView
}
from
'
react-intersection-observer
'
;
import
NftFallback
from
'
./NftFallback
'
;
import
NftFallback
from
'
./NftFallback
'
;
import
NftHtml
from
'
./NftHtml
'
;
import
NftHtml
from
'
./NftHtml
'
;
import
NftHtml
WithFullscreen
from
'
./NftHtmlWith
Fullscreen
'
;
import
NftHtml
Fullscreen
from
'
./NftHtml
Fullscreen
'
;
import
NftImage
from
'
./NftImage
'
;
import
NftImage
from
'
./NftImage
'
;
import
NftImage
WithFullscreen
from
'
./NftImageWith
Fullscreen
'
;
import
NftImage
Fullscreen
from
'
./NftImage
Fullscreen
'
;
import
NftVideo
from
'
./NftVideo
'
;
import
NftVideo
from
'
./NftVideo
'
;
import
NftVideo
WithFullscreen
from
'
./NftVideoWith
Fullscreen
'
;
import
NftVideo
Fullscreen
from
'
./NftVideo
Fullscreen
'
;
import
useNftMediaType
from
'
./useNftMediaType
'
;
import
useNftMediaType
from
'
./useNftMediaType
'
;
import
{
mediaStyleProps
}
from
'
./utils
'
;
import
{
mediaStyleProps
}
from
'
./utils
'
;
...
@@ -36,6 +36,8 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
...
@@ -36,6 +36,8 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
setIsLoadingError
(
true
);
setIsLoadingError
(
true
);
},
[]);
},
[]);
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
();
const
content
=
(()
=>
{
const
content
=
(()
=>
{
if
(
!
url
||
isLoadingError
)
{
if
(
!
url
||
isLoadingError
)
{
const
styleProps
=
withFullscreen
?
{}
:
mediaStyleProps
;
const
styleProps
=
withFullscreen
?
{}
:
mediaStyleProps
;
...
@@ -46,15 +48,39 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
...
@@ -46,15 +48,39 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
src
:
url
,
src
:
url
,
onLoad
:
handleMediaLoaded
,
onLoad
:
handleMediaLoaded
,
onError
:
handleMediaLoadError
,
onError
:
handleMediaLoadError
,
...(
withFullscreen
?
{
onClick
:
onOpen
}
:
{}),
};
switch
(
type
)
{
case
'
video
'
:
return
<
NftVideo
{
...
props
}
/>;
case
'
html
'
:
return
<
NftHtml
{
...
props
}
/>;
case
'
image
'
:
return
<
NftImage
{
...
props
}
/>;
default
:
return
null
;
}
})();
const
modal
=
(()
=>
{
if
(
!
url
||
!
withFullscreen
)
{
return
null
;
}
const
props
=
{
src
:
url
,
isOpen
,
onClose
,
};
};
switch
(
type
)
{
switch
(
type
)
{
case
'
video
'
:
case
'
video
'
:
return
withFullscreen
?
<
NftVideoWithFullscreen
{
...
props
}
/>
:
<
NftVideo
{
...
props
}
/>;
return
<
NftVideoFullscreen
{
...
props
}
/>;
case
'
html
'
:
case
'
html
'
:
return
withFullscreen
?
<
NftHtmlWithFullscreen
{
...
props
}
/>
:
<
NftHtml
{
...
props
}
/>;
return
<
NftHtmlFullscreen
{
...
props
}
/>;
case
'
image
'
:
case
'
image
'
:
return
withFullscreen
?
<
NftImageWithFullscreen
{
...
props
}
/>
:
<
NftImage
{
...
props
}
/>;
return
<
NftImageFullscreen
{
...
props
}
/>;
default
:
default
:
return
null
;
return
null
;
}
}
...
@@ -77,6 +103,7 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
...
@@ -77,6 +103,7 @@ const NftMedia = ({ url, className, isLoading, withFullscreen }: Props) => {
>
>
<>
<>
{
content
}
{
content
}
{
modal
}
{
isMediaLoading
&&
<
Skeleton
position=
"absolute"
left=
{
0
}
top=
{
0
}
w=
"100%"
h=
"100%"
zIndex=
"1"
/>
}
{
isMediaLoading
&&
<
Skeleton
position=
"absolute"
left=
{
0
}
top=
{
0
}
w=
"100%"
h=
"100%"
zIndex=
"1"
/>
}
</>
</>
</
AspectRatio
>
</
AspectRatio
>
...
...
ui/shared/nft/NftVideoFullscreen.tsx
0 → 100644
View file @
33f2d497
import
{
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
NftMediaFullscreenModal
from
'
./NftMediaFullscreenModal
'
;
import
{
videoPlayProps
}
from
'
./utils
'
;
interface
Props
{
src
:
string
;
isOpen
:
boolean
;
onClose
:
()
=>
void
;
}
const
NftVideoWithFullscreen
=
({
src
,
isOpen
,
onClose
}:
Props
)
=>
{
return
(
<
NftMediaFullscreenModal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
>
<
chakra
.
video
{
...
videoPlayProps
}
src=
{
src
}
maxH=
"90vh"
maxW=
"90vw"
/>
</
NftMediaFullscreenModal
>
);
};
export
default
NftVideoWithFullscreen
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment