diff --git a/src/components/PotCard/PotCard.tsx b/src/components/PotCard/PotCard.tsx index 76c7ad2f..789e19dc 100644 --- a/src/components/PotCard/PotCard.tsx +++ b/src/components/PotCard/PotCard.tsx @@ -38,7 +38,7 @@ const PotCard = ({ potId }: Props) => { const description = !pot_description ? "No description" : pot_description.length > MAX_DESCRIPTION_LENGTH - ? `${pot_description.slice(0, MAX_DESCRIPTION_LENGTH)}...` + ? `${pot_description.slice(0, MAX_DESCRIPTION_LENGTH).trim()}...` : pot_description; const title = !pot_name @@ -61,7 +61,7 @@ const PotCard = ({ potId }: Props) => { {title} - + { + {/* PROJECT DETAILS */}
@@ -209,7 +209,7 @@ const CreateForm = (props: { edit: boolean }) => { State.update({ daoAddressTemp: daoAddress.toLowerCase(), daoAddressError: "" }), @@ -269,7 +269,11 @@ const CreateForm = (props: { edit: boolean }) => { } State.update({ daoAddressError: "" }); }, - error: state.isDao ? state.daoAddressError : "", + error: state.isDao + ? state.daoAddressError + : !isNamedAccount(projectId) + ? "Require a name account for proejct registration" + : "", }} /> @@ -357,6 +361,7 @@ const CreateForm = (props: { edit: boolean }) => { />
+ {/* SMART CONTRACT */}
{state.smartContracts.map(([chain, contractAddress]: [string, string], index: number) => { @@ -480,6 +485,7 @@ const CreateForm = (props: { edit: boolean }) => { Add more contract
+ {/* FUNDING SOURCE */}
{state.fundingSources.length > 0 && ( @@ -593,12 +599,12 @@ const CreateForm = (props: { edit: boolean }) => { Add funding source
-
- - - {Array(4) - .fill("") - .map((_, index: number) => ( + {/* REPOSITIORIES */} + {state.categories.includes("Open Source") && ( +
+ + + {Object.values(state.githubRepos).map((repo: any, index: number) => ( github.com/, @@ -607,7 +613,7 @@ const CreateForm = (props: { edit: boolean }) => { borderRadius: "0px 4px 4px 0px", transform: "translateX(-1px)", }, - value: state.githubRepos[index].value, + value: repo.value, onChange: (value) => State.update({ githubRepos: { @@ -619,8 +625,6 @@ const CreateForm = (props: { edit: boolean }) => { }), validate: () => { // validate link - const repo = state.githubRepos[index]; - const repoObj = extractRepoPath(repo.value); State.update({ githubRepos: { @@ -629,12 +633,34 @@ const CreateForm = (props: { edit: boolean }) => { }, }); }, - error: state.githubRepos[index].err || "", + error: repo.err || "", }} /> ))} - -
+
+ +
+ )} + {/* SOCIAL LINKS */} +
diff --git a/src/pages/CreateProject/utils/fields.ts b/src/pages/CreateProject/utils/fields.ts index 3536e3f6..6722ce78 100644 --- a/src/pages/CreateProject/utils/fields.ts +++ b/src/pages/CreateProject/utils/fields.ts @@ -1,3 +1,5 @@ +export const addressNamed = [".tg", ".sweat", ".near"]; + export const socialFields = [ { label: "twitter", diff --git a/src/pages/CreateProject/utils/getSocialData.ts b/src/pages/CreateProject/utils/getSocialData.ts index ad1e4ceb..979490ea 100644 --- a/src/pages/CreateProject/utils/getSocialData.ts +++ b/src/pages/CreateProject/utils/getSocialData.ts @@ -26,7 +26,7 @@ const getSocialData = () => { plSmartContracts: formattedSmartContracts ? JSON.stringify(formattedSmartContracts) : null, plGithubRepos: JSON.stringify( Object.values(state.githubRepos) - .map(({ value, err }: any) => (err ? false : "github.com/" + value)) + .map(({ value, err }: any) => (err || !value ? false : "github.com/" + value)) .filter((val: any) => val), ), plFundingSources: JSON.stringify(state.fundingSources), diff --git a/src/pages/CreateProject/utils/helpers.ts b/src/pages/CreateProject/utils/helpers.ts index 4c350dc8..12971d11 100644 --- a/src/pages/CreateProject/utils/helpers.ts +++ b/src/pages/CreateProject/utils/helpers.ts @@ -1,5 +1,9 @@ -import { asyncFetch, state } from "alem"; -import { CATEGORY_MAPPINGS } from "./fields"; +import { asyncFetch, context, state } from "alem"; +import { CATEGORY_MAPPINGS, addressNamed } from "./fields"; + +export function isNamedAccount(accountId: string) { + return addressNamed.some((substring) => accountId.includes(substring)); +} export const deepObjectDiff = (objOriginal: any, objUpdated: any) => { if (!objUpdated) objUpdated = {}; @@ -41,6 +45,7 @@ export const uploadFileUpdateState = (body: any, callback: any) => { }; export const projectDisabled = () => + (!state.isDao && !isNamedAccount(context.accountId || "")) || !state.profileImage || !state.backgroundImage || state.daoAddressError ||