fix linter errors

This commit is contained in:
Daniel Avila 2023-02-21 19:40:28 -05:00
parent 7b7548c905
commit 168d5e8075
6 changed files with 8 additions and 13 deletions

View file

@ -2,7 +2,6 @@ import React, { useEffect } from 'react';
import { useSelector } from 'react-redux';
import GPTIcon from '../svg/GPTIcon';
import BingIcon from '../svg/BingIcon';
// import useCustomEffect from '~/hooks/useCustomEffect';
export default function Message({
sender,
@ -18,7 +17,7 @@ export default function Message({
if (blinker) {
scrollToBottom();
}
}, [isSubmitting, text]);
}, [isSubmitting, text, blinker, scrollToBottom]);
const props = {
className:
@ -52,7 +51,7 @@ export default function Message({
</strong>
<div className="relative flex w-[calc(100%-50px)] flex-col gap-1 whitespace-pre-wrap md:gap-3 lg:w-[calc(100%-115px)]">
<div className="flex flex-grow flex-col gap-3">
{!!error ? (
{error ? (
<div className="flex flex min-h-[20px] flex-row flex-col items-start gap-4 gap-2 whitespace-pre-wrap text-red-500">
<div className="rounded-md border border-red-500 bg-red-500/10 py-2 px-3 text-sm text-gray-600 dark:text-gray-100">
{text}

View file

@ -63,7 +63,7 @@ const Messages = ({ messages }) => {
sender={message.sender}
text={message.text}
last={i === messages.length - 1}
error={!!message.error ? true : false}
error={message.error ? true : false}
scrollToBottom={i === messages.length - 1 ? scrollToBottom : null}
/>
))}
@ -74,7 +74,7 @@ const Messages = ({ messages }) => {
unmountOnExit={false}
// appear
>
{(state) => showScrollButton && <ScrollToBottom scrollHandler={scrollHandler} />}
{() => showScrollButton && <ScrollToBottom scrollHandler={scrollHandler} />}
</CSSTransition>
<div

View file

@ -1,14 +1,12 @@
import React, { useState } from 'react';
import React from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { setModel } from '~/store/submitSlice';
import GPTIcon from '../svg/GPTIcon';
import BingIcon from '../svg/BingIcon';
import { DropdownMenuCheckboxItemProps } from '@radix-ui/react-dropdown-menu';
import { Button } from '../ui/Button.tsx';
import {
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
DropdownMenuLabel,
DropdownMenuRadioGroup,

View file

@ -1,5 +1,4 @@
import React from 'react';
import { CSSTransition } from 'react-transition-group';
export default function ScrollToBottom({ scrollHandler}) {

View file

@ -1,6 +1,5 @@
import React from 'react';
import { useSelector } from 'react-redux';
import useDidMountEffect from '~/hooks/useDidMountEffect';
export default function SubmitButton({ submitMessage }) {
const { isSubmitting } = useSelector((state) => state.submit);

View file

@ -20,7 +20,7 @@ export default function TextChat({ messages }) {
const { error } = convo;
const submitMessage = () => {
if (!!error) {
if (error) {
dispatch(setError(false));
}
@ -116,7 +116,7 @@ export default function TextChat({ messages }) {
}
if (e.key === 'Enter' && !e.shiftKey) {
if (!!isSubmitting) {
if (isSubmitting) {
return;
}
@ -142,7 +142,7 @@ export default function TextChat({ messages }) {
<form className="stretch mx-2 flex flex-row gap-3 pt-2 last:mb-2 md:last:mb-6 lg:mx-auto lg:max-w-3xl lg:pt-6">
<div className="relative flex h-full flex-1 md:flex-col">
<div className="ml-1 mt-1.5 flex justify-center gap-0 md:m-auto md:mb-2 md:w-full md:gap-2" />
{!!error ? (
{error ? (
<Regenerate
submitMessage={submitMessage}
tryAgain={tryAgain}