monthly money

This commit is contained in:
Thomas Demirdjian
2025-10-31 17:31:10 +01:00
parent 6f330c1df8
commit 0dd0fa5ab7
10 changed files with 299 additions and 1 deletions
+28
View File
@@ -3,6 +3,7 @@ import { Pressable, Text, View } from "react-native";
import { SheetManager } from "react-native-actions-sheet";
import { Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts";
import { openShareSheet } from "../../utils/shareSheet";
import AppActionSheet from "../AppActionSheet";
const OptionButton = ({ label, onPress, disabled = false }) => (
@@ -40,6 +41,9 @@ const MusicOptionsModal = ({ payload }) => {
projectId = null,
ownerId = null,
title = null,
onShare,
sharePayload = null,
shareDisabled = false,
} = payload || {};
const trigger = useCallback((action) => {
@@ -97,6 +101,23 @@ const MusicOptionsModal = ({ payload }) => {
trigger(run);
}, [downloadDisabled, onDownload, trigger]);
const handleShare = useCallback(() => {
if (shareDisabled) return;
const run = () => {
if (typeof onShare === "function") {
onShare();
return;
}
if (sharePayload) {
openShareSheet(sharePayload);
}
};
trigger(run);
}, [onShare, shareDisabled, sharePayload, trigger]);
const shouldShowShareOption =
typeof onShare === "function" || !!sharePayload;
return (
<AppActionSheet id="MusicOptions">
<View style={{ gap: 20 }}>
@@ -116,6 +137,13 @@ const MusicOptionsModal = ({ payload }) => {
label="Ajouter à une playlist"
onPress={handleAddToPlaylist}
/>
{shouldShowShareOption && (
<OptionButton
label="Partager la musique"
onPress={handleShare}
disabled={shareDisabled}
/>
)}
<OptionButton
label="Télécharger"
onPress={handleDownload}