Format numerical values in DataFetcher component for better readability

This commit is contained in:
Bram Suurd 2025-09-08 12:15:52 +02:00
parent db6369f3c6
commit 72c987d1f0
No known key found for this signature in database
GPG key ID: 678AEF108B1A133E

View file

@ -38,6 +38,7 @@ const DataFetcher: React.FC = () => {
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [itemsPerPage, setItemsPerPage] = useState(25); const [itemsPerPage, setItemsPerPage] = useState(25);
const [sortConfig, setSortConfig] = useState<{ key: string; direction: "ascending" | "descending" } | null>(null); const [sortConfig, setSortConfig] = useState<{ key: string; direction: "ascending" | "descending" } | null>(null);
const nf = new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 });
useEffect(() => { useEffect(() => {
const fetchSummary = async () => { const fetchSummary = async () => {
@ -129,19 +130,24 @@ const DataFetcher: React.FC = () => {
<p className="text-lg font-bold mt-4"> </p> <p className="text-lg font-bold mt-4"> </p>
<div className="mb-4 flex justify-between items-center"> <div className="mb-4 flex justify-between items-center">
<p className="text-lg font-bold"> <p className="text-lg font-bold">
{summary?.total_entries} {nf.format(
summary?.total_entries ?? 0,
)}
{" "} {" "}
results found results found
</p> </p>
<p className="text-lg font"> <p className="text-lg font">
Status Legend: 🔄 installing Status Legend: 🔄 installing
{summary?.status_count.installing ?? 0} {" "}
{nf.format(summary?.status_count.installing ?? 0)}
{" "} {" "}
| completed | completed
{summary?.status_count.done ?? 0} {" "}
{nf.format(summary?.status_count.done ?? 0)}
{" "} {" "}
| failed | failed
{summary?.status_count.failed ?? 0} {" "}
{nf.format(summary?.status_count.failed ?? 0)}
{" "} {" "}
| unknown | unknown
</p> </p>