diff --git a/src/pages/tools/number/generic-calc/data/ohmsLaw.ts b/src/pages/tools/number/generic-calc/data/ohmsLaw.ts index edb526b..3b75f47 100644 --- a/src/pages/tools/number/generic-calc/data/ohmsLaw.ts +++ b/src/pages/tools/number/generic-calc/data/ohmsLaw.ts @@ -1,8 +1,11 @@ import type { GenericCalcType } from './types'; const ohmsLawCalc: GenericCalcType = { - title: "Ohm's Law", - name: 'ohms-law', + icon: 'mdi:ohm', + keywords: [], + shortDescription: '', + name: "Ohm's Law", + path: 'ohms-law', description: 'Calculates voltage, current and resistance', formula: 'V = I * R', presets: [], diff --git a/src/pages/tools/number/generic-calc/data/sphereArea.ts b/src/pages/tools/number/generic-calc/data/sphereArea.ts index dd84991..a148c8c 100644 --- a/src/pages/tools/number/generic-calc/data/sphereArea.ts +++ b/src/pages/tools/number/generic-calc/data/sphereArea.ts @@ -1,8 +1,11 @@ import type { GenericCalcType } from './types'; const areaSphere: GenericCalcType = { - title: 'Area of a Sphere', - name: 'area-sphere', + icon: 'ph:sphere-duotone', + keywords: [], + shortDescription: '', + name: 'Area of a Sphere', + path: 'area-sphere', description: 'Area of a Sphere', formula: 'A = 4 * pi * r**2', presets: [], diff --git a/src/pages/tools/number/generic-calc/data/sphereVolume.ts b/src/pages/tools/number/generic-calc/data/sphereVolume.ts index 5ec4764..59c375f 100644 --- a/src/pages/tools/number/generic-calc/data/sphereVolume.ts +++ b/src/pages/tools/number/generic-calc/data/sphereVolume.ts @@ -1,8 +1,11 @@ import type { GenericCalcType } from './types'; const volumeSphere: GenericCalcType = { - title: 'Volume of a Sphere', - name: 'volume-sphere', + icon: 'gravity-ui:sphere', + keywords: [], + shortDescription: '', + name: 'Volume of a Sphere', + path: 'volume-sphere', description: 'Volume of a Sphere', formula: 'v = (4/3) * pi * r**3', presets: [], diff --git a/src/pages/tools/number/generic-calc/data/types.ts b/src/pages/tools/number/generic-calc/data/types.ts index 1ed2148..e4fc69d 100644 --- a/src/pages/tools/number/generic-calc/data/types.ts +++ b/src/pages/tools/number/generic-calc/data/types.ts @@ -1,4 +1,5 @@ import { DataTable } from '../../../../../datatables'; +import { ToolMeta } from '@tools/defineTool'; export interface AlternativeVarInfo { title: string; @@ -7,12 +8,8 @@ export interface AlternativeVarInfo { formula: string; } -export interface GenericCalcType { - title: string; - name: string; +export interface GenericCalcType extends Omit { formula: string; - description?: string; - extraOutputs?: { title: string; formula: string; diff --git a/src/pages/tools/number/generic-calc/data/voltageDropInWire.ts b/src/pages/tools/number/generic-calc/data/voltageDropInWire.ts index b8b0ebc..28f73d5 100644 --- a/src/pages/tools/number/generic-calc/data/voltageDropInWire.ts +++ b/src/pages/tools/number/generic-calc/data/voltageDropInWire.ts @@ -3,8 +3,11 @@ import material_electrical_properties from '../../../../../datatables/data/mater import wire_gauge from '../../../../../datatables/data/wire_gauge'; const voltageDropInWire: GenericCalcType = { - title: 'Round trip voltage drop in cable', - name: 'cable-voltage-drop', + icon: 'simple-icons:wire', + keywords: [], + shortDescription: '', + name: 'Round trip voltage drop in cable', + path: 'cable-voltage-drop', formula: 'x = (((p * L) / (A/10**6) ) *2) * I', description: 'Calculates round trip voltage and power loss in a 2 conductor cable', diff --git a/src/pages/tools/number/generic-calc/index.tsx b/src/pages/tools/number/generic-calc/index.tsx index d07b750..273f720 100644 --- a/src/pages/tools/number/generic-calc/index.tsx +++ b/src/pages/tools/number/generic-calc/index.tsx @@ -236,7 +236,7 @@ export default async function makeTool( inputComponent={null} initialValues={initialValues} toolInfo={{ - title: calcData.title, + title: calcData.name, description: (calcData.description || '') + ' Generated from formula: ' + diff --git a/src/pages/tools/number/generic-calc/meta.ts b/src/pages/tools/number/generic-calc/meta.ts index 3a23c13..f4e3582 100644 --- a/src/pages/tools/number/generic-calc/meta.ts +++ b/src/pages/tools/number/generic-calc/meta.ts @@ -17,13 +17,13 @@ allGenericCalcs.forEach((x) => { tools.push( defineTool('number', { - name: x.title, - path: 'generic-calc/' + x.name, - icon: 'lsicon:number-filled', + name: x.name, + path: 'generic-calc/' + x.path, + icon: x.icon || '', description: x.description || '', - shortDescription: '', - keywords: ['generic', 'calc'], - longDescription: '', + shortDescription: x.description || '', + keywords: ['calculator', 'math', ...x.keywords], + longDescription: x.longDescription || '', component: lazy(importComponent2) }) ); diff --git a/src/tools/defineTool.tsx b/src/tools/defineTool.tsx index 5263c6f..545c5b3 100644 --- a/src/tools/defineTool.tsx +++ b/src/tools/defineTool.tsx @@ -2,7 +2,7 @@ import ToolLayout from '../components/ToolLayout'; import React, { JSXElementConstructor, LazyExoticComponent } from 'react'; import { IconifyIcon } from '@iconify/react'; -interface ToolOptions { +export interface ToolMeta { path: string; component: LazyExoticComponent>; keywords: string[]; @@ -23,7 +23,6 @@ export type ToolCategory = | 'json' | 'time' | 'csv' - | 'time' | 'pdf'; export interface DefinedTool { @@ -44,7 +43,7 @@ export interface ToolComponentProps { export const defineTool = ( basePath: ToolCategory, - options: ToolOptions + options: ToolMeta ): DefinedTool => { const { icon,