Skip to content

Commit 52cd2fb

Browse files
committed
Merge branch 'fix/favorites' into chore/all-my-stuffs
# Conflicts: # src/tools/tools.store.ts
2 parents 802f2c4 + 44d7fa5 commit 52cd2fb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/tools.store.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,19 @@ export const useToolStore = defineStore('tools', () => {
2424
const toolsByCategory = computed<ToolCategory[]>(() => {
2525
return _.chain(tools.value)
2626
.groupBy('category')
27+
.map((components, name, path) => ({
2728
.map((components, name, path) => ({
2829
name,
2930
path,
31+
path,
3032
components,
3133
}))
3234
.value();
3335
});
3436

3537
const favoriteTools = computed(() => {
3638
return favoriteToolsName.value
39+
.map(favoriteName => tools.value.find(({ name, path }) => name === favoriteName || path === favoriteName))
3740
.map(favoriteName => tools.value.find(({ name, path }) => name === favoriteName || path === favoriteName))
3841
.filter(Boolean) as ToolWithCategory[]; // cast because .filter(Boolean) does not remove undefined from type
3942
});
@@ -53,6 +56,7 @@ export const useToolStore = defineStore('tools', () => {
5356

5457
removeToolFromFavorites({ tool }: { tool: MaybeRef<Tool> }) {
5558
favoriteToolsName.value = favoriteToolsName.value.filter(name => get(tool).name !== name && get(tool).path !== name);
59+
favoriteToolsName.value = favoriteToolsName.value.filter(name => get(tool).name !== name && get(tool).path !== name);
5660
},
5761

5862
isToolFavorite({ tool }: { tool: MaybeRef<Tool> }) {

0 commit comments

Comments
 (0)