Skip to content

Commit

Permalink
feat: basis point fee explanation (#2091)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham2503 authored Oct 25, 2023
1 parent 5ad8671 commit 16adf55
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/frontend/app/routes/assets.$assetId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
useLoaderData,
useNavigation
} from '@remix-run/react'
import { useState } from 'react'
import { z } from 'zod'
import { PageHeader } from '~/components'
import { Button, ErrorPanel, Input } from '~/components/ui'
Expand Down Expand Up @@ -56,6 +57,10 @@ export default function ViewAssetPage() {
const isSubmitting = navigation.state === 'submitting'
const currentPageAction = isSubmitting && navigation.formAction === formAction

const [basisPointsInput, setBasisPointsInput] = useState(
asset.sendingFee?.basisPoints ?? undefined
)

return (
<div className='pt-4 flex flex-col space-y-4'>
<div className='flex flex-col rounded-md bg-offwhite px-6'>
Expand Down Expand Up @@ -170,12 +175,16 @@ export default function ViewAssetPage() {
type='number'
name='basisPoints'
label='Basis Points'
defaultValue={asset.sendingFee?.basisPoints ?? undefined}
error={response?.errors.sendingFee.fieldErrors.basisPoints}
value={basisPointsInput}
onChange={(e) =>
setBasisPointsInput(parseFloat(e?.target?.value))
}
/>
<p className='text-gray-500 text-sm mt-2'>
A single basis point is a fee equal to 0.01% of the total
amount. A fee of 1 basis point on $100 is $0.01.
amount. A fee of {basisPointsInput || 1} basis point on $100
is ${((basisPointsInput || 1) * 0.01).toFixed(4)}.
</p>
<div className='flex justify-end p-4'>
<Button
Expand Down

0 comments on commit 16adf55

Please sign in to comment.