From 3f5224c1190c15f0179de921eda771c7a1ddd478 Mon Sep 17 00:00:00 2001 From: saml33 Date: Tue, 26 Sep 2023 23:15:36 +1000 Subject: [PATCH] logo animation --- components/BoostLogo.tsx | 5 +- components/StakeForm.tsx | 483 ++++++++++++++---------------- components/SunburstBackground.tsx | 2 +- store/mangoStore.ts | 2 + styles/globals.css | 10 +- tailwind.config.js | 2 +- 6 files changed, 241 insertions(+), 263 deletions(-) diff --git a/components/BoostLogo.tsx b/components/BoostLogo.tsx index 0f29563..7b5897e 100644 --- a/components/BoostLogo.tsx +++ b/components/BoostLogo.tsx @@ -1,7 +1,10 @@ +import mangoStore from '@store/mangoStore' + const BoostLogo = ({ className }: { className?: string }) => { + const submittingBoost = mangoStore((s) => s.submittingBoost) return ( { function StakeForm({ token: selectedToken }: StakeFormProps) { const { t } = useTranslation(['common', 'account']) const [inputAmount, setInputAmount] = useState('') - const [submitting, setSubmitting] = useState(false) - // const [selectedToken, setSelectedToken] = useState( - // token || INPUT_TOKEN_DEFAULT, - // ) + const submitting = mangoStore((s) => s.submittingBoost) const [leverage, setLeverage] = useState(1) - const [showTokenList, setShowTokenList] = useState(false) const [refreshingWalletTokens, setRefreshingWalletTokens] = useState(false) const { maxSolDeposit } = useSolBalance() - // const banks = useBanksWithBalances('walletBalance') const { usedTokens, totalTokens } = useMangoAccountAccounts() const { group } = useMangoGroup() const groupLoaded = mangoStore((s) => s.groupLoaded) @@ -166,7 +152,9 @@ function StakeForm({ token: selectedToken }: StakeFormProps) { if (!group || !stakeBank || !publicKey) return - setSubmitting(true) + set((state) => { + state.submittingBoost = true + }) try { const newAccountNum = getNextAccountNumber(mangoAccounts) const { signature: tx, slot } = await stakeAndCreate( @@ -190,11 +178,15 @@ function StakeForm({ token: selectedToken }: StakeFormProps) { } await actions.reloadMangoAccount(slot) await actions.fetchWalletTokens(publicKey) - setSubmitting(false) + set((state) => { + state.submittingBoost = false + }) setInputAmount('') } catch (e) { console.error('Error depositing:', e) - setSubmitting(false) + set((state) => { + state.submittingBoost = false + }) if (!isMangoError(e)) return notify({ title: 'Transaction failed', @@ -222,259 +214,236 @@ function StakeForm({ token: selectedToken }: StakeFormProps) { return ( <> - - setShowTokenList(false)} /> -

Select token to stake

-
-
-

{t('token')}

-
-
-

{t('wallet-balance')}

-
-
- {/* */} - - -
-
- -
-
-