mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-14 18:40:11 +01:00
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import pluralize from "pluralize";
|
|
import React, { useEffect, useState } from "react";
|
|
import System from "../../models/system";
|
|
import { numberWithCommas } from "../../utils/numbers";
|
|
|
|
export default function IndexCount() {
|
|
const [indexes, setIndexes] = useState(null);
|
|
useEffect(() => {
|
|
async function indexCount() {
|
|
setIndexes(await System.totalIndexes());
|
|
}
|
|
indexCount();
|
|
}, []);
|
|
|
|
if (indexes === null || indexes === 0) {
|
|
return (
|
|
<div className="flex w-full items-center justify-end gap-x-2">
|
|
<div className="flex items-center gap-x-1 px-2 rounded-full">
|
|
<p className="text-slate-400 leading-tight text-sm"></p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="flex w-full items-center justify-end gap-x-2">
|
|
<div className="flex items-center gap-x-1 px-2 rounded-full">
|
|
<p className="text-slate-400 leading-tight text-sm">
|
|
{numberWithCommas(indexes)} {pluralize("index", indexes)}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|