refactor[modals]: Remove any types
This commit is contained in:
parent
4fc636cb9b
commit
53a20ecccf
6 changed files with 26 additions and 17 deletions
|
|
@ -26,7 +26,7 @@ export default function ExportModal(): JSX.Element {
|
||||||
const { flows, tabId, updateFlow, downloadFlow, saveFlow } =
|
const { flows, tabId, updateFlow, downloadFlow, saveFlow } =
|
||||||
useContext(TabsContext);
|
useContext(TabsContext);
|
||||||
const [isMaxLength, setIsMaxLength] = useState(false);
|
const [isMaxLength, setIsMaxLength] = useState(false);
|
||||||
function setModalOpen(x: boolean) {
|
function setModalOpen(x: boolean): void {
|
||||||
setOpen(x);
|
setOpen(x);
|
||||||
if (x === false) {
|
if (x === false) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
@ -67,7 +67,7 @@ export default function ExportModal(): JSX.Element {
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="terms"
|
id="terms"
|
||||||
onCheckedChange={(event: boolean) => {
|
onCheckedChange={(event: boolean): void => {
|
||||||
setChecked(event);
|
setChecked(event);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export default function ChatInput({
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<textarea
|
<textarea
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event): void => {
|
||||||
if (event.key === "Enter" && !lockChat && !event.shiftKey) {
|
if (event.key === "Enter" && !lockChat && !event.shiftKey) {
|
||||||
sendMessage();
|
sendMessage();
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ export default function ChatInput({
|
||||||
}`,
|
}`,
|
||||||
}}
|
}}
|
||||||
value={lockChat ? "Thinking..." : chatValue}
|
value={lockChat ? "Thinking..." : chatValue}
|
||||||
onChange={(e) => {
|
onChange={(e): void => {
|
||||||
setChatValue(e.target.value);
|
setChatValue(e.target.value);
|
||||||
}}
|
}}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
|
|
@ -75,7 +75,7 @@ export default function ChatInput({
|
||||||
: "bg-emerald-600 text-background"
|
: "bg-emerald-600 text-background"
|
||||||
)}
|
)}
|
||||||
disabled={lockChat}
|
disabled={lockChat}
|
||||||
onClick={() => sendMessage()}
|
onClick={(): void => sendMessage()}
|
||||||
>
|
>
|
||||||
{lockChat ? (
|
{lockChat ? (
|
||||||
<IconComponent
|
<IconComponent
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,12 @@ import { useState } from "react";
|
||||||
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
||||||
import { oneDark } from "react-syntax-highlighter/dist/cjs/styles/prism";
|
import { oneDark } from "react-syntax-highlighter/dist/cjs/styles/prism";
|
||||||
import { programmingLanguages } from "../../../../constants/constants";
|
import { programmingLanguages } from "../../../../constants/constants";
|
||||||
|
import { Props } from "../../../../types/components";
|
||||||
interface Props {
|
|
||||||
language: string;
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function CodeBlock({ language, value }: Props): JSX.Element {
|
export function CodeBlock({ language, value }: Props): JSX.Element {
|
||||||
const [isCopied, setIsCopied] = useState<Boolean>(false);
|
const [isCopied, setIsCopied] = useState<Boolean>(false);
|
||||||
|
|
||||||
const copyToClipboard = () => {
|
const copyToClipboard = (): void => {
|
||||||
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +21,7 @@ export function CodeBlock({ language, value }: Props): JSX.Element {
|
||||||
}, 2000);
|
}, 2000);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const downloadAsFile = () => {
|
const downloadAsFile = (): void => {
|
||||||
const fileExtension = programmingLanguages[language] || ".file";
|
const fileExtension = programmingLanguages[language] || ".file";
|
||||||
const suggestedFileName = `${"generated-code"}${fileExtension}`;
|
const suggestedFileName = `${"generated-code"}${fileExtension}`;
|
||||||
const fileName = window.prompt("enter file name", suggestedFileName);
|
const fileName = window.prompt("enter file name", suggestedFileName);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export default function ChatMessage({
|
||||||
<div className="form-modal-chat-text">
|
<div className="form-modal-chat-text">
|
||||||
{hidden && chat.thought && chat.thought !== "" && (
|
{hidden && chat.thought && chat.thought !== "" && (
|
||||||
<div
|
<div
|
||||||
onClick={() => setHidden((prev) => !prev)}
|
onClick={(): void => setHidden((prev) => !prev)}
|
||||||
className="form-modal-chat-icon-div"
|
className="form-modal-chat-icon-div"
|
||||||
>
|
>
|
||||||
<IconComponent
|
<IconComponent
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import * as base64js from "base64-js";
|
import * as base64js from "base64-js";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import IconComponent from "../../../components/genericIconComponent";
|
import IconComponent from "../../../components/genericIconComponent";
|
||||||
|
import { fileCardPropsType } from "../../../types/components";
|
||||||
|
|
||||||
export default function FileCard({ fileName, content, fileType }) {
|
export default function FileCard({ fileName, content, fileType }: fileCardPropsType): JSX.Element {
|
||||||
const handleDownload = () => {
|
const handleDownload = (): void => {
|
||||||
const byteArray = new Uint8Array(base64js.toByteArray(content));
|
const byteArray = new Uint8Array(base64js.toByteArray(content));
|
||||||
const blob = new Blob([byteArray], { type: "application/octet-stream" });
|
const blob = new Blob([byteArray], { type: "application/octet-stream" });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
@ -16,10 +17,10 @@ export default function FileCard({ fileName, content, fileType }) {
|
||||||
URL.revokeObjectURL(url);
|
URL.revokeObjectURL(url);
|
||||||
};
|
};
|
||||||
const [isHovered, setIsHovered] = useState(false);
|
const [isHovered, setIsHovered] = useState(false);
|
||||||
function handleMouseEnter() {
|
function handleMouseEnter(): void {
|
||||||
setIsHovered(true);
|
setIsHovered(true);
|
||||||
}
|
}
|
||||||
function handleMouseLeave() {
|
function handleMouseLeave(): void {
|
||||||
setIsHovered(false);
|
setIsHovered(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,6 +56,7 @@ export default function FileCard({ fileName, content, fileType }) {
|
||||||
return (
|
return (
|
||||||
<button onClick={handleDownload} className="file-card-modal-button">
|
<button onClick={handleDownload} className="file-card-modal-button">
|
||||||
<div className="file-card-modal-div">
|
<div className="file-card-modal-div">
|
||||||
|
ooooooooooooooo
|
||||||
{" "}
|
{" "}
|
||||||
{fileType === "image" ? (
|
{fileType === "image" ? (
|
||||||
<img
|
<img
|
||||||
|
|
|
||||||
|
|
@ -477,3 +477,14 @@ export type editNodeToggleType = {
|
||||||
show: boolean;
|
show: boolean;
|
||||||
type: string;
|
type: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
language: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type fileCardPropsType = {
|
||||||
|
fileName: string;
|
||||||
|
content: string;
|
||||||
|
fileType: string;
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue