mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-29 17:39:27 +01:00
header style is good for now
fixed sorting
This commit is contained in:
parent
a4edbaf6f0
commit
c676944b9a
@ -23,6 +23,7 @@ const SongItem: React.FC<{
|
|||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
artist?: string;
|
artist?: string;
|
||||||
|
track?: number;
|
||||||
onPress: (event: GestureResponderEvent) => void;
|
onPress: (event: GestureResponderEvent) => void;
|
||||||
}> = ({ id, title, artist, onPress }) => {
|
}> = ({ id, title, artist, onPress }) => {
|
||||||
const [opacity, setOpacity] = useState(1);
|
const [opacity, setOpacity] = useState(1);
|
||||||
@ -137,11 +138,6 @@ const AlbumDetails: React.FC<{
|
|||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
}}>
|
}}>
|
||||||
<Button title="Play Album" onPress={() => setQueue(album.songs, album.songs[0].id)} />
|
<Button title="Play Album" onPress={() => setQueue(album.songs, album.songs[0].id)} />
|
||||||
{/* <View style={{ width: 6, }}></View>
|
|
||||||
<Button
|
|
||||||
title='S'
|
|
||||||
onPress={() => null}
|
|
||||||
/> */}
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@ -151,13 +147,20 @@ const AlbumDetails: React.FC<{
|
|||||||
marginBottom: 30,
|
marginBottom: 30,
|
||||||
}}>
|
}}>
|
||||||
{album.songs
|
{album.songs
|
||||||
.sort((a, b) => (a.track as number) - (b.track as number))
|
.sort((a, b) => {
|
||||||
|
if (b.track && a.track) {
|
||||||
|
return a.track - b.track;
|
||||||
|
} else {
|
||||||
|
return a.title.localeCompare(b.title);
|
||||||
|
}
|
||||||
|
})
|
||||||
.map(s => (
|
.map(s => (
|
||||||
<SongItem
|
<SongItem
|
||||||
key={s.id}
|
key={s.id}
|
||||||
id={s.id}
|
id={s.id}
|
||||||
title={s.title}
|
title={s.title}
|
||||||
artist={s.artist}
|
artist={s.artist}
|
||||||
|
track={s.track}
|
||||||
onPress={() => setQueue(album.songs, s.id)}
|
onPress={() => setQueue(album.songs, s.id)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@ -189,26 +192,12 @@ const AlbumView: React.FC<{
|
|||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
navigation.setOptions({
|
navigation.setOptions({ title });
|
||||||
headerCenter: () => (
|
|
||||||
<View style={{ flex: 1, marginLeft: 16 }}>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
width: 300,
|
|
||||||
...text.header,
|
|
||||||
}}
|
|
||||||
numberOfLines={1}>
|
|
||||||
{title}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
),
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Suspense fallback={<AlbumViewFallback />}>
|
<React.Suspense fallback={<AlbumViewFallback />}>
|
||||||
<AlbumDetails id={id} />
|
<AlbumDetails id={id} />
|
||||||
{/* <AlbumViewFallback /> */}
|
|
||||||
</React.Suspense>
|
</React.Suspense>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Pressable, StatusBar, View } from 'react-native';
|
import { StatusBar, View } from 'react-native';
|
||||||
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
|
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
|
||||||
import AlbumsTab from '../library/AlbumsTab';
|
import AlbumsTab from '../library/AlbumsTab';
|
||||||
import ArtistsTab from '../library/ArtistsTab';
|
import ArtistsTab from '../library/ArtistsTab';
|
||||||
@ -10,7 +10,6 @@ import { RouteProp } from '@react-navigation/native';
|
|||||||
import text from '../../styles/text';
|
import text from '../../styles/text';
|
||||||
import colors from '../../styles/colors';
|
import colors from '../../styles/colors';
|
||||||
import ArtistView from '../common/ArtistView';
|
import ArtistView from '../common/ArtistView';
|
||||||
import FastImage from 'react-native-fast-image';
|
|
||||||
|
|
||||||
const Tab = createMaterialTopTabNavigator();
|
const Tab = createMaterialTopTabNavigator();
|
||||||
|
|
||||||
@ -72,70 +71,20 @@ const Stack = createNativeStackNavigator<LibraryStackParamList>();
|
|||||||
const itemScreenOptions = {
|
const itemScreenOptions = {
|
||||||
title: '',
|
title: '',
|
||||||
headerStyle: {
|
headerStyle: {
|
||||||
height: 500,
|
|
||||||
backgroundColor: colors.gradient.high,
|
backgroundColor: colors.gradient.high,
|
||||||
},
|
},
|
||||||
headerTitleContainerStyle: {
|
headerHideShadow: true,
|
||||||
marginLeft: -14,
|
headerTintColor: 'white',
|
||||||
},
|
|
||||||
headerLeftContainerStyle: {
|
|
||||||
marginLeft: 8,
|
|
||||||
},
|
|
||||||
headerTitleStyle: {
|
headerTitleStyle: {
|
||||||
...text.header,
|
...text.header,
|
||||||
color: colors.text.primary,
|
} as any,
|
||||||
},
|
|
||||||
// headerBackImage: () => (
|
|
||||||
// <FastImage
|
|
||||||
// source={require('../../../res/arrow_left-fill.png')}
|
|
||||||
// tintColor={colors.text.primary}
|
|
||||||
// style={{ height: 22, width: 22 }}
|
|
||||||
// />
|
|
||||||
// ),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const LibraryStackNavigator = () => (
|
const LibraryStackNavigator = () => (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<Stack.Navigator>
|
<Stack.Navigator>
|
||||||
<Stack.Screen name="LibraryTopTabs" component={LibraryTopTabNavigator} options={{ headerShown: false }} />
|
<Stack.Screen name="LibraryTopTabs" component={LibraryTopTabNavigator} options={{ headerShown: false }} />
|
||||||
<Stack.Screen
|
<Stack.Screen name="AlbumView" component={AlbumScreen} options={itemScreenOptions} />
|
||||||
name="AlbumView"
|
|
||||||
component={AlbumScreen}
|
|
||||||
options={{
|
|
||||||
title: '',
|
|
||||||
headerStyle: {
|
|
||||||
// height: 500,
|
|
||||||
backgroundColor: colors.gradient.high,
|
|
||||||
},
|
|
||||||
headerHideShadow: true,
|
|
||||||
// headerTitleContainerStyle: {
|
|
||||||
// marginLeft: -14,
|
|
||||||
// },
|
|
||||||
// headerLeftContainerStyle: {
|
|
||||||
// marginLeft: 8,
|
|
||||||
// },
|
|
||||||
// headerTitleStyle: {
|
|
||||||
// ...text.header,
|
|
||||||
// color: colors.text.primary,
|
|
||||||
// },
|
|
||||||
headerLeft: () => (
|
|
||||||
<Pressable>
|
|
||||||
<FastImage
|
|
||||||
source={require('../../../res/arrow_left-fill.png')}
|
|
||||||
tintColor="white"
|
|
||||||
style={{ height: 24, width: 24 }}
|
|
||||||
/>
|
|
||||||
</Pressable>
|
|
||||||
),
|
|
||||||
// headerBackImage: () => (
|
|
||||||
// <FastImage
|
|
||||||
// source={require('../../../res/arrow_left-fill.png')}
|
|
||||||
// tintColor={colors.text.primary}
|
|
||||||
// style={{ height: 22, width: 22 }}
|
|
||||||
// />
|
|
||||||
// ),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Stack.Screen name="ArtistView" component={ArtistScreen} options={itemScreenOptions} />
|
<Stack.Screen name="ArtistView" component={ArtistScreen} options={itemScreenOptions} />
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@ -134,7 +134,7 @@ export const artistArtAtomFamily = atomFamily((id: string) =>
|
|||||||
if (b.year && a.year) {
|
if (b.year && a.year) {
|
||||||
return b.year - a.year;
|
return b.year - a.year;
|
||||||
} else {
|
} else {
|
||||||
return a.name.localeCompare(b.name) - 9000;
|
return a.name.localeCompare(b.name);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.map(a => a.coverArtThumbUri) as string[];
|
.map(a => a.coverArtThumbUri) as string[];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user