Skip to content
3 changes: 2 additions & 1 deletion apps/studio/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// List exports in alphabetical order by component name
// ! List exports in alphabetical order by component name.

export { default as AddProfileInformation } from "./createProfile/AddProfileInformation";
export { default as Background } from "./Background";
Expand All @@ -17,6 +17,7 @@ export { default as InvitesModal } from "./invites/InvitesModal";
export { default as LogoutButton } from "./home/LogoutButton";
export { default as MarketplaceTabSkeleton } from "./skeletons/MarketplaceTabSkeleton";
export { default as NEWMLogo } from "./NEWMLogo";
export { default as OfficialStatementCTA } from "./OfficialStatementCTA";
export { default as Owners } from "./minting/Owners";
export { default as PingEarningsInProgressWrapper } from "./PingEarningsInProgressWrapper";
export { default as PingSaleEnd } from "./sales/PingSaleEnd";
Expand Down
8 changes: 6 additions & 2 deletions apps/studio/src/pages/home/releases/EditSong.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ interface EditSongFormValues extends PatchSongThunkRequest {
}

const EditSong: FunctionComponent = () => {
const { webStudioDisableTrackDistributionAndMinting } = useFlags();
const {
webStudioDisableTrackDistributionAndMinting,
webStudioDisableDistributionAndSales,
} = useFlags();

const navigate = useNavigate();
const dispatch = useDispatch();
Expand Down Expand Up @@ -177,7 +180,8 @@ const EditSong: FunctionComponent = () => {
isMinting:
isArtistPricePlanSelected &&
isSongEditable(mintingStatus) &&
!webStudioDisableTrackDistributionAndMinting,
!webStudioDisableTrackDistributionAndMinting &&
!webStudioDisableDistributionAndSales,
isrc,
iswc,
language,
Expand Down
87 changes: 59 additions & 28 deletions apps/studio/src/pages/home/uploadSong/BasicSongDetails.tsx
Comment thread
dmkirshon marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { FunctionComponent, useEffect, useRef, useState } from "react";
import { useNavigate, useParams } from "react-router-dom";

import { useFlags } from "launchdarkly-react-client-sdk";

import { useFormikContext } from "formik";

import { Box, Link, Stack, Typography, useTheme } from "@mui/material";

import {
Alert,
Button,
Expand All @@ -11,6 +19,7 @@ import {
SwitchInputField,
TextAreaField,
TextInputField,
Tooltip,
UploadImageField,
UploadSongField,
} from "@newm-web/elements";
Expand All @@ -19,19 +28,20 @@ import {
useExtractProperty,
useWindowDimensions,
} from "@newm-web/utils";
import { useConnectWallet } from "@newm.io/cardano-dapp-wallet-connector";
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 { useConnectWallet } from "@newm.io/cardano-dapp-wallet-connector";

import { UploadSongFormValues } from "./UploadSong";
import {
NEWM_STUDIO_FAQ_URL,
SONG_DESCRIPTION_MAX_CHARACTER_COUNT,
useAppDispatch,
} from "../../../common";
import { DistributionPricingDialog, PlaySong } from "../../../components";
import {
DistributionPricingDialog,
OfficialStatementCTA,
PlaySong,
} from "../../../components";
import SelectCoCreators from "../../../components/minting/SelectCoCreators";
import {
useGetGenresQuery,
Expand Down Expand Up @@ -75,6 +85,25 @@ const BasicSongDetails: FunctionComponent<BasicSongDetailsProps> = ({
const descriptionRef = useRef<HTMLTextAreaElement>(null);
const songDetailsRef = useRef<HTMLDivElement>(null);

const {
webStudioDisableTrackDistributionAndMinting,
webStudioDisableDistributionAndSales,
} = useFlags();

const isDistributionDisabled =
webStudioDisableDistributionAndSales ||
webStudioDisableTrackDistributionAndMinting;
const shouldUseNewTooltip = webStudioDisableDistributionAndSales; // * New flag takes precedence.
const tooltipContent = shouldUseNewTooltip ? (
<OfficialStatementCTA />
) : webStudioDisableTrackDistributionAndMinting ? (
<>
Track distribution and minting are temporarily disabled, but we&apos;re
working on it! You can still upload your tracks and song details to save
for later. Check back in a bit for updates.
</>
) : undefined;

const {
data: {
verificationStatus,
Expand All @@ -83,7 +112,6 @@ const BasicSongDetails: FunctionComponent<BasicSongDetailsProps> = ({
appleMusicProfile,
} = emptyProfile,
} = useGetProfileQuery();
const { webStudioDisableTrackDistributionAndMinting } = useFlags();
const { data: genres = [] } = useGetGenresQuery();
const { data: moodOptions = [] } = useGetMoodsQuery();
const { data: languages = [] } = useGetLanguagesQuery();
Expand Down Expand Up @@ -134,7 +162,8 @@ const BasicSongDetails: FunctionComponent<BasicSongDetailsProps> = ({
const isSubmitDisabled =
!values.agreesToCoverArtGuidelines ||
(isMintingVisible && (!wallet || !isVerified)) ||
(values.isMinting && webStudioDisableTrackDistributionAndMinting);
(values.isMinting && isDistributionDisabled) ||
isDistributionDisabled;

const handleChangeOwners = (owners: ReadonlyArray<Owner>) => {
setFieldValue("owners", owners);
Expand Down Expand Up @@ -408,19 +437,11 @@ const BasicSongDetails: FunctionComponent<BasicSongDetailsProps> = ({
"Distribute your track to all major streaming platforms " +
"and generate stream tokens for royalty claiming."
}
disabled={
isDeclined || webStudioDisableTrackDistributionAndMinting
}
disabled={ isDeclined || isDistributionDisabled }
includeBorder={ false }
name="isMinting"
title="DISTRIBUTE & MINT SONG"
toggleTooltipText={
webStudioDisableTrackDistributionAndMinting
? "Track distribution and minting are temporarily disabled, " +
"but we're working on it! You can still upload your tracks and " +
"song details to save for later. Check back in a bit for updates."
: undefined
}
toggleTooltipText={ tooltipContent }
onClick={ () => {
if (!isArtistPricePlanSelected) handlePricingPlanOpen();
} }
Expand Down Expand Up @@ -516,18 +537,28 @@ const BasicSongDetails: FunctionComponent<BasicSongDetailsProps> = ({
<Box>
<HorizontalLine mb={ 5 } />

<Button
disabled={ isSubmitDisabled }
isLoading={ isSubmitting }
type="submit"
width={
windowWidth && windowWidth > theme.breakpoints.values.md
? "compact"
: "default"
<Tooltip
title={
isSubmitDisabled && isDistributionDisabled
? tooltipContent
: undefined
}
>
{ isMintingVisible ? "Next" : isInEditMode ? "Save" : "Upload" }
</Button>
<span>
<Button
disabled={ isSubmitDisabled }
isLoading={ isSubmitting }
type="submit"
width={
windowWidth && windowWidth > theme.breakpoints.values.md
? "compact"
: "default"
}
>
{ isMintingVisible ? "Next" : isInEditMode ? "Save" : "Upload" }
</Button>
</span>
</Tooltip>
</Box>
</Stack>
</Stack>
Expand Down
6 changes: 4 additions & 2 deletions packages/elements/src/lib/SwitchInput.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { FunctionComponent, ReactNode } from "react";

import {
IconButton,
Stack,
Expand All @@ -6,8 +8,8 @@ import {
Typography,
useTheme,
} from "@mui/material";
import { FunctionComponent, ReactNode } from "react";
import HelpIcon from "@mui/icons-material/Help";

import Switch from "./Switch";
import Tooltip from "./styled/Tooltip";

Expand All @@ -16,7 +18,7 @@ export interface SwitchInputProps extends SwitchProps {
readonly description?: string;
readonly includeBorder?: boolean;
readonly title: string;
readonly toggleTooltipText?: string;
readonly toggleTooltipText?: ReactNode;
readonly tooltipText?: string;
}

Expand Down
7 changes: 5 additions & 2 deletions packages/elements/src/lib/form/SwitchInputField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { FunctionComponent, ReactNode } from "react";

import { SwitchProps } from "@mui/material";

import { Field, FieldProps } from "formik";
import { FunctionComponent, ReactNode } from "react";

import SwitchInput from "../SwitchInput";

interface SwitchInputFieldProps extends SwitchProps {
Expand All @@ -9,7 +12,7 @@ interface SwitchInputFieldProps extends SwitchProps {
readonly includeBorder?: boolean;
readonly name: string;
readonly title: string;
readonly toggleTooltipText?: string;
readonly toggleTooltipText?: ReactNode;
readonly tooltipText?: string;
}

Expand Down
Loading