import {
Pressable,
StyleSheet,
View
} from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { Text } from '@/components/Text';
import { spacing } from '@/theme';
import { createThemedStyles, useColors } from '@/theme/themed';
interface SelectionActionBarProps {
count: number;
onPlayNext: () => void;
onAddToQueue: () => void;
onAddToPlaylist: () => void;
}
/** Bottom batch-action bar for library multi-select (QueueTray action-bar language). */
export function SelectionActionBar({
count,
onPlayNext,
onAddToQueue,
onAddToPlaylist,
}: SelectionActionBarProps) {
const styles = useStyles();
const disabled = count === 0;
return (
);
}
function BarButton({
icon,
label,
accessibilityLabel,
disabled,
onPress,
}: {
icon: keyof typeof Ionicons.glyphMap;
label: string;
accessibilityLabel: string;
disabled: boolean;
onPress: () => void;
}) {
const styles = useStyles();
const colors = useColors();
return (
[
styles.button,
pressed && styles.buttonPressed,
disabled && styles.buttonDisabled,
]}
onPress={onPress}
disabled={disabled}
accessibilityRole="button"
accessibilityLabel={accessibilityLabel}
>
{label}
);
}
const useStyles = createThemedStyles((colors) => ({
bar: {
flexDirection: 'row',
borderTopColor: colors.glassBorder,
borderTopWidth: StyleSheet.hairlineWidth,
backgroundColor: colors.bgTertiary,
},
button: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
gap: spacing.xs,
paddingVertical: spacing.md,
},
buttonPressed: {
opacity: 0.7,
},
buttonDisabled: {
opacity: 0.4,
},
label: {
color: colors.accent,
},
}));