From 2ab3920d5e0bf46f98e79cb192130432cf4c2fba Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sun, 15 Nov 2026 13:42:11 -0500 Subject: [PATCH] fix: simplify player menu and match navigation icons --- apps/mobile/app/(app)/player.tsx | 2 +- apps/mobile/components/media-context-menu.tsx | 4 +- .../player-artist-fallback-menu.ios.tsx | 56 ------------------- .../player-artist-fallback-menu.tsx | 35 ------------ apps/mobile/components/player-artist-menu.tsx | 45 ++++++--------- .../expo-module.config.json | 4 -- .../ios/PlayerNavigationMenu.podspec | 17 ------ .../ios/PlayerNavigationMenuModule.swift | 56 ------------------- apps/web/components/media-context-menu.tsx | 13 ++--- 9 files changed, 26 insertions(+), 206 deletions(-) delete mode 100644 apps/mobile/components/player-artist-fallback-menu.ios.tsx delete mode 100644 apps/mobile/components/player-artist-fallback-menu.tsx delete mode 100644 apps/mobile/modules/player-navigation-menu/expo-module.config.json delete mode 100644 apps/mobile/modules/player-navigation-menu/ios/PlayerNavigationMenu.podspec delete mode 100644 apps/mobile/modules/player-navigation-menu/ios/PlayerNavigationMenuModule.swift diff --git a/apps/mobile/app/(app)/player.tsx b/apps/mobile/app/(app)/player.tsx index a06b216..74da7bc 100644 --- a/apps/mobile/app/(app)/player.tsx +++ b/apps/mobile/app/(app)/player.tsx @@ -545,7 +545,7 @@ function SongMeta({ { color: colors.foreground }, ]} /> - + "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-fallback-menu.ios.tsx b/apps/mobile/components/player-artist-fallback-menu.ios.tsx deleted file mode 100644 index 12993be..0000000 --- a/apps/mobile/components/player-artist-fallback-menu.ios.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { - Button, - Host, - Label, - Menu, - RNHostView, - Text, - VStack, -} from "@expo/ui/swift-ui" -import { menuOrder } from "@expo/ui/swift-ui/modifiers" -import { StyleSheet, View } from "react-native" - -import type { PlayerArtistFallbackMenuProps } from "./player-artist-fallback-menu" - -// Use custom SwiftUI labels because the community menu adapter drops subtitles. -export function PlayerArtistFallbackMenu({ - song, - size, - onAction, -}: PlayerArtistFallbackMenuProps) { - return ( - - - - - } - > - - - - - ) -} diff --git a/apps/mobile/components/player-artist-fallback-menu.tsx b/apps/mobile/components/player-artist-fallback-menu.tsx deleted file mode 100644 index c70a844..0000000 --- a/apps/mobile/components/player-artist-fallback-menu.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { StyleSheet, View } from "react-native" - -import { - MediaActionMenu, - type MediaAction, -} from "@/components/media-context-menu" -import type { BrowseSong } from "@otunes/convex/types" - -export type PlayerArtistFallbackMenuProps = { - song: BrowseSong - size: { width: number; height: number } - onAction: (action: MediaAction) => void -} - -export function PlayerArtistFallbackMenu({ - song, - size, - onAction, -}: PlayerArtistFallbackMenuProps) { - return ( - - - - ) -} diff --git a/apps/mobile/components/player-artist-menu.tsx b/apps/mobile/components/player-artist-menu.tsx index 93518bf..f94fa85 100644 --- a/apps/mobile/components/player-artist-menu.tsx +++ b/apps/mobile/components/player-artist-menu.tsx @@ -1,31 +1,18 @@ -import { requireNativeView, requireOptionalNativeModule } from "expo" import { useState, type ReactNode } from "react" -import { Platform, StyleSheet, View, type ViewProps } from "react-native" +import { StyleSheet, View } from "react-native" -import type { MediaAction } from "@/components/media-context-menu" -import { PlayerArtistFallbackMenu } from "@/components/player-artist-fallback-menu" +import { + MediaActionMenu, + type MediaAction, +} from "@/components/media-context-menu" import type { BrowseSong } from "@otunes/convex/types" -const NativeMenu = - Platform.OS === "ios" && requireOptionalNativeModule("PlayerNavigationMenu") - ? requireNativeView< - ViewProps & { - artist: string - album: string - fontSize: number - onAction: (event: { nativeEvent: { action: MediaAction } }) => void - } - >("PlayerNavigationMenu") - : null - export function PlayerArtistMenu({ song, - compact, onAction, children, }: { song: BrowseSong - compact: boolean onAction: (action: MediaAction) => void children: ReactNode }) { @@ -45,16 +32,20 @@ export function PlayerArtistMenu({ > {children} - {NativeMenu ? ( - 0 ? ( + onAction(nativeEvent.action)} - /> - ) : size.width > 0 ? ( - + includeActions={["go-album", "go-artist"]} + onAction={onAction} + > + + ) : null} ) diff --git a/apps/mobile/modules/player-navigation-menu/expo-module.config.json b/apps/mobile/modules/player-navigation-menu/expo-module.config.json deleted file mode 100644 index c46913b..0000000 --- a/apps/mobile/modules/player-navigation-menu/expo-module.config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "platforms": ["apple"], - "apple": { "modules": ["PlayerNavigationMenuModule"] } -} diff --git a/apps/mobile/modules/player-navigation-menu/ios/PlayerNavigationMenu.podspec b/apps/mobile/modules/player-navigation-menu/ios/PlayerNavigationMenu.podspec deleted file mode 100644 index 7587309..0000000 --- a/apps/mobile/modules/player-navigation-menu/ios/PlayerNavigationMenu.podspec +++ /dev/null @@ -1,17 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'PlayerNavigationMenu' - s.version = '1.0.0' - s.summary = 'Native player navigation menu for oTunes' - s.description = s.summary - s.license = { :type => 'MIT' } - s.author = 'oTunes' - s.homepage = 'https://otunes.abunchofknowitalls.com' - s.platforms = { :ios => '16.4' } - s.swift_version = '5.9' - s.source = { :git => '' } - s.static_framework = true - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } - s.dependency 'ExpoModulesCore' - s.frameworks = 'UIKit' - s.source_files = '**/*.swift' -end diff --git a/apps/mobile/modules/player-navigation-menu/ios/PlayerNavigationMenuModule.swift b/apps/mobile/modules/player-navigation-menu/ios/PlayerNavigationMenuModule.swift deleted file mode 100644 index 58675d3..0000000 --- a/apps/mobile/modules/player-navigation-menu/ios/PlayerNavigationMenuModule.swift +++ /dev/null @@ -1,56 +0,0 @@ -import ExpoModulesCore -import UIKit - -public class PlayerNavigationMenuModule: Module { - public func definition() -> ModuleDefinition { - Name("PlayerNavigationMenu") - - View(PlayerNavigationMenuView.self) { - Events("onAction") - Prop("artist") { (view: PlayerNavigationMenuView, value: String) in - view.artist = value - } - Prop("album") { (view: PlayerNavigationMenuView, value: String) in - view.album = value - } - Prop("fontSize") { (view: PlayerNavigationMenuView, value: Double) in - view.fontSize = CGFloat(value) - } - } - } -} - -final class PlayerNavigationMenuView: ExpoView { - let onAction = EventDispatcher() - var artist = "" { didSet { updateMenu(); setNeedsLayout() } } - var album = "" { didSet { updateMenu() } } - var fontSize: CGFloat = 20 { didSet { setNeedsLayout() } } - private let button = UIButton(type: .custom) - - required init(appContext: AppContext? = nil) { - super.init(appContext: appContext) - button.showsMenuAsPrimaryAction = true - button.preferredMenuElementOrder = .fixed - button.accessibilityHint = "Opens album and artist options" - addSubview(button) - } - - private func updateMenu() { - button.accessibilityLabel = artist - button.menu = UIMenu(children: [ - UIAction(title: "Go to Album", subtitle: album, image: UIImage(systemName: "square.stack")) { [weak self] _ in - self?.onAction(["action": "go-album"]) - }, - UIAction(title: "Go to Artist", subtitle: artist, image: UIImage(systemName: "music.mic")) { [weak self] _ in - self?.onAction(["action": "go-artist"]) - }, - ]) - } - - override func layoutSubviews() { - super.layoutSubviews() - // Anchor to the visible artist text, not the marquee's offscreen track. - let textWidth = (artist as NSString).size(withAttributes: [.font: UIFont.systemFont(ofSize: fontSize)]).width - button.frame = CGRect(x: 0, y: 0, width: min(ceil(textWidth), bounds.width), height: bounds.height) - } -} 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}