@ludo.ninja/components 2.3.54 → 2.3.56
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/components/submitNewProjectForm/blockchainSelect/index.d.ts +11 -0
- package/build/components/submitNewProjectForm/blockchainSelect/index.js +129 -0
- package/build/components/submitNewProjectForm/index.d.ts +4 -1
- package/build/components/submitNewProjectForm/index.js +30 -54
- package/build/components/submitNewProjectForm/resultSubmitNewProjectModal/index.js +11 -3
- package/build/system/Forms/Selects/DesktopSelect/index.d.ts +4 -0
- package/build/system/Forms/Selects/DesktopSelect/index.js +3 -2
- package/build/system/Forms/Selects/MobileSelect/index.d.ts +1 -0
- package/build/utils/validateTokenAddress/index.d.ts +2 -0
- package/build/utils/validateTokenAddress/index.js +46 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ICollectionFilterInput, ICreationFilterInput } from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface Props {
|
|
4
|
+
defaultOptionValue?: string;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
onChangeHandler: (fieldName: keyof ICreationFilterInput & keyof ICollectionFilterInput, fieldValue: string) => Promise<void>;
|
|
7
|
+
name: string;
|
|
8
|
+
isError: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const BlockChainSelect: React.FC<Props>;
|
|
11
|
+
export default BlockChainSelect;
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const env_1 = require("../../../store/env");
|
|
8
|
+
const ScreenWidth_1 = require("../../../styles/ScreenWidth");
|
|
9
|
+
const DesktopSelect_1 = __importDefault(require("../../../system/Forms/Selects/DesktopSelect"));
|
|
10
|
+
const core_1 = require("@ludo.ninja/core");
|
|
11
|
+
const data_1 = require("@ludo.ninja/core/build/blockchains/data");
|
|
12
|
+
const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
|
|
13
|
+
const typography_1 = require("@ludo.ninja/ui/build/styles/typography");
|
|
14
|
+
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
15
|
+
const react_select_1 = require("react-select");
|
|
16
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
17
|
+
const StyledSelect = (0, styled_components_1.default)(DesktopSelect_1.default) `
|
|
18
|
+
border-radius: 6px;
|
|
19
|
+
border: 1px solid ${(props) => (props.isError ? colors_1.ErrorColor : colors_1.BorderColorLight)};
|
|
20
|
+
|
|
21
|
+
.react-select__value-container {
|
|
22
|
+
padding-left: 8px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.react-select__menu-list {
|
|
26
|
+
padding: 8px;
|
|
27
|
+
|
|
28
|
+
.react-select__option {
|
|
29
|
+
padding: 0;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
&.react-select__option--is-focused{
|
|
32
|
+
background: ${colors_1.BackgroundColorLight};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.react-select__menu {
|
|
38
|
+
box-shadow: 0 8px 16px 0 rgba(33, 21, 95, 0.1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.react-select__placeholder {
|
|
42
|
+
${typography_1.MainText};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.react-select__input-container {
|
|
46
|
+
${typography_1.MainText};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.react-select__single-value {
|
|
50
|
+
padding-left: 2px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
${ScreenWidth_1.mediaQuery.minWidthFourK} {
|
|
54
|
+
border-radius: ${(0, _4k_1.adaptiveValueCalc)(6)};
|
|
55
|
+
|
|
56
|
+
.react-select__value-container {
|
|
57
|
+
padding-left: ${(0, _4k_1.adaptiveValueCalc)(8)};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.react-select__menu-list {
|
|
61
|
+
padding: ${(0, _4k_1.adaptiveValueCalc)(8)};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.react-select__single-value {
|
|
65
|
+
padding-left: ${(0, _4k_1.adaptiveValueCalc)(2)};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
const getBlockchainOptions = (domain) => {
|
|
70
|
+
const data = [];
|
|
71
|
+
for (const buildBlockchainsDatum in data_1.blockChainData) {
|
|
72
|
+
const key = buildBlockchainsDatum;
|
|
73
|
+
const test = new core_1.BlockChainEntity(key);
|
|
74
|
+
if (key !== core_1.BlockChainKeys.no_blockchain) {
|
|
75
|
+
data.push({
|
|
76
|
+
id: data_1.blockChainData[key].blockchainPrivateLabel,
|
|
77
|
+
label: data_1.blockChainData[key].blockchainPublicLabel,
|
|
78
|
+
icon: test.getBlockChainIconRegular({ domain }),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return data.sort((a, b) => a.label.localeCompare(b.label));
|
|
83
|
+
};
|
|
84
|
+
const StyledImg = styled_components_1.default.img `
|
|
85
|
+
border-radius: 50%;
|
|
86
|
+
|
|
87
|
+
${ScreenWidth_1.mediaQuery.minWidthFourK} {
|
|
88
|
+
width: ${(0, _4k_1.adaptiveValueCalc)(20)};
|
|
89
|
+
height: ${(0, _4k_1.adaptiveValueCalc)(20)};
|
|
90
|
+
margin-right: ${(0, _4k_1.adaptiveValueCalc)(6)};
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
const OptionWrapper = styled_components_1.default.div `
|
|
94
|
+
display: flex;
|
|
95
|
+
padding: 6px 8px;
|
|
96
|
+
align-items: center;
|
|
97
|
+
gap: 10px;
|
|
98
|
+
border-radius: 4px;
|
|
99
|
+
|
|
100
|
+
&:hover {
|
|
101
|
+
background: ${colors_1.BackgroundColorLight};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
${ScreenWidth_1.mediaQuery.minWidthFourK} {
|
|
105
|
+
padding: ${(0, _4k_1.adaptiveValueCalc)(6)} ${(0, _4k_1.adaptiveValueCalc)(8)};
|
|
106
|
+
gap: ${(0, _4k_1.adaptiveValueCalc)(10)};
|
|
107
|
+
border-radius: ${(0, _4k_1.adaptiveValueCalc)(4)};
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
const SingleValueWrapper = styled_components_1.default.div `
|
|
111
|
+
display: flex;
|
|
112
|
+
padding: 6px 0;
|
|
113
|
+
align-items: center;
|
|
114
|
+
gap: 10px;
|
|
115
|
+
|
|
116
|
+
${ScreenWidth_1.mediaQuery.minWidthFourK} {
|
|
117
|
+
padding: ${(0, _4k_1.adaptiveValueCalc)(6)} 0;
|
|
118
|
+
gap: ${(0, _4k_1.adaptiveValueCalc)(10)};
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
const Option = (props) => {
|
|
122
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_select_1.components.Option, { ...props, children: (0, jsx_runtime_1.jsxs)(OptionWrapper, { children: [(0, jsx_runtime_1.jsx)(StyledImg, { width: 20, height: 20, src: props.data.icon, alt: props.label }), props.label] }) }) }));
|
|
123
|
+
};
|
|
124
|
+
const SingleValue = ({ children, ...props }) => ((0, jsx_runtime_1.jsx)(react_select_1.components.SingleValue, { ...props, children: (0, jsx_runtime_1.jsxs)(SingleValueWrapper, { children: [(0, jsx_runtime_1.jsx)(StyledImg, { width: 20, height: 20, src: props.data.icon, alt: props.data.label }), children] }) }));
|
|
125
|
+
const BlockChainSelect = ({ isLoading, isError, onChangeHandler, defaultOptionValue, name }) => {
|
|
126
|
+
const getStaticENVDomain = (0, env_1.useEnvStore)((state) => state.getStaticDomain);
|
|
127
|
+
return ((0, jsx_runtime_1.jsx)(StyledSelect, { isError: isError, options: getBlockchainOptions(getStaticENVDomain()), isLoading: isLoading, isSearchable: true, onChangeHandler: onChangeHandler, name: name, customComponents: { Option, SingleValue }, defaultOptionValue: defaultOptionValue, placeholder: "Blockchain" }));
|
|
128
|
+
};
|
|
129
|
+
exports.default = BlockChainSelect;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
declare const SubmitNewProjectForm: (
|
|
1
|
+
declare const SubmitNewProjectForm: ({ blockchain, contractAddress }: {
|
|
2
|
+
blockchain?: string;
|
|
3
|
+
contractAddress?: string;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
export default SubmitNewProjectForm;
|
|
@@ -7,11 +7,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const resultSubmitNewProjectModal_1 = __importDefault(require("./resultSubmitNewProjectModal"));
|
|
8
8
|
const ui_1 = require("../../store/ui");
|
|
9
9
|
const Forms_1 = require("../../system/Forms");
|
|
10
|
-
const DesktopSelect_1 = __importDefault(require("../../system/Forms/Selects/DesktopSelect"));
|
|
11
10
|
const api_1 = require("@ludo.ninja/api");
|
|
12
11
|
const schema_1 = require("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema");
|
|
13
|
-
const blockchains_1 = require("@ludo.ninja/core/build/blockchains");
|
|
14
|
-
const data_1 = require("@ludo.ninja/core/build/blockchains/data");
|
|
15
12
|
const ScreenWidth_1 = require("@ludo.ninja/ui/build/styles/ScreenWidth");
|
|
16
13
|
const colors_1 = require("@ludo.ninja/ui/build/styles/colors");
|
|
17
14
|
const typography_1 = require("@ludo.ninja/ui/build/styles/typography");
|
|
@@ -19,21 +16,11 @@ const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
|
19
16
|
const MainButton_1 = __importDefault(require("@ludo.ninja/ui/build/system/Buttons/MainButton"));
|
|
20
17
|
const Text_1 = require("@ludo.ninja/ui/build/system/Text");
|
|
21
18
|
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
19
|
+
const react_1 = require("react");
|
|
22
20
|
const react_hook_form_1 = require("react-hook-form");
|
|
23
21
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
for (const buildBlockchainsDatum in data_1.blockChainData) {
|
|
27
|
-
const key = buildBlockchainsDatum;
|
|
28
|
-
if (key !== blockchains_1.BlockChainKeys.no_blockchain) {
|
|
29
|
-
data.push({
|
|
30
|
-
id: data_1.blockChainData[key].blockchainPrivateLabel,
|
|
31
|
-
label: data_1.blockChainData[key].blockchainPublicLabel,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
22
|
+
const validateTokenAddress_1 = require("../../utils/validateTokenAddress");
|
|
23
|
+
const blockchainSelect_1 = __importDefault(require("./blockchainSelect"));
|
|
37
24
|
const StyledCreateForm = styled_components_1.default.div `
|
|
38
25
|
min-width: 392px;
|
|
39
26
|
margin-top: -18px;
|
|
@@ -118,33 +105,19 @@ const StyledCreateForm = styled_components_1.default.div `
|
|
|
118
105
|
}
|
|
119
106
|
}
|
|
120
107
|
`;
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.react-select__placeholder {
|
|
131
|
-
${typography_1.MainText};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
${ScreenWidth_1.mediaQuery.minWidthFourK} {
|
|
135
|
-
height: ${(0, _4k_1.adaptiveValueCalc)(46)};
|
|
136
|
-
border-radius: ${(0, _4k_1.adaptiveValueCalc)(6)};
|
|
137
|
-
border: ${(0, _4k_1.adaptiveValueCalc)(1)} solid #cfd5ea;
|
|
138
|
-
|
|
139
|
-
.react-select__menu {
|
|
140
|
-
box-shadow: 0 ${(0, _4k_1.adaptiveValueCalc)(8)} ${(0, _4k_1.adaptiveValueCalc)(16)} 0 rgba(33, 21, 95, 0.1);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
144
|
-
const SubmitNewProjectForm = () => {
|
|
145
|
-
const { control, register, handleSubmit, formState: { errors }, setError, } = (0, react_hook_form_1.useForm)({
|
|
146
|
-
mode: "all",
|
|
108
|
+
const SubmitNewProjectForm = ({ blockchain, contractAddress }) => {
|
|
109
|
+
const { control, register, handleSubmit, formState: { errors }, setError, setFocus, watch, } = (0, react_hook_form_1.useForm)({
|
|
110
|
+
mode: 'all',
|
|
111
|
+
defaultValues: {
|
|
112
|
+
blockchain: blockchain || '',
|
|
113
|
+
contract: contractAddress || '',
|
|
114
|
+
},
|
|
147
115
|
});
|
|
116
|
+
(0, react_1.useEffect)(() => {
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
setFocus('contract');
|
|
119
|
+
}, 1);
|
|
120
|
+
}, [setFocus]);
|
|
148
121
|
const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
|
|
149
122
|
const closeModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.closeModalSidebarPortal);
|
|
150
123
|
const openModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.openModalSidebarPortal);
|
|
@@ -154,12 +127,15 @@ const SubmitNewProjectForm = () => {
|
|
|
154
127
|
},
|
|
155
128
|
});
|
|
156
129
|
const dataForContract = {
|
|
157
|
-
labelText:
|
|
158
|
-
name:
|
|
159
|
-
placeHolder:
|
|
130
|
+
labelText: 'Project contract ID',
|
|
131
|
+
name: 'contract',
|
|
132
|
+
placeHolder: 'Project contract ID',
|
|
160
133
|
};
|
|
161
|
-
const
|
|
162
|
-
|
|
134
|
+
const blockchainValue = watch('blockchain');
|
|
135
|
+
const registerContract = register('contract', {
|
|
136
|
+
required: { message: 'Project contract ID is required', value: true },
|
|
137
|
+
validate: (value) => (0, validateTokenAddress_1.validateTokenAddress)(value, blockchainValue),
|
|
138
|
+
setValueAs: (value) => value.trim(),
|
|
163
139
|
});
|
|
164
140
|
const errorContract = {
|
|
165
141
|
isNeedShowError: Boolean(errors?.contract),
|
|
@@ -182,20 +158,20 @@ const SubmitNewProjectForm = () => {
|
|
|
182
158
|
openModalSidebarPortal((0, jsx_runtime_1.jsx)(resultSubmitNewProjectModal_1.default, { status: registerNewProject.status, projectInfo: registerNewProject.project }));
|
|
183
159
|
},
|
|
184
160
|
onError: () => {
|
|
185
|
-
setError(
|
|
186
|
-
type:
|
|
187
|
-
message:
|
|
161
|
+
setError('contract', {
|
|
162
|
+
type: 'custom',
|
|
163
|
+
message: 'Provided address is not matching the token address',
|
|
188
164
|
});
|
|
189
165
|
openAlert({
|
|
190
166
|
type: type_1.alertVariants.error,
|
|
191
|
-
caption:
|
|
167
|
+
caption: 'Project can not be registered',
|
|
192
168
|
});
|
|
193
169
|
},
|
|
194
170
|
});
|
|
195
171
|
};
|
|
196
|
-
return ((0, jsx_runtime_1.jsxs)(StyledCreateForm, { children: [(0, jsx_runtime_1.jsxs)("div", { className:
|
|
197
|
-
required: { message:
|
|
198
|
-
}, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(
|
|
172
|
+
return ((0, jsx_runtime_1.jsxs)(StyledCreateForm, { children: [(0, jsx_runtime_1.jsxs)("div", { className: 'head', children: [(0, jsx_runtime_1.jsx)("h3", { className: 'tittle', children: 'Submit New Project' }), (0, jsx_runtime_1.jsx)(Text_1.MainText, { color: colors_1.TextGrayColor, children: "Add your favorite project to follow up it on Ludo" })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleSubmit(onSubmit), children: [(0, jsx_runtime_1.jsxs)("div", { className: 'content', children: [(0, jsx_runtime_1.jsx)("div", { className: "input_group", children: (0, jsx_runtime_1.jsx)(Forms_1.Input, { register: registerContract, error: errorContract, data: dataForContract }) }), (0, jsx_runtime_1.jsx)("div", { className: "input_group", children: (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { name: "blockchain", control: control, rules: {
|
|
173
|
+
required: { message: 'Blockchain is required', value: true },
|
|
174
|
+
}, render: ({ field }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(blockchainSelect_1.default, { isError: Boolean(errors.blockchain), isLoading: false, onChangeHandler: async (fieldName, fieldValue) => field.onChange(fieldValue), name: field.name }), errors.blockchain && ((0, jsx_runtime_1.jsx)(Forms_1.BasicErrorLabel, { children: errors.blockchain.message }))] })) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "btns", children: [(0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Add', type: 'submit', variant: "primaryM", disabled: loading, onClick: () => null }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Cancel', variant: "outline", onClick: () => {
|
|
199
175
|
closeModalSidebarPortal();
|
|
200
176
|
} })] })] })] }));
|
|
201
177
|
};
|
|
@@ -15,6 +15,8 @@ const ScreenWidth_1 = require("@ludo.ninja/ui/build/styles/ScreenWidth");
|
|
|
15
15
|
const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
|
|
16
16
|
const utils_1 = require("@ludo.ninja/utils");
|
|
17
17
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
18
|
+
const MainButton_1 = __importDefault(require("@ludo.ninja/ui/build/system/Buttons/MainButton"));
|
|
19
|
+
const submitNewProjectForm_1 = __importDefault(require(".."));
|
|
18
20
|
const Wrapper = styled_components_1.default.div `
|
|
19
21
|
width: 290px;
|
|
20
22
|
display: flex;
|
|
@@ -79,17 +81,23 @@ const ProjectTitleWrapper = styled_components_1.default.div `
|
|
|
79
81
|
const ResultSubmitNewProjectModal = ({ status, projectInfo, }) => {
|
|
80
82
|
const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
|
|
81
83
|
const closeModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.closeModalSidebarPortal);
|
|
84
|
+
const openModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.openModalSidebarPortal);
|
|
82
85
|
const handleProjectClick = () => {
|
|
83
86
|
if (projectInfo?.slug) {
|
|
84
|
-
window.open(`${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE][
|
|
87
|
+
window.open(`${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]['welcome']}/x/${projectInfo.slug}`, '_blank');
|
|
85
88
|
closeModalSidebarPortal();
|
|
86
89
|
}
|
|
87
90
|
};
|
|
91
|
+
const handleAddNewProjectClick = () => {
|
|
92
|
+
closeModalSidebarPortal();
|
|
93
|
+
openModalSidebarPortal((0, jsx_runtime_1.jsx)(submitNewProjectForm_1.default, {}));
|
|
94
|
+
};
|
|
88
95
|
switch (status) {
|
|
89
96
|
case schema_1.IProjectRegistrationStatus.Submitted:
|
|
90
|
-
return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsx)(success_svg_1.default, {}), (0, jsx_runtime_1.jsx)(ui_2.H3, { children: "Project submitted successfully and added to the review queue" })] }));
|
|
97
|
+
return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsx)(success_svg_1.default, {}), (0, jsx_runtime_1.jsx)(ui_2.H3, { children: "Project submitted successfully and added to the review queue" }), (0, jsx_runtime_1.jsx)(MainButton_1.default, { text: 'Add new Project', type: 'submit', variant: "primaryM", onClick: handleAddNewProjectClick })] }));
|
|
91
98
|
case schema_1.IProjectRegistrationStatus.Exists:
|
|
92
|
-
return ((0, jsx_runtime_1.jsxs)(ProjectExist, { children: [(0, jsx_runtime_1.jsx)(ui_2.H3, { children: "This project already exists in our system" }), Boolean(projectInfo) && ((0, jsx_runtime_1.jsxs)(ProjectTitleWrapper, { onClick: handleProjectClick, children: [(0, jsx_runtime_1.jsxs)("div", { className:
|
|
99
|
+
return ((0, jsx_runtime_1.jsxs)(ProjectExist, { children: [(0, jsx_runtime_1.jsx)(ui_2.H3, { children: "This project already exists in our system" }), Boolean(projectInfo) && ((0, jsx_runtime_1.jsxs)(ProjectTitleWrapper, { onClick: handleProjectClick, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'name', children: [(0, jsx_runtime_1.jsx)(ui_2.H1, { color: '#6048FF', children: projectInfo?.name ||
|
|
100
|
+
(0, utils_1.shortenedText)(projectInfo?.contract) }), projectInfo?.verified && ((0, jsx_runtime_1.jsx)(badge_svg_1.default, { style: { color: '#43A5FF' } }))] }), (0, jsx_runtime_1.jsx)(ui_2.H2, { color: '#696F90', children: projectInfo?.symbol })] }))] }));
|
|
93
101
|
}
|
|
94
102
|
};
|
|
95
103
|
exports.default = ResultSubmitNewProjectModal;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { ISelectInput } from '../MobileSelect';
|
|
2
2
|
import { ICollectionFilterInput, ICreationFilterInput } from "@ludo.ninja/api/build/graphql_tools/__generated__/searchHost/schema";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { GroupBase } from "react-select";
|
|
5
|
+
import { SelectComponents } from "react-select/dist/declarations/src/components";
|
|
4
6
|
interface Props {
|
|
5
7
|
options: ISelectInput[];
|
|
6
8
|
defaultOptionValue?: string;
|
|
7
9
|
isLoading?: boolean;
|
|
10
|
+
isSearchable?: boolean;
|
|
8
11
|
onChangeHandler: (fieldName: keyof ICreationFilterInput & keyof ICollectionFilterInput, fieldValue: string) => Promise<void>;
|
|
9
12
|
name: string;
|
|
13
|
+
customComponents?: Partial<SelectComponents<unknown, boolean, GroupBase<unknown>>>;
|
|
10
14
|
}
|
|
11
15
|
declare const DesktopSelect: React.FC<Props>;
|
|
12
16
|
export default DesktopSelect;
|
|
@@ -149,7 +149,7 @@ const DropdownIndicator = (props) => {
|
|
|
149
149
|
transform: props.selectProps.menuIsOpen ? "rotate(180deg)" : "rotate(0)",
|
|
150
150
|
}, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M16 11L12 15L8 11", stroke: "#696F91", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }));
|
|
151
151
|
};
|
|
152
|
-
const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue, name, ...props }) => {
|
|
152
|
+
const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue, name, customComponents, isSearchable, ...props }) => {
|
|
153
153
|
const [selectedOption, setSelectedOption] = (0, react_1.useState)(options.find((option) => {
|
|
154
154
|
return defaultOptionValue === option.id;
|
|
155
155
|
}) || null);
|
|
@@ -172,9 +172,10 @@ const DesktopSelect = ({ options, isLoading, onChangeHandler, defaultOptionValue
|
|
|
172
172
|
const { windowDimensions } = (0, screen_1.useWindowDimensionsWithServerInitial)();
|
|
173
173
|
if (isLoading)
|
|
174
174
|
return (0, jsx_runtime_1.jsx)(react_loading_skeleton_1.default, { height: `${minHeight}px`, width: "154px" });
|
|
175
|
-
return ((0, jsx_runtime_1.jsx)(SelectElement, { id: String(Math.random()), minHeight: minHeight, scale: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }), classNamePrefix: "react-select", name: name, getOptionLabel: (option) => getOptionLabel(option), getOptionValue: (option) => getOptionValue(option), options: options, value: selectedOption, defaultValue: selectedOption, onChange: (option) => handleChangeOption(option), isSearchable:
|
|
175
|
+
return ((0, jsx_runtime_1.jsx)(SelectElement, { id: String(Math.random()), minHeight: minHeight, scale: (0, scale_1.getAdaptiveScale)({ windowDimensions, currentSize: 1 }), classNamePrefix: "react-select", name: name, getOptionLabel: (option) => getOptionLabel(option), getOptionValue: (option) => getOptionValue(option), options: options, value: selectedOption, defaultValue: selectedOption, onChange: (option) => handleChangeOption(option), isSearchable: isSearchable, components: {
|
|
176
176
|
DropdownIndicator,
|
|
177
177
|
IndicatorSeparator: () => null,
|
|
178
|
+
...customComponents
|
|
178
179
|
}, ...props }));
|
|
179
180
|
};
|
|
180
181
|
exports.default = DesktopSelect;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateTokenAddress = void 0;
|
|
4
|
+
const validateTokenAddress = (address, blockchain) => {
|
|
5
|
+
const ethLikeRegex = /^0x[a-fA-F0-9]{40}$/;
|
|
6
|
+
const base58Regex = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
7
|
+
const nearRegex = /^[.a-z0-9_-]+\.near$/;
|
|
8
|
+
const tezosRegex = /^(tz1|tz2|tz3|KT1)[1-9A-HJ-NP-Za-km-z]{33}$/;
|
|
9
|
+
const flowRegex = /^0x[a-fA-F0-9]{16}$/;
|
|
10
|
+
const tonRegex = /^[a-fA-F0-9]{64}$/;
|
|
11
|
+
const waxRegex = /^[a-z1-5.]{12}$/;
|
|
12
|
+
switch (blockchain) {
|
|
13
|
+
case 'ethereum':
|
|
14
|
+
case 'arbitrum':
|
|
15
|
+
case 'arbitrum-nova':
|
|
16
|
+
case 'avalanche':
|
|
17
|
+
case 'base':
|
|
18
|
+
case 'binance':
|
|
19
|
+
case 'cronos':
|
|
20
|
+
case 'immutablex':
|
|
21
|
+
case 'klaytn':
|
|
22
|
+
case 'moonbeam':
|
|
23
|
+
case 'optimism':
|
|
24
|
+
case 'polygon':
|
|
25
|
+
case 'polygonzkevm':
|
|
26
|
+
case 'skale':
|
|
27
|
+
return ethLikeRegex.test(address) || 'Invalid EVM address';
|
|
28
|
+
case 'solana':
|
|
29
|
+
return base58Regex.test(address) || 'Invalid Solana address';
|
|
30
|
+
case 'elrond':
|
|
31
|
+
return base58Regex.test(address) || 'Invalid MultiversX address';
|
|
32
|
+
case 'near':
|
|
33
|
+
return nearRegex.test(address) || 'Invalid Near address';
|
|
34
|
+
case 'tezos':
|
|
35
|
+
return tezosRegex.test(address) || 'Invalid Tezos address';
|
|
36
|
+
case 'flow':
|
|
37
|
+
return flowRegex.test(address) || 'Invalid Flow address';
|
|
38
|
+
case 'ton':
|
|
39
|
+
return tonRegex.test(address) || 'Invalid TON address';
|
|
40
|
+
case 'wax':
|
|
41
|
+
return waxRegex.test(address) || 'Invalid Wax address';
|
|
42
|
+
default:
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.validateTokenAddress = validateTokenAddress;
|