From b6d81c259859c4513fa30f5d0ae447dac3caa96a Mon Sep 17 00:00:00 2001 From: rish6ix Date: Mon, 26 Dec 2022 17:46:47 +0530 Subject: [PATCH 1/5] fixes --- src/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 3b9ca87f..66967cdb 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -17,6 +17,9 @@ import { MoralisProvider } from "react-moralis"; import "./polyfill"; import 'react-toastify/dist/ReactToastify.css'; +if (process.env.NODE_ENV !== "development") + console.log = () => {}; + const root = ReactDOM.createRoot( document.getElementById("root") as HTMLElement ); From 5597573d24ba4d6c4904753c439bec0d2b93d779 Mon Sep 17 00:00:00 2001 From: Lomads Technologies <107495745+lomads@users.noreply.github.com> Date: Thu, 5 Jan 2023 21:13:41 +0530 Subject: [PATCH 2/5] fixes (#62) Co-authored-by: rish6ix --- src/constants/terminology.ts | 4 ++-- src/hooks/useTerminology.ts | 4 ++-- .../NewPages/DashBoard/Task/TaskCard.jsx | 2 +- src/pages/NewPages/InviteGang.tsx | 7 ++++-- src/pages/NewPages/MintPassToken.jsx | 24 +++++++++++++++---- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/constants/terminology.ts b/src/constants/terminology.ts index 9ec4c2e4..b1002d79 100644 --- a/src/constants/terminology.ts +++ b/src/constants/terminology.ts @@ -47,12 +47,12 @@ export const TASK_OPTIONS = [ export const DEFAULT_ROLES = { "role1" : { "label": 'Admin', - "value": 'role1', + "value": 'ADMIN', "permissions": ["*"] }, "role2" : { "label": 'Core Contributor', - "value": 'role2', + "value": 'CORE_CONTRIBUTOR', "permissions": ["*"] }, "role3" : { diff --git a/src/hooks/useTerminology.ts b/src/hooks/useTerminology.ts index 535d304a..09bef2a6 100644 --- a/src/hooks/useTerminology.ts +++ b/src/hooks/useTerminology.ts @@ -2,7 +2,6 @@ import { get as _get, find as _find } from 'lodash' import { DEFAULT_ROLES, WORKSPACE_OPTIONS, TASK_OPTIONS } from "constants/terminology"; const useTerminology = (terminology: any) => { - console.log(terminology) const transformWorkspace = () => { if(terminology) return _get(terminology, 'workspace', _find(WORKSPACE_OPTIONS, wo => wo.value === 'WORKSPACE')) @@ -13,7 +12,8 @@ const useTerminology = (terminology: any) => { return _get(terminology, 'task', _find(TASK_OPTIONS, to => to.value === 'TASK')) return _find(TASK_OPTIONS, to => to.value === 'TASK') } - const transformRole = (role: string) => { + const transformRole = (r: string) => { + let role = r ? r : 'role4' if(terminology) return _get(terminology, `roles.${role}`, _get(DEFAULT_ROLES, role)) return _get(DEFAULT_ROLES, role) diff --git a/src/pages/NewPages/DashBoard/Task/TaskCard.jsx b/src/pages/NewPages/DashBoard/Task/TaskCard.jsx index 54fffa1a..3517f278 100644 --- a/src/pages/NewPages/DashBoard/Task/TaskCard.jsx +++ b/src/pages/NewPages/DashBoard/Task/TaskCard.jsx @@ -92,7 +92,7 @@ const TaskCard = ({ task, daoUrl }) => { return (
navigate(`/${daoUrl}/task/${task._id}`, { state: { task } })}> - {(submissionCount > 0 || applicationCount > 0) && task.creator === user._id && + {( ( (task.contributionType === 'open' && !task.isSingleContributor) || task.contributionType === 'assign' && submissionCount > 0 ) || applicationCount > 0) && task.creator === user._id &&
{(task.contributionType === 'open' && !task.isSingleContributor) || task.contributionType === 'assign' && submissionCount > 0 ?
diff --git a/src/pages/NewPages/InviteGang.tsx b/src/pages/NewPages/InviteGang.tsx index 498675b0..99f55dad 100644 --- a/src/pages/NewPages/InviteGang.tsx +++ b/src/pages/NewPages/InviteGang.tsx @@ -25,6 +25,7 @@ import binWhite from '../../assets/svg/bin-white.svg'; import { SupportedChainId } from "constants/chains"; import { DEFAULT_ROLES } from "constants/terminology"; import useEns from 'hooks/useEns'; +import useTerminology from "hooks/useTerminology"; const InviteGang = () => { const dispatch = useAppDispatch(); @@ -34,6 +35,8 @@ const InviteGang = () => { const [ownerAddress, setOwnerAddress] = useState(""); const [ownerRole, setOwnerRole] = useState("role4"); const [errors, setErrors] = useState({}); + const { DAO, DAOLoading } = useAppSelector((state) => state.dashboard); + const { transformRole } = useTerminology(_.get(DAO, 'terminologies')) const invitedMembers = useAppSelector((state) => state.flow.invitedGang); const { account, provider, chainId } = useWeb3React(); const { getENSAddress, getENSName } = useEns(); @@ -350,9 +353,9 @@ const InviteGang = () => { { result.address !== undefined && result.address === account ? - `core contributor` + transformRole('role2').label : - result.role?.replaceAll('_', ' ').toLowerCase() + transformRole(result?.role).label }

diff --git a/src/pages/NewPages/MintPassToken.jsx b/src/pages/NewPages/MintPassToken.jsx index 44b56736..5586ef60 100644 --- a/src/pages/NewPages/MintPassToken.jsx +++ b/src/pages/NewPages/MintPassToken.jsx @@ -22,6 +22,7 @@ import { getCurrentUser, getDao, updateCurrentUser } from "state/dashboard/actio import Footer from "components/Footer"; import { addDaoMember } from 'state/dashboard/actions' import axiosHttp from 'api' +import useRole from 'hooks/useRole'; const MintPassToken = () => { /// temporary solution until we don't have specific routes for DAO, contract address will be passed into the url @@ -41,6 +42,7 @@ const MintPassToken = () => { const [telegramError, setTelegramError] = useState(false); const { account, chainId, provider } = useWeb3React(); const { user, DAO, DAOLoading } = useAppSelector((state) => state.dashboard); + const { myRole } = useRole(DAO, account) const { needWhitelist, isWhitelisted, balanceOf, contractName, currentIndex } = useSBTStats(provider, account, update, contractAddr ? contractAddr : '', chainId); const sbtContract = useSBTContract(contractAddr ? contractAddr : null); @@ -126,6 +128,7 @@ const MintPassToken = () => { const isUpdate = useMemo(() => { if (contractName !== '' && DAO && DAO.sbt && DAO.sbt && account && balanceOf) { + console.log("balanceOF", parseInt(balanceOf._hex, 16)) if (parseInt(balanceOf._hex, 16) === 1) { return true } @@ -134,6 +137,7 @@ const MintPassToken = () => { }, [contractAddr, balanceOf, DAO]) + const updateMetadata = async () => { const userName = document.querySelector("#user-name"); const userMail = document.querySelector("#user-email"); @@ -178,7 +182,7 @@ const MintPassToken = () => { } } - const mintSBT = async () => { + const mintSBT = async (shouldMint = true) => { const userName = document.querySelector("#user-name"); const userMail = document.querySelector("#user-email"); const userDiscord = document.querySelector("#user-discord"); @@ -205,9 +209,11 @@ const MintPassToken = () => { try { setLoading(true); const sbtId = currentIndex.toString(); - const tx = await mintSBTtoken(sbtContract, account); + let tx = null; + if(shouldMint) + tx = await mintSBTtoken(sbtContract, account); console.log(tx) - if (tx.error) { + if (tx?.error) { setLoading(false); console.log(`${tx.error.message}`) //toast.error(`${tx.error.message}`); @@ -243,7 +249,7 @@ const MintPassToken = () => { const req = await APInewSBTtoken(metadataJSON); if (req) { dispatch(updateCurrentUser({ name: userName.value })) - dispatch(addDaoMember({ url: DAO?.url, payload: { name: '', address: account, role: 'role4' } })) + dispatch(addDaoMember({ url: DAO?.url, payload: { name: '', address: account, role: myRole ? myRole : 'role4' } })) dispatch(getDao(DAO.url)); setLoading(false); //toast.success("SBT mint successfuly !"); @@ -354,7 +360,15 @@ const MintPassToken = () => { width={160} fontsize={20} fontweight={400} - onClick={() => isUpdate ? updateMetadata() : mintSBT()} + onClick={() => { + if(isUpdate) { + if(myMetadata) + updateMetadata() + else + mintSBT(false) + } else + mintSBT() + }} bgColor={"#C94B32"} condition={isLoading} /> From 637b53203bbf8482fb8c2d7c32f70b0cc6ed0e04 Mon Sep 17 00:00:00 2001 From: rish6ix Date: Wed, 15 Feb 2023 20:44:04 +0530 Subject: [PATCH 3/5] fix --- src/pages/NewPages/MintPassToken.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/NewPages/MintPassToken.jsx b/src/pages/NewPages/MintPassToken.jsx index 2cda25f1..58be7910 100644 --- a/src/pages/NewPages/MintPassToken.jsx +++ b/src/pages/NewPages/MintPassToken.jsx @@ -412,8 +412,7 @@ const MintPassToken = () => { handleResetError(item)} /> From 256212e06098b628bad9557f2161719b330571a2 Mon Sep 17 00:00:00 2001 From: rish6ix Date: Wed, 15 Feb 2023 20:52:47 +0530 Subject: [PATCH 4/5] fix --- src/pages/NewPages/MintPassToken.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/NewPages/MintPassToken.jsx b/src/pages/NewPages/MintPassToken.jsx index 58be7910..910cdf10 100644 --- a/src/pages/NewPages/MintPassToken.jsx +++ b/src/pages/NewPages/MintPassToken.jsx @@ -103,7 +103,7 @@ const MintPassToken = () => { if (attr === attribute.trait_type.toLowerCase()) { if (decrypted) return decrypted[attr] - //return attribute?.value; + return (attribute?.value && attribute?.value !== 'true' && attribute?.value !== true) ? attribute?.value : ''; } } return null From 9cb829b1513bd1bed5f660dad82e13e761687c9c Mon Sep 17 00:00:00 2001 From: rish6ix Date: Wed, 22 Feb 2023 16:44:30 +0530 Subject: [PATCH 5/5] fix --- src/components/AddDiscordLink.jsx | 9 +++++---- src/pages/NewPages/DashBoard/Project/AddLink.jsx | 2 +- src/pages/NewPages/DashBoard/Project/ProjectResource.jsx | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/AddDiscordLink.jsx b/src/components/AddDiscordLink.jsx index 90b9051f..74c012a6 100644 --- a/src/components/AddDiscordLink.jsx +++ b/src/components/AddDiscordLink.jsx @@ -19,7 +19,7 @@ import axiosHttp from '../api'; import { nanoid } from "@reduxjs/toolkit"; import { SupportedChainId } from "constants/chains"; -export default ({ title, desc, link, roleName, accessControl, okButton, onGuildCreateSuccess, renderButton = undefined, ...props }) => { +export default ({ title, desc, link, roleName, accessControl, okButton, onGuildCreateSuccess, renderButton = undefined, onLinkError, ...props }) => { const { provider, account, chainId } = useWeb3React(); const signerFunction = useCallback((signableMessage) => getSigner(provider, account).signMessage(signableMessage), [provider, account]); @@ -183,9 +183,10 @@ export default ({ title, desc, link, roleName, accessControl, okButton, onGuildC } } } else { - setHasClickedAuth(true) - onResetAuth() - return setTimeout(() => onOpen(), 2000) + onLinkError('You are not the owner') + // setHasClickedAuth(true) + // onResetAuth() + // return setTimeout(() => onOpen(), 2000) } } else { setAddLinkLoading(null); diff --git a/src/pages/NewPages/DashBoard/Project/AddLink.jsx b/src/pages/NewPages/DashBoard/Project/AddLink.jsx index e9e95157..9c66e914 100644 --- a/src/pages/NewPages/DashBoard/Project/AddLink.jsx +++ b/src/pages/NewPages/DashBoard/Project/AddLink.jsx @@ -147,7 +147,7 @@ const AddLink = (props) => { const LinkBtn = (props) => { if(link && link.indexOf('discord.') > -1) - return + return setLinkError(e)} {...props} /> if(link && link.indexOf('notion.') > -1) return } diff --git a/src/pages/NewPages/DashBoard/Project/ProjectResource.jsx b/src/pages/NewPages/DashBoard/Project/ProjectResource.jsx index 29ebfdf7..6d692ced 100644 --- a/src/pages/NewPages/DashBoard/Project/ProjectResource.jsx +++ b/src/pages/NewPages/DashBoard/Project/ProjectResource.jsx @@ -80,7 +80,7 @@ const ProjectResource = ({ toggleShowResource, getResources, list, editResources const LinkBtn = (props) => { if (link && link.indexOf('discord.') > -1) - return + return setLinkError(e)} {...props} /> if (link && link.indexOf('notion.') > -1) return } @@ -219,7 +219,7 @@ const ProjectResource = ({ toggleShowResource, getResources, list, editResources
Add links -
+