mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 08:16:16 -04:00
feat(tools): new badge for recently created tools
This commit is contained in:
parent
ac89490794
commit
11720e6cde
33 changed files with 320 additions and 100 deletions
|
@ -1,3 +1,4 @@
|
|||
import { config } from '@/config';
|
||||
import type { Component } from 'vue';
|
||||
|
||||
export interface ITool {
|
||||
|
@ -8,6 +9,7 @@ export interface ITool {
|
|||
component: () => Promise<Component>;
|
||||
icon: Component;
|
||||
redirectFrom?: string[];
|
||||
isNew: boolean;
|
||||
}
|
||||
|
||||
export interface ToolCategory {
|
||||
|
@ -15,3 +17,17 @@ export interface ToolCategory {
|
|||
icon: Component;
|
||||
components: ITool[];
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue