minors fixes

This commit is contained in:
Thomas Demirdjian
2025-12-09 09:47:26 +01:00
parent 9c2087c574
commit 3f799af419
8 changed files with 155 additions and 164 deletions
+46 -3
View File
@@ -1,8 +1,9 @@
import { useRoute } from "@react-navigation/native";
import React, { useCallback, useMemo, useState } from "react";
import { Linking, Text, View } from "react-native";
import { Linking, StyleSheet, Text, View } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { background } from "../../assets";
import AppCheckbox from "../../components/AppCheckbox";
import BorderGradientButton from "../../components/BorderGradientButton";
import GradientButton from "../../components/GradientButton";
import MusicLandHeader from "../../components/MusicLandHeader";
@@ -37,6 +38,7 @@ const PublishYoutube = () => {
const projectId = project?.id || routeProjectId || null;
const [saving, setSaving] = useState(false);
const [hasAcceptedPublication, setHasAcceptedPublication] = useState(true);
const youtubeUrl = project?.youtubeUrl ?? null;
const youtubeStatus = project?.youtubeStatus ?? null;
const youtubeError = project?.youtubeError ?? null;
@@ -50,7 +52,11 @@ const PublishYoutube = () => {
[youtubeStatus]
);
const publishDisabled =
saving || isPublishing || !playbackReady || !projectId;
saving ||
isPublishing ||
!playbackReady ||
!projectId ||
!hasAcceptedPublication;
const publishButtonLabel = isPublishing
? "Publication en cours..."
: hasYoutubePublication
@@ -128,6 +134,13 @@ const PublishYoutube = () => {
}, [playbackReady, projectId, setTooltip]);
const handleConfirmPublish = useCallback(() => {
if (!hasAcceptedPublication) {
setTooltip?.({
type: "error",
text: "Confirme la diffusion sur Musicland et YouTube avant de publier",
});
return;
}
if (publishDisabled) {
return;
}
@@ -144,7 +157,13 @@ const PublishYoutube = () => {
onPress: handleMarkPublished,
},
]);
}, [handleMarkPublished, hasYoutubePublication, publishDisabled]);
}, [
handleMarkPublished,
hasAcceptedPublication,
hasYoutubePublication,
publishDisabled,
setTooltip,
]);
const handleResetPublication = useCallback(async () => {
if (!projectId) {
@@ -246,6 +265,18 @@ const PublishYoutube = () => {
)}
</View>
<View style={{ gap: 14 }}>
<View style={styles.consentContainer}>
<AppCheckbox
selected={hasAcceptedPublication}
onPress={() =>
setHasAcceptedPublication((prevState) => !prevState)
}
label="J'accepte la diffusion de mon contenu sur Musicland et YouTube."
/>
<Text style={styles.consentDescription}>
Cette confirmation est requise avant toute mise en ligne.
</Text>
</View>
<GradientButton
title={publishButtonLabel}
onPress={handleConfirmPublish}
@@ -272,4 +303,16 @@ const PublishYoutube = () => {
);
};
const styles = StyleSheet.create({
consentContainer: {
gap: 6,
},
consentDescription: {
fontSize: 13,
fontFamily: FONT_FAMILY.InterRegular,
color: Palette.white,
opacity: 0.8,
},
});
export default PublishYoutube;