Converting snake case on the fields names
This commit is contained in:
parent
fc3fe6a85d
commit
da8d39aab2
2 changed files with 11 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ import {
|
||||||
import { Handle, Position } from "reactflow";
|
import { Handle, Position } from "reactflow";
|
||||||
import Dropdown from "../../components/dropdownComponent";
|
import Dropdown from "../../components/dropdownComponent";
|
||||||
import Input from "../../components/inputComponent";
|
import Input from "../../components/inputComponent";
|
||||||
import { nodeColors, nodeIcons } from "../../utils";
|
import { nodeColors, nodeIcons, snakeToNormalCase } from "../../utils";
|
||||||
import Tooltip from "../../components/TooltipComponent";
|
import Tooltip from "../../components/TooltipComponent";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ export default function GenericNode({ data }) {
|
||||||
onSelect={() => {}}
|
onSelect={() => {}}
|
||||||
/>
|
/>
|
||||||
) : data.node.template[t].type === "str" ? (
|
) : data.node.template[t].type === "str" ? (
|
||||||
<Input title={t} placeholder="pleicerolder" onChange={() => {}} />
|
<Input title={snakeToNormalCase(t)} placeholder="pleicerolder" onChange={() => {}} />
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
|
|
@ -59,10 +59,10 @@ export default function GenericNode({ data }) {
|
||||||
|
|
||||||
<div className="flex w-full justify-between items-center bg-gray-50 gap-2 border-t text-gray-600 p-4 text-sm">
|
<div className="flex w-full justify-between items-center bg-gray-50 gap-2 border-t text-gray-600 p-4 text-sm">
|
||||||
<button onClick={data.onDelete}>
|
<button onClick={data.onDelete}>
|
||||||
<TrashIcon className="w-6 h-6"></TrashIcon>
|
<TrashIcon className="w-6 h-6 hover:text-red-500"></TrashIcon>
|
||||||
</button>
|
</button>
|
||||||
<button onClick={data.onRun}>
|
<button onClick={data.onRun}>
|
||||||
<PlayIcon className="w-6 h-6"></PlayIcon>
|
<PlayIcon className="w-6 h-6 hover:text-green-500"></PlayIcon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<Handle
|
<Handle
|
||||||
|
|
|
||||||
|
|
@ -280,6 +280,13 @@ export function classNames(...classes) {
|
||||||
.join('');
|
.join('');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function snakeToNormalCase(str: string){
|
||||||
|
return str
|
||||||
|
.split('_')
|
||||||
|
.map((word, index) => {if(index === 0){return word[0].toUpperCase() + word.slice(1).toLowerCase()} return word.toLowerCase()})
|
||||||
|
.join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
export function roundNumber(x, decimals){
|
export function roundNumber(x, decimals){
|
||||||
return Math.round(x * Math.pow(10, decimals))/Math.pow(10, decimals)
|
return Math.round(x * Math.pow(10, decimals))/Math.pow(10, decimals)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue