@ludo.ninja/components 2.2.35 → 2.2.37
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-galleries/queries/useFetchGallery/index.d.ts +5 -5
- package/build/api/server-galleries/queries/useFetchGallery/index.js +5 -8
- package/build/api/server-galleries/queries/useFetchMyFavorites/index.d.ts +3 -3
- package/build/api/server-galleries/queries/useFetchMyFavorites/index.js +5 -11
- package/build/api/server-galleries/queries/useFetchMyGalleries/index.d.ts +3 -3
- package/build/api/server-galleries/queries/useFetchMyGalleries/index.js +5 -11
- package/build/api/server-galleries/queries/useFetchUserFavorites/index.d.ts +4 -4
- package/build/api/server-galleries/queries/useFetchUserFavorites/index.js +6 -9
- package/build/api/server-search/queries/useFetchFindAllTopEntitiesByName/index.d.ts +6 -6
- package/build/api/server-search/queries/useFetchFindAllTopEntitiesByName/index.js +4 -7
- package/build/components/assetPage/assetLikes/index.js +7 -7
- package/build/components/search/searchSuggestions/index.d.ts +2 -2
- package/build/components/search/searchSuggestions/index.js +4 -46
- package/build/dto/AssetEntity/index.d.ts +3 -3
- package/build/dto/AssetEntity/index.js +16 -33
- package/build/dto/AssetSearchEntity/index.d.ts +2 -2
- package/build/dto/AssetSearchEntity/index.js +12 -29
- package/build/dto/Collection/CollectionCreationEntity/index.d.ts +3 -3
- package/build/dto/Collection/CollectionCreationEntity/index.js +13 -13
- package/build/dto/Collection/CollectionCreationEntity/interface.d.ts +2 -2
- package/build/dto/Collection/CollectionEntity/index.d.ts +2 -2
- package/build/dto/Collection/CollectionEntity/index.js +1 -1
- package/build/dto/CreationEntity/index.d.ts +3 -3
- package/build/dto/CreationEntity/index.js +9 -9
- package/build/dto/GalleryEntityV2/index.d.ts +4 -4
- package/build/dto/GalleryEntityV2/index.js +6 -8
- package/build/dto/common/ItemType/data.d.ts +1 -1
- package/build/dto/common/ItemType/data.js +25 -25
- package/build/entities/asset/AssetMediasViews.js +6 -6
- package/build/entities/asset/builder.js +2 -2
- package/build/entities/asset/{assetMediasOpengraph.d.ts → getAssetMediasOpengraph.d.ts} +1 -1
- package/build/entities/asset/{assetMediasOpengraph.js → getAssetMediasOpengraph.js} +7 -7
- package/build/entities/asset/getAssetMiniatureUrl.d.ts +4 -0
- package/build/entities/asset/getAssetMiniatureUrl.js +37 -0
- package/build/entities/asset/types.d.ts +1 -1
- package/build/entities/collection/builder.d.ts +3 -0
- package/build/entities/collection/builder.js +31 -0
- package/build/entities/collection/types.d.ts +17 -0
- package/build/entities/collection/types.js +2 -0
- package/build/entities/creation/CreationMediaView.d.ts +4 -0
- package/build/entities/creation/CreationMediaView.js +46 -0
- package/build/entities/creation/builder.d.ts +3 -0
- package/build/entities/creation/builder.js +63 -0
- package/build/entities/creation/collectionCreationBuilder.d.ts +3 -0
- package/build/entities/creation/collectionCreationBuilder.js +25 -0
- package/build/entities/creation/types.d.ts +23 -0
- package/build/entities/creation/types.js +2 -0
- package/build/entities/gallery/builder.d.ts +3 -0
- package/build/entities/gallery/builder.js +35 -0
- package/build/entities/gallery/types.d.ts +18 -0
- package/build/entities/gallery/types.js +2 -0
- package/build/entities/labelCreationType/data.d.ts +3 -0
- package/build/entities/labelCreationType/data.js +36 -0
- package/build/entities/labelCreationType/types.d.ts +45 -0
- package/build/entities/labelCreationType/types.js +42 -0
- package/build/entities/media/builder.d.ts +4 -0
- package/build/entities/media/builder.js +11 -1
- package/build/entities/media/types.d.ts +1 -1
- package/build/entities/media/urls.d.ts +31 -0
- package/build/entities/media/urls.js +125 -0
- package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.d.ts +4 -4
- package/build/hooks/favorites/useGetFavoriteGallaryCreations/index.js +17 -19
- package/build/hooks/favorites/useGetUserFevoritesCreations/index.d.ts +5 -5
- package/build/hooks/favorites/useGetUserFevoritesCreations/index.js +23 -33
- package/build/hooks/galleries/useGetUserGalleriesCreations/index.d.ts +5 -5
- package/build/hooks/galleries/useGetUserGalleriesCreations/index.js +23 -33
- package/build/hooks/likes/dynamic/useGetMixedLikesFavoriteList.d.ts +1 -1
- package/build/hooks/likes/index.d.ts +1 -1
- package/build/hooks/likes/index.js +12 -12
- package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.d.ts +4 -4
- package/build/modules/gallery/api/useGetAssetsAndCollectionForFavorite.js +35 -40
- package/build/modules/gallery/store.d.ts +3 -3
- package/build/modules/gallery/store.js +7 -11
- package/build/modules/gallery/ui/EditGallery.d.ts +2 -2
- package/build/modules/gallery/ui/EditGallery.js +11 -11
- package/build/modules/gallery/ui/chooseGalleryItems/chooseGalleryItem/index.d.ts +3 -3
- package/build/modules/gallery/ui/chooseGalleryItems/chooseGalleryItem/index.js +1 -1
- package/build/modules/gallery/ui/chooseGalleryItems/index.d.ts +1 -1
- package/build/modules/gallery/ui/chooseGalleryItems/index.js +19 -20
- package/build/modules/opportunity/OpportunityCard.js +25 -27
- package/build/system/Cards/CardContent/CardCategory/CardCategory.test.d.ts +1 -1
- package/build/system/Cards/CardContent/CardCategory/CardCategory.test.js +9 -9
- package/build/system/Cards/CardContent/CardCategory/index.d.ts +1 -1
- package/build/system/Cards/CardContent/CardCategory/index.js +3 -3
- package/build/system/Cards/CreationCard/CardHead.js +16 -21
- package/build/system/Cards/CreationCard/index.d.ts +2 -2
- package/build/system/Cards/CreationCard/index.js +5 -5
- package/build/system/Cards/MultiMediaCard/index.d.ts +2 -2
- package/build/system/Cards/MultiMediaCard/index.js +3 -3
- package/package.json +1 -1
|
@@ -4,17 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useGetAssetsAndCollectionForFavorite = void 0;
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const client_1 = require("@apollo/client");
|
|
9
|
-
const api_1 = require("@ludo.ninja/api");
|
|
10
|
-
const api_2 = require("@ludo.ninja/api");
|
|
11
|
-
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
12
7
|
const CollectionCreationEntity_1 = __importDefault(require("../../../dto/Collection/CollectionCreationEntity"));
|
|
13
8
|
const CreationEntity_1 = __importDefault(require("../../../dto/CreationEntity"));
|
|
9
|
+
const store_1 = require("../store");
|
|
14
10
|
const ui_1 = require("../../../store/ui");
|
|
15
11
|
const extractItemIds_1 = require("../../../utils/extractItemIds");
|
|
16
12
|
const getPageSizeAssets_1 = require("../../../utils/getPageSizeAssets");
|
|
17
|
-
const
|
|
13
|
+
const client_1 = require("@apollo/client");
|
|
14
|
+
const api_1 = require("@ludo.ninja/api");
|
|
15
|
+
const api_2 = require("@ludo.ninja/api");
|
|
16
|
+
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
17
|
+
const react_1 = require("react");
|
|
18
18
|
const limit = 40;
|
|
19
19
|
const useGetAssetsAndCollectionForFavorite = ({ gallery, activeTab, fetchLikes, }) => {
|
|
20
20
|
const [assets, setAssets] = (0, react_1.useState)([]);
|
|
@@ -36,25 +36,23 @@ const useGetAssetsAndCollectionForFavorite = ({ gallery, activeTab, fetchLikes,
|
|
|
36
36
|
})
|
|
37
37
|
: limit;
|
|
38
38
|
const totalLength = size !== limit ? size : false;
|
|
39
|
-
const creationIds = gallery.
|
|
39
|
+
const creationIds = gallery.creationIds;
|
|
40
40
|
const startIndex = (currentPageRef.current - 1) * limit;
|
|
41
41
|
const endIndex = totalLength ? totalLength : startIndex + limit;
|
|
42
42
|
for (let i = startIndex; i < endIndex && i < creationIds.length; i++) {
|
|
43
|
-
const elements = creationIds[i].split(
|
|
44
|
-
const id = elements.splice(1, creationIds[i].length).join(
|
|
45
|
-
if (elements[0] ===
|
|
43
|
+
const elements = creationIds[i].split(".");
|
|
44
|
+
const id = elements.splice(1, creationIds[i].length).join(".");
|
|
45
|
+
if (elements[0] === "asset") {
|
|
46
46
|
assetArray.push(id);
|
|
47
47
|
}
|
|
48
|
-
else if (elements[0] ===
|
|
48
|
+
else if (elements[0] === "collection") {
|
|
49
49
|
collectionsArray.push(id);
|
|
50
50
|
}
|
|
51
|
-
else if (elements[0] ===
|
|
51
|
+
else if (elements[0] === "opportunity") {
|
|
52
52
|
opportunitiesArray.push(id);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const assetPromise = assetArray.length > 0
|
|
56
|
-
? fetchAssets({ variables: { assetIds: assetArray } })
|
|
57
|
-
: Promise.resolve();
|
|
55
|
+
const assetPromise = assetArray.length > 0 ? fetchAssets({ variables: { assetIds: assetArray } }) : Promise.resolve();
|
|
58
56
|
const collectionsPromise = collectionsArray.length > 0
|
|
59
57
|
? fetchCollections({ variables: { collectionIds: collectionsArray } })
|
|
60
58
|
: Promise.resolve();
|
|
@@ -81,7 +79,7 @@ const useGetAssetsAndCollectionForFavorite = ({ gallery, activeTab, fetchLikes,
|
|
|
81
79
|
};
|
|
82
80
|
const [fetchAssets, { error: assetsError, refetch: refetchAssets }] = (0, client_1.useLazyQuery)(api_2.searchSchema.FetchAssetsDocument, {
|
|
83
81
|
context: { uri: api_1.hosts.searchHost },
|
|
84
|
-
fetchPolicy:
|
|
82
|
+
fetchPolicy: "no-cache",
|
|
85
83
|
onCompleted: ({ fetchAssets: data }) => {
|
|
86
84
|
setAssets((prevAssets) => {
|
|
87
85
|
const results = [
|
|
@@ -90,63 +88,60 @@ const useGetAssetsAndCollectionForFavorite = ({ gallery, activeTab, fetchLikes,
|
|
|
90
88
|
asset.assetId,
|
|
91
89
|
new CreationEntity_1.default({
|
|
92
90
|
...asset,
|
|
93
|
-
itemType:
|
|
91
|
+
itemType: "asset",
|
|
94
92
|
itemId: asset.assetId,
|
|
95
93
|
}),
|
|
96
94
|
]),
|
|
97
95
|
];
|
|
98
|
-
getLikesForAllCreations(results.map((el) => el[1]),
|
|
96
|
+
getLikesForAllCreations(results.map((el) => el[1]), "asset");
|
|
99
97
|
return results;
|
|
100
98
|
});
|
|
101
99
|
},
|
|
102
100
|
onError: () => {
|
|
103
101
|
openAlert({
|
|
104
102
|
type: type_1.alertVariants.error,
|
|
105
|
-
caption:
|
|
103
|
+
caption: "Oops, something went wrong.",
|
|
106
104
|
});
|
|
107
105
|
setAssets([]);
|
|
108
106
|
},
|
|
109
107
|
});
|
|
110
|
-
const [fetchCollections, { error: collectionsError, refetch: refetchCollections }
|
|
108
|
+
const [fetchCollections, { error: collectionsError, refetch: refetchCollections }] = (0, client_1.useLazyQuery)(api_2.searchSchema.FetchCollectionsByIdsDocument, {
|
|
111
109
|
context: { uri: api_1.hosts.searchHost },
|
|
112
|
-
fetchPolicy:
|
|
110
|
+
fetchPolicy: "no-cache",
|
|
113
111
|
onCompleted: ({ fetchCollectionsByIds: data }) => {
|
|
114
112
|
setCollections((prevCollections) => {
|
|
115
113
|
const results = [
|
|
116
114
|
...(prevCollections || []),
|
|
117
115
|
...data.map((collection) => [
|
|
118
116
|
collection.collectionId,
|
|
119
|
-
new CollectionCreationEntity_1.default(collection,
|
|
117
|
+
new CollectionCreationEntity_1.default(collection, "collection"),
|
|
120
118
|
]),
|
|
121
119
|
];
|
|
122
|
-
getLikesForAllCreations(results.map((el) => el[1]),
|
|
120
|
+
getLikesForAllCreations(results.map((el) => el[1]), "collection");
|
|
123
121
|
return results;
|
|
124
122
|
});
|
|
125
123
|
},
|
|
126
124
|
onError: () => {
|
|
127
125
|
openAlert({
|
|
128
126
|
type: type_1.alertVariants.error,
|
|
129
|
-
caption:
|
|
127
|
+
caption: "Oops, something went wrong.",
|
|
130
128
|
});
|
|
131
129
|
setCollections([]);
|
|
132
130
|
},
|
|
133
131
|
});
|
|
134
|
-
const [fetchOpportunities, { error: opportunitiesError, refetch: refetchOpportunities }
|
|
132
|
+
const [fetchOpportunities, { error: opportunitiesError, refetch: refetchOpportunities }] = api_1.opportunitiesSchema.useFetchOpportunitiesByIdsLazyQuery({
|
|
135
133
|
context: { uri: api_1.hosts.opportunitiesHost },
|
|
136
|
-
fetchPolicy:
|
|
134
|
+
fetchPolicy: "no-cache",
|
|
137
135
|
onCompleted: ({ fetchOpportunitiesByIds: data }) => {
|
|
138
136
|
setOpportunities((prev) => [
|
|
139
137
|
...(prev || []),
|
|
140
|
-
...data.map((opportunity) => [
|
|
141
|
-
opportunity.opportunityId,
|
|
142
|
-
opportunity,
|
|
143
|
-
]),
|
|
138
|
+
...data.map((opportunity) => [opportunity.opportunityId, opportunity]),
|
|
144
139
|
]);
|
|
145
140
|
},
|
|
146
141
|
onError: () => {
|
|
147
142
|
openAlert({
|
|
148
143
|
type: type_1.alertVariants.error,
|
|
149
|
-
caption:
|
|
144
|
+
caption: "Oops, something went wrong.",
|
|
150
145
|
});
|
|
151
146
|
setOpportunities([]);
|
|
152
147
|
},
|
|
@@ -166,22 +161,22 @@ const useGetAssetsAndCollectionForFavorite = ({ gallery, activeTab, fetchLikes,
|
|
|
166
161
|
});
|
|
167
162
|
};
|
|
168
163
|
const creations = (0, react_1.useMemo)(() => {
|
|
169
|
-
const creationIds = gallery.
|
|
164
|
+
const creationIds = gallery.creationIds;
|
|
170
165
|
const mapAssets = new Map(assets);
|
|
171
166
|
const collectionAssets = new Map(collections);
|
|
172
167
|
const opportunityAssets = new Map(opportunities);
|
|
173
168
|
return creationIds
|
|
174
169
|
.map((id) => {
|
|
175
|
-
const idSplit = id.split(
|
|
170
|
+
const idSplit = id.split(".");
|
|
176
171
|
const idType = idSplit[0];
|
|
177
|
-
const idElement = idSplit.slice(1).join(
|
|
178
|
-
if (idType ===
|
|
172
|
+
const idElement = idSplit.slice(1).join(".");
|
|
173
|
+
if (idType === "asset") {
|
|
179
174
|
return mapAssets.get(idElement);
|
|
180
175
|
}
|
|
181
|
-
if (idType ===
|
|
176
|
+
if (idType === "collection") {
|
|
182
177
|
return collectionAssets.get(idElement);
|
|
183
178
|
}
|
|
184
|
-
if (idType ===
|
|
179
|
+
if (idType === "opportunity") {
|
|
185
180
|
return opportunityAssets.get(idElement);
|
|
186
181
|
}
|
|
187
182
|
})
|
|
@@ -206,13 +201,13 @@ const useGetAssetsAndCollectionForFavorite = ({ gallery, activeTab, fetchLikes,
|
|
|
206
201
|
}
|
|
207
202
|
},
|
|
208
203
|
removeCreation: (creationIdToRemove, itemType) => {
|
|
209
|
-
if (itemType ===
|
|
204
|
+
if (itemType === "asset") {
|
|
210
205
|
setAssets((items) => items.filter((item) => item[0] !== creationIdToRemove));
|
|
211
206
|
}
|
|
212
|
-
if (itemType ===
|
|
207
|
+
if (itemType === "collection") {
|
|
213
208
|
setCollections((items) => items.filter((item) => item[0] !== creationIdToRemove));
|
|
214
209
|
}
|
|
215
|
-
if (itemType ===
|
|
210
|
+
if (itemType === "opportunity") {
|
|
216
211
|
setOpportunities((items) => items.filter((item) => item[0] !== creationIdToRemove));
|
|
217
212
|
}
|
|
218
213
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { TGallery } from '../../entities/gallery/types';
|
|
2
|
+
import { galleriesSchema as schema } from "@ludo.ninja/api";
|
|
3
3
|
type UserFields = {
|
|
4
4
|
galleryName: string;
|
|
5
5
|
galleryDescription: string;
|
|
@@ -9,7 +9,7 @@ export interface HTMLInputEvent extends Event {
|
|
|
9
9
|
}
|
|
10
10
|
interface IFavoriteStore {
|
|
11
11
|
fetchGalleryV2: schema.IGalleryV2 | null;
|
|
12
|
-
gallery:
|
|
12
|
+
gallery: TGallery | null;
|
|
13
13
|
setGallery: (gallery: schema.IGalleryV2 | null) => void;
|
|
14
14
|
updateGalleryInfo: (data: UserFields) => void;
|
|
15
15
|
updateGalleryBanner: (banner: string | null) => void;
|
|
@@ -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.useGalleryStore = void 0;
|
|
4
|
+
const builder_1 = require("../../entities/gallery/builder");
|
|
7
5
|
const getDimensionsImage_1 = require("../../utils/getDimensionsImage");
|
|
8
6
|
const shallow_1 = require("zustand/shallow");
|
|
9
7
|
const traditional_1 = require("zustand/traditional");
|
|
10
|
-
const GalleryEntityV2_1 = __importDefault(require("../../dto/GalleryEntityV2"));
|
|
11
8
|
const initialState = {
|
|
12
9
|
gallery: null,
|
|
13
10
|
fetchGalleryV2: null,
|
|
@@ -20,7 +17,7 @@ exports.useGalleryStore = (0, traditional_1.createWithEqualityFn)()((setState, g
|
|
|
20
17
|
setGallery: (gallery) => {
|
|
21
18
|
if (gallery) {
|
|
22
19
|
setState({
|
|
23
|
-
gallery:
|
|
20
|
+
gallery: (0, builder_1.buildGallery)(gallery),
|
|
24
21
|
fetchGalleryV2: gallery,
|
|
25
22
|
});
|
|
26
23
|
}
|
|
@@ -37,7 +34,7 @@ exports.useGalleryStore = (0, traditional_1.createWithEqualityFn)()((setState, g
|
|
|
37
34
|
};
|
|
38
35
|
return {
|
|
39
36
|
fetchGalleryV2: newGallery,
|
|
40
|
-
gallery:
|
|
37
|
+
gallery: (0, builder_1.buildGallery)(newGallery),
|
|
41
38
|
};
|
|
42
39
|
});
|
|
43
40
|
},
|
|
@@ -49,11 +46,11 @@ exports.useGalleryStore = (0, traditional_1.createWithEqualityFn)()((setState, g
|
|
|
49
46
|
};
|
|
50
47
|
return {
|
|
51
48
|
fetchGalleryV2: newGallery,
|
|
52
|
-
gallery:
|
|
49
|
+
gallery: (0, builder_1.buildGallery)(newGallery),
|
|
53
50
|
};
|
|
54
51
|
});
|
|
55
52
|
},
|
|
56
|
-
fileGallery:
|
|
53
|
+
fileGallery: "",
|
|
57
54
|
isErrorFileGallery: initialState.isErrorFileGallery,
|
|
58
55
|
addFileGalleryWithValidation: async (e) => {
|
|
59
56
|
const fileTarget = e.target.files?.[0];
|
|
@@ -68,8 +65,7 @@ exports.useGalleryStore = (0, traditional_1.createWithEqualityFn)()((setState, g
|
|
|
68
65
|
}
|
|
69
66
|
else {
|
|
70
67
|
const dimensions = await (0, getDimensionsImage_1.getDimensionsImage)(fileTarget);
|
|
71
|
-
const isErrorNew = !!(dimensions &&
|
|
72
|
-
(dimensions.width > 1200 || dimensions.height > 1200));
|
|
68
|
+
const isErrorNew = !!(dimensions && (dimensions.width > 1200 || dimensions.height > 1200));
|
|
73
69
|
setState({ isErrorFileGallery: isErrorNew });
|
|
74
70
|
if (isErrorNew) {
|
|
75
71
|
return;
|
|
@@ -84,7 +80,7 @@ exports.useGalleryStore = (0, traditional_1.createWithEqualityFn)()((setState, g
|
|
|
84
80
|
const fileGallery = getState().fileGallery;
|
|
85
81
|
if (fileGallery) {
|
|
86
82
|
URL.revokeObjectURL(fileGallery);
|
|
87
|
-
setState({ fileGallery:
|
|
83
|
+
setState({ fileGallery: "" });
|
|
88
84
|
}
|
|
89
85
|
},
|
|
90
86
|
allResults: initialState.allResults,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TGallery } from '../../../entities/gallery/types';
|
|
2
2
|
export declare const EditGallery: ({ galleryId, handleRemoveAsset, gallery, titleAssets, titleForm, inputPlaceHolderText, }: {
|
|
3
|
-
gallery:
|
|
3
|
+
gallery: TGallery;
|
|
4
4
|
galleryId: string;
|
|
5
5
|
handleRemoveAsset: (creationIdToRemove: string) => (itemType: "asset" | "collection") => void;
|
|
6
6
|
titleAssets: string;
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.EditGallery = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const
|
|
8
|
+
const editGalleryForm_1 = __importDefault(require("./editGalleryForm"));
|
|
9
|
+
const useRemoveAssetFromGallery_1 = require("../../../api/server-galleries/mutations/useRemoveAssetFromGallery");
|
|
10
|
+
const useRemoveCollectionFromGallery_1 = require("../../../api/server-galleries/mutations/useRemoveCollectionFromGallery");
|
|
9
11
|
const useGetAssetsAndCollectionForFavorite_1 = require("../api/useGetAssetsAndCollectionForFavorite");
|
|
10
12
|
const store_1 = require("../store");
|
|
11
13
|
const itemsPreview_1 = __importDefault(require("./itemsPreview"));
|
|
12
|
-
const
|
|
13
|
-
const useRemoveCollectionFromGallery_1 = require("../../../api/server-galleries/mutations/useRemoveCollectionFromGallery");
|
|
14
|
-
const editGalleryForm_1 = __importDefault(require("./editGalleryForm"));
|
|
14
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
15
15
|
const StyledAddFavlist = styled_components_1.default.div `
|
|
16
16
|
display: flex;
|
|
17
17
|
|
|
@@ -27,25 +27,25 @@ const EditGallery = ({ galleryId, handleRemoveAsset, gallery, titleAssets, title
|
|
|
27
27
|
const { removeAssetFromGallery } = (0, useRemoveAssetFromGallery_1.useRemoveAssetFromGalleryV2)();
|
|
28
28
|
const { removeCollectionFromGallery } = (0, useRemoveCollectionFromGallery_1.useRemoveCollectionFromGalleryV2)();
|
|
29
29
|
const handleDeleteCreation = async (itemId) => {
|
|
30
|
-
const id = itemId.split(
|
|
31
|
-
if (itemId.split(
|
|
30
|
+
const id = itemId.split(".").splice(1).join(".");
|
|
31
|
+
if (itemId.split(".")[0] === "collection") {
|
|
32
32
|
await removeCollectionFromGallery({
|
|
33
33
|
galleryId,
|
|
34
34
|
collectionId: id,
|
|
35
35
|
});
|
|
36
|
-
handleRemoveAsset(id)(
|
|
37
|
-
removeCreation(id,
|
|
36
|
+
handleRemoveAsset(id)("collection");
|
|
37
|
+
removeCreation(id, "collection");
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
await removeAssetFromGallery({
|
|
41
41
|
galleryId,
|
|
42
42
|
assetId: id,
|
|
43
43
|
});
|
|
44
|
-
handleRemoveAsset(id)(
|
|
45
|
-
removeCreation(id,
|
|
44
|
+
handleRemoveAsset(id)("asset");
|
|
45
|
+
removeCreation(id, "asset");
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
const allResults = (0, store_1.useGalleryStore)((state) => state.allResults);
|
|
49
|
-
return ((0, jsx_runtime_1.jsxs)(StyledAddFavlist, { children: [(0, jsx_runtime_1.jsx)(itemsPreview_1.default, { creations: creationsList, title: titleAssets, deleteMethod: handleDeleteCreation, isLoading: isLoading, loadMore: loadMore, isNextLoading: isNextLoading, allCount: allResults }), (0, jsx_runtime_1.jsx)(editGalleryForm_1.default, { name: gallery.
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)(StyledAddFavlist, { children: [(0, jsx_runtime_1.jsx)(itemsPreview_1.default, { creations: creationsList, title: titleAssets, deleteMethod: handleDeleteCreation, isLoading: isLoading, loadMore: loadMore, isNextLoading: isNextLoading, allCount: allResults }), (0, jsx_runtime_1.jsx)(editGalleryForm_1.default, { name: gallery.name, description: gallery.description, title: titleForm, inputPlaceHolderText: inputPlaceHolderText, galleryId: galleryId })] }));
|
|
50
50
|
};
|
|
51
51
|
exports.EditGallery = EditGallery;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TGallery } from '../../../../../entities/gallery/types';
|
|
2
2
|
declare const ChooseItem: ({ galleryItem, handleIsSelected, isSelected, }: {
|
|
3
|
-
galleryItem:
|
|
4
|
-
handleIsSelected: (arg:
|
|
3
|
+
galleryItem: TGallery;
|
|
4
|
+
handleIsSelected: (arg: TGallery) => void;
|
|
5
5
|
isSelected: boolean;
|
|
6
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default ChooseItem;
|
|
@@ -92,6 +92,6 @@ const StyledChooseItem = styled_components_1.default.div `
|
|
|
92
92
|
}
|
|
93
93
|
`;
|
|
94
94
|
// Component
|
|
95
|
-
const ChooseItem = ({ galleryItem, handleIsSelected, isSelected, }) => ((0, jsx_runtime_1.jsx)(StyledChooseItem, { isSelected: isSelected, onClick: () => handleIsSelected(galleryItem), children: (0, jsx_runtime_1.jsxs)("div", { className: "content-item-wrapper", children: [(0, jsx_runtime_1.jsx)("div", { className: "content-item-gallery-pic-default", children: (0, jsx_runtime_1.jsx)("div", { className: "image" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "content-item-gallery-name", children: [(0, jsx_runtime_1.jsx)("p", { className: "name", children: galleryItem.
|
|
95
|
+
const ChooseItem = ({ galleryItem, handleIsSelected, isSelected, }) => ((0, jsx_runtime_1.jsx)(StyledChooseItem, { isSelected: isSelected, onClick: () => handleIsSelected(galleryItem), children: (0, jsx_runtime_1.jsxs)("div", { className: "content-item-wrapper", children: [(0, jsx_runtime_1.jsx)("div", { className: "content-item-gallery-pic-default", children: (0, jsx_runtime_1.jsx)("div", { className: "image" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "content-item-gallery-name", children: [(0, jsx_runtime_1.jsx)("p", { className: "name", children: galleryItem.name }), (0, jsx_runtime_1.jsx)("span", { className: `items-count`, children: galleryItem.itemsCount })] })] }) }));
|
|
96
96
|
// Export
|
|
97
97
|
exports.default = ChooseItem;
|
|
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
-
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
11
|
-
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
7
|
+
const useFetchMyFavorites_1 = require("../../../../api/server-galleries/queries/useFetchMyFavorites");
|
|
8
|
+
const useFetchMyGalleries_1 = require("../../../../api/server-galleries/queries/useFetchMyGalleries");
|
|
12
9
|
const PlaceholderItemsGallery_1 = require("../PlaceholderItemsGallery");
|
|
13
10
|
const chooseGalleryItem_1 = __importDefault(require("./chooseGalleryItem"));
|
|
14
11
|
const ui_1 = require("../../../../store/ui");
|
|
15
|
-
const useFetchMyFavorites_1 = require("../../../../api/server-galleries/queries/useFetchMyFavorites");
|
|
16
|
-
const useFetchMyGalleries_1 = require("../../../../api/server-galleries/queries/useFetchMyGalleries");
|
|
17
12
|
const ScreenWidth_1 = require("../../../../styles/ScreenWidth");
|
|
18
13
|
const colors_1 = require("../../../../styles/colors");
|
|
19
14
|
const typography_1 = require("../../../../styles/typography");
|
|
20
15
|
const MainButton_1 = __importDefault(require("../../../../system/Buttons/MainButton"));
|
|
21
16
|
const CardsHolderLoader_1 = __importDefault(require("../../../../system/CardsHolderWithSkeleton/CardsHolderLoader"));
|
|
17
|
+
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
18
|
+
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const react_virtuoso_1 = require("react-virtuoso");
|
|
21
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
22
22
|
// Styles
|
|
23
23
|
const StyledChooseGalleryItems = styled_components_1.default.div `
|
|
24
24
|
min-height: calc(460px - 24px);
|
|
@@ -111,8 +111,8 @@ const GalleryItems = ({ galleryItems, loadMore, isNextLoading, isAdded, titleBtn
|
|
|
111
111
|
setSelectedItem(null);
|
|
112
112
|
openAlert({
|
|
113
113
|
type: type_1.alertVariants.success,
|
|
114
|
-
caption:
|
|
115
|
-
text:
|
|
114
|
+
caption: "NFT successfully added!",
|
|
115
|
+
text: "",
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
}, [isAdded]);
|
|
@@ -122,7 +122,7 @@ const GalleryItems = ({ galleryItems, loadMore, isNextLoading, isAdded, titleBtn
|
|
|
122
122
|
openAlert({
|
|
123
123
|
type: type_1.alertVariants.error,
|
|
124
124
|
caption: error.message,
|
|
125
|
-
text:
|
|
125
|
+
text: "",
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
}, [error]);
|
|
@@ -130,14 +130,13 @@ const GalleryItems = ({ galleryItems, loadMore, isNextLoading, isAdded, titleBtn
|
|
|
130
130
|
setSelectedItem(newGallery);
|
|
131
131
|
};
|
|
132
132
|
const renderItems = galleryItems
|
|
133
|
-
?.filter((gallery) => gallery.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return ((0, jsx_runtime_1.jsxs)(StyledChooseGalleryItems, { children: [(0, jsx_runtime_1.jsx)("div", { className: 'head', children: (0, jsx_runtime_1.jsx)("h3", { className: 'tittle', children: title }) }), (0, jsx_runtime_1.jsxs)("div", { className: "content", children: [!isLoading && galleryItems && ((0, jsx_runtime_1.jsx)(react_virtuoso_1.Virtuoso, { totalCount: renderItems.length, itemContent: (index) => renderItems[index], endReached: loadMore, overscan: 200, components: {
|
|
133
|
+
?.filter((gallery) => gallery.galleryType !== "likelist" && gallery.galleryId !== currentMyGalleryId)
|
|
134
|
+
.map((galleryItem) => ((0, jsx_runtime_1.jsx)(chooseGalleryItem_1.default, { galleryItem: galleryItem, isSelected: galleryItem.galleryId === selectedItem?.galleryId, handleIsSelected: handleIsSelected }, galleryItem.galleryId)));
|
|
135
|
+
return ((0, jsx_runtime_1.jsxs)(StyledChooseGalleryItems, { children: [(0, jsx_runtime_1.jsx)("div", { className: "head", children: (0, jsx_runtime_1.jsx)("h3", { className: "tittle", children: title }) }), (0, jsx_runtime_1.jsxs)("div", { className: "content", children: [!isLoading && galleryItems && ((0, jsx_runtime_1.jsx)(react_virtuoso_1.Virtuoso, { totalCount: renderItems.length, itemContent: (index) => renderItems[index], endReached: loadMore, overscan: 200, components: {
|
|
137
136
|
Footer: () => (isNextLoading ? (0, jsx_runtime_1.jsx)(CardsHolderLoader_1.default, {}) : null),
|
|
138
|
-
} })), isLoading && (
|
|
139
|
-
addMethod(selectedItem?.
|
|
140
|
-
} }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text:
|
|
137
|
+
} })), isLoading && (0, jsx_runtime_1.jsx)(react_virtuoso_1.Virtuoso, { totalCount: 20, itemContent: () => (0, jsx_runtime_1.jsx)(PlaceholderItemsGallery_1.PlaceholderItemsGallery, {}) })] }), (0, jsx_runtime_1.jsx)("div", { className: "favoriteBtn", children: (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: titleBtn, variant: "outline", onClick: () => setAddGallery(true) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "btns", children: [(0, jsx_runtime_1.jsx)(MainButton_1.default, { text: "Add", variant: "primaryM", disabled: !selectedItem || !ids, onClick: () => {
|
|
138
|
+
addMethod(selectedItem?.galleryId, ids);
|
|
139
|
+
} }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: "Cancel", variant: "secondary", onClick: () => {
|
|
141
140
|
closeModalSidebarPortal();
|
|
142
141
|
closeModalSidebar();
|
|
143
142
|
} })] })] }));
|
|
@@ -145,17 +144,17 @@ const GalleryItems = ({ galleryItems, loadMore, isNextLoading, isAdded, titleBtn
|
|
|
145
144
|
const GalleryItemsMyGallery = (props) => {
|
|
146
145
|
const { galleryItems, loadMore, isNextLoading, load, isLoading } = (0, useFetchMyGalleries_1.useFetchMyGalleriesV2)();
|
|
147
146
|
(0, react_1.useEffect)(() => {
|
|
148
|
-
load({ pageSize: 100, pageToken:
|
|
147
|
+
load({ pageSize: 100, pageToken: "" });
|
|
149
148
|
}, []);
|
|
150
149
|
return ((0, jsx_runtime_1.jsx)(GalleryItems, { ...props, galleryItems: galleryItems, loadMore: loadMore, isNextLoading: isNextLoading, isLoading: isLoading }));
|
|
151
150
|
};
|
|
152
151
|
const GalleryItemsMyFavorite = (props) => {
|
|
153
152
|
const { galleryItems, loadMore, isNextLoading, load, isLoading } = (0, useFetchMyFavorites_1.useFetchMyFavoritesV2)();
|
|
154
153
|
(0, react_1.useEffect)(() => {
|
|
155
|
-
load({ pageSize: 100, pageToken:
|
|
154
|
+
load({ pageSize: 100, pageToken: "" });
|
|
156
155
|
}, []);
|
|
157
156
|
return ((0, jsx_runtime_1.jsx)(GalleryItems, { ...props, galleryItems: galleryItems, loadMore: loadMore, isNextLoading: isNextLoading, isLoading: isLoading }));
|
|
158
157
|
};
|
|
159
|
-
const ChooseGalleryItems = ({ isGetMyGalleries, ...props }) => isGetMyGalleries ? (
|
|
158
|
+
const ChooseGalleryItems = ({ isGetMyGalleries, ...props }) => (isGetMyGalleries ? (0, jsx_runtime_1.jsx)(GalleryItemsMyGallery, { ...props }) : (0, jsx_runtime_1.jsx)(GalleryItemsMyFavorite, { ...props }));
|
|
160
159
|
// Export
|
|
161
160
|
exports.default = ChooseGalleryItems;
|
|
@@ -5,37 +5,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.OpportunityCard = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
8
|
+
const useDislikeOpportunity_1 = require("../../api/server-opportunities/mutations/useDislikeOpportunity");
|
|
9
|
+
const useLikeOpportunity_1 = require("../../api/server-opportunities/mutations/useLikeOpportunity");
|
|
10
|
+
const useOpenOpportunity_1 = __importDefault(require("../../api/server-opportunities/mutations/useOpenOpportunity"));
|
|
11
|
+
const data_1 = __importDefault(require("../../entities/labelCreationType/data"));
|
|
12
|
+
const vars_1 = require("../../fonts/vars");
|
|
13
|
+
const OpportunityDropDown_1 = require("./OpportunityDropDown");
|
|
14
|
+
const ShareIcon_1 = require("./ShareIcon");
|
|
15
|
+
const OpportunityMenu_1 = require("./popup/OpportunityMenu");
|
|
15
16
|
const store_1 = require("../user/store");
|
|
17
|
+
const heart_svg_1 = __importDefault(require("../../public/cards/heart"));
|
|
16
18
|
const env_1 = require("../../store/env");
|
|
17
19
|
const ui_1 = require("../../store/ui");
|
|
18
20
|
const ScreenWidth_1 = require("../../styles/ScreenWidth");
|
|
19
|
-
const
|
|
21
|
+
const colors_1 = require("../../styles/colors");
|
|
20
22
|
const boxTransform_1 = __importDefault(require("../../styles/mixins/boxTransform"));
|
|
21
23
|
const typography_1 = require("../../styles/typography");
|
|
22
|
-
const index_1 = require("../../system/index");
|
|
23
24
|
const CardCategory_1 = __importDefault(require("../../system/Cards/CardContent/CardCategory"));
|
|
24
25
|
const Headicons_1 = __importDefault(require("../../system/Cards/Styles/Headicons"));
|
|
25
26
|
const ImageInterceptor_1 = require("../../system/Img/ImageInterceptor");
|
|
27
|
+
const index_1 = require("../../system/index");
|
|
26
28
|
const screen_1 = require("../../utils/screen");
|
|
27
|
-
const OpportunityDropDown_1 = require("./OpportunityDropDown");
|
|
28
|
-
const ShareIcon_1 = require("./ShareIcon");
|
|
29
|
-
const OpportunityMenu_1 = require("./popup/OpportunityMenu");
|
|
30
|
-
const useDislikeOpportunity_1 = require("../../api/server-opportunities/mutations/useDislikeOpportunity");
|
|
31
|
-
const useLikeOpportunity_1 = require("../../api/server-opportunities/mutations/useLikeOpportunity");
|
|
32
|
-
const vars_1 = require("../../fonts/vars");
|
|
33
|
-
const heart_svg_1 = __importDefault(require("../../public/cards/heart"));
|
|
34
29
|
const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
|
|
35
|
-
const
|
|
30
|
+
const colors_2 = require("@ludo.ninja/ui/build/styles/colors");
|
|
31
|
+
const boxShadow_1 = __importDefault(require("@ludo.ninja/ui/build/styles/mixins/boxShadow"));
|
|
32
|
+
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
33
|
+
const moment_1 = __importDefault(require("moment/moment"));
|
|
34
|
+
const react_1 = require("react");
|
|
35
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
36
36
|
const SWrapperLink = styled_components_1.default.a `
|
|
37
37
|
position: relative;
|
|
38
|
-
background-color: ${
|
|
38
|
+
background-color: ${colors_2.WhiteColor};
|
|
39
39
|
border-radius: 6px;
|
|
40
40
|
${boxShadow_1.default};
|
|
41
41
|
${boxTransform_1.default};
|
|
@@ -114,7 +114,7 @@ const StyledCardContent = styled_components_1.default.div `
|
|
|
114
114
|
.mainName {
|
|
115
115
|
font-family: ${vars_1.dmsansFontVarCss.css};
|
|
116
116
|
${typography_1.TextSmall};
|
|
117
|
-
color: ${
|
|
117
|
+
color: ${colors_1.TextGrayColor};
|
|
118
118
|
font-size: 13px;
|
|
119
119
|
flex: 1;
|
|
120
120
|
-webkit-line-clamp: 6;
|
|
@@ -126,7 +126,7 @@ const StyledCardContent = styled_components_1.default.div `
|
|
|
126
126
|
.secondName {
|
|
127
127
|
font-family: ${vars_1.poppinsFontVarCss.css};
|
|
128
128
|
${typography_1.FH5};
|
|
129
|
-
color: ${
|
|
129
|
+
color: ${colors_1.BlackColor};
|
|
130
130
|
font-size: 15px;
|
|
131
131
|
overflow: hidden;
|
|
132
132
|
text-overflow: ellipsis;
|
|
@@ -144,7 +144,6 @@ const StyledCardContent = styled_components_1.default.div `
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
|
|
148
147
|
.date {
|
|
149
148
|
color: #b0b2c0;
|
|
150
149
|
font-size: 12px;
|
|
@@ -233,8 +232,7 @@ const OpportunityCard = ({ opportunity, toolsForRemove, }) => {
|
|
|
233
232
|
}));
|
|
234
233
|
const { windowDimensions } = (0, screen_1.useWindowDimensionsWithServerInitial)();
|
|
235
234
|
const { openOpportunityAction } = (0, useOpenOpportunity_1.default)();
|
|
236
|
-
const isMobile = !!(windowDimensions?.windowWidth &&
|
|
237
|
-
windowDimensions.windowWidth <= ScreenWidth_1.ScreenWidth.DESKTOP);
|
|
235
|
+
const isMobile = !!(windowDimensions?.windowWidth && windowDimensions.windowWidth <= ScreenWidth_1.ScreenWidth.DESKTOP);
|
|
238
236
|
const isSignedIn = (0, store_1.useUserStore)((state) => state.isSignedIn);
|
|
239
237
|
const { openModalSidebarPortal, closeModalSidebarPortal } = (0, ui_1.useUiStore)((state) => ({
|
|
240
238
|
openModalSidebarPortal: state.openModalSidebarPortal,
|
|
@@ -242,10 +240,10 @@ const OpportunityCard = ({ opportunity, toolsForRemove, }) => {
|
|
|
242
240
|
}));
|
|
243
241
|
const getMediaENVDomain = (0, env_1.useEnvStore)((state) => state.getMediaDomain);
|
|
244
242
|
const isProd = (0, env_1.useEnvStore)((state) => state.isProd);
|
|
245
|
-
const opportunityLink = opportunity.opportunityType ===
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
243
|
+
const opportunityLink = opportunity.opportunityType === "TOKEN_AIRDROP"
|
|
244
|
+
? `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"]}/brand/${opportunity.opportunityId}`
|
|
245
|
+
: opportunity.projectUrl || opportunity.shareLink || "";
|
|
246
|
+
return ((0, jsx_runtime_1.jsxs)(SWrapperLink, { href: opportunityLink, target: "_blank", onClick: () => openOpportunityAction({ opportunityId: opportunity.opportunityId }), children: [(0, jsx_runtime_1.jsxs)(StyledCardHead, { children: [(0, jsx_runtime_1.jsx)(OpportunityImage, { alt: opportunity.name, src: opportunity.media ? `${getMediaENVDomain()}/opportunity-medias/${opportunity.media}` : "" }), (0, jsx_runtime_1.jsx)(Headicons_1.default, { isMobile: isMobile, onClick: (e) => {
|
|
249
247
|
e.stopPropagation();
|
|
250
248
|
e.preventDefault();
|
|
251
249
|
}, children: (0, jsx_runtime_1.jsxs)("div", { className: "icons", children: [(0, jsx_runtime_1.jsx)("div", { className: "icon", onClick: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
@@ -4,24 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const index_1 = __importDefault(require("./index"));
|
|
8
|
+
const types_1 = require("../../../../entities/labelCreationType/types");
|
|
7
9
|
require("@testing-library/jest-dom/extend-expect");
|
|
8
10
|
const react_1 = require("@testing-library/react");
|
|
9
|
-
|
|
10
|
-
const index_1 = __importDefault(require("./index"));
|
|
11
|
-
describe('CardCategory Component', () => {
|
|
11
|
+
describe("CardCategory Component", () => {
|
|
12
12
|
const labelMock = {
|
|
13
|
-
text:
|
|
14
|
-
backgroundColor:
|
|
15
|
-
color:
|
|
13
|
+
text: types_1.LabelText.opportunity,
|
|
14
|
+
backgroundColor: types_1.LabelBackground.opportunity,
|
|
15
|
+
color: types_1.LabelColor.opportunity,
|
|
16
16
|
};
|
|
17
|
-
test(
|
|
17
|
+
test("renders the component with the provided label", () => {
|
|
18
18
|
(0, react_1.render)((0, jsx_runtime_1.jsx)(index_1.default, { label: labelMock }));
|
|
19
|
-
const labelElement = react_1.screen.getByText(
|
|
19
|
+
const labelElement = react_1.screen.getByText(types_1.LabelText.opportunity);
|
|
20
20
|
expect(labelElement).toBeInTheDocument();
|
|
21
21
|
expect(labelElement).toHaveStyle(`background: ${labelMock.backgroundColor}`);
|
|
22
22
|
expect(labelElement).toHaveStyle(`color: ${labelMock.color}`);
|
|
23
23
|
});
|
|
24
|
-
test(
|
|
24
|
+
test("does not render the component when no label is provided", () => {
|
|
25
25
|
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(index_1.default, { label: undefined }));
|
|
26
26
|
expect(container.firstChild).toBeNull();
|
|
27
27
|
});
|