@@ -38,6 +38,7 @@ const ButtonText = styled.Text<{ active?: boolean, size: ButtonSize }>`
|
|||||||
color: ${THEME_COLOR};
|
color: ${THEME_COLOR};
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
flex-shrink: 1;
|
||||||
|
|
||||||
${(props) => props.size === 'small' && css`
|
${(props) => props.size === 'small' && css`
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -78,7 +79,13 @@ const Button = React.forwardRef<View, ButtonProps>(function Button(props, ref) {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{title ? (
|
{title ? (
|
||||||
<ButtonText active={isPressed} size={size}>{title}</ButtonText>
|
<ButtonText
|
||||||
|
active={isPressed}
|
||||||
|
size={size}
|
||||||
|
numberOfLines={1}
|
||||||
|
>
|
||||||
|
{title}
|
||||||
|
</ButtonText>
|
||||||
) : undefined}
|
) : undefined}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"no-downloads": "You have not yet downloaded any tracks",
|
"no-downloads": "You have not yet downloaded any tracks",
|
||||||
"delete-track": "Delete Track",
|
"delete-track": "Delete Track",
|
||||||
"delete-all-tracks": "Delete All Tracks",
|
"delete-all-tracks": "Delete All Tracks",
|
||||||
|
"confirm-delete-all-tracks": "Are you sure you want to delete all currently downloaded tracks?",
|
||||||
"delete-album": "Delete Album",
|
"delete-album": "Delete Album",
|
||||||
"delete-playlist": "Delete Playlist",
|
"delete-playlist": "Delete Playlist",
|
||||||
"total-download-size": "Total Download Size",
|
"total-download-size": "Total Download Size",
|
||||||
@@ -71,5 +72,7 @@
|
|||||||
"color-scheme-dark": "Dark Mode",
|
"color-scheme-dark": "Dark Mode",
|
||||||
"artists": "Artists",
|
"artists": "Artists",
|
||||||
"privacy-policy": "Privacy Policy",
|
"privacy-policy": "Privacy Policy",
|
||||||
"sleep-timer": "Sleep timer"
|
"sleep-timer": "Sleep timer",
|
||||||
|
"delete": "Delete",
|
||||||
|
"cancel": "Cancel"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
"no-downloads": "Je hebt nog geen nummers gedownload",
|
"no-downloads": "Je hebt nog geen nummers gedownload",
|
||||||
"delete-track": "Verwijder Track",
|
"delete-track": "Verwijder Track",
|
||||||
"delete-all-tracks": "Verwijder alle nummers",
|
"delete-all-tracks": "Verwijder alle nummers",
|
||||||
|
"confirm-delete-all-tracks": "Weet je zeker dat je alle eerdere gedownloadede tracks wil verwijderen?",
|
||||||
"delete-album": "Verwijder Album",
|
"delete-album": "Verwijder Album",
|
||||||
"delete-playlist": "Verwijder Playlist",
|
"delete-playlist": "Verwijder Playlist",
|
||||||
"total-download-size": "Totale grootte downloads",
|
"total-download-size": "Totale grootte downloads",
|
||||||
@@ -71,5 +72,7 @@
|
|||||||
"color-scheme-light": "Lichte modus",
|
"color-scheme-light": "Lichte modus",
|
||||||
"color-scheme-dark": "Donkere modus",
|
"color-scheme-dark": "Donkere modus",
|
||||||
"privacy-policy": "Privacybeleid",
|
"privacy-policy": "Privacybeleid",
|
||||||
"sleep-timer": "Slaaptimer"
|
"sleep-timer": "Slaaptimer",
|
||||||
|
"delete": "Verwijder",
|
||||||
|
"cancel": "Annuleer"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export type LocaleKeys = 'play-next'
|
|||||||
| 'delete-playlist'
|
| 'delete-playlist'
|
||||||
| 'delete-track'
|
| 'delete-track'
|
||||||
| 'delete-all-tracks'
|
| 'delete-all-tracks'
|
||||||
|
| 'confirm-delete-all-tracks'
|
||||||
| 'total-download-size'
|
| 'total-download-size'
|
||||||
| 'no-downloads'
|
| 'no-downloads'
|
||||||
| 'retry-failed-downloads'
|
| 'retry-failed-downloads'
|
||||||
@@ -71,3 +72,5 @@ export type LocaleKeys = 'play-next'
|
|||||||
| 'artists'
|
| 'artists'
|
||||||
| 'privacy-policy'
|
| 'privacy-policy'
|
||||||
| 'sleep-timer'
|
| 'sleep-timer'
|
||||||
|
| 'delete'
|
||||||
|
| 'cancel'
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import useDefaultStyles from '@/components/Colors';
|
import useDefaultStyles from '@/components/Colors';
|
||||||
import React, { useCallback, useMemo } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
import { FlatListProps, View } from 'react-native';
|
import { Alert, FlatListProps, View } from 'react-native';
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
import { useAppDispatch, useTypedSelector } from '@/store';
|
import { useAppDispatch, useTypedSelector } from '@/store';
|
||||||
import formatBytes from '@/utility/formatBytes';
|
import formatBytes from '@/utility/formatBytes';
|
||||||
@@ -59,7 +59,22 @@ function Downloads() {
|
|||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
// Delete all downloaded tracks
|
// Delete all downloaded tracks
|
||||||
const handleDeleteAllTracks = useCallback(() => ids.forEach(handleDelete), [handleDelete, ids]);
|
const handleDeleteAllTracks = useCallback(() => {
|
||||||
|
Alert.alert(
|
||||||
|
t('delete-all-tracks'),
|
||||||
|
t('confirm-delete-all-tracks'),
|
||||||
|
[{
|
||||||
|
text: t('delete'),
|
||||||
|
style: 'destructive',
|
||||||
|
onPress() {
|
||||||
|
ids.forEach(handleDelete);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: t('cancel'),
|
||||||
|
style: 'cancel',
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
}, [handleDelete, ids]);
|
||||||
|
|
||||||
// Retry a single failed track
|
// Retry a single failed track
|
||||||
const retryTrack = useCallback((id: string) => {
|
const retryTrack = useCallback((id: string) => {
|
||||||
@@ -78,23 +93,31 @@ function Downloads() {
|
|||||||
|
|
||||||
const ListHeaderComponent = useMemo(() => (
|
const ListHeaderComponent = useMemo(() => (
|
||||||
<View style={[{ paddingHorizontal: 20, paddingBottom: 12, paddingTop: 12, borderBottomWidth: 0.5 }, defaultStyles.border]}>
|
<View style={[{ paddingHorizontal: 20, paddingBottom: 12, paddingTop: 12, borderBottomWidth: 0.5 }, defaultStyles.border]}>
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 24 }}>
|
||||||
|
<View>
|
||||||
|
<Text style={[
|
||||||
|
defaultStyles.text,
|
||||||
|
{ fontSize: 16, fontWeight: '600' },
|
||||||
|
]}>
|
||||||
|
{formatBytes(totalDownloadSize)}
|
||||||
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
defaultStyles.textHalfOpacity,
|
defaultStyles.textHalfOpacity,
|
||||||
{ marginRight: 8, flex: 1, fontSize: 12 },
|
{ fontSize: 12 },
|
||||||
]}
|
]}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
>
|
>
|
||||||
{t('total-download-size')}{': '}{formatBytes(totalDownloadSize)}
|
{t('total-download-size')}
|
||||||
</Text>
|
</Text>
|
||||||
|
</View>
|
||||||
<Button
|
<Button
|
||||||
icon={TrashIcon}
|
icon={TrashIcon}
|
||||||
title={t('delete-all-tracks')}
|
|
||||||
onPress={handleDeleteAllTracks}
|
onPress={handleDeleteAllTracks}
|
||||||
|
title={t('delete-all-tracks')}
|
||||||
disabled={!ids.length}
|
disabled={!ids.length}
|
||||||
size="small"
|
|
||||||
testID="delete-all-tracks"
|
testID="delete-all-tracks"
|
||||||
|
style={{ flexShrink: 1, flexGrow: 0 }}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
{failedIds.length > 0 && (
|
{failedIds.length > 0 && (
|
||||||
|
|||||||
Reference in New Issue
Block a user