From 0252aa8c46102d80db132b33cd32fafb05c0a22e Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sun, 15 Nov 2026 14:29:11 -0500 Subject: [PATCH] feat(mobile): open album and artist menu from player artist (#86) --- apps/mobile/app/(app)/player.tsx | 17 +++--- apps/mobile/components/media-context-menu.tsx | 4 +- apps/mobile/components/player-artist-menu.tsx | 56 +++++++++++++++++++ apps/web/components/media-context-menu.tsx | 13 ++--- 4 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 apps/mobile/components/player-artist-menu.tsx diff --git a/apps/mobile/app/(app)/player.tsx b/apps/mobile/app/(app)/player.tsx index ad6d740..74da7bc 100644 --- a/apps/mobile/app/(app)/player.tsx +++ b/apps/mobile/app/(app)/player.tsx @@ -44,6 +44,7 @@ import { NowPlayingQueue, QUEUE_HORIZONTAL_INSET, } from "@/components/now-playing-queue" +import { PlayerArtistMenu } from "@/components/player-artist-menu" import { PlayerSlider } from "@/components/player-slider" import { PlayerSymbol } from "@/components/player-symbol" import { useFavorites } from "@/contexts/favorites" @@ -544,13 +545,15 @@ function SongMeta({ { color: colors.foreground }, ]} /> - + + + void toggleSongFavorite(song.id)} diff --git a/apps/mobile/components/media-context-menu.tsx b/apps/mobile/components/media-context-menu.tsx index 202a05f..54c6dc2 100644 --- a/apps/mobile/components/media-context-menu.tsx +++ b/apps/mobile/components/media-context-menu.tsx @@ -89,12 +89,12 @@ const MEDIA_ACTION_ITEMS: { { action: "go-artist", label: () => "Go to Artist", - image: "person", + image: "music.mic", }, { action: "go-album", label: () => "Go to Album", - image: "opticaldisc", + image: "square.stack", }, { action: "favorite", diff --git a/apps/mobile/components/player-artist-menu.tsx b/apps/mobile/components/player-artist-menu.tsx new file mode 100644 index 0000000..f94fa85 --- /dev/null +++ b/apps/mobile/components/player-artist-menu.tsx @@ -0,0 +1,56 @@ +import { useState, type ReactNode } from "react" +import { StyleSheet, View } from "react-native" + +import { + MediaActionMenu, + type MediaAction, +} from "@/components/media-context-menu" +import type { BrowseSong } from "@otunes/convex/types" + +export function PlayerArtistMenu({ + song, + onAction, + children, +}: { + song: BrowseSong + onAction: (action: MediaAction) => void + children: ReactNode +}) { + const [size, setSize] = useState({ width: 0, height: 0 }) + + return ( + + setSize({ width: layout.width, height: layout.height }) + } + > + + {children} + + {size.width > 0 ? ( + + + + ) : null} + + ) +} + +const styles = StyleSheet.create({ + container: { overflow: "hidden" }, +}) diff --git a/apps/web/components/media-context-menu.tsx b/apps/web/components/media-context-menu.tsx index 9621781..d216401 100644 --- a/apps/web/components/media-context-menu.tsx +++ b/apps/web/components/media-context-menu.tsx @@ -3,15 +3,15 @@ import * as React from "react" import Link from "next/link" import { - Disc3, + GalleryVerticalEnd, ListEnd, ListPlus, ListStart, + MicVocal, MoreHorizontal, Share2, Shuffle, Star, - User, } from "lucide-react" import { Button } from "@/components/ui/button" @@ -22,10 +22,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" -import { - copyMediaShareLink, - type MediaShareContext, -} from "@/lib/media-links" +import { copyMediaShareLink, type MediaShareContext } from "@/lib/media-links" import { cn } from "@/lib/utils" export type MediaContextAction = @@ -141,7 +138,7 @@ export function MediaContextMenuItems({ Go to Artist - + ) : null} @@ -149,7 +146,7 @@ export function MediaContextMenuItems({ Go to Album - + ) : null}