UX: Change consolidated pageview experimental report colors (#27240)

Followup 94fe31e5b3,
change the color of the "Known Crawler" bar on the
new "Consolidated Pageviews with Browser Detection (Experimental)"
report to be purple, like it was on the original
"Consolidated Pageviews" report to allow for easier
visual comparison.

Also removes the report colors to named keys in a hash
for easier reference than having to look up the
index of the array all the time.
This commit is contained in:
Martin Brennan 2024-05-29 17:01:30 +10:00 committed by GitHub
parent 684492f2c5
commit 4580844c56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 9 deletions

View File

@ -11,7 +11,7 @@ module Reports::ConsolidatedApiRequests
requests =
filters.map do |filter|
color = filter == "api" ? report.colors[0] : report.colors[1]
color = filter == "api" ? report.colors[:turquoise] : report.colors[:lime]
{
req: filter,

View File

@ -11,9 +11,9 @@ module Reports::ConsolidatedPageViews
requests =
filters.map do |filter|
color = report.colors[0]
color = report.colors[1] if filter == "page_view_anon"
color = report.colors[2] if filter == "page_view_crawler"
color = report.colors[:turquoise]
color = report.colors[:lime] if filter == "page_view_anon"
color = report.colors[:purple] if filter == "page_view_crawler"
{
req: filter,

View File

@ -44,7 +44,7 @@ module Reports::ConsolidatedPageViewsBrowserDetection
I18n.t(
"reports.consolidated_page_views_browser_detection.xaxis.page_view_logged_in_browser",
),
color: report.colors[0],
color: report.colors[:turquoise],
data: data.map { |row| { x: row.date, y: row.page_view_logged_in_browser } },
},
{
@ -53,20 +53,20 @@ module Reports::ConsolidatedPageViewsBrowserDetection
I18n.t(
"reports.consolidated_page_views_browser_detection.xaxis.page_view_anon_browser",
),
color: report.colors[1],
color: report.colors[:lime],
data: data.map { |row| { x: row.date, y: row.page_view_anon_browser } },
},
{
req: "page_view_crawler",
label:
I18n.t("reports.consolidated_page_views_browser_detection.xaxis.page_view_crawler"),
color: report.colors[3],
color: report.colors[:purple],
data: data.map { |row| { x: row.date, y: row.page_view_crawler } },
},
{
req: "page_view_other",
label: I18n.t("reports.consolidated_page_views_browser_detection.xaxis.page_view_other"),
color: report.colors[2],
color: report.colors[:magenta],
data: data.map { |row| { x: row.date, y: row.page_view_other } },
},
]

View File

@ -419,7 +419,13 @@ class Report
end
def colors
%w[#1EB8D1 #9BC53D #721D8D #E84A5F #8A6916]
{
turquoise: "#1EB8D1",
lime: "#9BC53D",
purple: "#721D8D",
magenta: "#E84A5F",
brown: "#8A6916",
}
end
private