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