mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-16 12:23:12 +00:00
chore: update seed data
This commit is contained in:
parent
cee6c7c401
commit
ce5c4b65d3
@ -32,7 +32,7 @@ VALUES
|
||||
'ai-infra',
|
||||
'https://star-history.com/blog/open-source-ai-infra-projects',
|
||||
'PUBLIC',
|
||||
'star-history AI',
|
||||
'star-history ai',
|
||||
'{"title":"Open Source AI Infra for Your Next Project","description":"Some open-source infra projects that can be directly used for your next project. 💡","image":"https://star-history.com/blog/assets/open-source-ai-infra-projects/banner.webp"}'
|
||||
);
|
||||
|
||||
@ -72,7 +72,7 @@ VALUES
|
||||
101,
|
||||
'sqlchat',
|
||||
'https://www.sqlchat.ai',
|
||||
'ai chatbot',
|
||||
'ai chatbot sql',
|
||||
'WORKSPACE'
|
||||
);
|
||||
|
||||
|
@ -9,6 +9,7 @@ const Navigator = () => {
|
||||
const { shortcutList } = useAppSelector((state) => state.shortcut);
|
||||
const tags = uniq(shortcutList.map((shortcut) => shortcut.tags).flat());
|
||||
const currentTab = viewStore.filter.tab || `tab:all`;
|
||||
const sortedTagMap = sortTags(tags);
|
||||
|
||||
return (
|
||||
<div className="w-full flex flex-row justify-start items-center gap-1 flex-wrap mb-4">
|
||||
@ -30,7 +31,7 @@ const Navigator = () => {
|
||||
<Icon.User className="w-4 h-auto mr-1" />
|
||||
<span className="font-normal">Mine</span>
|
||||
</Button>
|
||||
{tags.map((tag) => (
|
||||
{Array.from(sortedTagMap.keys()).map((tag) => (
|
||||
<Button
|
||||
key={tag}
|
||||
variant={currentTab === `tag:${tag}` ? "solid" : "plain"}
|
||||
@ -46,4 +47,14 @@ const Navigator = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const sortTags = (tags: string[]): Map<string, number> => {
|
||||
const map = new Map<string, number>();
|
||||
for (const tag of tags) {
|
||||
const count = map.get(tag) || 0;
|
||||
map.set(tag, count + 1);
|
||||
}
|
||||
const sortedMap = new Map([...map.entries()].sort((a, b) => b[1] - a[1]));
|
||||
return sortedMap;
|
||||
};
|
||||
|
||||
export default Navigator;
|
||||
|
Loading…
x
Reference in New Issue
Block a user