Skip to content

Commit

Permalink
Merge pull request #65 from onflow/ianthpun/query-param-account
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthpun authored Dec 22, 2023
2 parents 6daded2 + 3e35b6c commit b8b81d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions components/FundAccountForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {ClientFundAccountResult} from "./FundAccountPanel"
import FundAccountSubmitted from "./FundAccountSubmitted"
import publicConfig from "../lib/publicConfig"

export default function FundAccountForm() {
export default function FundAccountForm({address}: {address: string}) {
const [errors, setErrors] = useState<string[]>([])
const [captchaToken, setCaptchaToken] = useState("")
const {mixpanel} = useMixpanel()
Expand All @@ -25,9 +25,10 @@ export default function FundAccountForm() {
<FormContainer>
<Formik
initialValues={{
address: "",
address: address,
token: FLOW_TYPE,
}}
enableReinitialize
validationSchema={fundAccountSchemaClient}
onSubmit={async ({address, token}, {setSubmitting}) => {
setErrors([])
Expand Down
4 changes: 2 additions & 2 deletions components/FundAccountPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export type ClientFundAccountResult = {
amount: string
}

export default function FundAccountPanel() {
export default function FundAccountPanel({address}: {address: string}) {
return (
<div>
<Grid gap={[0, 0, 40, 100]} columns={["auto", "auto", "1.6fr 1fr"]}>
<Box>
<FundAccountForm />
<FundAccountForm address={address} />
</Box>
<Box>
<Sidebar />
Expand Down
7 changes: 6 additions & 1 deletion pages/fund-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ import AppContainer from "components/AppContainer"
import FundAccountPanel from "components/FundAccountPanel"
import Header from "components/Header"
import PageTitle from "components/PageTitle"
import {useRouter} from "next/router"

export default function Fund() {
const router = useRouter()
const {address} = router.query
const formattedAddress = Array.isArray(address) ? address[0] : address || ""

return (
<AppContainer>
<PageTitle>Fund Account</PageTitle>
<Header />
<FundAccountPanel />
<FundAccountPanel address={formattedAddress} />
</AppContainer>
)
}

2 comments on commit b8b81d7

@vercel
Copy link

@vercel vercel bot commented on b8b81d7 Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on b8b81d7 Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.