aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-10-20 16:00:17 +0000
committerMohamed Bassem <me@mbassem.com>2024-10-20 16:00:17 +0000
commit4086c37b830c3c4141b37052e3c192a750470084 (patch)
tree7bab9bff1bdc7f7b4b48987b68a6b99b7b6fcfee /apps/web/components/dashboard
parente89a38680532c3ab72ef26dfe88bb64476b709ab (diff)
downloadkarakeep-4086c37b830c3c4141b37052e3c192a750470084.tar.zst
fix: Improve field names in the tag APIs
Diffstat (limited to 'apps/web/components/dashboard')
-rw-r--r--apps/web/components/dashboard/tags/AllTagsView.tsx16
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/web/components/dashboard/tags/AllTagsView.tsx b/apps/web/components/dashboard/tags/AllTagsView.tsx
index f6a42ef2..72f4dc11 100644
--- a/apps/web/components/dashboard/tags/AllTagsView.tsx
+++ b/apps/web/components/dashboard/tags/AllTagsView.tsx
@@ -59,10 +59,10 @@ function DeleteAllUnusedTags({ numUnusedTags }: { numUnusedTags: number }) {
const byUsageSorter = (a: ZGetTagResponse, b: ZGetTagResponse) => {
// Sort by name if the usage is the same to get a stable result
- if (b.count == a.count) {
+ if (b.numBookmarks == a.numBookmarks) {
return byNameSorter(a, b);
}
- return b.count - a.count;
+ return b.numBookmarks - a.numBookmarks;
};
const byNameSorter = (a: ZGetTagResponse, b: ZGetTagResponse) =>
a.name.localeCompare(b.name, undefined, { sensitivity: "base" });
@@ -102,9 +102,13 @@ export default function AllTagsView({
// Sort tags by usage desc
const allTags = data.tags.sort(sortByName ? byNameSorter : byUsageSorter);
- const humanTags = allTags.filter((t) => (t.countAttachedBy.human ?? 0) > 0);
- const aiTags = allTags.filter((t) => (t.countAttachedBy.ai ?? 0) > 0);
- const emptyTags = allTags.filter((t) => t.count === 0);
+ const humanTags = allTags.filter(
+ (t) => (t.numBookmarksByAttachedType.human ?? 0) > 0,
+ );
+ const aiTags = allTags.filter(
+ (t) => (t.numBookmarksByAttachedType.ai ?? 0) > 0,
+ );
+ const emptyTags = allTags.filter((t) => t.numBookmarks === 0);
const tagsToPill = (tags: typeof allTags) => {
let tagPill;
@@ -116,7 +120,7 @@ export default function AllTagsView({
key={t.id}
id={t.id}
name={t.name}
- count={t.count}
+ count={t.numBookmarks}
isDraggable={draggingEnabled}
onOpenDialog={handleOpenDialog}
/>