Skip to content

Commit

Permalink
Fix: Frontend: Respect item text Quality based color based on the cur…
Browse files Browse the repository at this point in the history
…rent Theme settings.
  • Loading branch information
Xian55 committed Dec 26, 2024
1 parent df8e210 commit 1712b55
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 22 deletions.
24 changes: 3 additions & 21 deletions Frontend/Pages/ItemComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<a href="@($"{api.ItemId}{Item.Entry}")" target="_blank" data-wowhead="[email protected]" class="small" style="text-decoration:none">
<b>
<span style="@ItemColour();font-weight:normal">
<span style="font-weight:normal" class="@(colors[Item.Quality])">
@if (Count > 1)
{
@Count
Expand All @@ -21,7 +21,7 @@
}
@if (WasRecentlyUpdated())
{
<Badge Color="BadgeColor.Info" class="float-right">@ChangeDescription()</Badge>
<Badge Color="BadgeColor.Info" class="float-end">@ChangeDescription()</Badge>
}
</span>
</b>
Expand Down Expand Up @@ -57,8 +57,7 @@
private string iconName { get; set; } = string.Empty;
private string imgLink => string.Format(WApi.TinyIconUrl, iconName);

private static readonly string[] colors = { "#9d9d9d", "#fff", "#1eff00", "#0070dd", "#9345ff", "#ff8000", "#e5cc80", "#e5cc80" };
private static readonly BadgeColor[] itemBadge = { BadgeColor.Secondary, BadgeColor.Dark, BadgeColor.Success, BadgeColor.Primary, BadgeColor.Warning, BadgeColor.Warning, BadgeColor.Warning, BadgeColor.Warning };
private static readonly string[] colors = { "poor", "common", "uncommon", "rare", "epic", "legendary", "artifact", "heirloom" };

private static readonly Dictionary<int, string> icons = new()
{
Expand All @@ -79,23 +78,6 @@
icons.TryAdd(Item.Entry, iconName);
}

private string ItemColour()
{
switch (Item.Quality)
{
case 1:
return "";
default:
return $"color:{colors[Item.Quality]}";
}
}

private BadgeColor ItemBadge()
{
if (Item.Quality < 0 || Item.Quality > 7) { return itemBadge[1]; }
return itemBadge[Item.Quality];
}

private Currency GetItemPrice()
{
int value = Count * Item.SellPrice;
Expand Down
2 changes: 1 addition & 1 deletion Frontend/Pages/Swag.razor
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<CardBody style="padding-bottom: 0">
<table class="table table-sm table-striped table-no-border">
<thead class="thead-dark">
<thead>
<tr>
@for (int i = bagReader.Bags.Length - 1; i >= 0; i--)
{
Expand Down
32 changes: 32 additions & 0 deletions Frontend/wwwroot/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,35 @@ app {
width: 100%;
aspect-ratio: 1.5/1;
}

.poor {
color: #9d9d9d;
}

.common {
color: var(--bs-emphasis-color);
}

.uncommon {
color: #1eff00;
}

.rare {
color: #0070dd;
}

.epic {
color: #9345ff;
}

.legendary {
color: #ff8000;
}

.artifact {
color: #e5cc80;
}

.heirloom {
color: #e5cc80;
}

0 comments on commit 1712b55

Please sign in to comment.