diff --git a/src/pages/issue/read/tabs/bounty/BountyRow.tsx b/src/pages/issue/read/tabs/bounty/BountyRow.tsx index 3ecd3e02..9db0a22a 100644 --- a/src/pages/issue/read/tabs/bounty/BountyRow.tsx +++ b/src/pages/issue/read/tabs/bounty/BountyRow.tsx @@ -1,10 +1,10 @@ -import { differenceInDays, formatDistanceToNow } from 'date-fns' +import { differenceInDays, formatDistanceToNow, startOfToday } from 'date-fns' import { TbMoneybag } from 'react-icons/tb' import SVG from 'react-inlinesvg' import ArweaveLogo from '@/assets/arweave.svg' import { resolveUsernameOrShorten } from '@/helpers/resolveUsername' -import { BountyStatus } from '@/types/repository' +import { BountyBase, BountyStatus } from '@/types/repository' type Props = { status: BountyStatus @@ -13,6 +13,7 @@ type Props = { author: string timestamp: number expiry: number + base: BountyBase onClick: () => void } @@ -30,10 +31,11 @@ const STATUS_TO_TEXT = { CLAIMED: 'been completed' } -export default function BountyRow({ status, author, id, amount, expiry, timestamp, onClick }: Props) { +export default function BountyRow({ status, author, id, amount, expiry, timestamp, onClick, base }: Props) { const Icon = STATUS_TO_ICON_MAP[status] const isActive = status === 'ACTIVE' + return (
- {amount.toFixed(2)} AR + + {amount.toFixed(2)} {base} +{errors.amount.message}
} diff --git a/src/pages/issue/read/tabs/bounty/ReadBountyModal.tsx b/src/pages/issue/read/tabs/bounty/ReadBountyModal.tsx index 3db0c0a4..a7699751 100644 --- a/src/pages/issue/read/tabs/bounty/ReadBountyModal.tsx +++ b/src/pages/issue/read/tabs/bounty/ReadBountyModal.tsx @@ -1,7 +1,7 @@ import { Dialog, Transition } from '@headlessui/react' import Arweave from 'arweave/web' import clsx from 'clsx' -import { differenceInDays } from 'date-fns' +import { differenceInDays, startOfToday } from 'date-fns' import React, { Fragment } from 'react' import toast from 'react-hot-toast' import SVG from 'react-inlinesvg' @@ -10,8 +10,10 @@ import { useParams } from 'react-router-dom' import ArweaveLogo from '@/assets/arweave.svg' import CloseCrossIcon from '@/assets/icons/close-cross.svg' import { Button } from '@/components/common/buttons' +import { getArweaveUSD } from '@/helpers/prices' import { useGlobalStore } from '@/stores/globalStore' -import { Bounty } from '@/types/repository' +import { Bounty, BountyBase } from '@/types/repository' + type NewBountyModalProps = { setIsOpen: (val: boolean) => void isOpen: boolean @@ -33,6 +35,9 @@ const arweave = new Arweave({ }) export default function ReadBountyModal({ isOpen, setIsOpen, bounty, author }: NewBountyModalProps) { + const [amount, setAmount] = React.useState(bounty.amount) + const [oppositePrice, setOppositePrice] = React.useState