@ludo.ninja/components 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,130 +0,0 @@
1
- import React from 'react';
2
-
3
- import Accordion from 'react-bootstrap/Accordion';
4
- import styled from 'styled-components';
5
-
6
- import { adaptiveValueCalc } from '@ludo.ninja/ui/build/utils/4k';
7
-
8
- import { mediaQuery } from '@/styles/ScreenWidth';
9
-
10
- import { H3 } from '@system';
11
-
12
- import AssetEntity from '@/dto/AssetEntity';
13
-
14
- import { Category } from '../category';
15
- import { Information } from '../information';
16
- import { Properties } from '../properties';
17
-
18
- type DetailsAccordeonProps = {
19
- asset: AssetEntity;
20
- };
21
-
22
- const StyledAccordion = styled.div`
23
- .accordion {
24
- width: 100%;
25
-
26
- &-header {
27
- .accordion-button::after {
28
- transform: rotate(90deg);
29
- background-image: url('/tabs/arrow_right_dark.svg');
30
- width: 24px;
31
- height: 24px;
32
- background-size: 100%;
33
- }
34
-
35
- .accordion-button:not(.collapsed)::after {
36
- transform: rotate(-90deg);
37
- }
38
- }
39
-
40
- &-item {
41
- border: none;
42
- border-radius: 0;
43
- background: transparent;
44
- }
45
-
46
- &-body {
47
- padding: 10px 0;
48
- }
49
-
50
- &-button {
51
- padding: 10px 0;
52
- color: inherit;
53
- box-shadow: none;
54
- background: transparent;
55
-
56
- &:not(.collapsed) {
57
- background: transparent;
58
- }
59
- }
60
- }
61
-
62
- ${mediaQuery.minWidthFourK} {
63
- .accordion {
64
- &-header {
65
- .accordion-button::after {
66
- width: ${adaptiveValueCalc(24)};
67
- height: ${adaptiveValueCalc(24)};
68
- }
69
- }
70
-
71
- &-body {
72
- padding: ${adaptiveValueCalc(10)} 0;
73
- }
74
-
75
- &-button {
76
- padding: ${adaptiveValueCalc(10)} 0;
77
- }
78
- }
79
- }
80
- `;
81
-
82
- const StyledCategoryH3 = styled(H3)`
83
- padding-top: 10px;
84
- margin-bottom: 20px;
85
-
86
- ${mediaQuery.minWidthFourK} {
87
- padding-top: ${adaptiveValueCalc(10)};
88
- margin-bottom: ${adaptiveValueCalc(20)};
89
- }
90
- `;
91
-
92
- export const DetailsAccordeon = ({ asset }: DetailsAccordeonProps) => {
93
- const attributes = asset.getAttributes();
94
-
95
- return (
96
- <StyledAccordion>
97
- <Accordion defaultActiveKey="1" style={{ width: '100%' }}>
98
- {(attributes.length && (
99
- <>
100
- <Accordion.Item eventKey="0">
101
- <Accordion.Header>
102
- <H3>Properties</H3>
103
- </Accordion.Header>
104
- <Accordion.Body>
105
- <Properties attributes={attributes} />
106
- </Accordion.Body>
107
- </Accordion.Item>
108
- <hr />
109
- </>
110
- )) ||
111
- null}
112
- <Accordion.Item eventKey="1">
113
- <Accordion.Header>
114
- <H3>Chain Info</H3>
115
- </Accordion.Header>
116
- <Accordion.Body>
117
- <Information asset={asset} />
118
- </Accordion.Body>
119
- </Accordion.Item>
120
- <hr />
121
- {asset.getCategory() && (
122
- <>
123
- <StyledCategoryH3>Category</StyledCategoryH3>
124
- <Category asset={asset} />
125
- </>
126
- )}
127
- </Accordion>
128
- </StyledAccordion>
129
- );
130
- };
@@ -1,299 +0,0 @@
1
- import React, { useMemo } from 'react';
2
-
3
- import Skeleton from 'react-loading-skeleton';
4
- import styled from 'styled-components';
5
-
6
- import { authCookies } from '@ludo.ninja/api';
7
- import { alertVariants } from '@ludo.ninja/ui/build/system/Alert/type';
8
- import { adaptiveValueCalc } from '@ludo.ninja/ui/build/utils/4k';
9
- import { copyToClipboard } from '@ludo.ninja/utils';
10
-
11
- import { useUserStore } from '@/modules/user/store';
12
-
13
- import { useUiStore } from '@/store/ui';
14
-
15
- import useFetchDynamicAssetLikes from '@/api/server-assets/queries/useFetchDynamicAssetLikes';
16
-
17
- import { ScreenWidth, mediaQuery } from '@/styles/ScreenWidth';
18
- import { BlackColor, TextDarkGrayColor, TextGrayColor } from '@/styles/colors';
19
-
20
- import AssetLikes from '@/components/assetPage/assetLikes';
21
- import { MoreDropDown } from '@/components/assetPage/moreDropDown';
22
- import AddAssetToFavoriteList from '@/components/favoriteList/add/addAssetToFavoriteList';
23
- import AddAssetToGallery from '@/components/gallery/add/addAssetToGallery';
24
- // import MoreIcon from '@/public/creation/card/moreBtn.svg';
25
- import ShareDialog from '@/components/shareDialog';
26
-
27
- import IconWithButton from '@/system/Buttons/IconWithButton';
28
- import StyledLikes from '@/system/Cards/Styles/Likes';
29
-
30
- import { Flex } from '@system';
31
-
32
- import { getAdaptiveValueWithCheck4k } from '@/utils/adaptive/check4k';
33
- import { getAdaptiveScale } from '@/utils/adaptive/scale';
34
- import { useWindowDimensionsWithServerInitial } from '@/utils/screen';
35
-
36
- import AssetEntity from '@/dto/AssetEntity';
37
-
38
- import GalleryIcon from '@/public/assetPage/favorite.svg';
39
- import FavoriteIcon from '@/public/assetPage/flag.svg';
40
- import ShareIcon from '@/public/assetPage/shareWithDots.svg';
41
-
42
- const ImageDetails = styled.div`
43
- margin-top: 16px;
44
- display: flex;
45
- justify-content: space-between;
46
- align-items: center;
47
- width: 510px;
48
-
49
- ${mediaQuery.desktop} {
50
- width: 335px;
51
- margin-top: 16px;
52
- }
53
-
54
- @media (max-width: 767px) {
55
- margin-top: 24px;
56
- align-items: center;
57
- width: 100%;
58
- margin-right: 0;
59
- }
60
-
61
- h5:hover {
62
- color: ${BlackColor};
63
- }
64
-
65
- ${StyledLikes} {
66
- margin-right: 20px;
67
- cursor: pointer;
68
- }
69
-
70
- .icon.liked {
71
- path {
72
- fill: #f94c66;
73
- }
74
- }
75
-
76
- .shareIconStyle {
77
- path {
78
- stroke: none;
79
- fill: ${TextDarkGrayColor};
80
- }
81
-
82
- :hover {
83
- path {
84
- fill: ${TextGrayColor};
85
- }
86
- }
87
- }
88
-
89
- ${mediaQuery.minWidthFourK} {
90
- margin-top: ${adaptiveValueCalc(16)};
91
- width: ${adaptiveValueCalc(510)};
92
-
93
- ${StyledLikes} {
94
- margin-right: ${adaptiveValueCalc(20)};
95
- }
96
- }
97
- `;
98
-
99
- const SIconResizeWrapper = styled.div`
100
- display: flex;
101
- align-items: center;
102
- justify-content: center;
103
-
104
- ${mediaQuery.minWidthFourK} {
105
- width: ${adaptiveValueCalc(16)};
106
- height: ${adaptiveValueCalc(16)};
107
- }
108
- `;
109
-
110
- export const Figcaption = ({ asset }: { asset: AssetEntity | null }) => {
111
- const isSignedIn = useUserStore((state) => state.isSignedIn);
112
- const getUser = useUserStore((state) => state.user);
113
-
114
- const { likesByUser, isLikedByUser, loading } = useFetchDynamicAssetLikes({
115
- assetId: asset?.getAssetId() || '',
116
- });
117
-
118
- const url =
119
- typeof window !== 'undefined'
120
- ? window.location.origin + window.location.pathname
121
- : null;
122
- const { openModal, closeModal, openModalSidebarPortal, openAlert } =
123
- useUiStore((state) => ({
124
- openModal: state.openModal,
125
- closeModal: state.closeModal,
126
- openAlert: state.openAlert,
127
- openModalSidebarPortal: state.openModalSidebarPortal,
128
- }));
129
-
130
- const { userId } = authCookies.getCookies();
131
-
132
- const { windowDimensions, isMobile } = useWindowDimensionsWithServerInitial();
133
- const currentDimensions = windowDimensions?.windowWidth || 1440;
134
-
135
- // const isCreator = useMemo(
136
- // () =>
137
- // Boolean(
138
- // asset?.getCreatorsProfiles() &&
139
- // asset
140
- // ?.getCreatorsProfiles()
141
- // .filter((item: schema.IProfile) => item?.userId === userId)
142
- // ),
143
- // [asset?.getCreatorsProfiles()]
144
- // );
145
- const isOwner = useMemo(
146
- () =>
147
- asset?.getOwnersProfiles().filter((item) => item?.userId === userId)
148
- .length !== 0,
149
- [asset?.getOwnersProfiles()]
150
- );
151
-
152
- const onShareBtnClick = () => {
153
- const title = asset?.getName() || undefined;
154
-
155
- openModal(
156
- <ShareDialog
157
- link={url}
158
- onHide={closeModal}
159
- params={{
160
- telegram: {
161
- title,
162
- },
163
- whatsapp: {
164
- title,
165
- },
166
- twitter: {
167
- title,
168
- hashtags: ['ludo', 'nft'],
169
- },
170
- reddit: {
171
- title,
172
- },
173
- facebook: {
174
- quote: title,
175
- hashtag: '#ludo',
176
- },
177
- }}
178
- />
179
- );
180
- };
181
-
182
- const onAddFavoriteClick = () =>
183
- openModalSidebarPortal(
184
- <AddAssetToFavoriteList ids={[asset?.getAssetId() as string]} />
185
- );
186
- const onAddGalleryClick = () =>
187
- openModalSidebarPortal(
188
- <AddAssetToGallery ids={[asset?.getAssetId() as string]} />
189
- );
190
-
191
- return (
192
- <ImageDetails>
193
- <Flex alignItems="center">
194
- {loading ? (
195
- <Skeleton
196
- style={{
197
- borderRadius: `${getAdaptiveValueWithCheck4k({
198
- windowDimensions,
199
- currentSize: 3,
200
- })}px`,
201
- marginRight: `${getAdaptiveValueWithCheck4k({
202
- windowDimensions,
203
- currentSize: 16.8,
204
- })}px`,
205
- }}
206
- height="100%"
207
- width={`${getAdaptiveValueWithCheck4k({
208
- windowDimensions,
209
- currentSize: 30,
210
- })}px`}
211
- />
212
- ) : (
213
- <AssetLikes
214
- assetId={asset?.getAssetId() || ''}
215
- isLikedByUser={isLikedByUser}
216
- likesByUser={likesByUser}
217
- />
218
- )}
219
-
220
- {isSignedIn && (
221
- <>
222
- {((asset?.getCreatorsAddresses() &&
223
- asset?.getCreatorsAddresses()?.[0] === getUser?.wallets[0]) ||
224
- isOwner) && (
225
- <IconWithButton
226
- variant={'figcaption'}
227
- text={
228
- currentDimensions > ScreenWidth.DESKTOP
229
- ? 'Add to Gallery'
230
- : '+ Gallery'
231
- }
232
- onClick={onAddGalleryClick}
233
- >
234
- <SIconResizeWrapper>
235
- <GalleryIcon
236
- style={getAdaptiveScale({
237
- windowDimensions,
238
- currentSize: 1,
239
- })}
240
- />
241
- </SIconResizeWrapper>
242
- </IconWithButton>
243
- )}
244
- <IconWithButton
245
- variant={'figcaption'}
246
- text={
247
- currentDimensions > ScreenWidth.DESKTOP
248
- ? 'Add to Favourite list'
249
- : '+Fave list'
250
- }
251
- onClick={onAddFavoriteClick}
252
- >
253
- <SIconResizeWrapper>
254
- <FavoriteIcon
255
- style={getAdaptiveScale({ windowDimensions, currentSize: 1 })}
256
- />
257
- </SIconResizeWrapper>
258
- </IconWithButton>
259
- </>
260
- )}
261
- </Flex>
262
- <Flex>
263
- {!isMobile && (
264
- <IconWithButton variant={'share'} text={''} onClick={onShareBtnClick}>
265
- <SIconResizeWrapper>
266
- <ShareIcon
267
- className="shareIconStyle"
268
- style={getAdaptiveScale({ windowDimensions, currentSize: 1 })}
269
- />
270
- </SIconResizeWrapper>
271
- </IconWithButton>
272
- )}
273
-
274
- <MoreDropDown
275
- items={[
276
- // {
277
- // id: 'make',
278
- // title: 'Make profile picture',
279
- // },
280
- {
281
- id: 'copy',
282
- title: 'Copy link',
283
- async onClick() {
284
- await copyToClipboard(window.location.href);
285
- openAlert({
286
- type: alertVariants.copied,
287
- });
288
- },
289
- },
290
- // {
291
- // id: 'Hide',
292
- // title: 'Hide'
293
- // }
294
- ]}
295
- />
296
- </Flex>
297
- </ImageDetails>
298
- );
299
- };
@@ -1,13 +0,0 @@
1
- export { Participants } from './participants';
2
- export { Title } from './tittle';
3
- export { AssetMedia } from './assetNft';
4
- export { PriceRank } from './priceRank';
5
- export { Properties } from './properties';
6
- export { Information } from './information';
7
- export { DetailsAccordeon } from './detailsAccordeon';
8
- export { Description } from './description';
9
- export { MarketPlaces } from './marketPlaces';
10
- export { CollectionSlider } from './slider';
11
- export { AudioVideoPlayer } from './audioVideoPlayer';
12
- export { Viewer3D } from './viewer3D';
13
- export { Figcaption } from './figCaption';
@@ -1,194 +0,0 @@
1
- import React, { CSSProperties } from 'react';
2
-
3
- import Link from 'next/link';
4
-
5
- import moment from 'moment';
6
- import styled from 'styled-components';
7
-
8
- import { BlackColor } from '@ludo.ninja/ui/build/styles/colors';
9
- import { adaptiveValueCalc } from '@ludo.ninja/ui/build/utils/4k';
10
- import { shortenedText } from '@ludo.ninja/utils';
11
-
12
- import { mediaQuery } from '@/styles/ScreenWidth';
13
- import { AccentColor, TextGrayColor } from '@/styles/colors';
14
-
15
- import { Flex, H5 } from '@system';
16
-
17
- import { CopyButton } from '@/utils/copyBtn';
18
- import { getStaticENVDomain } from '@/utils/env';
19
- import { useWindowDimensions } from '@/utils/screen';
20
-
21
- import AssetEntity from '@/dto/AssetEntity';
22
-
23
- import { poppinsFontVarCss } from '@/fonts/vars';
24
-
25
- type InformationProps = {
26
- asset: AssetEntity;
27
- };
28
-
29
- const StyledImage = styled.img`
30
- border-radius: 50%;
31
- width: 16px;
32
- height: 16px;
33
- ${mediaQuery.minWidthFourK} {
34
- width: ${adaptiveValueCalc(16)};
35
- height: ${adaptiveValueCalc(16)};
36
- }
37
- `;
38
-
39
- const BoxOverflow = styled.div`
40
- text-align: right;
41
- white-space: nowrap;
42
- width: 90px;
43
- overflow: hidden;
44
- text-overflow: ellipsis;
45
-
46
- ${mediaQuery.minWidthFourK} {
47
- width: ${adaptiveValueCalc(90)};
48
- }
49
- `;
50
-
51
- const FlexOverflow = styled(Flex)`
52
- justify-content: space-between;
53
- gap: 8px;
54
- margin-bottom: 8px;
55
-
56
- * {
57
- white-space: nowrap;
58
- }
59
-
60
- ${mediaQuery.minWidthFourK} {
61
- gap: ${adaptiveValueCalc(8)};
62
- margin-bottom: ${adaptiveValueCalc(8)};
63
- }
64
- `;
65
- const OverflowH5 = styled(H5)`
66
- text-overflow: ellipsis;
67
- overflow: hidden;
68
- `;
69
-
70
- const SBlockchain = styled(Flex)`
71
- text-align: center;
72
- align-items: center;
73
- width: max-content;
74
- background: ${({ theme }) => theme.colors.buttonInactive};
75
- transition: background-color 0.2s ease-in;
76
- padding: 4px 8px;
77
- border-radius: 6px;
78
- gap: 6px;
79
-
80
- p {
81
- color: ${BlackColor};
82
- font-family: ${poppinsFontVarCss.css};
83
- font-size: 15px;
84
- font-weight: 500;
85
- line-height: 22px;
86
- }
87
-
88
- &:hover {
89
- background: ${({ theme }) => theme.colors.accentHoverBg};
90
- }
91
-
92
- ${mediaQuery.minWidthFourK} {
93
- padding: ${adaptiveValueCalc(4)} ${adaptiveValueCalc(8)};
94
- border-radius: ${adaptiveValueCalc(6)};
95
- gap: ${adaptiveValueCalc(6)};
96
-
97
- p {
98
- font-size: ${adaptiveValueCalc(15)};
99
- line-height: ${adaptiveValueCalc(22)};
100
- }
101
- }
102
- `;
103
-
104
- const SFlex = styled(Flex)`
105
- margin-bottom: 8px;
106
-
107
- ${mediaQuery.minWidthFourK} {
108
- margin-bottom: ${adaptiveValueCalc(8)};
109
- }
110
- `;
111
-
112
- export const Information = ({ asset }: InformationProps) => {
113
- const tokenId = asset.getTokenId();
114
- const splittedAssetId = asset.getSplitedAssetId();
115
- const address = asset.getAddress();
116
- const blockChain = asset.getBlockchain();
117
- const blockTimestamp = asset.getBlockTimestamp();
118
-
119
- const id = tokenId ? tokenId : splittedAssetId;
120
- const idTittle = tokenId ? 'Token ID' : 'ID';
121
-
122
- const { deviceType } = useWindowDimensions();
123
-
124
- const isDesktop = deviceType === 'isDesktop';
125
-
126
- const styleOverflow: CSSProperties | undefined = isDesktop
127
- ? { overflow: 'hidden' }
128
- : undefined;
129
-
130
- return (
131
- <Flex flexDirection="column" justifyContent="space-between">
132
- <SFlex justifyContent="space-between" alignItems="center">
133
- <H5 color={TextGrayColor}>Blockchain</H5>
134
- <Link
135
- href={`/search/nfts?blockchain=${blockChain.getBlockChainPrivateLabel()}`}
136
- >
137
- <SBlockchain>
138
- <p>{blockChain.getBlockChainPublicLabel()}</p>
139
- <StyledImage
140
- width={16}
141
- height={16}
142
- src={
143
- blockChain.getBlockChainIconRegular({
144
- domain: getStaticENVDomain(),
145
- }) as string
146
- }
147
- alt={blockChain.getBlockChainPublicLabel() as string}
148
- />
149
- </SBlockchain>
150
- </Link>
151
- </SFlex>
152
- {address && (
153
- <FlexOverflow>
154
- <H5 color={TextGrayColor}>Contract Address</H5>
155
- <CopyButton value={address} style={styleOverflow}>
156
- {isDesktop ? (
157
- <OverflowH5 color={AccentColor} title={address}>
158
- {address}
159
- </OverflowH5>
160
- ) : (
161
- <H5 color={AccentColor} title={address}>
162
- {shortenedText(address as string)}
163
- </H5>
164
- )}
165
- </CopyButton>
166
- </FlexOverflow>
167
- )}
168
- <FlexOverflow>
169
- <H5 color={TextGrayColor}>{idTittle}</H5>
170
- <CopyButton value={id} style={styleOverflow}>
171
- {isDesktop ? (
172
- <OverflowH5 color={AccentColor} title={id}>
173
- {id}
174
- </OverflowH5>
175
- ) : (
176
- <BoxOverflow>
177
- <H5 color={AccentColor} title={id}>
178
- <BoxOverflow>{id}</BoxOverflow>
179
- </H5>
180
- </BoxOverflow>
181
- )}
182
- </CopyButton>
183
- </FlexOverflow>
184
- {blockTimestamp && (
185
- <SFlex justifyContent="space-between">
186
- <H5 color={TextGrayColor}>Added on</H5>
187
- <H5 color={TextGrayColor}>
188
- {moment(blockTimestamp * 1000).format('LL')}
189
- </H5>
190
- </SFlex>
191
- )}
192
- </Flex>
193
- );
194
- };