feat: fixes and formatter
This commit is contained in:
@@ -1,73 +1,69 @@
|
||||
import { View, Text, Image } from "react-native";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import AppCheckbox from "../../components/AppCheckbox";
|
||||
import Page from "../../layouts/Page";
|
||||
import MusicLandHeader from "../../components/MusicLandHeader";
|
||||
import GradientButton from "../../components/GradientButton";
|
||||
import { background, img } from "../../assets";
|
||||
import { goBack, navigate } from "../../navigation/NavigationService";
|
||||
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
|
||||
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
|
||||
import { responsiveHeight } from "react-native-responsive-dimensions";
|
||||
import { size } from "../../styles/Style";
|
||||
import { Palette } from "../../styles";
|
||||
import { FONT_FAMILY } from "../../styles/Fonts";
|
||||
import { Routes } from "../../navigation";
|
||||
import { useRoute } from "@react-navigation/native";
|
||||
import { useUser } from "../../providers/UserDataProvider";
|
||||
import { View, Text, Image } from 'react-native'
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
import AppCheckbox from '../../components/AppCheckbox'
|
||||
import Page from '../../layouts/Page'
|
||||
import MusicLandHeader from '../../components/MusicLandHeader'
|
||||
import GradientButton from '../../components/GradientButton'
|
||||
import { background, img } from '../../assets'
|
||||
import { goBack, navigate } from '../../navigation/NavigationService'
|
||||
import useMinuit from 'react-native-minuit/src/hooks/useMinuit.js'
|
||||
import CreateLyricsHeader from '../Writing/components/CreateLyricsHeader'
|
||||
import { responsiveHeight } from 'react-native-responsive-dimensions'
|
||||
import { size } from '../../styles/Style'
|
||||
import { Palette } from '../../styles'
|
||||
import { FONT_FAMILY } from '../../styles/Fonts'
|
||||
import { Routes } from '../../navigation'
|
||||
import { useRoute } from '@react-navigation/native'
|
||||
import { useUser } from '../../providers/UserDataProvider'
|
||||
|
||||
const StreamSong = () => {
|
||||
const params = useRoute().params;
|
||||
const action = params?.action;
|
||||
const project = params?.project || null;
|
||||
const { hasActiveSubscription } = useUser() || {};
|
||||
const userHasActiveSubscription = hasActiveSubscription;
|
||||
const { setTooltip } = useMinuit();
|
||||
const [hasAcceptedPublication, setHasAcceptedPublication] = useState(true);
|
||||
const params = useRoute().params
|
||||
const action = params?.action
|
||||
const project = params?.project || null
|
||||
const { hasActiveSubscription } = useUser() || {}
|
||||
const userHasActiveSubscription = hasActiveSubscription
|
||||
const { setTooltip } = useMinuit()
|
||||
const [hasAcceptedPublication, setHasAcceptedPublication] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
if (action && action !== "playback") {
|
||||
navigate(Routes.SongDownload, { project });
|
||||
if (action && action !== 'playback') {
|
||||
navigate(Routes.SongDownload, { project })
|
||||
}
|
||||
}, [action, project]);
|
||||
}, [action, project])
|
||||
|
||||
const headingText = "Publier ton playback";
|
||||
const headingText = 'Publier ton playback'
|
||||
const descriptionText = userHasActiveSubscription
|
||||
? "Ton abonnement est actif, publie ton playback et participe au concours."
|
||||
: "Pour publier ton playback sur la plateforme, rejoins le Club MusicLand.";
|
||||
? 'Ton abonnement est actif, publie ton playback et participe au concours.'
|
||||
: 'Pour publier ton playback sur la plateforme, rejoins le Club MusicLand.'
|
||||
const ctaLabel = userHasActiveSubscription
|
||||
? "Publier mon playback"
|
||||
: "Rejoindre le Club MusicLand";
|
||||
? 'Publier mon playback'
|
||||
: 'Rejoindre le Club MusicLand'
|
||||
const handlePrimaryAction = useCallback(() => {
|
||||
if (!hasAcceptedPublication) {
|
||||
setTooltip({
|
||||
type: "error",
|
||||
text: "Confirme la diffusion sur Musicland et YouTube avant de publier",
|
||||
});
|
||||
return;
|
||||
type: 'error',
|
||||
text: 'Confirme la diffusion sur Musicland et YouTube avant de publier',
|
||||
})
|
||||
return
|
||||
}
|
||||
if (userHasActiveSubscription) {
|
||||
if (action === "playback") {
|
||||
if (action === 'playback') {
|
||||
setTooltip({
|
||||
type: "success",
|
||||
text: "Playback publié !",
|
||||
});
|
||||
navigate(Routes.Home);
|
||||
return;
|
||||
type: 'success',
|
||||
text: 'Playback publié !',
|
||||
})
|
||||
navigate(Routes.Home)
|
||||
return
|
||||
}
|
||||
navigate(Routes.SongRelease, { action });
|
||||
return;
|
||||
navigate(Routes.SongRelease, { action })
|
||||
return
|
||||
}
|
||||
navigate(Routes.Payments);
|
||||
}, [action, hasAcceptedPublication, setTooltip, userHasActiveSubscription]);
|
||||
navigate(Routes.Payments)
|
||||
}, [action, hasAcceptedPublication, setTooltip, userHasActiveSubscription])
|
||||
|
||||
return (
|
||||
<Page
|
||||
backgroundImg={
|
||||
action === "playback"
|
||||
? background.playbackBG2
|
||||
: background.productionBG2
|
||||
}
|
||||
backgroundImg={action === 'playback' ? background.playbackBG2 : background.productionBG2}
|
||||
headerType="NONE"
|
||||
>
|
||||
<MusicLandHeader onPressBack={goBack} progress={75} />
|
||||
@@ -83,7 +79,7 @@ const StreamSong = () => {
|
||||
style={{
|
||||
...size({ size: 158 }),
|
||||
borderRadius: 13,
|
||||
alignSelf: "center",
|
||||
alignSelf: 'center',
|
||||
}}
|
||||
/>
|
||||
<View style={{ gap: 12 }}>
|
||||
@@ -93,7 +89,7 @@ const StreamSong = () => {
|
||||
fontSize: 22,
|
||||
color: Palette.white,
|
||||
fontFamily: FONT_FAMILY.InterSemiBold,
|
||||
textAlign: "center",
|
||||
textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
{headingText}
|
||||
@@ -103,7 +99,7 @@ const StreamSong = () => {
|
||||
fontSize: 16,
|
||||
color: Palette.white,
|
||||
fontFamily: FONT_FAMILY.InterMedium,
|
||||
textAlign: "center",
|
||||
textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
{descriptionText}
|
||||
@@ -115,9 +111,7 @@ const StreamSong = () => {
|
||||
<View style={{ gap: 6 }}>
|
||||
<AppCheckbox
|
||||
selected={hasAcceptedPublication}
|
||||
onPress={() =>
|
||||
setHasAcceptedPublication((prevState) => !prevState)
|
||||
}
|
||||
onPress={() => setHasAcceptedPublication((prevState) => !prevState)}
|
||||
label="J'accepte la diffusion de mon contenu sur Musicland et YouTube."
|
||||
/>
|
||||
<Text
|
||||
@@ -135,9 +129,9 @@ const StreamSong = () => {
|
||||
title={ctaLabel}
|
||||
onPress={handlePrimaryAction}
|
||||
containerStyle={{
|
||||
width: "100%",
|
||||
width: '100%',
|
||||
maxWidth: 320,
|
||||
alignSelf: "center",
|
||||
alignSelf: 'center',
|
||||
}}
|
||||
/>
|
||||
{!userHasActiveSubscription && (
|
||||
@@ -146,18 +140,18 @@ const StreamSong = () => {
|
||||
fontSize: 14,
|
||||
color: Palette.white,
|
||||
fontFamily: FONT_FAMILY.InterRegular,
|
||||
textAlign: "center",
|
||||
textAlign: 'center',
|
||||
opacity: 0.8,
|
||||
}}
|
||||
>
|
||||
Rejoins le club pour débloquer la publication de tes créations et
|
||||
tenter de grimper dans le classement.
|
||||
Rejoins le club pour débloquer la publication de tes créations et tenter de grimper
|
||||
dans le classement.
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
export default StreamSong;
|
||||
export default StreamSong
|
||||
|
||||
Reference in New Issue
Block a user