playlist details

This commit is contained in:
2025-08-29 11:54:41 +02:00
parent e0146321b8
commit 023177ea22
8 changed files with 160 additions and 56 deletions
+22 -2
View File
@@ -11,6 +11,7 @@ import {
import { SheetManager } from "react-native-actions-sheet";
import SwiperFlatList from "react-native-swiper-flatlist";
import { icons } from "../../assets";
import { arrayUnion, playlistsRef } from "../../config/firebase";
import { useUserData } from "../../providers/UserDataProvider";
import { createPlaylist } from "../../screens/Library/Playlists/playlist";
import { Palette } from "../../styles";
@@ -91,8 +92,25 @@ const PlaylistModal = (props) => {
containerStyle={{
width: "80%",
alignSelf: "center",
opacity: selectedId ? 1 : 0.5,
}}
disabled={!selectedId}
onPress={async () => {
try {
const projectId = props?.payload?.projectId;
if (!selectedId) return;
if (projectId) {
await playlistsRef.doc(selectedId).update({
musics: arrayUnion(projectId),
updatedAt: new Date(),
});
}
} catch (e) {
console.log("Add to playlist error", e?.message);
} finally {
SheetManager.hide("Playlist");
}
}}
onPress={() => SheetManager.hide("Playlist")}
/>
</View>
</View>
@@ -160,7 +178,9 @@ const PlaylistModal = (props) => {
await createPlaylist({
createdBy: currentUID,
name: playlist.trim(),
musics: [],
musics: props?.payload?.projectId
? [props.payload.projectId]
: [],
createdAt: new Date(),
updatedAt: new Date(),
});