8000 Inline TrackArtistLinks in Album page by defvs · Pull Request #633 · epoupon/lms · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Inline TrackArtistLinks in Album page #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000 Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions approot/release.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
</div>
</div>
</div>
${<if-has-artist-links>}
${artist-links}
${</if-has-artist-links>}
</message>

<message id="Lms.Explore.Release.template.release-info">
Expand Down
40 changes: 40 additions & 0 deletions src/lms/ui/explore/ReleaseView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,46 @@ namespace lms::ui
entry->bindWidget("artists-md", utils::createArtistDisplayNameWithAnchors(track->getArtistDisplayName(), artists));
}

{ // Generate all artist link widgets
// TODO: add config to chose whether to only show Remixer or show All.
std::vector<std::pair<Wt::WString, std::unique_ptr<Wt::WContainerWidget>>> artistLinksList;
auto createTrackArtistLink = [&](TrackArtistLinkType linkType, const std::string& trkey) {
const auto artists{ track->getArtistIds({ linkType }) };
const auto text = Wt::WString::trn(trkey, artists.size()).arg(artists.size());
auto anchors{ utils::createArtistAnchorList(std::vector(std::cbegin(artists), std::cend(artists))) };
if (!artists.empty())
{
auto myPair = std::make_pair(text, std::move(anchors));
artistLinksList.push_back(std::move(myPair));
}
};
createTrackArtistLink(TrackArtistLinkType::Remixer, "Lms.Explore.Artists.linktype-remixer");
createTrackArtistLink(TrackArtistLinkType::Producer, "Lms.Explore.Artists.linktype-producer");
createTrackArtistLink(TrackArtistLinkType::Performer, "Lms.Explore.Artists.linktype-performer");
createTrackArtistLink(TrackArtistLinkType::Composer, "Lms.Explore.Artists.linktype-composer");
createTrackArtistLink(TrackArtistLinkType::Conductor, "Lms.Explore.Artists.linktype-conductor");
createTrackArtistLink(TrackArtistLinkType::Lyricist, "Lms.Explore.Artists.linktype-lyricist");
createTrackArtistLink(TrackArtistLinkType::Mixer, "Lms.Explore.Artists.linktype-mixer");

if (!artistLinksList.empty())
{
entry->setCondition("if-has-artist-links", true);
Wt::WContainerWidget* artistLinksContainer = entry->bindNew<Wt::WContainerWidget>("artist-links");

for (auto& [role, artistWidget] : artistLinksList)
{
auto* currContainer = artistLinksContainer->addNew<Wt::WContainerWidget>();
currContainer->setStyleClass("overflow-hidden ms-5 pb-2 px-2 text-small d-flex");

auto* roleText = currContainer->addNew<Wt::WText>(role + Wt::WString::fromUTF8("&nbsp;—&nbsp;"));
roleText->setStyleClass("d-inline");

auto* newArtistWidget = currContainer->addWidget(std::move(artistWidget));
newArtistWidget->setInline(true);
}
}
}

auto trackNumber{ track->getTrackNumber() };
if (trackNumber)
{
Expand Down
Loading
0