chore: update seed data

This commit is contained in:
Steven 2023-07-27 22:25:36 +08:00
parent cee6c7c401
commit ce5c4b65d3
2 changed files with 14 additions and 3 deletions

View File

@ -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'
);

View File

@ -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;