username on creation

This commit is contained in:
2025-10-03 13:59:41 +02:00
parent dcc50506de
commit 1907449dee
7 changed files with 89 additions and 40 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { isWeb } from "../hooks/useLayoutType";
import { gutters, Palette } from "../styles";
const AppActionSheet = ({ children, props }) => {
const AppActionSheet = ({ children, ...props }) => {
const insets = useSafeAreaInsets();
return (
<ActionSheet
+33 -15
View File
@@ -46,9 +46,13 @@ const ShareModal = ({ payload }) => {
const [copied, setCopied] = useState(false);
const copyTimeout = useRef(null);
const qrOpenTimeout = useRef(null);
const blurProps =
Platform.OS === "android"
? { experimentalBlurMethod: "dimezisBlurView" }
: {};
const closeSheet = useCallback(() => {
SheetManager.hide("Share");
return SheetManager.hide("Share");
}, []);
const shareText = useMemo(() => {
@@ -134,7 +138,7 @@ const ShareModal = ({ payload }) => {
if (option?.type === "qr") {
const qrTitleValue = qrTitle;
closeSheet();
const hidePromise = closeSheet();
qrOpenTimeout.current = setTimeout(() => {
setGlobal({
shareQrModal: {
@@ -144,6 +148,8 @@ const ShareModal = ({ payload }) => {
},
});
}, 200);
await hidePromise;
return;
}
@@ -151,21 +157,21 @@ const ShareModal = ({ payload }) => {
if (!target) {
await handleSystemShare();
closeSheet();
await closeSheet();
return;
}
try {
if (Platform.OS === "web") {
window.open(target, "_blank", "noopener,noreferrer");
closeSheet();
await closeSheet();
return;
}
const supported = await Linking.canOpenURL(target);
if (supported) {
await Linking.openURL(target);
closeSheet();
await closeSheet();
return;
}
} catch (error) {
@@ -173,14 +179,14 @@ const ShareModal = ({ payload }) => {
}
await handleSystemShare();
closeSheet();
await closeSheet();
},
[closeSheet, handleSystemShare, qrTitle, qrUrl]
);
const onSystemShare = useCallback(async () => {
await handleSystemShare();
closeSheet();
await closeSheet();
}, [closeSheet, handleSystemShare]);
const shareOptions = useMemo(() => {
@@ -233,8 +239,11 @@ const ShareModal = ({ payload }) => {
style={[styles.card, styles.blurCard]}
tint="dark"
intensity={40}
experimentalBlurMethod="dimezisBlurView"
{...blurProps}
>
<Pressable onPress={closeSheet} style={styles.closeButton} hitSlop={8}>
<Feather name="x" size={18} color={Palette.white} />
</Pressable>
<Text style={styles.heading}>{heading}</Text>
<View style={styles.linkRow}>
<Text numberOfLines={1} style={styles.linkText}>
@@ -264,11 +273,7 @@ const ShareModal = ({ payload }) => {
{copied ? <Text style={styles.copiedText}>Lien copié</Text> : null}
</BlurView>
<BlurView
intensity={70}
experimentalBlurMethod="dimezisBlurView"
style={styles.card}
>
<BlurView intensity={70} style={styles.card} {...blurProps}>
<Text style={styles.sectionHeading}>{sectionTitle}</Text>
<View style={styles.optionsList}>
{shareOptions.map((option, index) => {
@@ -278,7 +283,7 @@ const ShareModal = ({ payload }) => {
key={option?.key || index}
style={styles.optionBlur}
intensity={40}
experimentalBlurMethod="dimezisBlurView"
{...blurProps}
>
<Pressable
onPress={() => handleShareOption(option)}
@@ -304,7 +309,7 @@ const styles = StyleSheet.create({
gap: 24,
},
card: {
// backgroundColor: Palette.glass,
backgroundColor: Palette.glass,
overflow: "hidden",
borderRadius: 24,
borderWidth: 1,
@@ -315,6 +320,19 @@ const styles = StyleSheet.create({
},
blurCard: {
overflow: "hidden",
position: "relative",
},
closeButton: {
position: "absolute",
top: 16,
right: 16,
width: 32,
height: 32,
borderRadius: 16,
alignItems: "center",
justifyContent: "center",
backgroundColor: "rgba(255, 255, 255, 0.12)",
zIndex: 2,
},
heading: {
fontSize: 20,
+31 -12
View File
@@ -1,14 +1,19 @@
import React, { useMemo } from "react";
import { BlurView } from "expo-blur";
import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
import { Feather } from "@expo/vector-icons";
import { Portal } from "@gorhom/portal";
import { BlurView } from "expo-blur";
import React, { useMemo } from "react";
import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
import QrCode from "../QrCode";
import { Palette } from "../../styles";
import { FONT_FAMILY } from "../../styles/Fonts";
import QrCode from "../QrCode";
const ShareQrModal = ({ visible, onClose, url, title = "Scannez le QR-code" }) => {
const ShareQrModal = ({
visible,
onClose,
url,
title = "Scannez le QR-code",
}) => {
const shareUrl = useMemo(() => url, [url]);
if (!visible) {
@@ -26,22 +31,36 @@ const ShareQrModal = ({ visible, onClose, url, title = "Scannez le QR-code" }) =
/>
<View style={styles.centerWrapper} pointerEvents="box-none">
<BlurView intensity={blurIntensity} tint="dark" style={styles.modalCard}>
<Pressable onPress={onClose} style={styles.closeButton} hitSlop={10}>
<BlurView
intensity={blurIntensity}
tint="dark"
style={styles.modalCard}
>
<Pressable
onPress={onClose}
style={styles.closeButton}
hitSlop={10}
>
<Feather name="x" size={20} color={Palette.white} />
</Pressable>
<View style={styles.content}>
<Text style={styles.title}>{title}</Text>
<Text style={styles.subtitle}>
Partage ce code pour guider tes contacts directement vers MusicLand.
</Text>
<Text style={styles.subtitle}>Partage Musicland à tes amis.</Text>
<View style={styles.qrWrapper}>
<QrCode value={shareUrl} size={220} backgroundColor="transparent" />
<QrCode
value={shareUrl}
size={220}
backgroundColor="transparent"
/>
</View>
<Text numberOfLines={1} ellipsizeMode="middle" style={styles.linkText}>
<Text
numberOfLines={1}
ellipsizeMode="middle"
style={styles.linkText}
>
{shareUrl}
</Text>
</View>
+10 -11
View File
@@ -112,17 +112,17 @@ export default ({ children }) => {
{
selectedProjectId: projectId || null,
},
{ merge: true },
{ merge: true }
);
console.log("update selected project");
} catch (error) {
console.log(
"UserDataProvider: unable to persist selectedProjectId",
error?.message || error,
error?.message || error
);
}
},
[currentUID],
[currentUID]
);
const selectProject = useCallback(
@@ -137,12 +137,12 @@ export default ({ children }) => {
persistSelectedProjectId(safeId).catch((error) => {
console.log(
"UserDataProvider: persist selectedProjectId failed",
error?.message || error,
error?.message || error
);
});
}
},
[currentUID, persistSelectedProjectId, setSelectedProject],
[currentUID, persistSelectedProjectId, setSelectedProject]
);
const resetSelectedProject = useCallback(() => {
@@ -159,7 +159,7 @@ export default ({ children }) => {
...partial,
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
},
options,
options
);
} catch (e) {
console.log("updateProjectData error", e?.message);
@@ -170,10 +170,9 @@ export default ({ children }) => {
const createNewProject = async ({ hasLyrics = false } = {}) => {
try {
await setIsLoading(true);
const user = firebase.auth().currentUser;
const payload = {
userId: user ? user.uid : currentUID || null,
hasLyrics: !!hasLyrics,
userId: currentUID || null,
userName: currentUserData?.userName || null,
createdAt: firebase.firestore.FieldValue.serverTimestamp(),
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
};
@@ -195,7 +194,7 @@ export default ({ children }) => {
followedBy: arrayUnion(currentUID),
lastFollowersUpdateAt: new Date(),
},
{ merge: true },
{ merge: true }
);
setTooltip({ type: "success", text: "Abonnement mis à jour" });
}
@@ -213,7 +212,7 @@ export default ({ children }) => {
followedBy: arrayRemove(currentUID),
lastFollowersUpdateAt: new Date(),
},
{ merge: true },
{ merge: true }
);
setTooltip({
type: "success",
+8
View File
@@ -32,6 +32,14 @@ const HitParade = () => {
condition: true,
});
console.log(
"top songs",
JSON.stringify(
topSongs.map((song) => song.userId),
null,
2
)
);
const { data: topPlaybacks } = useDataFromRef({
ref: projectsRef.where("views", ">", 0).orderBy("views", "desc").limit(50),
format: (docs) => docs.filter((d) => d?.playbackUrl != null).slice(0, 10),
+5
View File
@@ -146,6 +146,11 @@ const Home = () => {
resetSelectedProject();
setActiveStageIndex(0);
if (songwriterAction?.route) {
console.log(
"navigating to",
songwriterAction.route,
songwriterAction.params
);
navigate(songwriterAction.route, songwriterAction.params);
}
}, [resetSelectedProject, songwriterAction]);
+1 -1
View File
@@ -3,7 +3,7 @@ import { Image, StyleSheet, View } from "react-native";
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
import { ai } from "../../assets";
import BorderGradientButton from "../../components/BorderGradientButton";
import FullscreenIntroVideo from "../../components/FullscreenIntroVideo.web";
import FullscreenIntroVideo from "../../components/FullscreenIntroVideo";
import GradientButton from "../../components/GradientButton";
import MusicLandHeader from "../../components/MusicLandHeader";
import Page from "../../layouts/Page";