From 4a5ff50eed8120d0c9cb95b29ffac089a73c45f1 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Sat, 18 Jan 2025 20:44:52 +0200 Subject: [PATCH] CP dashboard UI updates --- cp/resources/views/admin/dashboard/index.twig | 52 ++++++++++++++----- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/cp/resources/views/admin/dashboard/index.twig b/cp/resources/views/admin/dashboard/index.twig index 2fcb3ec..14427b7 100644 --- a/cp/resources/views/admin/dashboard/index.twig +++ b/cp/resources/views/admin/dashboard/index.twig @@ -290,10 +290,10 @@ fill: { opacity: 1, }, - series: [{ - name: "Domain Registrations", - data: counts - }], + series: counts.some(count => count > 0) ? [{ + name: "Domain Registrations", + data: counts + }] : [], tooltip: { theme: 'dark' }, @@ -327,7 +327,16 @@ } }, }, - labels: dates, + noData: { + text: "No data available", + align: 'center', + verticalAlign: 'middle', + style: { + color: '#888', + fontSize: '14px', + fontFamily: 'inherit' + } + }, colors: [tabler.getColor("primary")], legend: { show: false, @@ -349,7 +358,7 @@ fill: { opacity: 1, }, - series: series, + series: series.some(val => val > 0) ? series : [], labels: labels, tooltip: { theme: 'dark' @@ -357,6 +366,16 @@ grid: { strokeDashArray: 4, }, + noData: { + text: "No data to display", + align: 'center', + verticalAlign: 'middle', + style: { + color: '#888', + fontSize: '14px', + fontFamily: 'inherit' + } + }, colors: [tabler.getColor("primary"), tabler.getColor("primary", 0.8), tabler.getColor("primary", 0.6), tabler.getColor("gray-300")], legend: { show: true, @@ -402,13 +421,10 @@ fill: { opacity: 1, }, - series: [{ - name: "Answered", - data: answeredData - },{ - name: "Pending", - data: unansweredData - }], + series: (answeredData.some(val => val > 0) || unansweredData.some(val => val > 0)) ? [ + { name: "Answered", data: answeredData }, + { name: "Pending", data: unansweredData } + ] : [], tooltip: { theme: 'dark' }, @@ -442,6 +458,16 @@ } }, }, + noData: { + text: "No support ticket data available", + align: 'center', + verticalAlign: 'middle', + style: { + color: '#888', + fontSize: '14px', + fontFamily: 'inherit' + } + }, colors: [tabler.getColor("primary"), tabler.getColor("red")], legend: { show: false,