🔧 chore(frontend): format code with prettier

The changes in this commit are purely cosmetic, as the code has been formatted with prettier to improve its readability and consistency. No functional changes have been made.
This commit is contained in:
Gabriel Almeida 2023-05-29 14:35:41 -03:00
commit 20a438428f
4 changed files with 66 additions and 54 deletions

View file

@ -11,7 +11,13 @@ import {
ExclamationCircleIcon, ExclamationCircleIcon,
} from "@heroicons/react/24/solid"; } from "@heroicons/react/24/solid";
import { classNames, nodeColors, nodeIcons, toNormalCase, toTitleCase } from "../../utils"; import {
classNames,
nodeColors,
nodeIcons,
toNormalCase,
toTitleCase,
} from "../../utils";
import ParameterComponent from "./components/parameterComponent"; import ParameterComponent from "./components/parameterComponent";
import { typesContext } from "../../contexts/typesContext"; import { typesContext } from "../../contexts/typesContext";
import { useContext, useState, useEffect, useRef, Fragment } from "react"; import { useContext, useState, useEffect, useRef, Fragment } from "react";

View file

@ -11,7 +11,7 @@ export default function PromptAreaModal({
setValue, setValue,
buttonText, buttonText,
modalTitle, modalTitle,
type type,
}: { }: {
setValue: (value: string) => void; setValue: (value: string) => void;
value: string; value: string;
@ -142,7 +142,8 @@ export default function PromptAreaModal({
} }
} else { } else {
setErrorData({ setErrorData({
title: "Something went wrong, please try again", title:
"Something went wrong, please try again",
}); });
} }
}) })

View file

@ -34,7 +34,7 @@ export default function ExtraSidebar() {
{Object.keys(data[d]) {Object.keys(data[d])
.sort() .sort()
.map((t: string, k) => ( .map((t: string, k) => (
<Tooltip title={t.length > 21 ? t : ''} placement="right"> <Tooltip title={t.length > 21 ? t : ""} placement="right">
<div key={k}> <div key={k}>
<div <div
draggable draggable

View file

@ -27,7 +27,7 @@ export function classNames(...classes: Array<string>) {
export enum TypeModal { export enum TypeModal {
TEXT = 1, TEXT = 1,
PROMPT = 2 PROMPT = 2,
} }
export const textColors = { export const textColors = {
@ -503,8 +503,9 @@ export function toTitleCase(str: string) {
.split("_") .split("_")
.map((word, index) => { .map((word, index) => {
if (index === 0) { if (index === 0) {
return checkUpperWords(
return checkUpperWords(word[0].toUpperCase() + word.slice(1).toLowerCase()); word[0].toUpperCase() + word.slice(1).toLowerCase()
);
} }
return checkUpperWords(word.toLowerCase()); return checkUpperWords(word.toLowerCase());
}) })
@ -514,7 +515,9 @@ export function toTitleCase(str: string) {
.split("-") .split("-")
.map((word, index) => { .map((word, index) => {
if (index === 0) { if (index === 0) {
return checkUpperWords(word[0].toUpperCase() + word.slice(1).toLowerCase()); return checkUpperWords(
word[0].toUpperCase() + word.slice(1).toLowerCase()
);
} }
return checkUpperWords(word.toLowerCase()); return checkUpperWords(word.toLowerCase());
}) })
@ -523,9 +526,11 @@ export function toTitleCase(str: string) {
export const upperCaseWords: string[] = ["llm", "uri"]; export const upperCaseWords: string[] = ["llm", "uri"];
export function checkUpperWords(str: string) { export function checkUpperWords(str: string) {
const words = str.split(' ').map((word) => { const words = str.split(" ").map((word) => {
return upperCaseWords.includes(word.toLowerCase()) ? word.toUpperCase() : word[0].toUpperCase() + word.slice(1).toLowerCase(); return upperCaseWords.includes(word.toLowerCase())
? word.toUpperCase()
: word[0].toUpperCase() + word.slice(1).toLowerCase();
}); });
return words.join(' '); return words.join(" ");
} }