2025-04-02 12:41:18 -06:00
|
|
|
import { DefinedTool, defineTool } from '@tools/defineTool';
|
2025-04-02 00:13:17 -06:00
|
|
|
import { lazy } from 'react';
|
2025-04-02 12:41:18 -06:00
|
|
|
import type { GenericCalcType } from './data/types';
|
|
|
|
|
import allGenericCalcs from './data/index';
|
2025-04-02 00:13:17 -06:00
|
|
|
|
2025-04-02 12:41:18 -06:00
|
|
|
async function importComponent(data: GenericCalcType) {
|
2025-04-02 00:13:17 -06:00
|
|
|
const x = await import('./index');
|
2025-04-02 12:41:18 -06:00
|
|
|
return { default: await x.default(data) };
|
2025-04-02 00:13:17 -06:00
|
|
|
}
|
2025-04-02 12:41:18 -06:00
|
|
|
|
|
|
|
|
const tools: DefinedTool[] = [];
|
|
|
|
|
|
|
|
|
|
allGenericCalcs.forEach((x) => {
|
|
|
|
|
async function importComponent2() {
|
|
|
|
|
return await importComponent(x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tools.push(
|
|
|
|
|
defineTool('number', {
|
|
|
|
|
name: x.title,
|
2025-04-02 13:38:12 -06:00
|
|
|
path: 'generic-calc/' + x.name,
|
2025-04-02 12:41:18 -06:00
|
|
|
icon: '',
|
|
|
|
|
description: '',
|
|
|
|
|
shortDescription: '',
|
|
|
|
|
keywords: ['generic', 'calc'],
|
|
|
|
|
longDescription: '',
|
|
|
|
|
component: lazy(importComponent2)
|
|
|
|
|
})
|
|
|
|
|
);
|
2025-04-02 00:13:17 -06:00
|
|
|
});
|
2025-04-02 12:41:18 -06:00
|
|
|
|
|
|
|
|
export { tools };
|