mirror of
https://github.com/stackblitz/bolt.new
synced 2025-06-26 18:17:50 +00:00
chore: lint fix
fixed lint errors
This commit is contained in:
commit
0f4f859a43
@ -2,6 +2,7 @@ import type { Message } from 'ai';
|
|||||||
import React, { type RefCallback } from 'react';
|
import React, { type RefCallback } from 'react';
|
||||||
import { ClientOnly } from 'remix-utils/client-only';
|
import { ClientOnly } from 'remix-utils/client-only';
|
||||||
import styles from './BaseChat.module.scss';
|
import styles from './BaseChat.module.scss';
|
||||||
|
import { ChatHistory } from './ChatHistory.client';
|
||||||
import FilePreview from './FilePreview';
|
import FilePreview from './FilePreview';
|
||||||
import GitCloneButton from './GitCloneButton';
|
import GitCloneButton from './GitCloneButton';
|
||||||
import { ImportFolderButton } from './ImportFolderButton';
|
import { ImportFolderButton } from './ImportFolderButton';
|
||||||
@ -12,7 +13,6 @@ import { Menu } from '~/components/sidebar/Menu.client';
|
|||||||
import { IconButton } from '~/components/ui/IconButton';
|
import { IconButton } from '~/components/ui/IconButton';
|
||||||
import { Workbench } from '~/components/workbench/Workbench.client';
|
import { Workbench } from '~/components/workbench/Workbench.client';
|
||||||
import { classNames } from '~/utils/classNames';
|
import { classNames } from '~/utils/classNames';
|
||||||
import { ChatHistory } from './ChatHistory.client';
|
|
||||||
|
|
||||||
interface BaseChatProps {
|
interface BaseChatProps {
|
||||||
textareaRef?: React.RefObject<HTMLTextAreaElement | null> | undefined;
|
textareaRef?: React.RefObject<HTMLTextAreaElement | null> | undefined;
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
|
import { useNavigate, useLoaderData } from '@remix-run/react';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import { IconButton } from '~/components/ui/IconButton';
|
||||||
|
import { getAll } from '~/lib/persistence/db';
|
||||||
import type { ChatHistoryItem } from '~/lib/persistence/useChatHistory';
|
import type { ChatHistoryItem } from '~/lib/persistence/useChatHistory';
|
||||||
import { db } from '~/lib/persistence/useChatHistory';
|
import { db } from '~/lib/persistence/useChatHistory';
|
||||||
import { getAll } from '~/lib/persistence/db';
|
|
||||||
import { useNavigate, useLoaderData } from '@remix-run/react';
|
|
||||||
import { IconButton } from '~/components/ui/IconButton';
|
|
||||||
import { classNames } from '~/utils/classNames';
|
import { classNames } from '~/utils/classNames';
|
||||||
import { createScopedLogger } from '~/utils/logger';
|
import { createScopedLogger } from '~/utils/logger';
|
||||||
|
|
||||||
@ -16,14 +16,17 @@ export function ChatHistory() {
|
|||||||
const { id: currentId } = useLoaderData<{ id?: string }>();
|
const { id: currentId } = useLoaderData<{ id?: string }>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!db) return;
|
if (!db) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const loadHistory = async () => {
|
const loadHistory = async () => {
|
||||||
try {
|
try {
|
||||||
const items = await getAll(db!);
|
const items = await getAll(db!);
|
||||||
// Filter items to only show history for the current chat
|
|
||||||
|
// filter items to only show history for the current chat
|
||||||
const filteredItems = items
|
const filteredItems = items
|
||||||
.filter(item => item.urlId === currentId || item.id === currentId)
|
.filter((item) => item.urlId === currentId || item.id === currentId)
|
||||||
.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
||||||
setHistory(filteredItems);
|
setHistory(filteredItems);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -39,7 +42,9 @@ export function ChatHistory() {
|
|||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!db || history.length === 0) return null;
|
if (!db || history.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
@ -78,4 +83,4 @@ export function ChatHistory() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user