Skip to content

Commit

Permalink
Release: 2nd Oct 2024 (#4483)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyd-eth authored Oct 1, 2024
1 parent e578472 commit 8823ae0
Show file tree
Hide file tree
Showing 32 changed files with 1,284 additions and 111 deletions.
6 changes: 6 additions & 0 deletions src/locales/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ msgstr ""
msgid "Claim {tokensLabel} as ERC-20"
msgstr ""

msgid "Save project"
msgstr ""

msgid "Total issuance"
msgstr ""

Expand Down Expand Up @@ -2807,6 +2810,9 @@ msgstr ""
msgid "We've disabled payments because the project has opted to reserve 100% of new tokens. You would receive no tokens from your payment."
msgstr ""

msgid "Get notifications"
msgstr ""

msgid "Unarchiving your project has the following effects:"
msgstr ""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Trans } from '@lingui/macro'
import { Divider, Drawer, Space, Tabs } from 'antd'
import { AddToProjectBalanceForm } from 'components/Project/ProjectToolsDrawer/AddToProjectBalanceForm'
import { ExportSection } from 'components/Project/ProjectToolsDrawer/ExportSection'
import { TransferOwnershipForm } from 'components/Project/ProjectToolsDrawer/TransferOwnershipForm'
import { useIsUserAddress } from 'hooks/useIsUserAddress'
import { V1ProjectContext } from 'packages/v1/contexts/Project/V1ProjectContext'
import { useAddToBalanceTx } from 'packages/v1/hooks/transactor/useAddToBalanceTx'
import { useSafeTransferFromTx } from 'packages/v1/hooks/transactor/useSafeTransferFromTx'
import { useSetProjectUriTx } from 'packages/v1/hooks/transactor/useSetProjectUriTx'
import { AddToProjectBalanceForm } from 'packages/v2v3/components/V2V3Project/V2V3ProjectToolsDrawer/AddToProjectBalanceForm'
import { ExportSection } from 'packages/v2v3/components/V2V3Project/V2V3ProjectToolsDrawer/ExportSection'
import { TransferOwnershipForm } from 'packages/v2v3/components/V2V3Project/V2V3ProjectToolsDrawer/TransferOwnershipForm'
import { useContext } from 'react'
import ArchiveV1Project from './ArchiveV1Project'
import { ExportPayoutModsButton } from './ExportPayoutModsButton'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { WrenchScrewdriverIcon } from '@heroicons/react/24/outline'
import { Trans } from '@lingui/macro'
import { SocialLinkButton } from 'components/Project/ProjectHeader/SocialLinkButton'
import { useSocialLinks } from 'components/Project/ProjectHeader/hooks/useSocialLinks'
import { BookmarkButtonIcon } from 'components/buttons/BookmarkButton/BookmarkButtonIcon'
import { useBookmarkButton } from 'components/buttons/BookmarkButton/hooks/useBookmarkButton'
import { SubscribeButtonIcon } from 'components/buttons/SubscribeButton/SubscribeButtonIcon'
import { useSubscribeButton } from 'components/buttons/SubscribeButton/hooks/useSubscribeButton'
import { PopupMenu } from 'components/ui/PopupMenu'
import { PV_V2 } from 'constants/pv'
import useMobile from 'hooks/useMobile'
import { useMemo, useState } from 'react'
import { twJoin } from 'tailwind-merge'
import { V2V3ProjectToolsDrawer } from '../../V2V3ProjectToolsDrawer'

type SocialLink = 'twitter' | 'discord' | 'telegram' | 'website'

export function ProjectHeaderPopupMenu({
className,
projectId,
}: {
className?: string
projectId: number
}) {
const socialLinks = useSocialLinks()
const isMobile = useMobile()
const [toolsIsOpen, setToolsIsOpen] = useState<boolean>()

const { isBookmarked, onBookmarkButtonClicked } = useBookmarkButton({
projectId,
pv: PV_V2,
})
const { isSubscribed, onSubscribeButtonClicked } = useSubscribeButton({
projectId,
})

const socialItems = useMemo(
() => Object.entries(socialLinks).filter(([, href]) => !!href),
[socialLinks],
) as [string, string][]

return (
<>
<PopupMenu
className={twJoin('z-20', className)}
menuButtonIconClassName="h-8 w-8"
items={[
...(isMobile
? socialItems.map(([type, href]) => ({
id: type,
label: (
<SocialLinkButton type={type as SocialLink} href={href} />
),
href,
}))
: []),
{
id: 'subscribe',
label: (
<>
<SubscribeButtonIcon
isSubscribed={isSubscribed}
className="h-5 w-5"
/>

<span className="whitespace-nowrap text-sm font-medium">
<Trans>Get notifications</Trans>
</span>
</>
),
onClick: onSubscribeButtonClicked,
},
{
id: 'bookmark',
label: (
<>
<BookmarkButtonIcon
isBookmarked={isBookmarked}
className="h-5 w-5"
/>
<span className="whitespace-nowrap text-sm font-medium">
<Trans>Save project</Trans>
</span>
</>
),
onClick(ev) {
ev.preventDefault()
ev.stopPropagation()

onBookmarkButtonClicked()
},
},
{
id: 'tools',
label: (
<>
<WrenchScrewdriverIcon className="h-5 w-5" />

<span className="whitespace-nowrap text-sm font-medium">
<Trans>Tools</Trans>
</span>
</>
),
onClick: ev => {
ev.preventDefault()
ev.stopPropagation()

setToolsIsOpen(true)
},
},
]}
/>

<V2V3ProjectToolsDrawer
open={toolsIsOpen}
onClose={() => setToolsIsOpen(false)}
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { DomainBadge } from 'components/DomainBadge'
import EthereumAddress from 'components/EthereumAddress'
import { GnosisSafeBadge } from 'components/Project/ProjectHeader/GnosisSafeBadge'
import { ProjectHeaderLogo } from 'components/Project/ProjectHeader/ProjectHeaderLogo'
import { ProjectHeaderPopupMenu } from 'components/Project/ProjectHeader/ProjectHeaderPopupMenu'
import { SocialLinkButton } from 'components/Project/ProjectHeader/SocialLinkButton'
import { Subtitle } from 'components/Project/ProjectHeader/Subtitle'
import { useSocialLinks } from 'components/Project/ProjectHeader/hooks/useSocialLinks'
Expand All @@ -21,6 +20,7 @@ import { V2V3OperatorPermission } from 'packages/v2v3/models/v2v3Permissions'
import { settingsPagePath, v2v3ProjectRoute } from 'packages/v2v3/utils/routes'
import { twMerge } from 'tailwind-merge'
import { SocialLink } from '../hooks/useAboutPanel'
import { ProjectHeaderPopupMenu } from './ProjectHeaderPopupMenu'

export const V2V3ProjectHeader = ({ className }: { className?: string }) => {
const socialLinks = useSocialLinks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { Form } from 'antd'
import FormattedNumberInput from 'components/inputs/FormattedNumberInput'
import { MAX_MINT_RATE } from 'packages/v2v3/utils/math'

// Note: "issuanceRate" = "mintRate"
export function MintRateField() {
return (
<Form.Item name="issuanceRate">
<Form.Item name="mintRate">
<FormattedNumberInput
className="h-10 py-1 pr-4"
min={0}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TransferOwnershipForm } from 'components/Project/ProjectToolsDrawer/TransferOwnershipForm'
import { TransferOwnershipForm } from 'packages/v2v3/components/V2V3Project/V2V3ProjectToolsDrawer/TransferOwnershipForm'
import { V2V3ProjectContext } from 'packages/v2v3/contexts/Project/V2V3ProjectContext'
import { useTransferProjectOwnershipTx } from 'packages/v2v3/hooks/transactor/useTransferProjectOwnershipTx'
import { useContext } from 'react'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Trans } from '@lingui/macro'
import { Divider, Drawer } from 'antd'
import { AddToProjectBalanceForm } from 'components/Project/ProjectToolsDrawer/AddToProjectBalanceForm'
import { ExportSection } from 'components/Project/ProjectToolsDrawer/ExportSection'
import {
ETH_PAYOUT_SPLIT_GROUP,
RESERVED_TOKEN_SPLIT_GROUP,
} from 'constants/splits'
import { ProjectMetadataContext } from 'contexts/ProjectMetadataContext'
import useMobile from 'hooks/useMobile'
import Link from 'next/link'
import { AddToProjectBalanceForm } from 'packages/v2v3/components/V2V3Project/V2V3ProjectToolsDrawer/AddToProjectBalanceForm'
import { ExportSection } from 'packages/v2v3/components/V2V3Project/V2V3ProjectToolsDrawer/ExportSection'
import { V2V3ProjectContext } from 'packages/v2v3/contexts/Project/V2V3ProjectContext'
import { useAddToBalanceTx } from 'packages/v2v3/hooks/transactor/AddToBalanceTx'
import { useDeployProjectPayerTx } from 'packages/v2v3/hooks/transactor/useDeployProjectPayerTx'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { WrenchScrewdriverIcon } from '@heroicons/react/24/outline'
import { Trans } from '@lingui/macro'
import { useBookmarkButton } from 'components/buttons/BookmarkButton/hooks/useBookmarkButton'
import { useSubscribeButton } from 'components/buttons/SubscribeButton/hooks/useSubscribeButton'
import { PV_V2 } from 'constants/pv'
import { SocialLinkButton } from 'components/Project/ProjectHeader/SocialLinkButton'
import { useSocialLinks } from 'components/Project/ProjectHeader/hooks/useSocialLinks'
import { PopupMenu } from 'components/ui/PopupMenu'
import useMobile from 'hooks/useMobile'
import { V2V3ProjectToolsDrawer } from 'packages/v2v3/components/V2V3Project/V2V3ProjectToolsDrawer'
import { useMemo, useState } from 'react'
import { twJoin } from 'tailwind-merge'
import { PopupMenu } from '../../ui/PopupMenu'
import { SocialLinkButton } from './SocialLinkButton'
import { useSocialLinks } from './hooks/useSocialLinks'
import { V4ProjectToolsDrawer } from './V4ProjectToolsDrawer'

type SocialLink = 'twitter' | 'discord' | 'telegram' | 'website'

Expand All @@ -24,13 +21,13 @@ export function ProjectHeaderPopupMenu({
const isMobile = useMobile()
const [toolsIsOpen, setToolsIsOpen] = useState<boolean>()

const { isBookmarked, onBookmarkButtonClicked } = useBookmarkButton({
projectId,
pv: PV_V2,
})
const { isSubscribed, onSubscribeButtonClicked } = useSubscribeButton({
projectId,
})
// const { isBookmarked, onBookmarkButtonClicked } = useBookmarkButton({
// projectId,
// pv: PV_V2,
// })
// const { isSubscribed, onSubscribeButtonClicked } = useSubscribeButton({
// projectId,
// })

const socialItems = useMemo(
() => Object.entries(socialLinks).filter(([, href]) => !!href),
Expand Down Expand Up @@ -109,7 +106,7 @@ export function ProjectHeaderPopupMenu({
]}
/>

<V2V3ProjectToolsDrawer
<V4ProjectToolsDrawer
open={toolsIsOpen}
onClose={() => setToolsIsOpen(false)}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { Trans } from '@lingui/macro'
import { waitForTransactionReceipt } from '@wagmi/core'
import { Form } from 'antd'
import InputAccessoryButton from 'components/buttons/InputAccessoryButton'
import TransactorButton from 'components/buttons/TransactorButton'
import FormattedNumberInput from 'components/inputs/FormattedNumberInput'
import { TxHistoryContext } from 'contexts/Transaction/TxHistoryContext'
import { useWallet } from 'hooks/Wallet'
import { NATIVE_TOKEN } from 'juice-sdk-core'
import { useJBContractContext, useWriteJbMultiTerminalAddToBalanceOf } from 'juice-sdk-react'
import { wagmiConfig } from 'packages/v4/wagmiConfig'
import { useContext, useState } from 'react'
import { parseWad } from 'utils/format/formatNumber'
import { emitErrorNotification } from 'utils/notifications'
import { reloadWindow } from 'utils/windowUtils'

export function AddToProjectBalanceForm() {
const { contracts, projectId } = useJBContractContext()
const { addTransaction } = useContext(TxHistoryContext)

const [loadingAddToBalance, setLoadingAddToBalance] = useState<boolean>()

const { userAddress } = useWallet()

const [addToBalanceForm] = Form.useForm<{ amount: string }>()

const { writeContractAsync: writeAddToBalance } =
useWriteJbMultiTerminalAddToBalanceOf()


async function addToBalance() {
const amount = parseWad(addToBalanceForm.getFieldValue('amount')).toBigInt()
if (
!amount ||
!contracts.primaryNativeTerminal.data ||
!projectId
)
return

setLoadingAddToBalance(true)

const args = [
projectId,
NATIVE_TOKEN,
amount,
false, // shouldReturnHeldFees
'', // memo
'0x', // metadata
] as const

try {
const hash = await writeAddToBalance({
address: contracts.primaryNativeTerminal.data,
args,
})

addTransaction?.('Send payouts', { hash })
await waitForTransactionReceipt(wagmiConfig, {
hash,
})

reloadWindow()

setLoadingAddToBalance(false)
} catch (e) {
setLoadingAddToBalance(false)

emitErrorNotification((e as unknown as Error).message)
}
}

return (
<Form form={addToBalanceForm} layout="vertical">
<h3 className="text-primary">
<Trans>Transfer ETH to this project</Trans>
</h3>
<p>
<Trans>
Transfer ETH from your wallet to this project without minting tokens.
</Trans>
</p>

<Form.Item name="amount" label={<Trans>Transfer amount</Trans>}>
<FormattedNumberInput
placeholder="0"
accessory={<InputAccessoryButton content="ETH" />}
/>
</Form.Item>
<TransactorButton
onClick={() => addToBalance()}
loading={loadingAddToBalance}
size="small"
type="primary"
text={<Trans>Transfer ETH to project</Trans>}
disabled={!userAddress}
connectWalletText={<Trans>Connect wallet to transfer ETH</Trans>}
/>
</Form>
)
}
Loading

0 comments on commit 8823ae0

Please sign in to comment.