@ludo.ninja/components 1.4.2 → 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.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/src/components/index.ts +1 -0
  3. package/src/index.ts +2 -0
  4. package/src/system/Filters/helpers.ts +4 -4
  5. package/src/system/Filters/index.ts +2 -0
  6. package/src/system/index.ts +1 -0
  7. package/src/components/assetPage/assetLikes/index.tsx +0 -96
  8. package/src/components/assetPage/assetNft/index.tsx +0 -52
  9. package/src/components/assetPage/assetWrapper/index.tsx +0 -174
  10. package/src/components/assetPage/audioVideoPlayer/Duration.tsx +0 -32
  11. package/src/components/assetPage/audioVideoPlayer/index.tsx +0 -525
  12. package/src/components/assetPage/category/index.tsx +0 -71
  13. package/src/components/assetPage/description/index.tsx +0 -54
  14. package/src/components/assetPage/detailsAccordeon/index.tsx +0 -130
  15. package/src/components/assetPage/figCaption/index.tsx +0 -299
  16. package/src/components/assetPage/index.ts +0 -13
  17. package/src/components/assetPage/information/index.tsx +0 -194
  18. package/src/components/assetPage/marketPlaces/index.tsx +0 -86
  19. package/src/components/assetPage/media/AssetImage/index.tsx +0 -217
  20. package/src/components/assetPage/moreDropDown/index.tsx +0 -176
  21. package/src/components/assetPage/participants/index.tsx +0 -330
  22. package/src/components/assetPage/priceRank/index.tsx +0 -192
  23. package/src/components/assetPage/properties/index.tsx +0 -56
  24. package/src/components/assetPage/slider/index.tsx +0 -235
  25. package/src/components/assetPage/slider/slideItem.tsx +0 -55
  26. package/src/components/assetPage/slider/store.ts +0 -23
  27. package/src/components/assetPage/tittle/index.tsx +0 -143
  28. package/src/components/assetPage/viewer3D/index.tsx +0 -206
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "next dev -p 4000",
@@ -0,0 +1 @@
1
+ export { default as ShareDialog } from './shareDialog';
package/src/index.ts CHANGED
@@ -6,3 +6,5 @@ export * from './hooks';
6
6
  export * from './utils';
7
7
  export * from './store';
8
8
  export * from './system';
9
+ export * from './components';
10
+
@@ -1,9 +1,9 @@
1
1
  import {
2
- ISelection,
3
- Maybe,
4
- } from '@ludo.ninja/api/build/graphql_tools/__generated__/preferencesHost/schema';
2
+ preferencesSchema
3
+ } from '@ludo.ninja/api';
4
+ import { Maybe } from "graphql/jsutils/Maybe";
5
5
 
6
- type Selection = Maybe<Pick<ISelection, 'label'> & { id: string }>;
6
+ type Selection = Maybe<Pick<preferencesSchema.ISelection, 'label'> & { id: string }>;
7
7
 
8
8
  export const findDefaultFilterValue = (
9
9
  queryValue: string | string[] | undefined,
@@ -0,0 +1,2 @@
1
+ export * from './type';
2
+ export * from './helpers';
@@ -8,6 +8,7 @@ export * from './Tabs';
8
8
  export * from './Buttons';
9
9
  export * from './Cards';
10
10
  export * from './Forms';
11
+ export * from './Filters';
11
12
  export { default as CardsHolder } from './CardsHolderWithSkeleton/CardsHolder';
12
13
  export { default as CardsError } from './CardsHolderWithSkeleton/CardsHolder/CardsError';
13
14
  export { default as CardsNoResults } from './CardsHolderWithSkeleton/CardsHolder/CardsNoResults';
@@ -1,96 +0,0 @@
1
- import React from 'react';
2
-
3
- import Skeleton from 'react-loading-skeleton';
4
-
5
- import useLikes from '@/hooks/likes';
6
-
7
- import { useUserStore } from '@/modules/user/store';
8
-
9
- import IconWithButton from '@/system/Buttons/IconWithButton';
10
-
11
- import { getAdaptiveValueWithCheck4k } from '@/utils/adaptive/check4k';
12
- import { getAdaptiveScale } from '@/utils/adaptive/scale';
13
- import { redirectToLoginWindow } from '@/utils/auth';
14
- import { useWindowDimensionsWithServerInitial } from '@/utils/screen';
15
-
16
- import { LabelKeys } from '@/dto/common/ItemType';
17
-
18
- import HeartIcon from '@/public/showCaseIcons/heart.svg';
19
-
20
- const AssetLikes = ({
21
- assetId,
22
- likesByUser,
23
- isLikedByUser,
24
- }: {
25
- assetId: string;
26
- likesByUser: number;
27
- isLikedByUser: boolean;
28
- }) => {
29
- const isSignedIn = useUserStore((state) => state.isSignedIn);
30
-
31
- const { likes, addLike, deleteLike, isLoading } = useLikes({
32
- defaultLikesCount: likesByUser,
33
- defaultIsLiked: isLikedByUser,
34
- itemType: LabelKeys.asset,
35
- });
36
-
37
- const handleLikes = (isLiked: boolean) => {
38
- if (!isSignedIn) {
39
- redirectToLoginWindow();
40
- } else {
41
- !isLiked ? addLike(assetId) : deleteLike(assetId);
42
- }
43
- };
44
- const onLikeBtnClick = () => handleLikes(likes.isLiked);
45
- const { windowDimensions } = useWindowDimensionsWithServerInitial();
46
-
47
- return (
48
- <>
49
- {isLoading ? (
50
- <Skeleton
51
- style={{
52
- borderRadius: `${getAdaptiveValueWithCheck4k({
53
- windowDimensions,
54
- currentSize: 3,
55
- })}px`,
56
- marginRight: `${getAdaptiveValueWithCheck4k({
57
- windowDimensions,
58
- currentSize: 16.8,
59
- })}px`,
60
- }}
61
- height="100%"
62
- width={`${getAdaptiveValueWithCheck4k({
63
- windowDimensions,
64
- currentSize: 30,
65
- })}px`}
66
- />
67
- ) : (
68
- <IconWithButton
69
- variant={'figcaption'}
70
- text={likes.likesCount}
71
- onClick={onLikeBtnClick}
72
- >
73
- <div
74
- style={{
75
- width: `${getAdaptiveValueWithCheck4k({
76
- windowDimensions,
77
- currentSize: 18,
78
- })}px`,
79
- height: `${getAdaptiveValueWithCheck4k({
80
- windowDimensions,
81
- currentSize: 18,
82
- })}px`,
83
- }}
84
- >
85
- <HeartIcon
86
- className={`icon ${likes.isLiked ? 'liked' : ''}`}
87
- style={getAdaptiveScale({ windowDimensions, currentSize: 1 })}
88
- />
89
- </div>
90
- </IconWithButton>
91
- )}
92
- </>
93
- );
94
- };
95
-
96
- export default AssetLikes;
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
-
3
- import styled from 'styled-components';
4
-
5
- import { assetSchema as schema } from '@ludo.ninja/api';
6
- import { isImage } from '@ludo.ninja/core';
7
-
8
- import { mediaQuery } from '@/styles/ScreenWidth';
9
-
10
- import { Box, ExternalImage, Flex } from '@system';
11
-
12
- type AssetMediaProps = Pick<schema.IAsset, 'medias'>;
13
-
14
- const ResponsiveImage = styled(ExternalImage)`
15
- max-width: 320px;
16
- max-height: 320px;
17
-
18
- ${mediaQuery.tablet} {
19
- max-width: 336px;
20
- max-height: 336px;
21
- }
22
-
23
- ${mediaQuery.desktop} {
24
- max-width: 508px;
25
- max-height: 508px;
26
- }
27
- `;
28
-
29
- const EmptyState = () => (
30
- <Flex justifyContent="center">
31
- <Box borderRadius={16} overflow="hidden" />
32
- </Flex>
33
- );
34
-
35
- export const AssetMedia = ({ medias }: AssetMediaProps) => {
36
- if (!medias?.length || medias.length > 1 || !medias[0]) return <EmptyState />;
37
-
38
- const [media] = medias;
39
- const { url, mimeType } = media;
40
-
41
- if (url && isImage({ media: url, mimeType, originalMimeType: null })) {
42
- return (
43
- <Flex justifyContent="center">
44
- <Box borderRadius={16} overflow="hidden">
45
- <ResponsiveImage src={url} />
46
- </Box>
47
- </Flex>
48
- );
49
- }
50
-
51
- return <EmptyState />;
52
- };
@@ -1,174 +0,0 @@
1
- import React from 'react';
2
-
3
- import styled from 'styled-components';
4
-
5
- import { BlockChainKeys } from '@ludo.ninja/core';
6
- import { adaptiveValueCalc } from '@ludo.ninja/ui/build/utils/4k';
7
-
8
- import { useFetchAssetByBlockchain } from '@/api/server-assets/queries/useFetchAssetByBlockchain';
9
-
10
- import { mediaQuery } from '@/styles/ScreenWidth';
11
-
12
- import {
13
- CollectionSlider,
14
- Description,
15
- DetailsAccordeon,
16
- Figcaption,
17
- MarketPlaces,
18
- Participants,
19
- PriceRank,
20
- Title,
21
- } from '@/components/assetPage';
22
-
23
- import AssetEntity from '@/dto/AssetEntity';
24
-
25
- import AssetImage from '../media/AssetImage';
26
-
27
- const AvatarContainer = styled.div`
28
- display: flex;
29
- flex-direction: column;
30
- width: 510px;
31
- margin-right: 60px;
32
-
33
- ${mediaQuery.desktop} {
34
- width: 335px;
35
- margin-right: 30px;
36
- }
37
-
38
- ${mediaQuery.tablet} {
39
- margin-right: 0;
40
- }
41
-
42
- ${mediaQuery.mobile} {
43
- width: 320px;
44
- }
45
-
46
- .description {
47
- display: flex;
48
-
49
- ${mediaQuery.tablet} {
50
- display: none;
51
- }
52
- }
53
-
54
- ${mediaQuery.minWidthFourK} {
55
- width: ${adaptiveValueCalc(510)};
56
- margin-right: ${adaptiveValueCalc(60)};
57
- }
58
- `;
59
-
60
- const Wrapper = styled.div`
61
- display: flex;
62
- justify-content: center;
63
- flex-direction: row;
64
- align-items: flex-start;
65
-
66
- ${mediaQuery.tablet} {
67
- flex-direction: column;
68
- align-items: center;
69
- }
70
- `;
71
-
72
- const Container = styled.div`
73
- display: flex;
74
- flex-direction: column;
75
- width: 510px;
76
-
77
- ${mediaQuery.desktop} {
78
- width: 335px;
79
- }
80
-
81
- ${mediaQuery.mobile} {
82
- width: 320px;
83
- }
84
-
85
- .description {
86
- display: none;
87
-
88
- ${mediaQuery.tablet} {
89
- display: flex;
90
- margin-bottom: 25px;
91
- }
92
- }
93
- ${mediaQuery.minWidthFourK} {
94
- width: ${adaptiveValueCalc(510)};
95
- }
96
- `;
97
-
98
- const AssetComponents = ({ clientData }: { clientData: AssetEntity }) => {
99
- // const file2D = '/test/test.svg';
100
- // const file3D =
101
- // 'https://nfts.snowx.com/0xfe2674e976884844db9ff5e49b6bbca878ddac2d/2-artwork.glb';
102
- // 'https://ipfs.io/ipfs/QmPsVLBHhczr6uF6AaWsS2fUcWuMFHBsUZi3BGKgSsDpxJ/2109.glb';
103
- // const audio = "https://storage.googleapis.com/media-session/elephants-dream/the-wires.mp3";
104
- // const video = "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4";
105
-
106
- const isSlider = clientData.getIsSlider();
107
-
108
- const markets = clientData.getMarkets();
109
-
110
- return (
111
- <>
112
- {isSlider && <CollectionSlider medias={clientData.getAssetMediaType()} />}
113
- <Wrapper>
114
- <AvatarContainer>
115
- {!isSlider &&
116
- (clientData.getAssetMediaType()[0]?.displayLinkedMedia() ?? (
117
- <AssetImage
118
- alt={`${clientData.getName()} ${clientData.getAddress() || ''}`}
119
- imageUrl={'/noContent/noContent.svg'}
120
- errorImg={'/noContent/noContent.svg'}
121
- />
122
- ))}
123
- <Figcaption asset={clientData} />
124
- <Description description={clientData.getDescription()} />
125
- </AvatarContainer>
126
- <Container>
127
- <Title
128
- collectionId={clientData.getCollection().collectionId}
129
- collectionTitle={clientData.getCollection().collectionTitle}
130
- collectionMedias={clientData.getCollection().collectionMedias}
131
- name={clientData.getName()}
132
- />
133
- <Participants
134
- creatorsAddresses={clientData.getCreatorsAddresses()}
135
- creatorsProfiles={clientData.getCreatorsProfiles()}
136
- ownersAddresses={clientData.getOwnersAddresses()}
137
- ownersProfiles={clientData.getOwnersProfiles()}
138
- />
139
- <PriceRank
140
- latestPriceAmount={clientData.getPrice().latestPriceAmount}
141
- latestPriceCurrency={clientData.getPrice().latestPriceCurrency}
142
- rank={clientData.getRank()}
143
- blockchain={clientData.getBlockchain()}
144
- />
145
- {markets && <MarketPlaces markets={markets} />}
146
- <Description description={clientData.getDescription()} />
147
- <DetailsAccordeon asset={clientData} />
148
- </Container>
149
- </Wrapper>
150
- </>
151
- );
152
- };
153
-
154
- const AssetWrapper = ({
155
- blockchain,
156
- address,
157
- elrondId,
158
- tokenId,
159
- }: {
160
- blockchain: BlockChainKeys;
161
- address: string;
162
- elrondId: string;
163
- tokenId: string;
164
- }) => {
165
- const { clientData, loading, error } = useFetchAssetByBlockchain(
166
- { blockchain, address, tokenId, elrondId },
167
- null
168
- );
169
-
170
- if (loading || error || !clientData) return null;
171
-
172
- return <AssetComponents clientData={clientData} />;
173
- };
174
- export default AssetWrapper;
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
-
3
- import { InactiveButtonColor } from '@/styles/colors';
4
-
5
- import { H5 } from '@system';
6
-
7
- type DurationProps = {
8
- seconds: number;
9
- };
10
-
11
- export default function Duration({ seconds }: DurationProps) {
12
- return (
13
- <time dateTime={`P${Math.round(seconds)}S`}>
14
- <H5 color={InactiveButtonColor}>{format(seconds as number)}</H5>
15
- </time>
16
- );
17
- }
18
-
19
- function format(seconds: number) {
20
- const date = new Date(seconds * 1000);
21
- const hh = date.getUTCHours();
22
- const mm = date.getUTCMinutes();
23
- const ss = pad(date.getUTCSeconds());
24
- if (hh) {
25
- return `${hh}:${pad(mm)}:${ss}`;
26
- }
27
- return `${mm}:${ss}`;
28
- }
29
-
30
- function pad(string: number) {
31
- return ('0' + string).slice(-2);
32
- }