monthly money
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user