Skip to content

Commit

Permalink
Merge pull request #4424 from jbx-protocol/dev
Browse files Browse the repository at this point in the history
release: 2024-08-10
  • Loading branch information
aeolianeth committed Aug 9, 2024
2 parents 1f3288d + d12aa37 commit 83cd8ae
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import {
TERMINAL_MIGRATION_EXPLANATION,
} from 'components/strings'
import { CREATE_FLOW } from 'constants/fathomEvents'
import { FEATURE_FLAGS } from 'constants/featureFlags'
import { readNetwork } from 'constants/networks'
import { trackFathomGoal } from 'lib/fathom'
import { useContext } from 'react'
import { useSetCreateFurthestPageReached } from 'redux/hooks/useEditingCreateFurthestPageReached'
import { featureFlagEnabled } from 'utils/featureFlags'
import { CreateCollapse } from '../../CreateCollapse/CreateCollapse'
import { PageContext } from '../../Wizard/contexts/PageContext'
import { Wizard } from '../../Wizard/Wizard'
Expand Down Expand Up @@ -82,12 +84,14 @@ export const ReconfigurationRulesPage = () => {
<JuiceSwitch label={t`Hold fees`} />
</Form.Item>

{/* <Form.Item
name="projectRequiredOFACCheck"
extra={t`Disallow payments from users who appear on OFAC’s Specially Designated Nationals (SDN) list. Note: payments are still possible on other websites (for example, Etherscan).`}
>
<JuiceSwitch label={t`OFAC Sanctions screening`} />
</Form.Item> */}
{featureFlagEnabled(FEATURE_FLAGS.OFAC) ? (
<Form.Item
name="projectRequiredOFACCheck"
extra={t`Disallow payments from users who appear on OFAC’s Specially Designated Nationals (SDN) list. Note: payments are still possible on other websites (for example, Etherscan).`}
>
<JuiceSwitch label={t`OFAC Sanctions screening`} />
</Form.Item>
) : null}
</CreateCollapse.Panel>
<CreateCollapse.Panel
key={1}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { t } from '@lingui/macro'
import EthereumAddress from 'components/EthereumAddress'
import { FEATURE_FLAGS } from 'constants/featureFlags'
import { featureFlagEnabled } from 'utils/featureFlags'
import { ReviewDescription } from '../ReviewDescription'
import { useRulesReview } from './hooks/useRulesReview'

Expand All @@ -13,7 +15,7 @@ export const RulesReview = () => {
terminalMigration,
controllerMigration,
holdFees,
// ofac,
ofac,
} = useRulesReview()

return (
Expand Down Expand Up @@ -63,10 +65,12 @@ export const RulesReview = () => {
<div className="text-base font-medium">{controllerMigration}</div>
}
/>
{/* <ReviewDescription
title={t`OFAC Sanctions screening`}
desc={<div className="text-base font-medium">{ofac}</div>}
/> */}
{featureFlagEnabled(FEATURE_FLAGS.OFAC) ? (
<ReviewDescription
title={t`OFAC Sanctions screening`}
desc={<div className="text-base font-medium">{ofac}</div>}
/>
) : null}
</div>
)
}
3 changes: 2 additions & 1 deletion src/constants/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type FeatureFlag = 'SIMULATE_TXS' | 'V4'
export type FeatureFlag = 'SIMULATE_TXS' | 'V4' | 'OFAC'

export const FEATURE_FLAGS: { [k in FeatureFlag]: string } = {
SIMULATE_TXS: 'simulateTxs',
V4: 'v4',
OFAC: 'ofac',
}
15 changes: 15 additions & 0 deletions src/locales/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ msgstr ""
msgid "An address"
msgstr ""

msgid "Activating this option enables running the user's wallet address against OFAC’s Specially Designated Nationals (SDN) list"
msgstr ""

msgid "Pay {0}"
msgstr ""

Expand Down Expand Up @@ -1748,6 +1751,9 @@ msgstr ""
msgid "About the protocol"
msgstr ""

msgid "OFAC Sanctions screening"
msgstr ""

msgid "Existing project payer addresses can be found in the Tools drawer (<0/>) on the project page."
msgstr ""

Expand Down Expand Up @@ -2309,6 +2315,9 @@ msgstr ""
msgid "to close"
msgstr ""

msgid "Disallow payments from users who appear on OFAC’s Specially Designated Nationals (SDN) list. Note: payments are still possible on other websites (for example, Etherscan)."
msgstr ""

msgid "Immediately"
msgstr ""

Expand Down Expand Up @@ -3074,6 +3083,9 @@ msgstr ""
msgid "If you don't plan on unlocking the held fees later on, you can use the button below to process them now. When you press the button, the held fees will be used to buy $JBX. This cannot be undone."
msgstr ""

msgid "Check User Wallet Address"
msgstr ""

msgid "Set ENS text record for {ensName}"
msgstr ""

Expand Down Expand Up @@ -3692,6 +3704,9 @@ msgstr ""
msgid "Payment amount can't exceed your wallet balance."
msgstr ""

msgid "Additional settings"
msgstr ""

msgid "Last paid"
msgstr ""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { t } from '@lingui/macro'
import { EmptyScreen } from 'components/Project/ProjectTabs/EmptyScreen'
import { RichPreview } from 'components/RichPreview/RichPreview'
import { useAboutPanel } from 'packages/v2v3/components/V2V3Project/ProjectDashboard/hooks/useAboutPanel'
import { EmptyScreen } from '../EmptyScreen'

export const AboutPanel = () => {
const { description } = useAboutPanel()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Trans, t } from '@lingui/macro'
import { EmptyScreen } from '../EmptyScreen'
import { EmptyScreen } from 'components/Project/ProjectTabs/EmptyScreen'
import { NftReward, NftRewardSkeleton } from './NftReward/NftReward'
import { RedeemNftsSection } from './RedeemNftsSection/RedeemNftsSection'
import { useNftRewardsPanel } from './hooks/useNftRewardsPanel'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { Button, Form, FormInstance } from 'antd'
import { useWatch } from 'antd/lib/form/Form'
import { FormItems } from 'components/formItems'
import { FormImageUploader } from 'components/inputs/FormImageUploader'
import { JuiceSwitch } from 'components/inputs/JuiceSwitch'
import { JuiceInput } from 'components/inputs/JuiceTextInput'
import { MinimalCollapse } from 'components/MinimalCollapse'
import { RichEditor } from 'components/RichEditor'
import { FEATURE_FLAGS } from 'constants/featureFlags'

import { ProjectTagName } from 'models/project-tags'
import { inputIsLengthRule } from 'utils/antdRules/inputIsLengthRule'
import { featureFlagEnabled } from 'utils/featureFlags'
import { normalizeHandle } from 'utils/format/formatHandle'

export type ProjectDetailsFormFields = {
Expand Down Expand Up @@ -145,17 +148,21 @@ export function ProjectDetailsForm({
<FormItems.ProjectPayDisclosure name="payDisclosure" />
</MinimalCollapse>
</div>
{/* <div>
<MinimalCollapse header={<Trans>Additional settings</Trans>}>
<Form.Item
name="projectRequiredOFACCheck"
label={t`OFAC Sanctions screening`}
extra={t`Activating this option enables running the user's wallet address against OFAC’s Specially Designated Nationals (SDN) list`}
>
<JuiceSwitch label={t`Check User Wallet Address`} />
</Form.Item>
</MinimalCollapse>
</div> */}

{featureFlagEnabled(FEATURE_FLAGS.OFAC) ? (
<div>
<MinimalCollapse header={<Trans>Additional settings</Trans>}>
<Form.Item
name="projectRequiredOFACCheck"
label={t`OFAC Sanctions screening`}
extra={t`Activating this option enables running the user's wallet address against OFAC’s Specially Designated Nationals (SDN) list`}
>
<JuiceSwitch label={t`Check User Wallet Address`} />
</Form.Item>
</MinimalCollapse>
</div>
) : null}

<div>
<Form.Item>
{saveButton ?? (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { t } from "@lingui/macro"
import { EmptyScreen } from "components/Project/ProjectTabs/EmptyScreen"
import { RichPreview } from "components/RichPreview/RichPreview"
import { useV4AboutPanel } from "./hooks/useV4AboutPanel"

export const V4AboutPanel = () => {
const { description } = useV4AboutPanel()
return (
<div className="flex min-h-[384px] w-full flex-col gap-8 md:gap-10">
<div className="flex flex-col gap-4 whitespace-pre-wrap">
{description ? (
<RichPreview source={description} />
) : (
<>
<EmptyScreen subtitle={t`This project has no description`} />
</>
)}
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useJBProjectMetadataContext } from 'juice-sdk-react'
import { wrapNonAnchorsInAnchor } from 'utils/wrapNonAnchorsInAnchor'

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

export const useV4AboutPanel = () => {
const { metadata } = useJBProjectMetadataContext()
const projectMetadata = metadata?.data

const description = projectMetadata?.description
? addHttpsToDescriptionUrls(
wrapNonAnchorsInAnchor(projectMetadata?.description),
)
: undefined


return {
description,
projectName: projectMetadata?.name,
}
}

const addHttpsToDescriptionUrls = (description: string) => {
// find all dangling a hrefs missing a https:// or http:// or any protocol and add https://
const urlRegex = /<a href="((?!http|https).+?)"/g
return description.replace(urlRegex, '<a href="https://$1"')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { V4AboutPanel } from "./V4AboutPanel";

export default V4AboutPanel;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useOnScreen } from 'hooks/useOnScreen'
import { Fragment, useEffect, useMemo, useRef, useState } from 'react'
import { twMerge } from 'tailwind-merge'
import { useProjectPageQueries } from '../hooks/useProjectPageQueries'
import V4AboutPanel from './V4AboutPanel'
import { V4ActivityPanel } from './V4ActivityPanel/V4ActivityPanel'
import { V4CyclesPayoutsPanel } from './V4CyclesPayoutsPanel/V4CyclesPayoutsPanel'
import { V4TokensPanel } from './V4TokensPanel/V4TokensPanel'
Expand Down Expand Up @@ -45,7 +46,7 @@ export const V4ProjectTabs = ({ className }: { className?: string }) => {
const tabs: ProjectTabConfig[] = useMemo(
() => [
{ id: 'activity', name: t`Activity`, panel: <V4ActivityPanel /> },
{ id: 'about', name: t`About`, panel: <></> },
{ id: 'about', name: t`About`, panel: <V4AboutPanel /> },
{
id: 'cycle_payouts',
name: t`Cycles & Payouts`,
Expand Down

0 comments on commit 83cd8ae

Please sign in to comment.