mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 08:16:16 -04:00
feat(tools): added favorite tool handling
This commit is contained in:
parent
8d09086e78
commit
4cd809bd0c
10 changed files with 181 additions and 51 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue