minor fix

This commit is contained in:
2025-08-29 13:19:10 +02:00
parent 20b132f5ab
commit 0699ac9ea8
6 changed files with 193 additions and 149 deletions
+103 -78
View File
@@ -2,9 +2,9 @@ import { BlurView } from "expo-blur";
import React from "react"; import React from "react";
import { Platform, Pressable, Text, View } from "react-native"; import { Platform, Pressable, Text, View } from "react-native";
import { SheetManager } from "react-native-actions-sheet"; import { SheetManager } from "react-native-actions-sheet";
import useMinuit from "react-native-minuit/src/hooks/useMinuit";
import Animated, { Easing, FadeIn, FadeOut } from "react-native-reanimated"; import Animated, { Easing, FadeIn, FadeOut } from "react-native-reanimated";
import { arrayRemove, playlistsRef } from "../config/firebase"; import { arrayRemove, playlistsRef } from "../config/firebase";
import useMinuit from "react-native-minuit/src/hooks/useMinuit";
import { Palette } from "../styles"; import { Palette } from "../styles";
import { FONT_FAMILY } from "../styles/Fonts"; import { FONT_FAMILY } from "../styles/Fonts";
@@ -17,8 +17,8 @@ const MoreMenu = ({
projectId = null, projectId = null,
extraItems = [], extraItems = [],
}) => { }) => {
if (!visible) return null;
const { setTooltip } = useMinuit(); const { setTooltip } = useMinuit();
if (!visible) return null;
const removeFromPlaylist = async () => { const removeFromPlaylist = async () => {
try { try {
@@ -30,7 +30,10 @@ const MoreMenu = ({
} }
} catch (e) { } catch (e) {
console.log("Remove from playlist error", e?.message); console.log("Remove from playlist error", e?.message);
setTooltip({ type: "error", text: e?.message || "Suppression impossible" }); setTooltip({
type: "error",
text: e?.message || "Suppression impossible",
});
} finally { } finally {
onClose?.(); onClose?.();
} }
@@ -46,78 +49,35 @@ const MoreMenu = ({
}; };
return ( return (
<Animated.View <View
entering={FadeIn.duration(300).easing(Easing.ease)} style={{
exiting={FadeOut.duration(300).easing(Easing.ease)} position: "absolute",
style={{ position: "absolute", right: 0, top, zIndex: 2 }} left: 0,
right: 0,
top: 0,
bottom: 0,
zIndex: 9999,
elevation: 9999,
}}
> >
<View style={{ gap: 2 }}> <Pressable
{inPlaylist && ( style={{ position: "absolute", left: 0, right: 0, top: 0, bottom: 0 }}
<Pressable onPress={removeFromPlaylist}> onPress={onClose}
<BlurView />
intensity={20} <Animated.View
style={{ entering={FadeIn.duration(300).easing(Easing.ease)}
paddingHorizontal: 12, exiting={FadeOut.duration(300).easing(Easing.ease)}
paddingVertical: 10, style={{
backgroundColor: Palette.glass, position: "absolute",
borderRadius: 12, right: 0,
overflow: "hidden", top,
}} zIndex: 10000,
experimentalBlurMethod={ elevation: 10000,
Platform.OS !== "ios" ? "dimezisBlurView" : "none" }}
} >
> <View style={{ gap: 2 }}>
<Text {inPlaylist && (
style={{ <Pressable onPress={removeFromPlaylist}>
fontSize: 14,
color: Palette.white,
fontFamily: FONT_FAMILY.InterRegular,
}}
>
Supprimer de la playlist
</Text>
</BlurView>
</Pressable>
)}
<Pressable onPress={addToPlaylist}>
<BlurView
intensity={20}
style={{
paddingHorizontal: 12,
paddingVertical: 10,
backgroundColor: Palette.glass,
borderRadius: 12,
overflow: "hidden",
}}
experimentalBlurMethod={
Platform.OS !== "ios" ? "dimezisBlurView" : "none"
}
>
<Text
style={{
fontSize: 14,
color: Palette.white,
fontFamily: FONT_FAMILY.InterRegular,
}}
>
Ajouter à une playlist
</Text>
</BlurView>
</Pressable>
{Array.isArray(extraItems) &&
extraItems.map((item, idx) => (
<Pressable
key={idx}
onPress={() => {
try {
item?.onPress?.();
} finally {
onClose?.();
}
}}
>
<BlurView <BlurView
intensity={20} intensity={20}
style={{ style={{
@@ -138,13 +98,78 @@ const MoreMenu = ({
fontFamily: FONT_FAMILY.InterRegular, fontFamily: FONT_FAMILY.InterRegular,
}} }}
> >
{item?.label || "Action"} Supprimer de la playlist
</Text> </Text>
</BlurView> </BlurView>
</Pressable> </Pressable>
))} )}
</View>
</Animated.View> <Pressable onPress={addToPlaylist}>
<BlurView
intensity={20}
style={{
paddingHorizontal: 12,
paddingVertical: 10,
backgroundColor: Palette.glass,
borderRadius: 12,
overflow: "hidden",
}}
experimentalBlurMethod={
Platform.OS !== "ios" ? "dimezisBlurView" : "none"
}
>
<Text
style={{
fontSize: 14,
color: Palette.white,
fontFamily: FONT_FAMILY.InterRegular,
}}
>
Ajouter à une playlist
</Text>
</BlurView>
</Pressable>
{Array.isArray(extraItems) &&
extraItems.map((item, idx) => (
<Pressable
key={idx}
onPress={() => {
try {
item?.onPress?.();
} finally {
onClose?.();
}
}}
>
<BlurView
intensity={20}
style={{
paddingHorizontal: 12,
paddingVertical: 10,
backgroundColor: Palette.glass,
borderRadius: 12,
overflow: "hidden",
}}
experimentalBlurMethod={
Platform.OS !== "ios" ? "dimezisBlurView" : "none"
}
>
<Text
style={{
fontSize: 14,
color: Palette.white,
fontFamily: FONT_FAMILY.InterRegular,
}}
>
{item?.label || "Action"}
</Text>
</BlurView>
</Pressable>
))}
</View>
</Animated.View>
</View>
); );
}; };
+20 -15
View File
@@ -1,24 +1,29 @@
import { useRoute } from "@react-navigation/core";
import { Audio } from "expo-av";
import React, { useEffect, useMemo, useState } from "react";
import { import {
View,
Text,
ScrollView,
Image, Image,
Pressable, Pressable,
ScrollView,
StyleSheet, StyleSheet,
Text,
View,
} from "react-native"; } from "react-native";
import React, { useEffect, useMemo, useState } from "react";
import Page from "../../layouts/Page";
import { background, icons, img } from "../../assets";
import { Palette } from "../../styles";
import Style, { gutters, size } from "../../styles/Style";
import { FONT_FAMILY } from "../../styles/Fonts";
import Slider from "../../components/Slider";
import { useRoute } from "@react-navigation/core";
import { SheetManager } from "react-native-actions-sheet"; import { SheetManager } from "react-native-actions-sheet";
import firebase, { usersRef, projectsRef, arrayUnion, arrayRemove } from "../../config/firebase";
import { useGlobal } from "reactn"; import { useGlobal } from "reactn";
import { background, icons, img } from "../../assets";
import Slider from "../../components/Slider";
import firebase, {
arrayRemove,
arrayUnion,
projectsRef,
usersRef,
} from "../../config/firebase";
import useDataFromRef from "../../hooks/useDataFromRef"; import useDataFromRef from "../../hooks/useDataFromRef";
import { Audio } from "expo-av"; import Page from "../../layouts/Page";
import { Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts";
import Style, { gutters, size } from "../../styles/Style";
const MusicDetails = () => { const MusicDetails = () => {
const params = useRoute().params || {}; const params = useRoute().params || {};
@@ -88,7 +93,7 @@ const MusicDetails = () => {
const dur = status.durationMillis || 0; const dur = status.durationMillis || 0;
setProgressInfo({ pos, dur }); setProgressInfo({ pos, dur });
setIsPlaying(!!status.isPlaying); setIsPlaying(!!status.isPlaying);
}, }
); );
soundRef.current = sound; soundRef.current = sound;
} catch (e) { } catch (e) {
@@ -239,7 +244,7 @@ const MusicDetails = () => {
} }
> >
<Image <Image
source={icons.check} source={icons.more}
style={{ ...size({ size: 24 }) }} style={{ ...size({ size: 24 }) }}
resizeMode="contain" resizeMode="contain"
/> />
+22 -10
View File
@@ -1,17 +1,22 @@
import { View, Image, FlatList, Pressable } from "react-native";
import React from "react"; import React from "react";
import CardContainer from "./CardContainer"; import { FlatList, Image, Pressable, useWindowDimensions } from "react-native";
import { Style } from "../../../styles";
import { img } from "../../../assets"; import { img } from "../../../assets";
import { navigate } from "../../../navigation/NavigationService";
import { Routes } from "../../../navigation"; import { Routes } from "../../../navigation";
import { navigate } from "../../../navigation/NavigationService";
import { useUser } from "../../../providers/UserDataProvider"; import { useUser } from "../../../providers/UserDataProvider";
import CardContainer from "./CardContainer";
const LikedMusic = () => { const LikedMusic = () => {
const { userLikedProjects = [] } = useUser(); const { userLikedProjects = [] } = useUser();
const items = Array.isArray(userLikedProjects) const items = Array.isArray(userLikedProjects)
? userLikedProjects.slice(0, 6) ? userLikedProjects.slice(0, 6)
: []; : [];
const { width: screenWidth } = useWindowDimensions();
const numColumns = 3;
const gap = 6;
const containerGap = 10;
const totalGap = gap * (numColumns - 1) + containerGap * 2;
const itemWidth = (screenWidth - totalGap) / numColumns;
return ( return (
<CardContainer <CardContainer
label="Musiques likées" label="Musiques likées"
@@ -20,18 +25,25 @@ const LikedMusic = () => {
<FlatList <FlatList
scrollEnabled={false} scrollEnabled={false}
data={items} data={items}
numColumns={3} numColumns={numColumns}
contentContainerStyle={{ gap: 10 }} contentContainerStyle={{ gap: containerGap }}
columnWrapperStyle={{ gap: 6 }} columnWrapperStyle={{ gap }}
keyExtractor={(item) => item.id} keyExtractor={(item) => item.id}
renderItem={({ item }) => ( renderItem={({ item }) => (
<Pressable <Pressable
style={{ flex: 1 }} style={{ flex: 1 }}
onPress={() => navigate(Routes.MusicDetails, { projectId: item.id })} onPress={() =>
navigate(Routes.MusicDetails, { projectId: item.id })
}
> >
<Image <Image
source={item?.coverUrl ? { uri: item.coverUrl } : img.placeholder3} source={
style={{ width: "100%", height: 172, borderRadius: 10 }} item?.coverUrl ? { uri: item.coverUrl } : img.placeholder3
}
style={{
height: itemWidth - containerGap,
borderRadius: 10,
}}
/> />
</Pressable> </Pressable>
)} )}
@@ -26,7 +26,6 @@ const MusicCard = ({
}) => { }) => {
const [currentUID] = useGlobal("currentUID"); const [currentUID] = useGlobal("currentUID");
const [selected, setSelected] = useState(false); const [selected, setSelected] = useState(false);
const [open, setOpen] = useState(false);
const [layout, setLayout] = useState(null); const [layout, setLayout] = useState(null);
const [menuPos, setMenuPos] = useState(0); const [menuPos, setMenuPos] = useState(0);
+31 -28
View File
@@ -1,31 +1,31 @@
import {
View,
Text,
Pressable,
Image,
FlatList,
StyleSheet,
Platform,
} from "react-native";
import React, { useState } from "react";
import Page from "../../layouts/Page";
import { background, icons, img } from "../../assets";
import { BlurView } from "expo-blur"; import { BlurView } from "expo-blur";
import React, { useState } from "react";
import {
FlatList,
Image,
Platform,
Pressable,
ScrollView,
StyleSheet,
Text,
View,
} from "react-native";
import { SheetManager } from "react-native-actions-sheet";
import { responsiveHeight } from "react-native-responsive-dimensions"; import { responsiveHeight } from "react-native-responsive-dimensions";
import Style, { gutters, size } from "../../styles/Style"; import { useGlobal } from "reactn";
import { background, icons, img } from "../../assets";
import alert from "../../components/Alert";
import BorderGradient from "../../components/BorderGradient/BorderGradient";
import MoreMenu from "../../components/MoreMenu";
import { projectsRef } from "../../config/firebase";
import Page from "../../layouts/Page";
import { Routes } from "../../navigation";
import { navigate } from "../../navigation/NavigationService";
import { useUser } from "../../providers/UserDataProvider";
import { Palette } from "../../styles"; import { Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts"; import { FONT_FAMILY } from "../../styles/Fonts";
import BorderGradient from "../../components/BorderGradient/BorderGradient"; import Style, { gutters, size } from "../../styles/Style";
import MusicCard from "../Library/components/MusicCard"; import MusicCard from "../Library/components/MusicCard";
import MoreMenu from "../../components/MoreMenu";
import { useUser } from "../../providers/UserDataProvider";
import { SheetManager } from "react-native-actions-sheet";
import { navigate } from "../../navigation/NavigationService";
import { Routes } from "../../navigation";
import { useGlobal } from "reactn";
import Animated, { Easing, FadeIn, FadeOut } from "react-native-reanimated";
import alert from "../../components/Alert";
import { projectsRef } from "../../config/firebase";
const Profile = () => { const Profile = () => {
const [selected, setSelected] = useState("Chansons"); const [selected, setSelected] = useState("Chansons");
@@ -53,7 +53,7 @@ const Profile = () => {
}} }}
rightComponent={() => ( rightComponent={() => (
<Pressable onPress={() => SheetManager.show("ProfileSettings")}> <Pressable onPress={() => SheetManager.show("ProfileSettings")}>
<Image source={icons.more} /> <Image source={icons.more} style={{ ...size({ size: 24 }) }} />
</Pressable> </Pressable>
)} )}
> >
@@ -183,7 +183,7 @@ const Profile = () => {
</View> </View>
)} )}
{selected === "Chansons" && ( {selected === "Chansons" && (
<View style={{ flex: 1 }}> <ScrollView style={{ flex: 1 }}>
<FlatList <FlatList
data={Array.isArray(userProjects) ? userProjects : []} data={Array.isArray(userProjects) ? userProjects : []}
contentContainerStyle={{ contentContainerStyle={{
@@ -229,7 +229,10 @@ const Profile = () => {
try { try {
if (!selectedProjectId) return; if (!selectedProjectId) return;
await projectsRef.doc(selectedProjectId).delete(); await projectsRef.doc(selectedProjectId).delete();
setTooltip({ type: "success", text: "Projet supprimé" }); setTooltip({
type: "success",
text: "Projet supprimé",
});
} catch (e) { } catch (e) {
setTooltip({ setTooltip({
type: "error", type: "error",
@@ -239,12 +242,12 @@ const Profile = () => {
}, },
}, },
], ],
{ cancelable: true }, { cancelable: true }
), ),
}, },
]} ]}
/> />
</View> </ScrollView>
)} )}
</View> </View>
</Page> </Page>
+17 -17
View File
@@ -1,22 +1,22 @@
import {
View,
Text,
Pressable,
Image,
StyleSheet,
FlatList,
Platform,
} from "react-native";
import React, { useState } from "react";
import Page from "../../layouts/Page";
import { background, icons, img } from "../../assets";
import { gutters, Palette } from "../../styles";
import { BlurView } from "expo-blur"; import { BlurView } from "expo-blur";
import Style, { size } from "../../styles/Style"; import React, { useState } from "react";
import {
FlatList,
Image,
Platform,
Pressable,
StyleSheet,
Text,
View,
} from "react-native";
import { responsiveHeight } from "react-native-responsive-dimensions"; import { responsiveHeight } from "react-native-responsive-dimensions";
import { FONT_FAMILY } from "../../styles/Fonts"; import { background, icons, img } from "../../assets";
import GradientButton from "../../components/GradientButton";
import BorderGradient from "../../components/BorderGradient/BorderGradient"; import BorderGradient from "../../components/BorderGradient/BorderGradient";
import GradientButton from "../../components/GradientButton";
import Page from "../../layouts/Page";
import { gutters, Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts";
import Style, { size } from "../../styles/Style";
import MusicCard from "../Library/components/MusicCard"; import MusicCard from "../Library/components/MusicCard";
const SingerProfile = () => { const SingerProfile = () => {
@@ -42,7 +42,7 @@ const SingerProfile = () => {
}} }}
rightComponent={() => ( rightComponent={() => (
<Pressable> <Pressable>
<Image source={icons.more} /> <Image source={icons.more} style={{ ...size({ size: 24 }) }} />
</Pressable> </Pressable>
)} )}
> >