2023-01-25 22:22:05 +00:00
|
|
|
@using SpotifyAPI.Web;
|
|
|
|
|
|
|
|
@if (Count is not null) {
|
|
|
|
|
|
|
|
<div class="card info-card">
|
|
|
|
@if (Count.Track is not null) {
|
|
|
|
<h5>
|
|
|
|
<a href="@trackLink" class="subtle-link" style="color: #7a99c2">
|
|
|
|
Track: @Count.Track
|
|
|
|
@if (trackPercent >= 0.01)
|
|
|
|
{
|
2023-01-26 22:06:52 +00:00
|
|
|
<small> (@(trackPercentDisplay)%)</small>
|
2023-01-25 22:22:05 +00:00
|
|
|
}
|
|
|
|
</a>
|
|
|
|
</h5>
|
|
|
|
}
|
|
|
|
@if (Count.Album is not null)
|
|
|
|
{
|
|
|
|
<h5>
|
|
|
|
<a href="@albumLink" class="subtle-link" style="color: #a34c77">
|
|
|
|
Album: @Count.Album
|
|
|
|
@if (albumPercent >= 0.01)
|
|
|
|
{
|
2023-01-26 22:06:52 +00:00
|
|
|
<small> (@(albumPercentDisplay)%)</small>
|
2023-01-25 22:22:05 +00:00
|
|
|
}
|
|
|
|
</a>
|
|
|
|
</h5>
|
|
|
|
}
|
|
|
|
@if (Count.Artist is not null)
|
|
|
|
{
|
|
|
|
<h5>
|
|
|
|
<a href="@artistLink" class="subtle-link" style="color: #598556">
|
|
|
|
Artist: @Count.Artist
|
|
|
|
@if (artistPercent >= 0.1)
|
|
|
|
{
|
2023-01-26 22:06:52 +00:00
|
|
|
<small> (@(artistPercentDisplay)%)</small>
|
2023-01-25 22:22:05 +00:00
|
|
|
}
|
|
|
|
</a>
|
|
|
|
</h5>
|
|
|
|
}
|
|
|
|
@if (Count.User is not null)
|
|
|
|
{
|
|
|
|
<h5>
|
|
|
|
<a href="@userLink" class="subtle-link">
|
|
|
|
User: @Count.User
|
|
|
|
</a>
|
|
|
|
</h5>
|
|
|
|
}
|
|
|
|
<LastfmLogo Link="@userLink" />
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
|
|
public FullTrack Track { get; set; }
|
|
|
|
[Parameter]
|
|
|
|
public PlayCount Count { get; set; }
|
|
|
|
[Parameter]
|
|
|
|
public string Username { get; set; }
|
|
|
|
|
2023-01-26 21:54:09 +00:00
|
|
|
private string trackLink => $"https://www.last.fm/user/{Username}/library/music/{Track.Artists.First().Name}/_/{Track.Name}";
|
|
|
|
private string albumLink => $"https://www.last.fm/user/{Username}/library/music/{Track.Album.Artists.First().Name}/{Track.Album.Name}";
|
2023-01-25 22:22:05 +00:00
|
|
|
private string artistLink => $"https://www.last.fm/user/{Username}/library/music/{Track.Artists.First().Name}";
|
|
|
|
private string userLink => $"https://www.last.fm/user/{Username}";
|
|
|
|
|
2023-01-26 22:06:52 +00:00
|
|
|
private float trackPercent => Count.Track.HasValue && Count.User.HasValue ? (float) Count.Track.Value * 100 / Count.User.Value : 0f;
|
|
|
|
private float albumPercent => Count.Album.HasValue && Count.User.HasValue ? (float) Count.Album.Value * 100 / Count.User.Value : 0f;
|
|
|
|
private float artistPercent => Count.Artist.HasValue && Count.User.HasValue ? (float) Count.Artist.Value * 100 / Count.User.Value : 0f ;
|
2023-01-25 22:22:05 +00:00
|
|
|
|
|
|
|
private string trackPercentDisplay => string.Format("{0:#,##0.##}", trackPercent);
|
|
|
|
private string albumPercentDisplay => string.Format("{0:#,##0.##}", albumPercent);
|
|
|
|
private string artistPercentDisplay => string.Format("{0:#,##0.##}", artistPercent);
|
|
|
|
}
|
|
|
|
|