Skip to content

Commit

Permalink
fix atom creation, add network handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalsine85 committed Jan 23, 2025
1 parent d615460 commit 13ae7cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@0xintuition/1ui'
import { useGetAtomByDataQuery } from '@0xintuition/graphql'

import SubmitButton from '@components/submit-button'
import { zodResolver } from '@hookform/resolvers/zod'
import { ipfsUrl } from '@lib/utils/app'
import { Link } from '@remix-run/react'
Expand Down Expand Up @@ -161,19 +162,16 @@ export function SurveyDepositForm({
>
Back
</Button>
<Button
type="submit"
size={ButtonSize.md}
<SubmitButton
disabled={
isSubmitting || isLoadingConfig || isCheckingAtom || atomExists
}
className="min-w-32"
>
{isSubmitting && (
<Icon name={IconName.inProgress} className="animate-spin" />
)}
{isSubmitting ? 'Creating...' : 'Create Atom'}
</Button>
buttonText="Create Atom"
loadingText="Creating..."
loading={isSubmitting || isLoadingConfig || isCheckingAtom}
onClick={() => form.handleSubmit(onSubmit)}
/>
</div>
</div>
</form>
Expand Down
9 changes: 8 additions & 1 deletion apps/launchpad/app/components/submit-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ const SubmitButton: React.FC<SubmitButtonProps> = ({
<Button
variant="primary"
disabled={loading || disabled}
onClick={correctChain ? onClick : handleSwitch}
onClick={(e) => {
if (correctChain) {
onClick()
} else {
e.preventDefault()
handleSwitch()
}
}}
className={className}
>
{loading ? (
Expand Down

0 comments on commit 13ae7cf

Please sign in to comment.