fix: share music
This commit is contained in:
+1
-5
@@ -163,7 +163,7 @@ export const SONG_STYLE = [
|
|||||||
description: "Pour un style exubérant ",
|
description: "Pour un style exubérant ",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Melancholic",
|
title: "Mélancolique",
|
||||||
description: "ambiance mélancolique",
|
description: "ambiance mélancolique",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -182,10 +182,6 @@ export const SONG_STYLE = [
|
|||||||
title: "Mysterious",
|
title: "Mysterious",
|
||||||
description: "Pour un sentiment de mystère",
|
description: "Pour un sentiment de mystère",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "Melancholic",
|
|
||||||
description: "ambiance mélancolique",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: OTHER_STYLE_OPTION,
|
title: OTHER_STYLE_OPTION,
|
||||||
description: "Décris ton style personnalisé",
|
description: "Décris ton style personnalisé",
|
||||||
|
|||||||
+15
-2
@@ -46,6 +46,19 @@ export default ({
|
|||||||
|
|
||||||
const computedWidth = width ?? (isWeb ? "60%" : "100%");
|
const computedWidth = width ?? (isWeb ? "60%" : "100%");
|
||||||
|
|
||||||
|
const shareButtonElement = (() => {
|
||||||
|
if (!shareBtn) return null;
|
||||||
|
if (typeof React?.isValidElement === "function") {
|
||||||
|
if (React.isValidElement(shareBtn)) {
|
||||||
|
return shareBtn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof shareBtn === "object" && !Array.isArray(shareBtn)) {
|
||||||
|
return <ShareBtn {...shareBtn} />;
|
||||||
|
}
|
||||||
|
return <ShareBtn />;
|
||||||
|
})();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -119,7 +132,7 @@ export default ({
|
|||||||
</PageContainer>
|
</PageContainer>
|
||||||
|
|
||||||
{bottomStickyContent?.()}
|
{bottomStickyContent?.()}
|
||||||
{(shareBtn || connect) && isWeb && (
|
{(shareButtonElement || connect) && isWeb && (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
@@ -130,7 +143,7 @@ export default ({
|
|||||||
gap: 12, // ou marginLeft sur chaque bouton si gap non supporté
|
gap: 12, // ou marginLeft sur chaque bouton si gap non supporté
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{shareBtn && <ShareBtn />}
|
{shareButtonElement}
|
||||||
{connect && <ConnectBtn />}
|
{connect && <ConnectBtn />}
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import React, { useState } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
|
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
|
||||||
import { CHOOSE_GENRE } from "../../data/data";
|
import { CHOOSE_GENRE } from "../../data/data";
|
||||||
import ItemContainer from "../../components/ItemContainer/ItemContainer";
|
import ItemContainer from "../../components/ItemContainer/ItemContainer";
|
||||||
@@ -7,6 +7,17 @@ import ListSelection from "../../components/ListSelection/ListSelection";
|
|||||||
|
|
||||||
const ChooseGenre = ({ selected = [], setSelected }) => {
|
const ChooseGenre = ({ selected = [], setSelected }) => {
|
||||||
const [containerLayout, setContainerLayout] = useState(null);
|
const [containerLayout, setContainerLayout] = useState(null);
|
||||||
|
const genreOptions = useMemo(() => {
|
||||||
|
const seen = new Set();
|
||||||
|
return (CHOOSE_GENRE ?? []).filter((item) => {
|
||||||
|
const title = item?.title;
|
||||||
|
if (!title) return true;
|
||||||
|
const key = title.trim().toLowerCase();
|
||||||
|
if (seen.has(key)) return false;
|
||||||
|
seen.add(key);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Selection handled by ListSelection
|
// Selection handled by ListSelection
|
||||||
|
|
||||||
@@ -22,7 +33,7 @@ const ChooseGenre = ({ selected = [], setSelected }) => {
|
|||||||
>
|
>
|
||||||
<ItemContainer height={containerLayout?.height}>
|
<ItemContainer height={containerLayout?.height}>
|
||||||
<ListSelection
|
<ListSelection
|
||||||
options={CHOOSE_GENRE}
|
options={genreOptions}
|
||||||
variant="titleDescription"
|
variant="titleDescription"
|
||||||
selected={selected}
|
selected={selected}
|
||||||
setSelected={setSelected}
|
setSelected={setSelected}
|
||||||
|
|||||||
@@ -27,14 +27,11 @@ const resolveBaseShareUrl = () => {
|
|||||||
return musiclandShareUrl;
|
return musiclandShareUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createMusicSharePayload = ({
|
export const createMusicSharePayload = ({ projectId, title, artist } = {}) => {
|
||||||
projectId,
|
|
||||||
title,
|
|
||||||
artist,
|
|
||||||
} = {}) => {
|
|
||||||
if (!projectId) return null;
|
if (!projectId) return null;
|
||||||
|
|
||||||
const baseUrl = trimTrailingSlash(resolveBaseShareUrl());
|
const baseUrl = trimTrailingSlash(resolveBaseShareUrl());
|
||||||
|
if (!baseUrl) return null;
|
||||||
const shareUrl = `${baseUrl}/music/${projectId}`;
|
const shareUrl = `${baseUrl}/music/${projectId}`;
|
||||||
|
|
||||||
let shareMessage = musiclandShareMessage;
|
let shareMessage = musiclandShareMessage;
|
||||||
|
|||||||
Reference in New Issue
Block a user