@ludo.ninja/components 2.2.47 → 2.2.48
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.
|
@@ -71,9 +71,11 @@ const StyledSearchSuggestions = styled_components_1.default.div `
|
|
|
71
71
|
`;
|
|
72
72
|
// Components
|
|
73
73
|
const SearchSuggestions = ({ searchTerm, assets, profiles, collections, isLoading }) => {
|
|
74
|
-
const { getMediaENVDomain, NEXT_PUBLIC_ENV_VALUE } = (0, env_1.useEnvStore)((state) => ({
|
|
74
|
+
const { getMediaENVDomain, NEXT_PUBLIC_ENV_VALUE, getAudioDomain, getVideoDomain } = (0, env_1.useEnvStore)((state) => ({
|
|
75
75
|
getMediaENVDomain: state.getMediaDomain,
|
|
76
76
|
NEXT_PUBLIC_ENV_VALUE: state.NEXT_PUBLIC_ENV_VALUE,
|
|
77
|
+
getAudioDomain: state.getAudioDomain,
|
|
78
|
+
getVideoDomain: state.getVideoDomain,
|
|
77
79
|
}));
|
|
78
80
|
const isNotFound = !assets?.length && !profiles?.length && !collections?.length;
|
|
79
81
|
return ((0, jsx_runtime_1.jsx)(StyledSearchSuggestions, { children: (0, jsx_runtime_1.jsxs)("div", { className: "content", children: [isLoading && (0, jsx_runtime_1.jsx)(searchSuggestionsItemSkeleton_1.SearchSuggestionsItemsSkeleton, {}), !isLoading &&
|
|
@@ -82,7 +84,7 @@ const SearchSuggestions = ({ searchTerm, assets, profiles, collections, isLoadin
|
|
|
82
84
|
? [
|
|
83
85
|
{
|
|
84
86
|
caption: "NFTs",
|
|
85
|
-
children: assets.map((asset) => ((0, jsx_runtime_1.jsx)(searchSuggestionsItem_1.default, { name: asset?.name, link: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["asset"]}${asset.assetLink.replace(`${types_1.LabelKeys.asset}/`, "")}`, imgUrl: (0, getAssetMiniatureUrl_1.getAssetMiniatureUrl)({ asset }), searchTerm: searchTerm }, `${asset?.assetId}.${Math.random()}`))),
|
|
87
|
+
children: assets.map((asset) => ((0, jsx_runtime_1.jsx)(searchSuggestionsItem_1.default, { name: asset?.name, link: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["asset"]}${asset.assetLink.replace(`${types_1.LabelKeys.asset}/`, "")}`, imgUrl: (0, getAssetMiniatureUrl_1.getAssetMiniatureUrl)({ asset, nextPublicDomain: NEXT_PUBLIC_ENV_VALUE, getAudioDomain, getVideoDomain }), searchTerm: searchTerm }, `${asset?.assetId}.${Math.random()}`))),
|
|
86
88
|
},
|
|
87
89
|
]
|
|
88
90
|
: []),
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { TAsset } from './types';
|
|
2
|
-
export declare const getAssetMiniatureUrl: ({ asset }: {
|
|
2
|
+
export declare const getAssetMiniatureUrl: ({ asset, nextPublicDomain, getAudioDomain, getVideoDomain }: {
|
|
3
3
|
asset: TAsset;
|
|
4
|
+
nextPublicDomain: string;
|
|
5
|
+
getAudioDomain: (env?: string) => string;
|
|
6
|
+
getVideoDomain: (env?: string) => string;
|
|
4
7
|
}) => string;
|
|
@@ -4,14 +4,8 @@ exports.getAssetMiniatureUrl = void 0;
|
|
|
4
4
|
const getMediaVariant_1 = require("../media/getMediaVariant");
|
|
5
5
|
const types_1 = require("../media/types");
|
|
6
6
|
const urls_1 = require("../media/urls");
|
|
7
|
-
const env_1 = require("../../store/env");
|
|
8
7
|
const constants_1 = require("@ludo.ninja/core/build/constants");
|
|
9
|
-
const getAssetMiniatureUrl = ({ asset }) => {
|
|
10
|
-
const { NEXT_PUBLIC_STATIC_DOMAIN, getAudioDomain, getVideoDomain } = (0, env_1.useEnvStore)((state) => ({
|
|
11
|
-
NEXT_PUBLIC_STATIC_DOMAIN: state.NEXT_PUBLIC_STATIC_DOMAIN,
|
|
12
|
-
getAudioDomain: state.getAudioDomain,
|
|
13
|
-
getVideoDomain: state.getVideoDomain,
|
|
14
|
-
}));
|
|
8
|
+
const getAssetMiniatureUrl = ({ asset, nextPublicDomain, getAudioDomain, getVideoDomain }) => {
|
|
15
9
|
const media = asset.medias[0];
|
|
16
10
|
if (!media)
|
|
17
11
|
return `${constants_1.staticLink}/public/noContent/noContent.svg`;
|
|
@@ -31,7 +25,7 @@ const getAssetMiniatureUrl = ({ asset }) => {
|
|
|
31
25
|
case types_1.EMediaVariants.other:
|
|
32
26
|
case types_1.EMediaVariants.screenshot:
|
|
33
27
|
default:
|
|
34
|
-
return (0, urls_1.isExternalMediaImage)(media.media, urls_1.mediaSizes.small,
|
|
28
|
+
return (0, urls_1.isExternalMediaImage)(media.media, urls_1.mediaSizes.small, nextPublicDomain);
|
|
35
29
|
}
|
|
36
30
|
};
|
|
37
31
|
exports.getAssetMiniatureUrl = getAssetMiniatureUrl;
|