Files
Psychotoxical-psysonic/src/components/contextMenu/ContextMenuItems.tsx
T
Frank Stellmacher ef5eda263d refactor(context-menu): H.1–H.12 — extract submenus + 5 type-branch components + hooks (Phase H start) (#662)
* refactor(context-menu): H.1 — extract helpers + constants

* refactor(context-menu): H.2 — extract AddToPlaylistSubmenu component

* refactor(context-menu): H.3 — extract AlbumToPlaylistSubmenu + ArtistToPlaylistSubmenu

* refactor(context-menu): H.4 — extract MultiAlbumToPlaylistSubmenu

* refactor(context-menu): H.5 — extract MultiArtistToPlaylistSubmenu

* refactor(context-menu): H.6 — extract SinglePlaylist + MultiPlaylist submenus

* refactor(context-menu): H.7 — extract startRadio/startInstantMix/downloadAlbum/copyShareLink actions

* refactor(context-menu): H.8 — extract useContextMenuKeyboardNav hook

* refactor(context-menu): H.9 — extract useContextMenuRating hook

* refactor(context-menu): H.10 — extract ContextMenuItems (all 9 type branches)

* refactor(context-menu): H.11 — split ContextMenuItems into 5 type-branch files

ContextMenuItems.tsx (800 LOC) was just a moved 400-LOC-cap violation.
Now ContextMenuItems is a 30-LOC switch that dispatches to:
  - SongContextItems       (song + album-song + favorite-song)
  - QueueItemContextItems  (queue-item)
  - AlbumContextItems      (album + multi-album)
  - ArtistContextItems     (artist + multi-artist)
  - PlaylistContextItems   (playlist + multi-playlist)

All five branch files are now under 330 LOC; ContextMenu.tsx itself stays
at 194 LOC. Shared Props interface lives in contextMenuItemTypes.ts.

* refactor(context-menu): H.12 — strip unused imports from branch components
2026-05-13 21:06:49 +02:00

31 lines
996 B
TypeScript

import React from 'react';
import type { ContextMenuItemsProps } from './contextMenuItemTypes';
import SongContextItems from './SongContextItems';
import QueueItemContextItems from './QueueItemContextItems';
import AlbumContextItems from './AlbumContextItems';
import ArtistContextItems from './ArtistContextItems';
import PlaylistContextItems from './PlaylistContextItems';
export default function ContextMenuItems(props: ContextMenuItemsProps) {
const { type } = props;
switch (type) {
case 'song':
case 'album-song':
case 'favorite-song':
return <SongContextItems {...props} />;
case 'queue-item':
return <QueueItemContextItems {...props} />;
case 'album':
case 'multi-album':
return <AlbumContextItems {...props} />;
case 'artist':
case 'multi-artist':
return <ArtistContextItems {...props} />;
case 'playlist':
case 'multi-playlist':
return <PlaylistContextItems {...props} />;
default:
return null;
}
}