From c9dfd65c1baca256ea76f28a992f0ae6c4946f17 Mon Sep 17 00:00:00 2001 From: escobarjonatan Date: Wed, 20 Nov 2024 22:43:50 -0600 Subject: [PATCH 1/2] STUD-381: Add feature flag to disable song minting and distribution --- .../src/pages/home/uploadSong/BasicSongDetails.tsx | 14 +++++++++++++- packages/elements/src/lib/SwitchInput.tsx | 8 +++++++- .../elements/src/lib/form/SwitchInputField.tsx | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx b/apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx index 83de6f9a6..1565bf8cc 100644 --- a/apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx +++ b/apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx @@ -11,6 +11,7 @@ import { SwitchInputField, TextAreaField, TextInputField, + Tooltip, UploadImageField, UploadSongField, } from "@newm-web/elements"; @@ -25,6 +26,7 @@ import { useFormikContext } from "formik"; import { FunctionComponent, useEffect, useRef, useState } from "react"; import { useNavigate, useParams } from "react-router-dom"; import { MintingStatus } from "@newm-web/types"; +import { useFlags } from "launchdarkly-react-client-sdk"; import { UploadSongFormValues } from "./UploadSong"; import { NEWM_STUDIO_FAQ_URL, @@ -83,6 +85,7 @@ const BasicSongDetails: FunctionComponent = ({ appleMusicProfile, } = emptyProfile, } = useGetProfileQuery(); + const { webStudioDisableTrackDistributionAndMinting } = useFlags(); const { data: genres = [] } = useGetGenresQuery(); const { data: moodOptions = [] } = useGetMoodsQuery(); const { data: languages = [] } = useGetLanguagesQuery(); @@ -401,10 +404,19 @@ const BasicSongDetails: FunctionComponent = ({ "ownership, makes streaming royalties available for " + "purchase, and enables royalty distribution to your account." } - disabled={ isDeclined } + disabled={ + isDeclined || webStudioDisableTrackDistributionAndMinting + } includeBorder={ false } name="isMinting" title="DISTRIBUTE & MINT SONG" + toggleTooltipText={ + webStudioDisableTrackDistributionAndMinting + ? "Track distribution and minting is temporarily disabled. " + + "Please upload your song to save your progress, and check " + + "back later to finish the distribution process." + : undefined + } onClick={ () => { if (!isArtistPricePlanSelected) handlePricingPlanOpen(); } } diff --git a/packages/elements/src/lib/SwitchInput.tsx b/packages/elements/src/lib/SwitchInput.tsx index 76a54933e..4f7318134 100644 --- a/packages/elements/src/lib/SwitchInput.tsx +++ b/packages/elements/src/lib/SwitchInput.tsx @@ -16,6 +16,7 @@ export interface SwitchInputProps extends SwitchProps { readonly description?: string; readonly includeBorder?: boolean; readonly title: string; + readonly toggleTooltipText?: string; readonly tooltipText?: string; } @@ -28,6 +29,7 @@ const SwitchInput: FunctionComponent = ({ includeBorder = true, tooltipText = "", children, + toggleTooltipText, ...props }) => { const theme = useTheme(); @@ -81,7 +83,11 @@ const SwitchInput: FunctionComponent = ({ ) } - + + + + + { props.checked ? children : null } diff --git a/packages/elements/src/lib/form/SwitchInputField.tsx b/packages/elements/src/lib/form/SwitchInputField.tsx index 25cc49960..1de052da5 100644 --- a/packages/elements/src/lib/form/SwitchInputField.tsx +++ b/packages/elements/src/lib/form/SwitchInputField.tsx @@ -9,6 +9,7 @@ interface SwitchInputFieldProps extends SwitchProps { readonly includeBorder?: boolean; readonly name: string; readonly title: string; + readonly toggleTooltipText?: string; readonly tooltipText?: string; } From 8635703beeac4da6e9ee5fea98501d0abacb057b Mon Sep 17 00:00:00 2001 From: escobarjonatan Date: Thu, 21 Nov 2024 09:28:44 -0600 Subject: [PATCH 2/2] STUD-381: Add disable minting flag on edit song logic --- apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx b/apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx index 1565bf8cc..33d9e57fb 100644 --- a/apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx +++ b/apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx @@ -11,7 +11,6 @@ import { SwitchInputField, TextAreaField, TextInputField, - Tooltip, UploadImageField, UploadSongField, } from "@newm-web/elements"; @@ -131,7 +130,8 @@ const BasicSongDetails: FunctionComponent = ({ const isSubmitDisabled = !values.agreesToCoverArtGuidelines || - (isMintingVisible && (!wallet || !isVerified)); + (isMintingVisible && (!wallet || !isVerified)) || + (values.isMinting && webStudioDisableTrackDistributionAndMinting); const handleChangeOwners = (owners: ReadonlyArray) => { setFieldValue("owners", owners);