feat: fixes

This commit is contained in:
2025-12-10 11:52:25 +01:00
parent d92303dd8a
commit bff35bb118
7 changed files with 348 additions and 15 deletions
+30 -2
View File
@@ -1,5 +1,6 @@
import { View, Text, Image } from "react-native";
import React, { useCallback, useEffect } from "react";
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";
@@ -22,6 +23,7 @@ const StreamSong = () => {
const { hasActiveSubscription } = useUser() || {};
const userHasActiveSubscription = hasActiveSubscription;
const { setTooltip } = useMinuit();
const [hasAcceptedPublication, setHasAcceptedPublication] = useState(true);
useEffect(() => {
if (action && action !== "playback") {
@@ -37,6 +39,13 @@ const StreamSong = () => {
? "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;
}
if (userHasActiveSubscription) {
if (action === "playback") {
setTooltip({
@@ -50,7 +59,7 @@ const StreamSong = () => {
return;
}
navigate(Routes.Payments);
}, [action, setTooltip, userHasActiveSubscription]);
}, [action, hasAcceptedPublication, setTooltip, userHasActiveSubscription]);
return (
<Page
@@ -103,6 +112,25 @@ const StreamSong = () => {
</View>
</CreateLyricsHeader>
<View style={{ marginTop: 24, gap: 12 }}>
<View style={{ gap: 6 }}>
<AppCheckbox
selected={hasAcceptedPublication}
onPress={() =>
setHasAcceptedPublication((prevState) => !prevState)
}
label="J'accepte la diffusion de mon contenu sur Musicland et YouTube."
/>
<Text
style={{
fontSize: 13,
fontFamily: FONT_FAMILY.InterRegular,
color: Palette.white,
opacity: 0.8,
}}
>
Cette confirmation est requise avant toute mise en ligne.
</Text>
</View>
<GradientButton
title={ctaLabel}
onPress={handlePrimaryAction}