diff --git a/app/allocation/[category]/components/RankingRow.tsx b/app/allocation/[category]/components/RankingRow.tsx index 23c4ba9..167e6e9 100644 --- a/app/allocation/[category]/components/RankingRow.tsx +++ b/app/allocation/[category]/components/RankingRow.tsx @@ -35,7 +35,11 @@ const RankingRow: FC = ({ }; return ( - + = ({ -
+

{index + 1}

@@ -79,9 +87,12 @@ const RankingRow: FC = ({ values?.floatValue ? values.floatValue / 100 : 0 ); }} - className="w-24 rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-center focus:outline-none focus:ring-1" + className={`w-24 rounded-md border border-gray-200 px-4 py-2 text-center focus:outline-none focus:ring-1 ${ + locked && 'bg-gray-100' + }`} placeholder="0.00%" isAllowed={values => handleAllowdValue(values)} + disabled={locked} /> {formatBudget(budget)} @@ -91,9 +102,7 @@ const RankingRow: FC = ({
-
- + {projects?.length && checkedItems.length > 0 && ( + <> +
+ {isLocked && ( + + )} + {isLocked && isUnlocked && ( +
+ )} + {isUnlocked && ( + + )} + + )}

- 0 items locked + {lockedItems.length} + {' '} + items locked

diff --git a/app/allocation/components/EOA/EmailLoginModal.tsx b/app/allocation/components/EOA/EmailLoginModal.tsx index 4c88553..ece6513 100644 --- a/app/allocation/components/EOA/EmailLoginModal.tsx +++ b/app/allocation/components/EOA/EmailLoginModal.tsx @@ -176,6 +176,7 @@ const EmailLoginModal = ({ closeModal, selectedCategoryId }: TEmailLoginModalPro setOAuthData={setOAuthData} sendOTP={sendOTP} setStep={setStep} + closeModal={closeModal} /> ) : ( @@ -186,6 +187,7 @@ const EmailLoginModal = ({ closeModal, selectedCategoryId }: TEmailLoginModalPro setEoaWallet={setEoaWallet} setStep={setStep} resendOTP={sendOTP} + closeModal={closeModal} /> )} diff --git a/app/allocation/components/EOA/MethodSelection.tsx b/app/allocation/components/EOA/MethodSelection.tsx index 94129e5..6b3f4b8 100644 --- a/app/allocation/components/EOA/MethodSelection.tsx +++ b/app/allocation/components/EOA/MethodSelection.tsx @@ -1,6 +1,7 @@ import React, { FC, FormEvent } from 'react'; import Image from 'next/image'; import { Wallet } from 'thirdweb/wallets'; +import { useConnect } from 'thirdweb/react'; import { createSmartWalletFromEOA, createSocialEoa, @@ -8,6 +9,7 @@ import { } from '@/app/lib/third-web/methods'; import { TOTPData, TOAuthData, Step } from './EmailLoginModal'; import { InfoIcon } from '@/public/assets/icon-components/Info'; +import StorageLabel from '@/app/lib/localStorage'; interface IMethodSelectionProps { pickedMethod: Strategy | 'email' | null @@ -19,6 +21,7 @@ interface IMethodSelectionProps { setOtpData: (data: TOTPData) => void sendOTP: () => void setStep: (step: Step) => void + closeModal: () => void } export const MethodSelection: FC = ({ @@ -31,7 +34,10 @@ export const MethodSelection: FC = ({ setOtpData, sendOTP, setStep, + closeModal, }) => { + const { connect } = useConnect(); + const handleOAuthConnect = (strategy: Strategy) => async () => { try { setPickedMethod(strategy); @@ -42,20 +48,30 @@ export const MethodSelection: FC = ({ if (!account) throw new Error(`Unable to create a ${strategy} EOA`); const smartWallet = await createSmartWalletFromEOA(account); - console.log('Connected EOA wallet ==> ', smartWallet); setEoaWallet(smartWallet); setOAuthData({ ...oAuthData, loading: false }); - setStep(Step.CONNECT_EOA); - setPickedMethod(null); + + const personalWalletId = localStorage.getItem( + StorageLabel.LAST_CONNECT_PERSONAL_WALLET_ID + ); + + if (!personalWalletId) { + setStep(Step.CONNECT_EOA); + setPickedMethod(null); + } + else { + console.log('Connecting to smart wallet'); + connect(smartWallet); + closeModal(); + } } catch (error: any) { - if (error.message === 'User closed login window') dismissOAuthError(); - else - setOAuthData({ - ...oAuthData, - loading: true, - error: 'There was a problem connecting to your Google account', - }); + console.error(error); + setOAuthData({ + ...oAuthData, + loading: true, + error: 'There was a problem connecting to your Google account', + }); } }; @@ -137,7 +153,7 @@ export const MethodSelection: FC = ({ ) : (