2022-06-01 23:52:21 +02:00
|
|
|
import { config } from '@/config';
|
2022-03-31 00:33:29 +02:00
|
|
|
import type { Component } from 'vue';
|
|
|
|
|
|
|
|
export interface ITool {
|
|
|
|
name: string;
|
|
|
|
path: string;
|
|
|
|
description: string;
|
|
|
|
keywords: string[];
|
|
|
|
component: () => Promise<Component>;
|
2022-04-04 00:24:45 +02:00
|
|
|
icon: Component;
|
2022-04-16 10:10:21 +02:00
|
|
|
redirectFrom?: string[];
|
2022-06-01 23:52:21 +02:00
|
|
|
isNew: boolean;
|
2022-04-04 00:24:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ToolCategory {
|
|
|
|
name: string;
|
|
|
|
icon: Component;
|
|
|
|
components: ITool[];
|
2022-03-31 00:33:29 +02:00
|
|
|
}
|
2022-06-01 23:52:21 +02:00
|
|
|
|
|
|
|
type WithOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
|
|
|
|
|
|
export function defineTool(
|
|
|
|
tool: WithOptional<ITool, 'isNew'>,
|
|
|
|
{ newTools }: { newTools: string[] } = { newTools: config.tools.newTools },
|
|
|
|
) {
|
|
|
|
const isNew = newTools.includes(tool.name);
|
|
|
|
|
|
|
|
return {
|
|
|
|
isNew,
|
|
|
|
...tool,
|
|
|
|
};
|
|
|
|
}
|