@ludo.ninja/components 2.1.55 → 2.1.61

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,4 +1,4 @@
1
1
  export declare const useGetOpportunities: () => {
2
- opportunities: import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").Maybe<Pick<import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").IOpportunityV2, "collection" | "liked" | "media" | "name" | "views" | "createdAt" | "blockchain" | "description" | "opportunityId" | "brandId" | "categoryId" | "opportunityStatus" | "opportunityType" | "notificationType" | "brandName" | "brandDescription" | "brandMedia" | "brandUrl" | "brandIndustry" | "categoryName" | "ludoUrl" | "projectUrl" | "activeFrom" | "activeUntil" | "minXpLevel" | "maxXpLevel" | "minRank" | "maxRank" | "reportLink" | "clicks" | "minWalletValue" | "maxWalletValue" | "shareLink">>[];
2
+ opportunities: import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").Maybe<Pick<import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").IOpportunityV2, "views" | "createdAt" | "blockchain" | "name" | "description" | "collection" | "liked" | "opportunityId" | "brandId" | "categoryId" | "opportunityStatus" | "opportunityType" | "notificationType" | "brandName" | "brandDescription" | "brandMedia" | "brandUrl" | "brandIndustry" | "categoryName" | "ludoUrl" | "projectUrl" | "activeFrom" | "activeUntil" | "minXpLevel" | "maxXpLevel" | "minRank" | "maxRank" | "media" | "reportLink" | "clicks" | "minWalletValue" | "maxWalletValue" | "shareLink">>[];
3
3
  isLoadingOpportunities: boolean;
4
4
  };
@@ -8,6 +8,6 @@ export declare const prefetchSearchResultCategorySelections: (apolloClient: Apol
8
8
  declare const useSearchResultCategorySelections: () => {
9
9
  categorySelectionsLoading: boolean;
10
10
  error: import("@apollo/client").ApolloError | undefined;
11
- searchResultCategorySelections: schema.Maybe<Pick<schema.ISelection, "label" | "name">>[] | null;
11
+ searchResultCategorySelections: schema.Maybe<Pick<schema.ISelection, "name" | "label">>[] | null;
12
12
  };
13
13
  export default useSearchResultCategorySelections;
@@ -9,6 +9,6 @@ declare const useSearchResultStatusSelections: () => {
9
9
  searchResultStatusSelectionsLoading: boolean;
10
10
  loading: boolean;
11
11
  error: import("@apollo/client").ApolloError | undefined;
12
- searchResultStatusSelections: schema.Maybe<Pick<schema.ISelection, "label" | "name">>[] | null;
12
+ searchResultStatusSelections: schema.Maybe<Pick<schema.ISelection, "name" | "label">>[] | null;
13
13
  };
14
14
  export default useSearchResultStatusSelections;
@@ -9,5 +9,5 @@ export declare const useSearchResultTypeSelections: () => {
9
9
  resultTypeSelectionsLoading: boolean;
10
10
  error: import("@apollo/client").ApolloError | undefined;
11
11
  data: any;
12
- searchResultTypeSelections: schema.Maybe<Pick<schema.ISelection, "label" | "name">>[] | null;
12
+ searchResultTypeSelections: schema.Maybe<Pick<schema.ISelection, "name" | "label">>[] | null;
13
13
  };
@@ -27,15 +27,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const jsx_runtime_1 = require("react/jsx-runtime");
30
- const react_1 = __importStar(require("react"));
31
- const link_1 = __importDefault(require("next/link"));
30
+ const vars_1 = require("../../../../fonts/vars");
31
+ const creation_1 = require("../../../../store/creation");
32
+ // import { useCreationStore } from "@/store/creation";
32
33
  const ScreenWidth_1 = require("../../../../styles/ScreenWidth");
33
34
  const imageProportionsSize_1 = require("../../../../utils/imageProportionsSize");
34
- const react_loading_skeleton_1 = __importDefault(require("react-loading-skeleton"));
35
- const styled_components_1 = __importStar(require("styled-components"));
36
35
  const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
37
36
  const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
38
- const vars_1 = require("../../../../fonts/vars");
37
+ const link_1 = __importDefault(require("next/link"));
38
+ const react_1 = __importStar(require("react"));
39
+ const react_loading_skeleton_1 = __importDefault(require("react-loading-skeleton"));
40
+ const styled_components_1 = __importStar(require("styled-components"));
39
41
  const SScreenshotContainer = styled_components_1.default.div `
40
42
  border-radius: 16px;
41
43
  overflow: hidden;
@@ -151,8 +153,16 @@ const ImageContainer = styled_components_1.default.div `
151
153
  }
152
154
  `;
153
155
  const AssetImage = ({ imageUrl, errorImg, originalUrl, alt, isScreenshot, }) => {
156
+ // const { urlsActive, addUrlsActive } = useCreationStore((state) => ({
157
+ // urlsActive: state.urlsActive,
158
+ // addUrlsActive: state.addUrlsActive,
159
+ // }));
160
+ const isFirstLoading = !creation_1.urlsActive[imageUrl];
154
161
  const [size, setSize] = (0, react_1.useState)({});
155
- const [loading, setLoading] = (0, react_1.useState)(true);
162
+ const [loading, setLoading] = (0, react_1.useState)(isFirstLoading);
163
+ if (isFirstLoading) {
164
+ (0, creation_1.addUrlsActive)(imageUrl);
165
+ }
156
166
  const ref = (0, react_1.useRef)(null);
157
167
  (0, react_1.useLayoutEffect)(() => {
158
168
  const { width, height } = (0, imageProportionsSize_1.defineImgProportion)(ref, 80);
@@ -162,24 +172,22 @@ const AssetImage = ({ imageUrl, errorImg, originalUrl, alt, isScreenshot, }) =>
162
172
  }
163
173
  }, [imageUrl]);
164
174
  const LinkComponent = originalUrl ? link_1.default : react_1.default.Fragment;
165
- const ScreenShotContainer = isScreenshot
166
- ? SScreenshotContainer
167
- : react_1.default.Fragment;
168
- return ((0, jsx_runtime_1.jsx)(LinkComponent, { href: `${originalUrl}`, target: "_blank", children: (0, jsx_runtime_1.jsxs)(ScreenShotContainer, { children: [(0, jsx_runtime_1.jsxs)(ImageContainer, { isScreenshot: isScreenshot, children: [loading && ((0, jsx_runtime_1.jsx)(react_loading_skeleton_1.default, { height: '100%', width: '100%', style: {
169
- lineHeight: 'normal',
170
- position: 'absolute',
175
+ const ScreenShotContainer = isScreenshot ? SScreenshotContainer : react_1.default.Fragment;
176
+ return ((0, jsx_runtime_1.jsx)(LinkComponent, { href: `${originalUrl}`, target: "_blank", children: (0, jsx_runtime_1.jsxs)(ScreenShotContainer, { children: [(0, jsx_runtime_1.jsxs)(ImageContainer, { isScreenshot: isScreenshot, children: [loading && ((0, jsx_runtime_1.jsx)(react_loading_skeleton_1.default, { height: "100%", width: "100%", style: {
177
+ lineHeight: "normal",
178
+ position: "absolute",
171
179
  top: 0,
172
180
  left: 0,
173
- visibility: `${loading ? 'hidden' : 'visible'}`,
181
+ visibility: `${loading ? "hidden" : "visible"}`,
174
182
  } })), (0, jsx_runtime_1.jsx)("img", { alt: alt, ref: ref, src: imageUrl, onError: (e) => {
175
183
  e.target.src = errorImg;
176
- setSize({ width: '100%', height: '100%' });
184
+ setSize({ width: "100%", height: "100%" });
177
185
  }, onLoad: () => setLoading(false), style: {
178
- opacity: loading ? '0' : '1',
186
+ opacity: loading ? "0" : "1",
179
187
  ...(isScreenshot
180
188
  ? {
181
- maxHeight: '100%',
182
- maxWidth: '100%',
189
+ maxHeight: "100%",
190
+ maxWidth: "100%",
183
191
  }
184
192
  : size),
185
193
  } })] }), isScreenshot && originalUrl && ((0, jsx_runtime_1.jsx)("div", { className: "link", title: originalUrl, children: (0, jsx_runtime_1.jsx)("span", { children: originalUrl }) }))] }) }));
@@ -50,11 +50,6 @@ const useVerification = () => {
50
50
  role: authCookiesParsed.role,
51
51
  });
52
52
  }
53
- else {
54
- if (currentLocation !== "/forms/[formId]" && currentLocation !== "/minting") {
55
- await signOut();
56
- }
57
- }
58
53
  }
59
54
  catch (e) {
60
55
  // console.error('verification', e);
@@ -0,0 +1,5 @@
1
+ export declare let urlsActive: {
2
+ [a: string]: boolean;
3
+ };
4
+ export declare const addUrlsActive: (url: string) => void;
5
+ export declare const clearAllUrlsActive: () => void;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clearAllUrlsActive = exports.addUrlsActive = exports.urlsActive = void 0;
4
+ // interface ICreationStore {
5
+ // urlsActive: { [a: string]: boolean };
6
+ // addUrlsActive: (url: string) => void;
7
+ // clearAllUrlsActive: () => void;
8
+ // }
9
+ //
10
+ // export const useCreationStore = createWithEqualityFn<ICreationStore>()(
11
+ // (setState) => ({
12
+ // urlsActive: {},
13
+ // addUrlsActive: (url) => {
14
+ // setState((prev) => ({
15
+ // urlsActive: {
16
+ // ...prev.urlsActive,
17
+ // [url]: true,
18
+ // },
19
+ // }));
20
+ // },
21
+ // clearAllUrlsActive: () => {
22
+ // setState({
23
+ // urlsActive: {},
24
+ // });
25
+ // },
26
+ // }),
27
+ // shallow,
28
+ // );
29
+ //without rerenders include stack
30
+ exports.urlsActive = {};
31
+ const addUrlsActive = (url) => {
32
+ exports.urlsActive[url] = true;
33
+ };
34
+ exports.addUrlsActive = addUrlsActive;
35
+ const clearAllUrlsActive = () => {
36
+ exports.urlsActive = {};
37
+ };
38
+ exports.clearAllUrlsActive = clearAllUrlsActive;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.1.55",
3
+ "version": "2.1.61",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,14 +0,0 @@
1
- import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
2
- import { searchSchema as schema } from '@ludo.ninja/api';
3
- import AssetEntity from '../../../../dto/AssetEntity';
4
- declare const prefetchAssetByBlockchain: ({ blockchain, address, elrondId, tokenId, }: schema.IQueryFetchAssetByBlockchainArgs, apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
5
- data: {
6
- fetchAssetByBlockchain: null;
7
- };
8
- }>;
9
- declare const useFetchAssetByBlockchain: ({ blockchain, address, elrondId, tokenId, }: schema.IQueryFetchAssetByBlockchainArgs, prefetchedAsset: AssetEntity | null) => {
10
- clientData: AssetEntity | null;
11
- loading: boolean;
12
- error: import("@apollo/client").ApolloError | undefined;
13
- };
14
- export { prefetchAssetByBlockchain, useFetchAssetByBlockchain };
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useFetchAssetByBlockchain = exports.prefetchAssetByBlockchain = void 0;
7
- const react_1 = require("react");
8
- const api_1 = require("@ludo.ninja/api");
9
- const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
10
- const ui_1 = require("../../../../store/ui");
11
- const AssetEntity_1 = __importDefault(require("../../../../dto/AssetEntity"));
12
- const prefetchAssetByBlockchain = async ({ blockchain, address, elrondId, tokenId, }, apolloClient) => {
13
- return apolloClient
14
- .query({
15
- query: api_1.searchSchema.FetchAssetByBlockchainDocument,
16
- variables: { blockchain, address, elrondId, tokenId },
17
- context: { uri: api_1.hosts.serverSearchHost }, // faster service assets for production,
18
- fetchPolicy: 'network-only',
19
- })
20
- .catch(() => {
21
- return {
22
- data: { fetchAssetByBlockchain: null },
23
- };
24
- });
25
- };
26
- exports.prefetchAssetByBlockchain = prefetchAssetByBlockchain;
27
- const useFetchAssetByBlockchain = ({ blockchain, address, elrondId, tokenId, }, prefetchedAsset) => {
28
- const [asset, setAsset] = (0, react_1.useState)(prefetchedAsset);
29
- const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
30
- const { loading, error } = api_1.searchSchema.useFetchAssetByBlockchainQuery({
31
- variables: { blockchain, address, elrondId, tokenId },
32
- context: {
33
- uri: api_1.hosts.searchHost,
34
- },
35
- onCompleted: ({ fetchAssetByBlockchain }) => {
36
- setAsset(new AssetEntity_1.default(fetchAssetByBlockchain));
37
- },
38
- onError: () => {
39
- openAlert({
40
- type: type_1.alertVariants.error,
41
- caption: 'Oops, something went wrong.',
42
- });
43
- setAsset(null);
44
- },
45
- });
46
- return { clientData: asset, loading, error };
47
- };
48
- exports.useFetchAssetByBlockchain = useFetchAssetByBlockchain;