From fa44b31f5138c3622179a7381decbbb678ab524f Mon Sep 17 00:00:00 2001
From: Gregoo <versatile.mailbox@gmail.com>
Date: Sun, 26 Jan 2025 10:29:33 +0100
Subject: [PATCH] Grey out legacy database tables in the admin

---
 bricktracker/sql_counter.py   | 3 +++
 templates/admin/database.html | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/bricktracker/sql_counter.py b/bricktracker/sql_counter.py
index d104269..7175494 100644
--- a/bricktracker/sql_counter.py
+++ b/bricktracker/sql_counter.py
@@ -22,6 +22,7 @@ class BrickCounter(object):
     table: str
     icon: str
     count: int
+    legacy: bool
 
     def __init__(
         self,
@@ -44,3 +45,5 @@ class BrickCounter(object):
                 self.name = name
 
             self.icon = icon
+
+        self.legacy = '(legacy)' in self.name
diff --git a/templates/admin/database.html b/templates/admin/database.html
index 36d2b0d..9704365 100644
--- a/templates/admin/database.html
+++ b/templates/admin/database.html
@@ -22,8 +22,8 @@
   <div class="d-flex justify-content-start">
     <ul class="list-group me-2">
       {% for counter in database_counters %}
-        <li class="list-group-item d-flex justify-content-between align-items-start">
-          <span><i class="ri-{{ counter.icon }}"></i> {{ counter.name }}</span> <span class="badge text-bg-primary rounded-pill ms-2">{{ counter.count }}</span>
+        <li class="list-group-item d-flex justify-content-between align-items-start {% if counter.legacy %}list-group-item-dark{% endif %}">
+          <span><i class="ri-{{ counter.icon }}"></i> {{ counter.name }}</span> <span class="badge {% if counter.legacy %}text-bg-light border{% else %}text-bg-primary{% endif %} rounded-pill ms-2">{{ counter.count }}</span>
         </li>
         {% if not (loop.index % 5) %}
           </ul>