mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
fix(search): right-click context menu on artist + album rows (#302)
Mirrors what PR #298 did for songs in the live-search dropdown: both artist and album rows now respond to right-click with the matching context menu (type 'artist' / 'album'), and pick up the .context-active highlight while their menu is open. Click-to-navigate behaviour is unchanged. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
807e7b4520
commit
3c0a42e298
@@ -157,9 +157,14 @@ export default function LiveSearch() {
|
|||||||
<div className="search-section-label"><Users size={12} /> {t('search.artists')}</div>
|
<div className="search-section-label"><Users size={12} /> {t('search.artists')}</div>
|
||||||
{results.artists.map(a => {
|
{results.artists.map(a => {
|
||||||
const i = idx++;
|
const i = idx++;
|
||||||
|
const isCtxActive = ctxIsOpen && ctxType === 'artist' && ctxItemId === a.id;
|
||||||
return (
|
return (
|
||||||
<button key={a.id} className={`search-result-item${activeIndex === i ? ' active' : ''}`}
|
<button key={a.id} className={`search-result-item${activeIndex === i ? ' active' : ''}${isCtxActive ? ' context-active' : ''}`}
|
||||||
onClick={() => { navigate(`/artist/${a.id}`); setOpen(false); setQuery(''); }}
|
onClick={() => { navigate(`/artist/${a.id}`); setOpen(false); setQuery(''); }}
|
||||||
|
onContextMenu={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
openContextMenu(e.clientX, e.clientY, a, 'artist');
|
||||||
|
}}
|
||||||
role="option" aria-selected={activeIndex === i}>
|
role="option" aria-selected={activeIndex === i}>
|
||||||
<div className="search-result-icon"><Users size={14} /></div>
|
<div className="search-result-icon"><Users size={14} /></div>
|
||||||
<span>{a.name}</span>
|
<span>{a.name}</span>
|
||||||
@@ -174,9 +179,14 @@ export default function LiveSearch() {
|
|||||||
<div className="search-section-label"><Disc3 size={12} /> {t('search.albums')}</div>
|
<div className="search-section-label"><Disc3 size={12} /> {t('search.albums')}</div>
|
||||||
{results.albums.map(a => {
|
{results.albums.map(a => {
|
||||||
const i = idx++;
|
const i = idx++;
|
||||||
|
const isCtxActive = ctxIsOpen && ctxType === 'album' && ctxItemId === a.id;
|
||||||
return (
|
return (
|
||||||
<button key={a.id} className={`search-result-item${activeIndex === i ? ' active' : ''}`}
|
<button key={a.id} className={`search-result-item${activeIndex === i ? ' active' : ''}${isCtxActive ? ' context-active' : ''}`}
|
||||||
onClick={() => { navigate(`/album/${a.id}`); setOpen(false); setQuery(''); }}
|
onClick={() => { navigate(`/album/${a.id}`); setOpen(false); setQuery(''); }}
|
||||||
|
onContextMenu={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
openContextMenu(e.clientX, e.clientY, a, 'album');
|
||||||
|
}}
|
||||||
role="option" aria-selected={activeIndex === i}>
|
role="option" aria-selected={activeIndex === i}>
|
||||||
{a.coverArt ? (
|
{a.coverArt ? (
|
||||||
<CachedImage
|
<CachedImage
|
||||||
|
|||||||
Reference in New Issue
Block a user