From b8183ec96179c5f7241a9aa31eb6882b4e56e833 Mon Sep 17 00:00:00 2001 From: overcuriousity Date: Mon, 14 Jul 2025 15:29:11 +0200 Subject: [PATCH] adjust tag cloud --- src/components/ToolFilters.astro | 136 ++++++++++++++++++++++++++----- 1 file changed, 114 insertions(+), 22 deletions(-) diff --git a/src/components/ToolFilters.astro b/src/components/ToolFilters.astro index 97a8fa6..85da000 100644 --- a/src/components/ToolFilters.astro +++ b/src/components/ToolFilters.astro @@ -11,8 +11,18 @@ const data = load(yamlContent) as any; const domains = data.domains; const phases = data.phases; -// Get unique tags from all tools -const allTags = [...new Set(data.tools.flatMap((tool: any) => tool.tags))].sort(); +// Get unique tags from all tools with frequency count +const tagFrequency = data.tools.reduce((acc: Record, tool: any) => { + tool.tags.forEach((tag: string) => { + acc[tag] = (acc[tag] || 0) + 1; + }); + return acc; +}, {}); + +// Sort tags by frequency (descending) +const sortedTags = Object.entries(tagFrequency) + .sort(([,a], [,b]) => (b as number) - (a as number)) + .map(([tag]) => tag); ---
@@ -56,24 +66,28 @@ const allTags = [...new Set(data.tools.flatMap((tool: any) => tool.tags))].sort(
- +
- -
- + +
+
-
- {allTags.map(tag => ( -
- - -
+ +
+ {sortedTags.map(tag => ( + ))}
-
+
@@ -84,7 +98,56 @@ const allTags = [...new Set(data.tools.flatMap((tool: any) => tool.tags))].sort( - \ No newline at end of file