Formatting issues

This commit is contained in:
Lucas Oliveira 2023-08-31 11:48:36 -03:00
commit 06e5e7dc4c
8 changed files with 111 additions and 106 deletions

View file

@ -28,7 +28,6 @@ import {
TabsList,
TabsTrigger,
} from "../../components/ui/tabs";
import { alertContext } from "../../contexts/alertContext";
import { darkContext } from "../../contexts/darkContext";
import { typesContext } from "../../contexts/typesContext";
import { codeTabsPropsType } from "../../types/components";

View file

@ -1,4 +1,4 @@
import { cn } from "../../utils/utils"
import { cn } from "../../utils/utils";
function Skeleton({
className,
@ -9,7 +9,7 @@ function Skeleton({
className={cn("animate-pulse rounded-md bg-border", className)}
{...props}
/>
)
);
}
export { Skeleton }
export { Skeleton };

View file

@ -25,7 +25,7 @@ const initialValue: alertContextType = {
notificationList: [],
pushNotificationList: () => {},
clearNotificationList: () => {},
removeFromNotificationList: () => {}
removeFromNotificationList: () => {},
};
export const alertContext = createContext<alertContextType>(initialValue);

View file

@ -8,7 +8,7 @@ import { classNames } from "../../utils/utils";
import ChatInput from "./chatInput";
import ChatMessage from "./chatMessage";
import _, { set } from "lodash";
import _ from "lodash";
import AccordionComponent from "../../components/AccordionComponent";
import IconComponent from "../../components/genericIconComponent";
import ToggleShadComponent from "../../components/toggleShadComponent";
@ -25,9 +25,9 @@ import { Textarea } from "../../components/ui/textarea";
import { CHAT_FORM_DIALOG_SUBTITLE } from "../../constants/constants";
import { AuthContext } from "../../contexts/authContext";
import { TabsContext } from "../../contexts/tabsContext";
import { getBuildStatus } from "../../controllers/API";
import { TabsState } from "../../types/tabs";
import { validateNodes } from "../../utils/reactflowUtils";
import { getBuildStatus } from "../../controllers/API";
export default function FormModal({
flow,
@ -156,18 +156,20 @@ export default function FormModal({
function handleOnClose(event: CloseEvent): void {
if (isOpen.current) {
getBuildStatus(flow.id).then((response) => {
getBuildStatus(flow.id)
.then((response) => {
if (response.data.built) {
connectWS();
}
else {
} else {
setErrorData({
title: "Please build the flow again before using the chat."
})
title: "Please build the flow again before using the chat.",
});
}
}).catch((error) => {
setErrorData({title:error.data?.detail?error.data.detail:error.message})
})
.catch((error) => {
setErrorData({
title: error.data?.detail ? error.data.detail : error.message,
});
});
setErrorData({ title: event.reason });
setTimeout(() => {
@ -186,7 +188,8 @@ export default function FormModal({
const host = isDevelopment ? "localhost:7860" : window.location.host;
const chatEndpoint = `/api/v1/chat/${chatId}`;
return `${isDevelopment ? "ws" : webSocketProtocol
return `${
isDevelopment ? "ws" : webSocketProtocol
}://${host}${chatEndpoint}?token=${encodeURIComponent(accessToken!)}`;
}

View file

@ -136,7 +136,11 @@ export default function GenericModal({
setSuccessData({
title: "Prompt is ready",
});
if(JSON.stringify(apiReturn.data?.frontend_node)!==JSON.stringify({})) setNodeClass!(apiReturn.data?.frontend_node);
if (
JSON.stringify(apiReturn.data?.frontend_node) !==
JSON.stringify({})
)
setNodeClass!(apiReturn.data?.frontend_node);
setModalOpen(closeModal);
setValue(inputValue);
}

View file

@ -21,8 +21,7 @@ export default function ExtraSidebar(): JSX.Element {
const { data, templates } = useContext(typesContext);
const { flows, tabId, uploadFlow, tabsState, saveFlow, isBuilt } =
useContext(TabsContext);
const { setSuccessData, setErrorData } =
useContext(alertContext);
const { setSuccessData, setErrorData } = useContext(alertContext);
const [dataFilter, setFilterData] = useState(data);
const [search, setSearch] = useState("");
const isPending = tabsState[tabId]?.isPending;
@ -101,9 +100,7 @@ export default function ExtraSidebar(): JSX.Element {
<div className="side-bar-button">
{flow && flow.data && (
<ApiModal flow={flow} disable={!isBuilt}>
<div
className={classNames("extra-side-bar-buttons")}
>
<div className={classNames("extra-side-bar-buttons")}>
<IconComponent
name="Code2"
className={

View file

@ -131,7 +131,9 @@ export default function LoginPage(): JSX.Element {
</div>
<div className="w-full">
<Form.Submit asChild>
<Button className="mr-3 mt-6 w-full" type="submit">Sign in</Button>
<Button className="mr-3 mt-6 w-full" type="submit">
Sign in
</Button>
</Form.Submit>
</div>
<div className="w-full">