feat: unauthenticated tab
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
import useTrackController from "../../hooks/useTrackController";
|
||||
import usePlayer from "../../hooks/usePlayer";
|
||||
import { Image as ExpoImage } from "expo-image";
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import {
|
||||
Linking,
|
||||
Pressable,
|
||||
Image as RNImage,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
Linking,
|
||||
} from "react-native";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import {
|
||||
@@ -29,21 +33,24 @@ import {
|
||||
usersRef,
|
||||
} from "../../config/firebase";
|
||||
import useDataFromRef from "../../hooks/useDataFromRef";
|
||||
import usePlayer from "../../hooks/usePlayer";
|
||||
import useTrackController from "../../hooks/useTrackController";
|
||||
import Page from "../../layouts/Page";
|
||||
import { Palette } from "../../styles";
|
||||
import { FONT_FAMILY } from "../../styles/Fonts";
|
||||
import Style, { gutters, size } from "../../styles/Style";
|
||||
import { getArtistDisplayName } from "../../utils/artistName";
|
||||
import { ensureAuthenticated } from "../../utils/authRedirect";
|
||||
import {
|
||||
createMusicSharePayload,
|
||||
openShareSheet,
|
||||
} from "../../utils/shareSheet";
|
||||
import {
|
||||
formatStructureLabel,
|
||||
getPromptLabelForStructure,
|
||||
getSegmentMeta,
|
||||
normalizeStructureType,
|
||||
} from "../../utils/songStructure";
|
||||
import {
|
||||
createMusicSharePayload,
|
||||
openShareSheet,
|
||||
} from "../../utils/shareSheet";
|
||||
|
||||
// 20 secondes
|
||||
const timeBeforeIncrement = 20000;
|
||||
@@ -413,13 +420,7 @@ const MusicDetails = ({ route }) => {
|
||||
console.log("MusicDetails seekBy error", e?.message);
|
||||
}
|
||||
},
|
||||
[
|
||||
trackDescriptor,
|
||||
positionMs,
|
||||
isCurrentTrack,
|
||||
ensureLoaded,
|
||||
seekTrackBy,
|
||||
]
|
||||
[trackDescriptor, positionMs, isCurrentTrack, ensureLoaded, seekTrackBy]
|
||||
);
|
||||
|
||||
const handleLyricsSeek = useCallback(
|
||||
@@ -495,7 +496,8 @@ const MusicDetails = ({ route }) => {
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
const isSentenceEnd = (txt) => /[.!?]$/.test((txt || "").trim());
|
||||
const stripSectionTag = (txt) => String(txt || "").replace(SECTION_TAG_REGEX, "");
|
||||
const stripSectionTag = (txt) =>
|
||||
String(txt || "").replace(SECTION_TAG_REGEX, "");
|
||||
const parseSectionTag = (txt) => {
|
||||
const match = String(txt || "").match(SECTION_TAG_REGEX);
|
||||
if (!match) return null;
|
||||
@@ -503,7 +505,8 @@ const MusicDetails = ({ route }) => {
|
||||
const lower = label.toLowerCase();
|
||||
let type = "section";
|
||||
if (lower.includes("refrain") || lower.includes("chorus")) type = "refrain";
|
||||
else if (lower.includes("couplet") || lower.includes("verse")) type = "couplet";
|
||||
else if (lower.includes("couplet") || lower.includes("verse"))
|
||||
type = "couplet";
|
||||
else if (
|
||||
lower.includes("pré") ||
|
||||
lower.includes("prechorus") ||
|
||||
@@ -632,7 +635,9 @@ const MusicDetails = ({ route }) => {
|
||||
current = null;
|
||||
return;
|
||||
}
|
||||
const lines = groupAlignedWordsToLines(current.words, { removeTags: true });
|
||||
const lines = groupAlignedWordsToLines(current.words, {
|
||||
removeTags: true,
|
||||
});
|
||||
if (!lines.length) {
|
||||
current = null;
|
||||
return;
|
||||
@@ -785,7 +790,10 @@ const MusicDetails = ({ route }) => {
|
||||
justifyContent: "center",
|
||||
opacity: isCurrentTrack ? 1 : 0.4,
|
||||
}}
|
||||
contentStyle={{ alignItems: "center", justifyContent: "center" }}
|
||||
contentStyle={{
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<Feather
|
||||
name="repeat"
|
||||
@@ -795,7 +803,8 @@ const MusicDetails = ({ route }) => {
|
||||
</PressableScale>
|
||||
<PressableScale
|
||||
onPress={async () => {
|
||||
if (!projectId || !currentUID) return;
|
||||
if (!projectId) return;
|
||||
if (!ensureAuthenticated(currentUID)) return;
|
||||
const next = !fav;
|
||||
setFav(next);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user