mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-19 12:14:47 +02:00
track controls
This commit is contained in:
@@ -8,6 +8,7 @@ import { Text } from '@/components/Text';
|
||||
import { AstraLogo } from '@/components/AstraLogo';
|
||||
import { SpectrumCurve } from '@/components/SpectrumCurve';
|
||||
import { TrackRow } from '@/components/library/TrackRow';
|
||||
import { TrackActionsSheet } from '@/components/library/TrackActionsSheet';
|
||||
import { PlaylistRow } from '@/components/library/PlaylistRow';
|
||||
import { ScanProgress } from '@/components/library/ScanProgress';
|
||||
import {
|
||||
@@ -357,6 +358,7 @@ export default function HomeScreen() {
|
||||
|
||||
const [randomAlbumKey, setRandomAlbumKey] = useState<string | null>(null);
|
||||
const [randomSeed] = useState(() => Math.random());
|
||||
const [actionTrack, setActionTrack] = useState<DbTrack | null>(null);
|
||||
const scrollTop = useScrollTopGate();
|
||||
const hasLibrary = tracks.length > 0;
|
||||
|
||||
@@ -511,6 +513,8 @@ export default function HomeScreen() {
|
||||
active={track.path === currentPath}
|
||||
swipeToQueue={false}
|
||||
onPress={() => playTrackList(recentTracks, index)}
|
||||
onLongPress={() => setActionTrack(track)}
|
||||
onOpenActions={() => setActionTrack(track)}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
@@ -564,6 +568,7 @@ export default function HomeScreen() {
|
||||
)}
|
||||
</PullSearchScrollView>
|
||||
</PullSearchGesture>
|
||||
<TrackActionsSheet track={actionTrack} onClose={() => setActionTrack(null)} />
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ export default function AlbumScreen() {
|
||||
active={item.path === currentPath}
|
||||
onPress={() => playFrom(index)}
|
||||
onLongPress={() => setActionTrack(item)}
|
||||
onOpenActions={() => setActionTrack(item)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -119,6 +119,7 @@ export default function ArtistScreen() {
|
||||
active={item.track.path === currentPath}
|
||||
onPress={() => playTrackListFrom(sourceTracks, item.index)}
|
||||
onLongPress={() => setActionTrack(item.track)}
|
||||
onOpenActions={() => setActionTrack(item.track)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ export default function ArtistAppearancesScreen() {
|
||||
active={item.path === currentPath}
|
||||
onPress={() => playFrom(index)}
|
||||
onLongPress={() => setActionTrack(item)}
|
||||
onOpenActions={() => setActionTrack(item)}
|
||||
/>
|
||||
)}
|
||||
ListEmptyComponent={<EmptyList label="No appearances found for this artist." />}
|
||||
|
||||
@@ -62,6 +62,7 @@ export default function ArtistSongsScreen() {
|
||||
active={item.path === currentPath}
|
||||
onPress={() => playFrom(index)}
|
||||
onLongPress={() => setActionTrack(item)}
|
||||
onOpenActions={() => setActionTrack(item)}
|
||||
/>
|
||||
)}
|
||||
ListEmptyComponent={<EmptyList label="No songs found for this artist." />}
|
||||
|
||||
@@ -175,6 +175,7 @@ export default function LibraryScreen() {
|
||||
active={item.path === currentPath}
|
||||
onPress={() => playAllFrom(index)}
|
||||
onLongPress={() => setActionTrack(item)}
|
||||
onOpenActions={() => setActionTrack(item)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -231,6 +231,7 @@ export default function PlaylistScreen() {
|
||||
active={item.track.path === currentPath}
|
||||
onPress={() => startPlayback(playableIndexByEntryId.get(item.id) ?? 0)}
|
||||
onLongPress={() => setActionEntry(item)}
|
||||
onOpenActions={() => setActionEntry(item)}
|
||||
/>
|
||||
) : (
|
||||
<MissingRow entry={item} onLongPress={() => setMissingEntry(item)} />
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { Pressable, StyleSheet, View } from 'react-native';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { FlashList } from '@shopify/flash-list';
|
||||
@@ -5,11 +6,13 @@ import { useRouter } from 'expo-router';
|
||||
import { Screen } from '@/components/Screen';
|
||||
import { Text } from '@/components/Text';
|
||||
import { TrackRow } from '@/components/library/TrackRow';
|
||||
import { TrackActionsSheet } from '@/components/library/TrackActionsSheet';
|
||||
import { colors, spacing } from '@/theme';
|
||||
import { useLibraryStore } from '@/stores/libraryStore';
|
||||
import { usePlayerStore } from '@/stores/playerStore';
|
||||
import { playTracks } from '@/audio/playbackController';
|
||||
import { dbTrackToTrack } from '@/library/trackAdapter';
|
||||
import type { DbTrack } from '@/types/library';
|
||||
|
||||
function formatCount(count: number, noun: string): string {
|
||||
return `${count} ${count === 1 ? noun : `${noun}s`}`;
|
||||
@@ -30,6 +33,7 @@ export default function RecentlyPlayedScreen() {
|
||||
const router = useRouter();
|
||||
const tracks = useLibraryStore((s) => s.recentlyPlayedTracks);
|
||||
const currentPath = usePlayerStore((s) => s.currentTrack?.path);
|
||||
const [actionTrack, setActionTrack] = useState<DbTrack | null>(null);
|
||||
|
||||
const playFrom = (index: number) => {
|
||||
if (tracks.length === 0) return;
|
||||
@@ -62,11 +66,14 @@ export default function RecentlyPlayedScreen() {
|
||||
active={item.path === currentPath}
|
||||
swipeToQueue={false}
|
||||
onPress={() => playFrom(index)}
|
||||
onLongPress={() => setActionTrack(item)}
|
||||
onOpenActions={() => setActionTrack(item)}
|
||||
/>
|
||||
)}
|
||||
ListEmptyComponent={<EmptyList />}
|
||||
contentContainerStyle={styles.listContent}
|
||||
/>
|
||||
<TrackActionsSheet track={actionTrack} onClose={() => setActionTrack(null)} />
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user