Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STUD-381: Add feature flag to disable song minting and distribution #831

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,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,
Expand Down Expand Up @@ -83,6 +84,7 @@ const BasicSongDetails: FunctionComponent<BasicDonDetailsProps> = ({
appleMusicProfile,
} = emptyProfile,
} = useGetProfileQuery();
const { webStudioDisableTrackDistributionAndMinting } = useFlags();
const { data: genres = [] } = useGetGenresQuery();
const { data: moodOptions = [] } = useGetMoodsQuery();
const { data: languages = [] } = useGetLanguagesQuery();
Expand Down Expand Up @@ -128,7 +130,8 @@ const BasicSongDetails: FunctionComponent<BasicDonDetailsProps> = ({

const isSubmitDisabled =
!values.agreesToCoverArtGuidelines ||
(isMintingVisible && (!wallet || !isVerified));
(isMintingVisible && (!wallet || !isVerified)) ||
(values.isMinting && webStudioDisableTrackDistributionAndMinting);

const handleChangeOwners = (owners: ReadonlyArray<Owner>) => {
setFieldValue("owners", owners);
Expand Down Expand Up @@ -401,10 +404,19 @@ const BasicSongDetails: FunctionComponent<BasicDonDetailsProps> = ({
"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
}
Comment on lines +413 to +419
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shows up in the Library edit song page when the minting is already toggled by default, I'm able to even proceed to next, logic needs to be added to disable this route as well.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks good. We will need to make it more obvious though, first instinct isn't to go over to minting toggle to check for tooltip as the reason Next button is disabled, might confuse users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can wait on feedback for this as it should just be in for a short(hopefully) period of time

onClick={ () => {
if (!isArtistPricePlanSelected) handlePricingPlanOpen();
} }
Expand Down
8 changes: 7 additions & 1 deletion packages/elements/src/lib/SwitchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface SwitchInputProps extends SwitchProps {
readonly description?: string;
readonly includeBorder?: boolean;
readonly title: string;
readonly toggleTooltipText?: string;
readonly tooltipText?: string;
}

Expand All @@ -28,6 +29,7 @@ const SwitchInput: FunctionComponent<SwitchInputProps> = ({
includeBorder = true,
tooltipText = "",
children,
toggleTooltipText,
...props
}) => {
const theme = useTheme();
Expand Down Expand Up @@ -81,7 +83,11 @@ const SwitchInput: FunctionComponent<SwitchInputProps> = ({
</Typography>
) }
</Stack>
<Switch { ...props } />
<Tooltip title={ toggleTooltipText }>
<Stack>
<Switch { ...props } />
</Stack>
</Tooltip>
</Stack>
{ props.checked ? children : null }
</Stack>
Expand Down
1 change: 1 addition & 0 deletions packages/elements/src/lib/form/SwitchInputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface SwitchInputFieldProps extends SwitchProps {
readonly includeBorder?: boolean;
readonly name: string;
readonly title: string;
readonly toggleTooltipText?: string;
readonly tooltipText?: string;
}

Expand Down
Loading