mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-24 08:29:32 +02:00
chore: use full meta init
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
import type { GenericCalcType } from './types';
|
import type { GenericCalcType } from './types';
|
||||||
|
|
||||||
const ohmsLawCalc: GenericCalcType = {
|
const ohmsLawCalc: GenericCalcType = {
|
||||||
title: "Ohm's Law",
|
icon: 'mdi:ohm',
|
||||||
name: 'ohms-law',
|
keywords: [],
|
||||||
|
shortDescription: '',
|
||||||
|
name: "Ohm's Law",
|
||||||
|
path: 'ohms-law',
|
||||||
description: 'Calculates voltage, current and resistance',
|
description: 'Calculates voltage, current and resistance',
|
||||||
formula: 'V = I * R',
|
formula: 'V = I * R',
|
||||||
presets: [],
|
presets: [],
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
import type { GenericCalcType } from './types';
|
import type { GenericCalcType } from './types';
|
||||||
|
|
||||||
const areaSphere: GenericCalcType = {
|
const areaSphere: GenericCalcType = {
|
||||||
title: 'Area of a Sphere',
|
icon: 'ph:sphere-duotone',
|
||||||
name: 'area-sphere',
|
keywords: [],
|
||||||
|
shortDescription: '',
|
||||||
|
name: 'Area of a Sphere',
|
||||||
|
path: 'area-sphere',
|
||||||
description: 'Area of a Sphere',
|
description: 'Area of a Sphere',
|
||||||
formula: 'A = 4 * pi * r**2',
|
formula: 'A = 4 * pi * r**2',
|
||||||
presets: [],
|
presets: [],
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
import type { GenericCalcType } from './types';
|
import type { GenericCalcType } from './types';
|
||||||
|
|
||||||
const volumeSphere: GenericCalcType = {
|
const volumeSphere: GenericCalcType = {
|
||||||
title: 'Volume of a Sphere',
|
icon: 'gravity-ui:sphere',
|
||||||
name: 'volume-sphere',
|
keywords: [],
|
||||||
|
shortDescription: '',
|
||||||
|
name: 'Volume of a Sphere',
|
||||||
|
path: 'volume-sphere',
|
||||||
description: 'Volume of a Sphere',
|
description: 'Volume of a Sphere',
|
||||||
formula: 'v = (4/3) * pi * r**3',
|
formula: 'v = (4/3) * pi * r**3',
|
||||||
presets: [],
|
presets: [],
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { DataTable } from '../../../../../datatables';
|
import { DataTable } from '../../../../../datatables';
|
||||||
|
import { ToolMeta } from '@tools/defineTool';
|
||||||
|
|
||||||
export interface AlternativeVarInfo {
|
export interface AlternativeVarInfo {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -7,12 +8,8 @@ export interface AlternativeVarInfo {
|
|||||||
formula: string;
|
formula: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GenericCalcType {
|
export interface GenericCalcType extends Omit<ToolMeta, 'component'> {
|
||||||
title: string;
|
|
||||||
name: string;
|
|
||||||
formula: string;
|
formula: string;
|
||||||
description?: string;
|
|
||||||
|
|
||||||
extraOutputs?: {
|
extraOutputs?: {
|
||||||
title: string;
|
title: string;
|
||||||
formula: string;
|
formula: string;
|
||||||
|
@@ -3,8 +3,11 @@ import material_electrical_properties from '../../../../../datatables/data/mater
|
|||||||
import wire_gauge from '../../../../../datatables/data/wire_gauge';
|
import wire_gauge from '../../../../../datatables/data/wire_gauge';
|
||||||
|
|
||||||
const voltageDropInWire: GenericCalcType = {
|
const voltageDropInWire: GenericCalcType = {
|
||||||
title: 'Round trip voltage drop in cable',
|
icon: 'simple-icons:wire',
|
||||||
name: 'cable-voltage-drop',
|
keywords: [],
|
||||||
|
shortDescription: '',
|
||||||
|
name: 'Round trip voltage drop in cable',
|
||||||
|
path: 'cable-voltage-drop',
|
||||||
formula: 'x = (((p * L) / (A/10**6) ) *2) * I',
|
formula: 'x = (((p * L) / (A/10**6) ) *2) * I',
|
||||||
description:
|
description:
|
||||||
'Calculates round trip voltage and power loss in a 2 conductor cable',
|
'Calculates round trip voltage and power loss in a 2 conductor cable',
|
||||||
|
@@ -236,7 +236,7 @@ export default async function makeTool(
|
|||||||
inputComponent={null}
|
inputComponent={null}
|
||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
toolInfo={{
|
toolInfo={{
|
||||||
title: calcData.title,
|
title: calcData.name,
|
||||||
description:
|
description:
|
||||||
(calcData.description || '') +
|
(calcData.description || '') +
|
||||||
' Generated from formula: ' +
|
' Generated from formula: ' +
|
||||||
|
@@ -17,13 +17,13 @@ allGenericCalcs.forEach((x) => {
|
|||||||
|
|
||||||
tools.push(
|
tools.push(
|
||||||
defineTool('number', {
|
defineTool('number', {
|
||||||
name: x.title,
|
name: x.name,
|
||||||
path: 'generic-calc/' + x.name,
|
path: 'generic-calc/' + x.path,
|
||||||
icon: 'lsicon:number-filled',
|
icon: x.icon || '',
|
||||||
description: x.description || '',
|
description: x.description || '',
|
||||||
shortDescription: '',
|
shortDescription: x.description || '',
|
||||||
keywords: ['generic', 'calc'],
|
keywords: ['calculator', 'math', ...x.keywords],
|
||||||
longDescription: '',
|
longDescription: x.longDescription || '',
|
||||||
component: lazy(importComponent2)
|
component: lazy(importComponent2)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@@ -2,7 +2,7 @@ import ToolLayout from '../components/ToolLayout';
|
|||||||
import React, { JSXElementConstructor, LazyExoticComponent } from 'react';
|
import React, { JSXElementConstructor, LazyExoticComponent } from 'react';
|
||||||
import { IconifyIcon } from '@iconify/react';
|
import { IconifyIcon } from '@iconify/react';
|
||||||
|
|
||||||
interface ToolOptions {
|
export interface ToolMeta {
|
||||||
path: string;
|
path: string;
|
||||||
component: LazyExoticComponent<JSXElementConstructor<ToolComponentProps>>;
|
component: LazyExoticComponent<JSXElementConstructor<ToolComponentProps>>;
|
||||||
keywords: string[];
|
keywords: string[];
|
||||||
@@ -23,7 +23,6 @@ export type ToolCategory =
|
|||||||
| 'json'
|
| 'json'
|
||||||
| 'time'
|
| 'time'
|
||||||
| 'csv'
|
| 'csv'
|
||||||
| 'time'
|
|
||||||
| 'pdf';
|
| 'pdf';
|
||||||
|
|
||||||
export interface DefinedTool {
|
export interface DefinedTool {
|
||||||
@@ -44,7 +43,7 @@ export interface ToolComponentProps {
|
|||||||
|
|
||||||
export const defineTool = (
|
export const defineTool = (
|
||||||
basePath: ToolCategory,
|
basePath: ToolCategory,
|
||||||
options: ToolOptions
|
options: ToolMeta
|
||||||
): DefinedTool => {
|
): DefinedTool => {
|
||||||
const {
|
const {
|
||||||
icon,
|
icon,
|
||||||
|
Reference in New Issue
Block a user