Order newest tools by createdAt so the latest tool shows first

This commit is contained in:
lidong-sal 2026-06-16 10:52:46 +08:00
parent fb4f9bbb60
commit e52e33ac4f

View file

@ -42,7 +42,9 @@ export const useToolStore = defineStore('tools', () => {
tools,
favoriteTools,
toolsByCategory,
newTools: computed(() => tools.value.filter(({ isNew }) => isNew)),
newTools: computed(() => tools.value
.filter(({ isNew }) => isNew)
.sort((a, b) => (b.createdAt?.getTime() ?? 0) - (a.createdAt?.getTime() ?? 0))),
addToolToFavorites({ tool }: { tool: MaybeRef<Tool> }) {
const toolPath = get(tool).path;