Skip to content

feat(lyrics-presenter): add 'Show more' button for playlists#81

Open
XDMINT wants to merge 3 commits into
Vija02:mainfrom
XDMINT:feat/playlist-show-more
Open

feat(lyrics-presenter): add 'Show more' button for playlists#81
XDMINT wants to merge 3 commits into
Vija02:mainfrom
XDMINT:feat/playlist-show-more

Conversation

@XDMINT
Copy link
Copy Markdown

@XDMINT XDMINT commented Aug 16, 2025

Summary

Adds a compact playlist preview to the lyrics-presenter import modal:

  • Show only the first 6 items by default
  • Display “…and N more” with a Show more / Show less toggle
  • Keeps existing selection logic (click selects all IDs)
  • Uses shared Button component from @repo/ui (link variant)
  • Updated colors (secondary instead of muted-foreground) to match theme.css
  • Minor styling improvements (mt-1, pointer cursor for toggle button)
  • Refactored state names (expandedIdsexpandedPlaylistIds)
  • Wrapped toggle logic in useCallback
  • Applied Prettier formatting for consistency

Motivation

Improves readability and accessibility for long playlists.
Closes #76.


Implementation

  • UI change in ImportPlaylist.tsx
  • State-based expand/collapse; accessible button with aria-controls / aria-expanded
  • Button component from @repo/ui ensures consistent styling across the project
  • No breaking changes

Testing

  • Local dev with AUTO_LOGIN=1 and mock/real playlists
  • Verified:
    • ≤6 items → no toggle shown
    • 6 items → toggle works correctly

    • Playlist selection logic remains unchanged

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 16, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@XDMINT XDMINT force-pushed the feat/playlist-show-more branch from 2ebe85e to 397ed81 Compare August 16, 2025 14:50
@XDMINT
Copy link
Copy Markdown
Author

XDMINT commented Aug 16, 2025

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Aug 16, 2025
@Vija02
Copy link
Copy Markdown
Owner

Vija02 commented Aug 19, 2025

Hey @XDMINT, thanks for the PR. I'll have a look at this shortly

Copy link
Copy Markdown
Owner

@Vija02 Vija02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! A few things that needs to be changed but overall thanks for the PR. Let me know if you need any help

export const ImportPlaylist = ({
setSelectedPlaylistSongIds,
}: {
setSelectedPlaylistSongIds,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's a formatting error here. Can you run prettier here?

const { data: playlistData, isLoading } =
trpc.lyricsPresenter.playlist.useQuery();
const [selectedPlaylistId, setSelectedPlaylistId] = useState<number | null>(null);
const [expandedIds, setExpandedIds] = useState<Set<number>>(new Set());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename this into expandedPlaylistIds so that it's clear what id this is?

const [expandedIds, setExpandedIds] = useState<Set<number>>(new Set());
const { data: playlistData, isLoading } = trpc.lyricsPresenter.playlist.useQuery();

const toggleExpand = (id: number) => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we wrap this into a useCallback

{!isExpanded && hiddenCount > 0 && (
<p className="text-ellipsis overflow-hidden text-xs text-muted-foreground">
…and {hiddenCount} more{" "}
<button
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use our button component from @repo/ui. There's the unstyled/link variant that you can use


{isExpanded && allItems.length > MAX_VISIBLE && (
<div className="mt-1">
<button
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as above

</div>

{!isExpanded && hiddenCount > 0 && (
<p className="text-ellipsis overflow-hidden text-xs text-muted-foreground">
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This muted-foreground color does not exist. Use secondary instead. You can see colors in theme.css

<div className="mt-1">
<button
type="button"
className="text-xs underline text-muted-foreground hover:no-underline"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

))}
</div>

{!isExpanded && hiddenCount > 0 && (
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the styles here:

  • The margin doesn't match as with when it's open. Can we add mt-1 here too
  • Can we make the button have pointer as a cursor please

Comment thread package.json Outdated
@XDMINT XDMINT force-pushed the feat/playlist-show-more branch from a8f05ba to 063890c Compare August 21, 2025 17:00
@XDMINT XDMINT requested a review from Vija02 August 21, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lyrics Plugin] Limit playlist count

2 participants