import classNames from "classnames";
import { useTranslation } from "react-i18next";
import { useShortcutStore, useViewStore } from "@/stores";
import Icon from "./Icon";
const ShortcutsNavigator = () => {
const { t } = useTranslation();
const viewStore = useViewStore();
const shortcutList = useShortcutStore().getShortcutList();
const tags = shortcutList.map((shortcut) => shortcut.tags).flat();
const currentTab = viewStore.filter.tab || `tab:all`;
const sortedTagMap = sortTags(tags);
return (
{Array.from(sortedTagMap.keys()).map((tag) => (
))}
);
};
const sortTags = (tags: string[]): Map => {
const map = new Map();
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 ShortcutsNavigator;