T3code/mobile button icons #3
No files matched your search
@@ -116,15 +116,32 @@ export default function AlbumScreen() {
|
||||
<Text style={{ color: colors.mutedForeground }}>{metadata}</Text>
|
||||
) : null}
|
||||
<View style={styles.actions}>
|
||||
<Button title="Play" onPress={() => void playAlbum(album.id)} />
|
||||
<Button title="Shuffle" variant="secondary" onPress={() => void playAlbumShuffled(album.id)} />
|
||||
<Pressable onPress={() => void toggleAlbumFavorite(album.id)} hitSlop={8}>
|
||||
<Pressable
|
||||
onPress={() => void toggleAlbumFavorite(album.id)}
|
||||
hitSlop={8}
|
||||
style={[styles.iconAction, { backgroundColor: colors.muted }]}
|
||||
>
|
||||
<Ionicons
|
||||
name={isAlbumFavorite(album.id) ? "star" : "star-outline"}
|
||||
size={24}
|
||||
color={isAlbumFavorite(album.id) ? colors.primary : colors.foreground}
|
||||
/>
|
||||
</Pressable>
|
||||
<Button
|
||||
title="Play"
|
||||
icon="play"
|
||||
onPress={() => void playAlbum(album.id)}
|
||||
style={styles.playButton}
|
||||
/>
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel="Shuffle"
|
||||
hitSlop={8}
|
||||
onPress={() => void playAlbumShuffled(album.id)}
|
||||
style={[styles.iconAction, { backgroundColor: colors.muted }]}
|
||||
>
|
||||
<Ionicons name="shuffle" size={24} color={colors.foreground} />
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -188,9 +205,18 @@ const styles = StyleSheet.create({
|
||||
actions: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: spacing.sm,
|
||||
marginTop: spacing.sm,
|
||||
},
|
||||
playButton: { borderRadius: 999, minWidth: 160 },
|
||||
iconAction: {
|
||||
width: 44,
|
||||
height: 44,
|
||||
borderRadius: 22,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
trackRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
|
||||
@@ -92,15 +92,32 @@ export default function ArtistScreen() {
|
||||
/>
|
||||
<Text style={[styles.title, { color: colors.foreground }]}>{data.artist.name}</Text>
|
||||
<View style={styles.actions}>
|
||||
<Button title="Play" onPress={() => void playArtist(data.artist.id)} />
|
||||
<Button title="Shuffle" variant="secondary" onPress={() => void playArtistShuffled(data.artist.id)} />
|
||||
<Pressable onPress={() => void toggleArtistFavorite(data.artist.id)} hitSlop={8}>
|
||||
<Pressable
|
||||
onPress={() => void toggleArtistFavorite(data.artist.id)}
|
||||
hitSlop={8}
|
||||
style={[styles.iconAction, { backgroundColor: colors.muted }]}
|
||||
>
|
||||
<Ionicons
|
||||
name={isArtistFavorite(data.artist.id) ? "star" : "star-outline"}
|
||||
size={24}
|
||||
color={isArtistFavorite(data.artist.id) ? colors.primary : colors.foreground}
|
||||
/>
|
||||
</Pressable>
|
||||
<Button
|
||||
title="Play"
|
||||
icon="play"
|
||||
onPress={() => void playArtist(data.artist.id)}
|
||||
style={styles.playButton}
|
||||
/>
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel="Shuffle"
|
||||
hitSlop={8}
|
||||
onPress={() => void playArtistShuffled(data.artist.id)}
|
||||
style={[styles.iconAction, { backgroundColor: colors.muted }]}
|
||||
>
|
||||
<Ionicons name="shuffle" size={24} color={colors.foreground} />
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -121,7 +138,21 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 90,
|
||||
},
|
||||
title: { fontSize: 28, fontWeight: "800", textAlign: "center" },
|
||||
actions: { flexDirection: "row", alignItems: "center", gap: spacing.sm, marginTop: spacing.sm },
|
||||
actions: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: spacing.sm,
|
||||
marginTop: spacing.sm,
|
||||
},
|
||||
playButton: { borderRadius: 999, minWidth: 160 },
|
||||
iconAction: {
|
||||
width: 44,
|
||||
height: 44,
|
||||
borderRadius: 22,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
section: { padding: spacing.lg, gap: spacing.md },
|
||||
sectionTitle: { fontSize: 20, fontWeight: "700" },
|
||||
})
|
||||
@@ -5,7 +5,10 @@ import { Ionicons } from "@expo/vector-icons"
|
||||
|
||||
import { CoverImage } from "@/components/cover-image"
|
||||
|
||||
import { MediaActionMenu } from "@/components/media-actions-sheet"
|
||||
import {
|
||||
MediaActionMenu,
|
||||
type MediaAction,
|
||||
} from "@/components/media-actions-sheet"
|
||||
import { Button, LoadingView } from "@/components/ui/primitives"
|
||||
import { contentBottomInset, SongRow } from "@/components/player"
|
||||
import { useFavorites } from "@/contexts/favorites"
|
||||
@@ -98,6 +101,15 @@ export default function PlaylistScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlaylistMenuAction(action: MediaAction) {
|
||||
if (action === "delete-playlist") {
|
||||
void handleDelete()
|
||||
return
|
||||
}
|
||||
|
||||
void handlePlaylistDetailAction(songIds, action)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
@@ -112,9 +124,20 @@ export default function PlaylistScreen() {
|
||||
type: "playlist",
|
||||
playlistId: playlist.id ?? "favorites",
|
||||
}}
|
||||
onAction={(action) =>
|
||||
void handlePlaylistDetailAction(songIds, action)
|
||||
includeActions={
|
||||
playlist.isOwner && playlist.id
|
||||
? [
|
||||
"share",
|
||||
"playlist",
|
||||
"play-next",
|
||||
"play-last",
|
||||
"shuffle",
|
||||
"favorite",
|
||||
"delete-playlist",
|
||||
]
|
||||
: undefined
|
||||
}
|
||||
onAction={handlePlaylistMenuAction}
|
||||
>
|
||||
<Pressable hitSlop={8}>
|
||||
<Ionicons name="ellipsis-horizontal" size={22} color={colors.foreground} />
|
||||
@@ -137,23 +160,49 @@ export default function PlaylistScreen() {
|
||||
<Text style={[styles.title, { color: colors.foreground }]}>{playlist.title}</Text>
|
||||
<Text style={{ color: colors.mutedForeground }}>{playlist.owner.name}</Text>
|
||||
<View style={styles.actions}>
|
||||
<Button title="Play" onPress={() => playlist.id && void playPlaylist(playlist.id)} />
|
||||
{!playlist.isOwner && playlist.id ? (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={playlist.isSubscribed ? "Subscribed" : "Subscribe"}
|
||||
accessibilityState={{ selected: playlist.isSubscribed }}
|
||||
hitSlop={8}
|
||||
onPress={() => void handleSubscribeToggle()}
|
||||
style={[
|
||||
styles.iconAction,
|
||||
{
|
||||
backgroundColor: playlist.isSubscribed
|
||||
? colors.muted
|
||||
: colors.primary,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Ionicons
|
||||
name={playlist.isSubscribed ? "checkmark" : "add"}
|
||||
size={24}
|
||||
color={
|
||||
playlist.isSubscribed
|
||||
? colors.foreground
|
||||
: colors.primaryForeground
|
||||
}
|
||||
/>
|
||||
</Pressable>
|
||||
) : null}
|
||||
<Button
|
||||
title="Shuffle"
|
||||
variant="secondary"
|
||||
title="Play"
|
||||
icon="play"
|
||||
onPress={() => playlist.id && void playPlaylist(playlist.id)}
|
||||
style={styles.playButton}
|
||||
/>
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel="Shuffle"
|
||||
hitSlop={8}
|
||||
onPress={() => playlist.id && void playPlaylistShuffled(playlist.id)}
|
||||
/>
|
||||
style={[styles.iconAction, { backgroundColor: colors.muted }]}
|
||||
>
|
||||
<Ionicons name="shuffle" size={24} color={colors.foreground} />
|
||||
</Pressable>
|
||||
</View>
|
||||
{!playlist.isOwner && playlist.id ? (
|
||||
<Button
|
||||
title={playlist.isSubscribed ? "Unsubscribe" : "Subscribe"}
|
||||
variant="ghost"
|
||||
onPress={() => void handleSubscribeToggle()}
|
||||
/>
|
||||
) : null}
|
||||
{playlist.isOwner && playlist.id ? (
|
||||
<Button title="Delete Playlist" variant="destructive" onPress={() => void handleDelete()} />
|
||||
) : null}
|
||||
</View>
|
||||
|
||||
{playlist.songs.map((song: BrowseSong) => (
|
||||
@@ -204,5 +253,19 @@ const styles = StyleSheet.create({
|
||||
borderRadius: radius.lg,
|
||||
},
|
||||
title: { fontSize: 24, fontWeight: "800", textAlign: "center" },
|
||||
actions: { flexDirection: "row", gap: spacing.sm, marginTop: spacing.sm },
|
||||
actions: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: spacing.sm,
|
||||
marginTop: spacing.sm,
|
||||
},
|
||||
playButton: { borderRadius: 999, minWidth: 160 },
|
||||
iconAction: {
|
||||
width: 44,
|
||||
height: 44,
|
||||
borderRadius: 22,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
})
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useQuery } from "convex/react"
|
||||
import { ScrollView, StyleSheet, Text, View } from "react-native"
|
||||
import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native"
|
||||
|
||||
import { Button, LoadingView } from "@/components/ui/primitives"
|
||||
import { contentBottomInset, SongRow } from "@/components/player"
|
||||
@@ -90,12 +90,21 @@ export default function FavoritesScreen() {
|
||||
{favorites.title}
|
||||
</Text>
|
||||
<View style={styles.actions}>
|
||||
<Button title="Play" onPress={() => void playInOrder(songIds)} />
|
||||
<Button
|
||||
title="Shuffle"
|
||||
variant="secondary"
|
||||
onPress={() => void playShuffled(songIds)}
|
||||
title="Play"
|
||||
icon="play"
|
||||
onPress={() => void playInOrder(songIds)}
|
||||
style={styles.playButton}
|
||||
/>
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel="Shuffle"
|
||||
hitSlop={8}
|
||||
onPress={() => void playShuffled(songIds)}
|
||||
style={[styles.iconAction, { backgroundColor: colors.muted }]}
|
||||
>
|
||||
<Ionicons name="shuffle" size={24} color={colors.foreground} />
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -134,5 +143,19 @@ const styles = StyleSheet.create({
|
||||
borderRadius: radius.lg,
|
||||
},
|
||||
title: { fontSize: 24, fontWeight: "800" },
|
||||
actions: { flexDirection: "row", gap: spacing.sm, marginTop: spacing.sm },
|
||||
actions: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: spacing.sm,
|
||||
marginTop: spacing.sm,
|
||||
},
|
||||
playButton: { borderRadius: 999, minWidth: 160 },
|
||||
iconAction: {
|
||||
width: 44,
|
||||
height: 44,
|
||||
borderRadius: 22,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
})
|
||||
@@ -16,6 +16,7 @@ export type MediaAction =
|
||||
| "favorite"
|
||||
| "go-artist"
|
||||
| "go-album"
|
||||
| "delete-playlist"
|
||||
|
||||
export type MediaNavigation = {
|
||||
artist?: { id: string }
|
||||
@@ -86,6 +87,11 @@ const MEDIA_ACTION_ITEMS: {
|
||||
`${favorited ? "Unfavorite" : "Favorite"}${countSuffix}`,
|
||||
image: "star",
|
||||
},
|
||||
{
|
||||
action: "delete-playlist",
|
||||
label: () => "Delete Playlist",
|
||||
image: "trash",
|
||||
},
|
||||
]
|
||||
|
||||
function isActionIncluded(
|
||||
@@ -96,6 +102,10 @@ function isActionIncluded(
|
||||
return config.includeActions.includes(action)
|
||||
}
|
||||
|
||||
if (action === "delete-playlist") {
|
||||
return false
|
||||
}
|
||||
|
||||
if (action === "share") {
|
||||
return shouldShowShare(config.share, config.selectedCount ?? 1)
|
||||
}
|
||||
|
||||
@@ -2,12 +2,15 @@ import {
|
||||
ActivityIndicator,
|
||||
Pressable,
|
||||
PressableProps,
|
||||
StyleProp,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TextInput,
|
||||
TextInputProps,
|
||||
View,
|
||||
ViewStyle,
|
||||
} from "react-native"
|
||||
import { Ionicons } from "@expo/vector-icons"
|
||||
|
||||
import { radius, spacing, useThemeColors } from "@/lib/theme"
|
||||
|
||||
@@ -15,7 +18,8 @@ type ButtonProps = Omit<PressableProps, "style"> & {
|
||||
title: string
|
||||
variant?: "primary" | "secondary" | "ghost" | "destructive"
|
||||
loading?: boolean
|
||||
style?: PressableProps["style"]
|
||||
icon?: React.ComponentProps<typeof Ionicons>["name"]
|
||||
style?: StyleProp<ViewStyle>
|
||||
}
|
||||
|
||||
export function Button({
|
||||
@@ -23,6 +27,8 @@ export function Button({
|
||||
variant = "primary",
|
||||
loading = false,
|
||||
disabled,
|
||||
icon,
|
||||
style,
|
||||
...props
|
||||
}: ButtonProps) {
|
||||
const colors = useThemeColors()
|
||||
@@ -48,21 +54,22 @@ export function Button({
|
||||
<Pressable
|
||||
{...props}
|
||||
disabled={isDisabled}
|
||||
style={({ pressed }) => ({
|
||||
minHeight: 44,
|
||||
borderRadius: radius.md,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
paddingHorizontal: spacing.lg,
|
||||
paddingVertical: spacing.sm,
|
||||
backgroundColor,
|
||||
opacity: isDisabled ? 0.5 : pressed ? 0.85 : 1,
|
||||
})}
|
||||
style={({ pressed }) => [
|
||||
styles.button,
|
||||
{
|
||||
backgroundColor,
|
||||
opacity: isDisabled ? 0.5 : pressed ? 0.85 : 1,
|
||||
},
|
||||
style,
|
||||
]}
|
||||
>
|
||||
{loading ? (
|
||||
<ActivityIndicator color={textColor} />
|
||||
) : (
|
||||
<Text style={[styles.buttonText, { color: textColor }]}>{title}</Text>
|
||||
<View style={styles.buttonContent}>
|
||||
{icon ? <Ionicons name={icon} size={18} color={textColor} /> : null}
|
||||
<Text style={[styles.buttonText, { color: textColor }]}>{title}</Text>
|
||||
</View>
|
||||
)}
|
||||
</Pressable>
|
||||
)
|
||||
@@ -114,6 +121,12 @@ const styles = StyleSheet.create({
|
||||
paddingHorizontal: spacing.lg,
|
||||
paddingVertical: spacing.sm,
|
||||
},
|
||||
buttonContent: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: spacing.xs,
|
||||
},
|
||||
buttonText: {
|
||||
fontSize: 16,
|
||||
fontWeight: "600",
|
||||
|
||||
Reference in new issue
Block a user