1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-16 09:33:13 +02:00
This commit is contained in:
Matthias Kretschmann 2023-11-03 00:00:55 +00:00
parent 0728c63b17
commit 2a77163382
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 8 additions and 6 deletions

View File

@ -60,12 +60,13 @@
} }
.submit { .submit {
width: calc(100% - calc(var(--spacer) / 2) - 2px);
max-width: none; max-width: none;
height: calc(- var(--border-width)); height: calc(var(--height) - calc(var(--border-width) * 2));
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
border: var(--border-width) solid var(--link-color); border: var(--border-width) solid var(--link-color);
padding-top: 0;
padding-bottom: 0;
} }
@media (min-width: 40rem) { @media (min-width: 40rem) {

View File

@ -5,7 +5,7 @@ import type {
SendTransactionArgs, SendTransactionArgs,
WriteContractPreparedArgs WriteContractPreparedArgs
} from 'wagmi/actions' } from 'wagmi/actions'
import { $selectedToken, $isInitSend } from '@features/Web3/stores' import { $selectedToken, $isInitSend, $txHash } from '@features/Web3/stores'
import siteConfig from '@config/blog.config' import siteConfig from '@config/blog.config'
import { prepareTransaction, sendTransaction } from './actions' import { prepareTransaction, sendTransaction } from './actions'
import styles from './Send.module.css' import styles from './Send.module.css'
@ -16,6 +16,7 @@ export function Send({ amount }: { amount: string }) {
const { ens } = siteConfig.author.ether const { ens } = siteConfig.author.ether
const { chain } = useNetwork() const { chain } = useNetwork()
const selectedToken = useStore($selectedToken) const selectedToken = useStore($selectedToken)
const txHash = useStore($txHash)
// Always resolve to address from ENS name and vice versa // Always resolve to address from ENS name and vice versa
// so nobody has to trust my config values. // so nobody has to trust my config values.
@ -28,7 +29,6 @@ export function Send({ amount }: { amount: string }) {
const [txConfig, setTxConfig] = useState< const [txConfig, setTxConfig] = useState<
SendTransactionArgs | WriteContractPreparedArgs SendTransactionArgs | WriteContractPreparedArgs
>() >()
const [txHash, setTxHash] = useState<string>()
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
useEffect(() => { useEffect(() => {
@ -57,7 +57,7 @@ export function Send({ amount }: { amount: string }) {
try { try {
setIsLoading(true) setIsLoading(true)
const result = await sendTransaction(selectedToken, txConfig) const result = await sendTransaction(selectedToken, txConfig)
setTxHash(result?.hash) $txHash.set(result?.hash)
setIsLoading(false) setIsLoading(false)
} catch (error: unknown) { } catch (error: unknown) {
console.error((error as Error).message) console.error((error as Error).message)

View File

@ -1,3 +1,3 @@
export * from './tokens' export * from './tokens'
export * from './selectedToken' export * from './selectedToken'
export * from './isInitSend' export * from './send'

View File

@ -1,3 +1,4 @@
import { atom } from 'nanostores' import { atom } from 'nanostores'
export const $isInitSend = atom<boolean>(false) export const $isInitSend = atom<boolean>(false)
export const $txHash = atom<string | undefined>()