@ludo.ninja/components 2.2.37 → 2.2.39
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.
- package/build/api/server-search/queries/useFetchAllCreations/index.d.ts +7 -7
- package/build/api/server-search/queries/useFetchAllCreations/index.js +7 -10
- package/build/api/server-search/queries/useFetchCollections/index.d.ts +6 -6
- package/build/api/server-search/queries/useFetchCollections/index.js +10 -12
- package/build/api/server-search/queries/useFetchDynamicCollectionData/index.d.ts +4 -4
- package/build/api/server-search/queries/useFetchDynamicCollectionData/index.js +8 -11
- package/build/api/server-search/queries/useFindCreations/index.d.ts +7 -7
- package/build/api/server-search/queries/useFindCreations/index.js +9 -12
- package/build/api/server-search/queries/useFindUserCreations/index.d.ts +3 -3
- package/build/api/server-search/queries/useFindUserCreations/index.js +7 -10
- package/build/api/server-search/queries/useFindUserLudoCreations/index.d.ts +3 -3
- package/build/api/server-search/queries/useFindUserLudoCreations/index.js +7 -10
- package/build/components/gallery/add/addCreationToGallery/index.js +7 -7
- package/build/components/search/SearchInputContainer.d.ts +1 -1
- package/build/components/search/SearchInputContainer.js +14 -17
- package/build/entities/creation/collectionCreationBuilder.d.ts +2 -2
- package/build/entities/creation/collectionCreationBuilder.js +4 -3
- package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.d.ts +2 -3
- package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.js +7 -9
- package/build/hooks/favorites/useGetUserFevoritesCreations/index.d.ts +3 -4
- package/build/hooks/favorites/useGetUserFevoritesCreations/index.js +6 -9
- package/build/hooks/galleries/useGetUserGalleriesCreations/index.d.ts +3 -4
- package/build/hooks/galleries/useGetUserGalleriesCreations/index.js +6 -9
- package/build/hooks/likes/dynamic/useFindCollectionsAndLikes.d.ts +6 -6
- package/build/hooks/likes/dynamic/useFindCollectionsAndLikes.js +15 -17
- package/build/hooks/likes/dynamic/useFindCreationsAndLikes.d.ts +4 -4
- package/build/hooks/likes/dynamic/useFindCreationsAndLikes.js +12 -15
- package/build/hooks/likes/dynamic/useGetCollectionInfoAndLikes.d.ts +4 -4
- package/build/hooks/likes/dynamic/useGetCollectionInfoAndLikes.js +11 -18
- package/build/hooks/likes/dynamic/useGetCreationsAndLikes.d.ts +4 -5
- package/build/hooks/likes/dynamic/useGetCreationsAndLikes.js +12 -17
- package/build/hooks/likes/dynamic/useGetCreationsAndLikesByType.d.ts +4 -4
- package/build/hooks/likes/dynamic/useGetCreationsAndLikesByType.js +16 -19
- package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.d.ts +4 -5
- package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.js +9 -10
- package/build/hooks/likes/dynamic/useGetTableLikes.d.ts +4 -5
- package/build/hooks/likes/dynamic/useGetTableLikes.js +14 -21
- package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.d.ts +2 -2
- package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.js +7 -10
- package/build/modules/gallery/ui/itemsPreview/index.d.ts +2 -3
- package/build/modules/gallery/ui/itemsPreview/index.js +9 -4
- package/build/modules/gallery/useToGalleryAsset.d.ts +5 -5
- package/build/modules/gallery/useToGalleryAsset.js +7 -7
- package/build/modules/virtuoso/types.d.ts +0 -3
- package/build/system/Cards/CreationCard/CardHead.d.ts +2 -3
- package/build/system/Cards/CreationCard/CardHead.js +5 -14
- package/build/system/Cards/CreationCard/index.d.ts +2 -2
- package/build/system/Cards/CreationCard/index.js +7 -6
- package/build/system/Cards/MultiMediaCard/index.d.ts +3 -4
- package/build/system/Cards/MultiMediaCard/index.js +5 -4
- package/build/utils/extractItemIds.d.ts +2 -2
- package/build/utils/extractItemIds.js +1 -7
- package/package.json +1 -1
|
@@ -6,10 +6,10 @@ const types_1 = require("../labelCreationType/types");
|
|
|
6
6
|
const utils_1 = require("@ludo.ninja/utils");
|
|
7
7
|
const buildCollectionCreation = (creation, type) => (0, builder_1.buildCreation)({
|
|
8
8
|
itemId: creation.collectionId || "",
|
|
9
|
-
id: creation.id || "",
|
|
9
|
+
id: "id" in creation ? creation.id || "" : "",
|
|
10
10
|
itemType: type ?? types_1.LabelKeys.asset,
|
|
11
11
|
blockchain: creation.blockchain,
|
|
12
|
-
address: creation.address,
|
|
12
|
+
address: "address" in creation ? creation.address : null,
|
|
13
13
|
tokenId: creation.tokenId,
|
|
14
14
|
originalUrls: creation.originalUrls
|
|
15
15
|
? creation.originalUrls.map((el) => (0, utils_1.checkGltfUrl)(el || ""))
|
|
@@ -17,9 +17,10 @@ const buildCollectionCreation = (creation, type) => (0, builder_1.buildCreation)
|
|
|
17
17
|
rank: creation.rank,
|
|
18
18
|
likes: creation.likes,
|
|
19
19
|
liked: creation.liked,
|
|
20
|
-
name: creation.name,
|
|
20
|
+
name: "name" in creation ? creation.name : null,
|
|
21
21
|
creatorsAddresses: creation.creatorsAddresses,
|
|
22
22
|
media: creation?.medias?.[0]?.url || null,
|
|
23
23
|
mimeType: creation?.medias?.[0]?.mimeType,
|
|
24
24
|
});
|
|
25
25
|
exports.buildCollectionCreation = buildCollectionCreation;
|
|
26
|
+
//todo: update collectionCreationId to new field in TCreation
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CreationEntity from '../../../dto/CreationEntity';
|
|
1
|
+
import { TCreation } from '../../../entities/creation/types';
|
|
3
2
|
import { TGallery } from '../../../entities/gallery/types';
|
|
4
3
|
import { IQueryFetchGalleryV2Args } from "@ludo.ninja/api/build/graphql_tools/__generated__/galleriesHost/schema";
|
|
5
4
|
declare const useGetFavoriteGallaryCreations: ({ galleryId, itemsCount, }: {
|
|
@@ -8,7 +7,7 @@ declare const useGetFavoriteGallaryCreations: ({ galleryId, itemsCount, }: {
|
|
|
8
7
|
}) => {
|
|
9
8
|
gallery: TGallery[] | null;
|
|
10
9
|
loading: boolean;
|
|
11
|
-
creationsList:
|
|
10
|
+
creationsList: TCreation[];
|
|
12
11
|
loadingAssets: boolean;
|
|
13
12
|
loadingGallery: boolean;
|
|
14
13
|
loadingCollections: boolean;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useGetFavoriteGallaryCreations = void 0;
|
|
7
4
|
const useGetUserFevoritesCreations_1 = require("../useGetUserFevoritesCreations");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
5
|
+
const builder_1 = require("../../../entities/creation/builder");
|
|
6
|
+
const collectionCreationBuilder_1 = require("../../../entities/creation/collectionCreationBuilder");
|
|
7
|
+
const builder_2 = require("../../../entities/gallery/builder");
|
|
8
|
+
const types_1 = require("../../../entities/labelCreationType/types");
|
|
11
9
|
const ui_1 = require("../../../store/ui");
|
|
12
10
|
const client_1 = require("@apollo/client");
|
|
13
11
|
const api_1 = require("@ludo.ninja/api");
|
|
@@ -32,7 +30,7 @@ const useGetFavoriteGallaryCreations = ({ galleryId, itemsCount, }) => {
|
|
|
32
30
|
notifyOnNetworkStatusChange: true,
|
|
33
31
|
fetchPolicy: "no-cache",
|
|
34
32
|
onCompleted: ({ fetchGalleryV2 }) => {
|
|
35
|
-
setGallery([(0,
|
|
33
|
+
setGallery([(0, builder_2.buildGallery)(fetchGalleryV2)]);
|
|
36
34
|
setAllResults(fetchGalleryV2.items);
|
|
37
35
|
},
|
|
38
36
|
onError: () => {
|
|
@@ -48,7 +46,7 @@ const useGetFavoriteGallaryCreations = ({ galleryId, itemsCount, }) => {
|
|
|
48
46
|
onCompleted: ({ fetchAssets: data }) => {
|
|
49
47
|
setAssets((prevAssets) => [
|
|
50
48
|
...(prevAssets || []),
|
|
51
|
-
...data.map((asset) =>
|
|
49
|
+
...data.map((asset) => (0, builder_1.buildCreation)({
|
|
52
50
|
...asset,
|
|
53
51
|
itemType: "asset",
|
|
54
52
|
itemId: asset.assetId,
|
|
@@ -70,7 +68,7 @@ const useGetFavoriteGallaryCreations = ({ galleryId, itemsCount, }) => {
|
|
|
70
68
|
onCompleted: ({ fetchCollectionsByIds: data }) => {
|
|
71
69
|
setCollections((prevCollections) => [
|
|
72
70
|
...(prevCollections || []),
|
|
73
|
-
...data.map((collection) =>
|
|
71
|
+
...data.map((collection) => (0, collectionCreationBuilder_1.buildCollectionCreation)(collection, types_1.LabelKeys.collection)),
|
|
74
72
|
]);
|
|
75
73
|
},
|
|
76
74
|
onError: () => {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CreationEntity from '../../../dto/CreationEntity';
|
|
1
|
+
import { TCreation } from '../../../entities/creation/types';
|
|
3
2
|
import { TGallery } from '../../../entities/gallery/types';
|
|
4
3
|
import { IQueryFetchUserFavoritesV2Args } from "@ludo.ninja/api/build/graphql_tools/__generated__/galleriesHost/schema";
|
|
5
4
|
declare const useGetUserFevoritesCreations: ({ userId, pageSize, pageToken }: IQueryFetchUserFavoritesV2Args) => {
|
|
6
5
|
favorites: TGallery[];
|
|
7
|
-
assets:
|
|
8
|
-
collections:
|
|
6
|
+
assets: TCreation[] | null;
|
|
7
|
+
collections: TCreation[] | null;
|
|
9
8
|
loading: boolean;
|
|
10
9
|
loadingAssets: boolean;
|
|
11
10
|
loadingFavorites: boolean;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useGetUserFevoritesCreations = void 0;
|
|
7
4
|
exports.getMediaForGallery = getMediaForGallery;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
5
|
+
const builder_1 = require("../../../entities/creation/builder");
|
|
6
|
+
const collectionCreationBuilder_1 = require("../../../entities/creation/collectionCreationBuilder");
|
|
7
|
+
const builder_2 = require("../../../entities/gallery/builder");
|
|
11
8
|
const ui_1 = require("../../../store/ui");
|
|
12
9
|
const client_1 = require("@apollo/client");
|
|
13
10
|
const api_1 = require("@ludo.ninja/api");
|
|
@@ -33,7 +30,7 @@ const useGetUserFevoritesCreations = ({ userId, pageSize, pageToken }) => {
|
|
|
33
30
|
onCompleted: ({ fetchUserFavoritesV2: { galleries, nextPageToken: token } }) => {
|
|
34
31
|
// nextPageToken.current = nextPage.nextPage?.token || null;
|
|
35
32
|
nextPageToken.current = token || null;
|
|
36
|
-
setFavorites(galleries.map((gallery) => (0,
|
|
33
|
+
setFavorites(galleries.map((gallery) => (0, builder_2.buildGallery)(gallery)));
|
|
37
34
|
setLoading(false);
|
|
38
35
|
},
|
|
39
36
|
onError: () => {
|
|
@@ -49,7 +46,7 @@ const useGetUserFevoritesCreations = ({ userId, pageSize, pageToken }) => {
|
|
|
49
46
|
context: { uri: api_1.hosts.searchHost },
|
|
50
47
|
fetchPolicy: "no-cache",
|
|
51
48
|
onCompleted: ({ fetchAssets: data }) => {
|
|
52
|
-
setAsset(data.map((asset) =>
|
|
49
|
+
setAsset(data.map((asset) => (0, builder_1.buildCreation)({
|
|
53
50
|
...asset,
|
|
54
51
|
itemType: "asset",
|
|
55
52
|
itemId: asset.assetId,
|
|
@@ -69,7 +66,7 @@ const useGetUserFevoritesCreations = ({ userId, pageSize, pageToken }) => {
|
|
|
69
66
|
context: { uri: api_1.hosts.searchHost },
|
|
70
67
|
fetchPolicy: "no-cache",
|
|
71
68
|
onCompleted: ({ fetchCollectionsByIds: data }) => {
|
|
72
|
-
setCollections(data.map((collection) =>
|
|
69
|
+
setCollections(data.map((collection) => (0, collectionCreationBuilder_1.buildCollectionCreation)(collection)));
|
|
73
70
|
setLoading(false);
|
|
74
71
|
},
|
|
75
72
|
onError: () => {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CreationEntity from '../../../dto/CreationEntity';
|
|
1
|
+
import { TCreation } from '../../../entities/creation/types';
|
|
3
2
|
import { TGallery } from '../../../entities/gallery/types';
|
|
4
3
|
import { IQueryFetchUserGalleriesV2Args } from "@ludo.ninja/api/build/graphql_tools/__generated__/galleriesHost/schema";
|
|
5
4
|
declare const useGetUserGalleriesCreations: ({ userId, pageSize, pageToken }: IQueryFetchUserGalleriesV2Args) => {
|
|
6
5
|
galleries: TGallery[];
|
|
7
|
-
assets:
|
|
8
|
-
collections:
|
|
6
|
+
assets: TCreation[] | null;
|
|
7
|
+
collections: TCreation[] | null;
|
|
9
8
|
loading: boolean;
|
|
10
9
|
loadingAssets: boolean;
|
|
11
10
|
loadingFavorites: boolean;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useGetUserGalleriesCreations = void 0;
|
|
7
4
|
exports.getMediaForGallery = getMediaForGallery;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
5
|
+
const builder_1 = require("../../../entities/creation/builder");
|
|
6
|
+
const collectionCreationBuilder_1 = require("../../../entities/creation/collectionCreationBuilder");
|
|
7
|
+
const builder_2 = require("../../../entities/gallery/builder");
|
|
11
8
|
const ui_1 = require("../../../store/ui");
|
|
12
9
|
const client_1 = require("@apollo/client");
|
|
13
10
|
const api_1 = require("@ludo.ninja/api");
|
|
@@ -33,7 +30,7 @@ const useGetUserGalleriesCreations = ({ userId, pageSize, pageToken }) => {
|
|
|
33
30
|
onCompleted: ({ fetchUserGalleriesV2: { galleries, nextPageToken: token } }) => {
|
|
34
31
|
// nextPageToken.current = nextPage.nextPage?.token || null;
|
|
35
32
|
nextPageToken.current = token || null;
|
|
36
|
-
setGalleries(galleries.map((gallery) => (0,
|
|
33
|
+
setGalleries(galleries.map((gallery) => (0, builder_2.buildGallery)(gallery)));
|
|
37
34
|
setLoading(false);
|
|
38
35
|
},
|
|
39
36
|
onError: () => {
|
|
@@ -49,7 +46,7 @@ const useGetUserGalleriesCreations = ({ userId, pageSize, pageToken }) => {
|
|
|
49
46
|
context: { uri: api_1.hosts.searchHost },
|
|
50
47
|
fetchPolicy: "no-cache",
|
|
51
48
|
onCompleted: ({ fetchAssets: data }) => {
|
|
52
|
-
setAsset(data.map((asset) =>
|
|
49
|
+
setAsset(data.map((asset) => (0, builder_1.buildCreation)({
|
|
53
50
|
...asset,
|
|
54
51
|
itemType: "asset",
|
|
55
52
|
itemId: asset.assetId,
|
|
@@ -69,7 +66,7 @@ const useGetUserGalleriesCreations = ({ userId, pageSize, pageToken }) => {
|
|
|
69
66
|
context: { uri: api_1.hosts.searchHost },
|
|
70
67
|
fetchPolicy: "no-cache",
|
|
71
68
|
onCompleted: ({ fetchCollectionsByIds: data }) => {
|
|
72
|
-
setCollections(data.map((collection) =>
|
|
69
|
+
setCollections(data.map((collection) => (0, collectionCreationBuilder_1.buildCollectionCreation)(collection)));
|
|
73
70
|
setLoading(false);
|
|
74
71
|
},
|
|
75
72
|
onError: () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
export declare const useFindCollectionsAndLikes: ({ term, input, page
|
|
1
|
+
import { TCreation } from '../../../entities/creation/types';
|
|
2
|
+
import { IDynamicCollectionData, IQueryFindCollectionsArgs } from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
|
|
3
|
+
export declare const useFindCollectionsAndLikes: ({ term, input, page }: IQueryFindCollectionsArgs) => {
|
|
4
4
|
loadMore: (pageToken: string) => Promise<void>;
|
|
5
5
|
loading: boolean;
|
|
6
6
|
collectionsLoading: boolean;
|
|
@@ -8,12 +8,12 @@ export declare const useFindCollectionsAndLikes: ({ term, input, page, }: IQuery
|
|
|
8
8
|
collectionsLikes: [] | IDynamicCollectionData[];
|
|
9
9
|
error: import("@apollo/client").ApolloError | undefined;
|
|
10
10
|
results: number;
|
|
11
|
-
collections:
|
|
11
|
+
collections: TCreation[];
|
|
12
12
|
nextPageToken: string | null;
|
|
13
13
|
refetchQuery: () => Promise<void>;
|
|
14
14
|
};
|
|
15
15
|
declare const _default: {
|
|
16
|
-
useFindCollectionsAndLikes: ({ term, input, page
|
|
16
|
+
useFindCollectionsAndLikes: ({ term, input, page }: IQueryFindCollectionsArgs) => {
|
|
17
17
|
loadMore: (pageToken: string) => Promise<void>;
|
|
18
18
|
loading: boolean;
|
|
19
19
|
collectionsLoading: boolean;
|
|
@@ -21,7 +21,7 @@ declare const _default: {
|
|
|
21
21
|
collectionsLikes: [] | IDynamicCollectionData[];
|
|
22
22
|
error: import("@apollo/client").ApolloError | undefined;
|
|
23
23
|
results: number;
|
|
24
|
-
collections:
|
|
24
|
+
collections: TCreation[];
|
|
25
25
|
nextPageToken: string | null;
|
|
26
26
|
refetchQuery: () => Promise<void>;
|
|
27
27
|
};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useFindCollectionsAndLikes = void 0;
|
|
7
|
-
const
|
|
4
|
+
const collectionCreationBuilder_1 = require("../../../entities/creation/collectionCreationBuilder");
|
|
5
|
+
const types_1 = require("../../../entities/labelCreationType/types");
|
|
6
|
+
const useGetCreationsAndLikes_1 = require("./useGetCreationsAndLikes");
|
|
7
|
+
const ui_1 = require("../../../store/ui");
|
|
8
8
|
const client_1 = require("@apollo/client");
|
|
9
9
|
const api_1 = require("@ludo.ninja/api");
|
|
10
10
|
const schema_1 = require("@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema");
|
|
11
11
|
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
12
|
-
const
|
|
13
|
-
const ui_1 = require("../../../store/ui");
|
|
14
|
-
const CollectionCreationEntity_1 = __importDefault(require("../../../dto/Collection/CollectionCreationEntity"));
|
|
12
|
+
const react_1 = require("react");
|
|
15
13
|
// export const prefetchFindCollections = (
|
|
16
14
|
// { term, input, pageSize, pageToken }: schema.IQueryFindCollectionsArgs,
|
|
17
15
|
// apolloClient: ApolloClient<NormalizedCacheObject>
|
|
@@ -30,7 +28,7 @@ const CollectionCreationEntity_1 = __importDefault(require("../../../dto/Collect
|
|
|
30
28
|
// });
|
|
31
29
|
// };
|
|
32
30
|
const maxCollectionsLength = 1000;
|
|
33
|
-
const useFindCollectionsAndLikes = ({ term, input, page
|
|
31
|
+
const useFindCollectionsAndLikes = ({ term, input, page }) => {
|
|
34
32
|
const [collections, setCollections] = (0, react_1.useState)([]);
|
|
35
33
|
const [nextPageToken, setNextPageToken] = (0, react_1.useState)(null);
|
|
36
34
|
const [results, setResults] = (0, react_1.useState)(0);
|
|
@@ -38,7 +36,7 @@ const useFindCollectionsAndLikes = ({ term, input, page, }) => {
|
|
|
38
36
|
const [collectionsLikes, setCollectionsLikes] = (0, react_1.useState)([]);
|
|
39
37
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
40
38
|
const { error, loading: collectionsLoading, fetchMore, refetch, } = (0, schema_1.useFindCollectionsQuery)({
|
|
41
|
-
fetchPolicy:
|
|
39
|
+
fetchPolicy: "no-cache",
|
|
42
40
|
context: {
|
|
43
41
|
uri: api_1.hosts.searchHost,
|
|
44
42
|
},
|
|
@@ -48,10 +46,10 @@ const useFindCollectionsAndLikes = ({ term, input, page, }) => {
|
|
|
48
46
|
page,
|
|
49
47
|
},
|
|
50
48
|
onCompleted: ({ findCollections: { collections, ...nextPage } }) => {
|
|
51
|
-
setCollections(collections.map((collection) =>
|
|
49
|
+
setCollections(collections.map((collection) => (0, collectionCreationBuilder_1.buildCollectionCreation)({
|
|
52
50
|
...collection,
|
|
53
51
|
name: collection && collection.collectionTitle,
|
|
54
|
-
},
|
|
52
|
+
}, types_1.LabelKeys.collection)));
|
|
55
53
|
if (!collections.length) {
|
|
56
54
|
setLoading(false);
|
|
57
55
|
}
|
|
@@ -61,7 +59,7 @@ const useFindCollectionsAndLikes = ({ term, input, page, }) => {
|
|
|
61
59
|
onError: () => {
|
|
62
60
|
openAlert({
|
|
63
61
|
type: type_1.alertVariants.error,
|
|
64
|
-
caption:
|
|
62
|
+
caption: "Oops, something went wrong.",
|
|
65
63
|
});
|
|
66
64
|
setCollections([]);
|
|
67
65
|
setNextPageToken(null);
|
|
@@ -73,11 +71,11 @@ const useFindCollectionsAndLikes = ({ term, input, page, }) => {
|
|
|
73
71
|
setCollectionsLikes(fetchDynamicCollectionsData);
|
|
74
72
|
setLoading(false);
|
|
75
73
|
},
|
|
76
|
-
fetchPolicy:
|
|
74
|
+
fetchPolicy: "no-cache",
|
|
77
75
|
onError: () => {
|
|
78
76
|
openAlert({
|
|
79
77
|
type: type_1.alertVariants.error,
|
|
80
|
-
caption:
|
|
78
|
+
caption: "Oops, something went wrong when fetch collections likes.",
|
|
81
79
|
});
|
|
82
80
|
setCollectionsLikes([]);
|
|
83
81
|
setLoading(false);
|
|
@@ -87,7 +85,7 @@ const useFindCollectionsAndLikes = ({ term, input, page, }) => {
|
|
|
87
85
|
if (collections.length > 0) {
|
|
88
86
|
const itemsIdsArray = (0, useGetCreationsAndLikes_1.extractItemIds)(collections);
|
|
89
87
|
if (itemsIdsArray.length > 0) {
|
|
90
|
-
if (collections[0].
|
|
88
|
+
if (collections[0].itemType === types_1.LabelKeys.collection) {
|
|
91
89
|
fetchCollectionsLikes({
|
|
92
90
|
variables: {
|
|
93
91
|
input: itemsIdsArray.map((collectionId) => {
|
|
@@ -136,10 +134,10 @@ const useFindCollectionsAndLikes = ({ term, input, page, }) => {
|
|
|
136
134
|
},
|
|
137
135
|
});
|
|
138
136
|
const { collections: nextCollections, ...nextPage } = data.findCollections;
|
|
139
|
-
const nextList = nextCollections.map((collectionAsset) =>
|
|
137
|
+
const nextList = nextCollections.map((collectionAsset) => (0, collectionCreationBuilder_1.buildCollectionCreation)({
|
|
140
138
|
...collectionAsset,
|
|
141
139
|
name: collectionAsset && collectionAsset.collectionTitle,
|
|
142
|
-
},
|
|
140
|
+
}, types_1.LabelKeys.collection));
|
|
143
141
|
setCollections((prevCollection) => [...prevCollection, ...nextList]);
|
|
144
142
|
setResults(nextPage.nextPage?.elements || 0);
|
|
145
143
|
setNextPageToken(nextPage.nextPage?.token || null);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
declare const useFindCreationsAndLikes: ({ term, input, page
|
|
1
|
+
import { TCreation } from '../../../entities/creation/types';
|
|
2
|
+
import { IDynamicAssetData, IQueryFindCreationsArgs } from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
|
|
3
|
+
declare const useFindCreationsAndLikes: ({ term, input, page }: IQueryFindCreationsArgs) => {
|
|
4
4
|
loading: boolean;
|
|
5
5
|
assetsLikesLoading: boolean;
|
|
6
6
|
creationsLoading: boolean;
|
|
7
7
|
error: import("@apollo/client").ApolloError | undefined;
|
|
8
|
-
creations:
|
|
8
|
+
creations: TCreation[];
|
|
9
9
|
results: number;
|
|
10
10
|
assetsLikes: [] | IDynamicAssetData[];
|
|
11
11
|
nextPageToken: string | null;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useFindCreationsAndLikes = void 0;
|
|
7
|
-
const
|
|
4
|
+
const builder_1 = require("../../../entities/creation/builder");
|
|
5
|
+
const useGetCreationsAndLikes_1 = require("./useGetCreationsAndLikes");
|
|
6
|
+
const ui_1 = require("../../../store/ui");
|
|
8
7
|
const client_1 = require("@apollo/client");
|
|
9
8
|
const api_1 = require("@ludo.ninja/api");
|
|
10
9
|
const schema_1 = require("@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema");
|
|
11
10
|
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
12
|
-
const
|
|
13
|
-
const ui_1 = require("../../../store/ui");
|
|
14
|
-
const CreationEntity_1 = __importDefault(require("../../../dto/CreationEntity"));
|
|
11
|
+
const react_1 = require("react");
|
|
15
12
|
const maxCreationLength = 1000;
|
|
16
|
-
const useFindCreationsAndLikes = ({ term, input, page
|
|
13
|
+
const useFindCreationsAndLikes = ({ term, input, page }) => {
|
|
17
14
|
const [creations, setCreations] = (0, react_1.useState)([]);
|
|
18
15
|
const [results, setResults] = (0, react_1.useState)(0);
|
|
19
16
|
const [nextPageToken, setNextPageToken] = (0, react_1.useState)(null);
|
|
@@ -26,12 +23,12 @@ const useFindCreationsAndLikes = ({ term, input, page, }) => {
|
|
|
26
23
|
input,
|
|
27
24
|
page,
|
|
28
25
|
},
|
|
29
|
-
fetchPolicy:
|
|
26
|
+
fetchPolicy: "no-cache",
|
|
30
27
|
context: {
|
|
31
28
|
uri: api_1.hosts.searchHost,
|
|
32
29
|
},
|
|
33
30
|
onCompleted: ({ findCreations: { creations, ...nextPage } }) => {
|
|
34
|
-
setCreations(creations.map((creation) =>
|
|
31
|
+
setCreations(creations.map((creation) => (0, builder_1.buildCreation)(creation)));
|
|
35
32
|
if (!creations.length) {
|
|
36
33
|
setLoading(false);
|
|
37
34
|
}
|
|
@@ -41,7 +38,7 @@ const useFindCreationsAndLikes = ({ term, input, page, }) => {
|
|
|
41
38
|
onError: () => {
|
|
42
39
|
openAlert({
|
|
43
40
|
type: type_1.alertVariants.error,
|
|
44
|
-
caption:
|
|
41
|
+
caption: "Oops, something went wrong.",
|
|
45
42
|
});
|
|
46
43
|
setCreations([]);
|
|
47
44
|
setNextPageToken(null);
|
|
@@ -53,7 +50,7 @@ const useFindCreationsAndLikes = ({ term, input, page, }) => {
|
|
|
53
50
|
context: {
|
|
54
51
|
uri: api_1.hosts.searchHost,
|
|
55
52
|
},
|
|
56
|
-
fetchPolicy:
|
|
53
|
+
fetchPolicy: "no-cache",
|
|
57
54
|
onCompleted: ({ fetchDynamicAssetsData }) => {
|
|
58
55
|
setAssetsLikes(fetchDynamicAssetsData);
|
|
59
56
|
setLoading(false);
|
|
@@ -61,7 +58,7 @@ const useFindCreationsAndLikes = ({ term, input, page, }) => {
|
|
|
61
58
|
onError: () => {
|
|
62
59
|
openAlert({
|
|
63
60
|
type: type_1.alertVariants.error,
|
|
64
|
-
caption:
|
|
61
|
+
caption: "Oops, something went wrong when fetch assets likes.",
|
|
65
62
|
});
|
|
66
63
|
setAssetsLikes([]);
|
|
67
64
|
setLoading(false);
|
|
@@ -105,7 +102,7 @@ const useFindCreationsAndLikes = ({ term, input, page, }) => {
|
|
|
105
102
|
input,
|
|
106
103
|
page: {
|
|
107
104
|
token: pageToken,
|
|
108
|
-
...(page &&
|
|
105
|
+
...(page && "size" in page ? { size: page.size } : {}),
|
|
109
106
|
},
|
|
110
107
|
},
|
|
111
108
|
updateQuery: (previousQueryResult) => {
|
|
@@ -115,7 +112,7 @@ const useFindCreationsAndLikes = ({ term, input, page, }) => {
|
|
|
115
112
|
const { creations: nextCreations, ...nextPage } = data.findCreations;
|
|
116
113
|
setCreations((prevCreations) => [
|
|
117
114
|
...prevCreations,
|
|
118
|
-
...nextCreations.map((creation) =>
|
|
115
|
+
...nextCreations.map((creation) => (0, builder_1.buildCreation)(creation)),
|
|
119
116
|
]);
|
|
120
117
|
setResults(nextPage.nextPage?.elements || 0);
|
|
121
118
|
setNextPageToken(nextPage.nextPage?.token || null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
declare const useGetCollectionInfoAndLikes: ({ input
|
|
4
|
-
collectionAssetsList:
|
|
1
|
+
import { TCreation } from '../../../entities/creation/types';
|
|
2
|
+
import { IDynamicAssetData, IQueryFetchDynamicCollectionDataArgs } from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
|
|
3
|
+
declare const useGetCollectionInfoAndLikes: ({ input }: IQueryFetchDynamicCollectionDataArgs) => {
|
|
4
|
+
collectionAssetsList: TCreation[];
|
|
5
5
|
collectionItemsLikes: [] | IDynamicAssetData[];
|
|
6
6
|
collectionLikes: number;
|
|
7
7
|
isCollectionLikedByUser: boolean;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useGetCollectionInfoAndLikes = void 0;
|
|
7
|
-
const
|
|
4
|
+
const collectionCreationBuilder_1 = require("../../../entities/creation/collectionCreationBuilder");
|
|
5
|
+
const useGetCreationsAndLikes_1 = require("./useGetCreationsAndLikes");
|
|
6
|
+
const ui_1 = require("../../../store/ui");
|
|
8
7
|
const client_1 = require("@apollo/client");
|
|
9
8
|
const api_1 = require("@ludo.ninja/api");
|
|
10
9
|
const schema_1 = require("@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema");
|
|
11
10
|
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
12
|
-
const
|
|
13
|
-
const ui_1 = require("../../../store/ui");
|
|
14
|
-
const CollectionCreationEntity_1 = __importDefault(require("../../../dto/Collection/CollectionCreationEntity"));
|
|
11
|
+
const react_1 = require("react");
|
|
15
12
|
const maxCollectionListLength = 1000;
|
|
16
|
-
const useGetCollectionInfoAndLikes = ({ input
|
|
13
|
+
const useGetCollectionInfoAndLikes = ({ input }) => {
|
|
17
14
|
const { page, collectionId } = input;
|
|
18
15
|
const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
|
|
19
16
|
const [collectionAssetsList, setCollectionAssetsList] = (0, react_1.useState)([]);
|
|
@@ -32,7 +29,7 @@ const useGetCollectionInfoAndLikes = ({ input, }) => {
|
|
|
32
29
|
setCollectionLikes(likesNum);
|
|
33
30
|
setIsCollectionLikedByUser(isLikedByUser);
|
|
34
31
|
setNextPageToken(nextPage.token);
|
|
35
|
-
setCollectionAssetsList(collectionAssets.map((collectionAsset) =>
|
|
32
|
+
setCollectionAssetsList(collectionAssets.map((collectionAsset) => (0, collectionCreationBuilder_1.buildCollectionCreation)({
|
|
36
33
|
...collectionAsset,
|
|
37
34
|
collectionId: collectionAsset.assetId,
|
|
38
35
|
})));
|
|
@@ -41,7 +38,7 @@ const useGetCollectionInfoAndLikes = ({ input, }) => {
|
|
|
41
38
|
onError: () => {
|
|
42
39
|
openAlert({
|
|
43
40
|
type: type_1.alertVariants.error,
|
|
44
|
-
caption:
|
|
41
|
+
caption: "Oops, something went wrong.",
|
|
45
42
|
});
|
|
46
43
|
setCollectionAssetsList([]);
|
|
47
44
|
setNextPageToken(null);
|
|
@@ -73,8 +70,7 @@ const useGetCollectionInfoAndLikes = ({ input, }) => {
|
|
|
73
70
|
(0, react_1.useEffect)(() => {
|
|
74
71
|
if (!collectionLoading && collectionAssetsList.length > 0) {
|
|
75
72
|
const assetIds = (0, useGetCreationsAndLikes_1.extractItemIds)(collectionAssetsList);
|
|
76
|
-
if (assetIds.length > 0 &&
|
|
77
|
-
collectionAssetsList.length !== collectionItemsLikes.length) {
|
|
73
|
+
if (assetIds.length > 0 && collectionAssetsList.length !== collectionItemsLikes.length) {
|
|
78
74
|
setLoading(false);
|
|
79
75
|
{
|
|
80
76
|
/* Todo fix it by PR with new likes */
|
|
@@ -111,17 +107,14 @@ const useGetCollectionInfoAndLikes = ({ input, }) => {
|
|
|
111
107
|
input: { page: { token: pageToken, size: page?.size }, collectionId },
|
|
112
108
|
},
|
|
113
109
|
});
|
|
114
|
-
const { collectionAssetsPage: { nextPageToken, collectionAssets: nextCollectionAssetsList
|
|
115
|
-
const nextList = nextCollectionAssetsList.map((collectionAsset) =>
|
|
110
|
+
const { collectionAssetsPage: { nextPageToken, collectionAssets: nextCollectionAssetsList }, } = data.fetchDynamicCollectionData;
|
|
111
|
+
const nextList = nextCollectionAssetsList.map((collectionAsset) => (0, collectionCreationBuilder_1.buildCollectionCreation)({
|
|
116
112
|
...collectionAsset,
|
|
117
113
|
collectionId: collectionAsset.assetId,
|
|
118
114
|
}));
|
|
119
115
|
// const assetIds = getAssetIds(nextList);
|
|
120
116
|
// await fetchAssetsLikes({ variables: { assetIds } });
|
|
121
|
-
setCollectionAssetsList((prevCollection) => [
|
|
122
|
-
...prevCollection,
|
|
123
|
-
...nextList,
|
|
124
|
-
]);
|
|
117
|
+
setCollectionAssetsList((prevCollection) => [...prevCollection, ...nextList]);
|
|
125
118
|
setNextPageToken(nextPageToken);
|
|
126
119
|
}
|
|
127
120
|
catch (error) {
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import CreationEntity from '../../../dto/CreationEntity';
|
|
1
|
+
import { TCreation } from '../../../entities/creation/types';
|
|
2
|
+
import { IDynamicAssetData, IDynamicCollectionData, IQueryFetchAllCreationsArgs } from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
|
|
4
3
|
declare const useGetCreationsAndLikes: ({ page }: IQueryFetchAllCreationsArgs) => {
|
|
5
4
|
loading: boolean;
|
|
6
5
|
assetsLikesLoading: boolean;
|
|
7
6
|
collectionsLikesLoading: boolean;
|
|
8
7
|
creationsLoading: boolean;
|
|
9
8
|
error: import("@apollo/client").ApolloError | undefined;
|
|
10
|
-
allCreations:
|
|
9
|
+
allCreations: TCreation[];
|
|
11
10
|
assetsLikes: [] | IDynamicAssetData[];
|
|
12
11
|
collectionsLikes: [] | IDynamicCollectionData[];
|
|
13
12
|
nextPageToken: string | null;
|
|
14
13
|
loadMore: (pageToken: string | null) => Promise<void>;
|
|
15
14
|
refetchQuery: () => Promise<void>;
|
|
16
15
|
};
|
|
17
|
-
declare function extractItemIds(creations:
|
|
16
|
+
declare function extractItemIds(creations: TCreation[]): string[];
|
|
18
17
|
export { useGetCreationsAndLikes, extractItemIds };
|