Skip to content

Commit

Permalink
feat(mfi-v2-ui): spinner when refreshing quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
losman0s committed Sep 20, 2023
1 parent 5b7444b commit 3330b41
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
13 changes: 13 additions & 0 deletions apps/marginfi-v2-ui/src/components/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const Spinner = () => ( <svg
className="animate-spin ml-1 mr-3 h-5 w-5 text-white"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
>
<circle width="opacity-10" cx="12" cy="12" r="10" stroke="#aaa" strokeWidth="4"></circle>
<path
width="opacity-100"
fill="#DCE85D"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
</svg>)
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { SettingsIcon } from "./SettingsIcon";
import { SOL_MINT, TokenData, TokenDataMap } from "~/store/lstStore";
import { RefreshIcon } from "./RefreshIcon";
import { StakePoolProxyProgram } from "~/utils/stakePoolProxy";
import { Spinner } from "~/components/Spinner";

const QUOTE_EXPIRY_MS = 30_000;

Expand Down Expand Up @@ -458,7 +459,15 @@ export const StakingCard: FC = () => {
loading={connected && !!ongoingAction}
onClick={connected ? onMint : openWalletSelector}
>
{!connected ? "connect" : ongoingAction ? `${ongoingAction}...` : "mint"}
{!connected ? (
"connect"
) : ongoingAction ? (
`${ongoingAction}...`
) : refreshingQuotes ? (
<Spinner />
) : (
"mint"
)}
</PrimaryButton>
</div>
<div className="flex flex-row justify-between w-full my-auto">
Expand Down

0 comments on commit 3330b41

Please sign in to comment.