feat(tools): added favorite tool handling

This commit is contained in:
Corentin Thomasset 2022-12-17 01:30:02 +01:00
parent 8d09086e78
commit 4cd809bd0c
No known key found for this signature in database
GPG key ID: DBD997E935996158
10 changed files with 181 additions and 51 deletions

View file

@ -1,27 +1,10 @@
import { config } from '@/config';
import type { Component } from 'vue';
export interface ITool {
name: string;
path: string;
description: string;
keywords: string[];
component: () => Promise<Component>;
icon: Component;
redirectFrom?: string[];
isNew: boolean;
}
export interface ToolCategory {
name: string;
icon: Component;
components: ITool[];
}
import type { Tool } from './tools.types';
type WithOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
export function defineTool(
tool: WithOptional<ITool, 'isNew'>,
tool: WithOptional<Tool, 'isNew'>,
{ newTools }: { newTools: string[] } = { newTools: config.tools.newTools },
) {
const isNew = newTools.includes(tool.name);