Skip to content

Commit 459b403

Browse files
committed
Refactor component imports to use "type" for better type checking
1 parent f9e8022 commit 459b403

File tree

10 files changed

+23
-15
lines changed

10 files changed

+23
-15
lines changed

src/components/QuickMenu/index.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ export const QuickMenu = ({ selectedText, setMenuOpen }: QuickMenuProps) => {
8181
</DropdownMenu.Label>
8282
)}
8383
{noCategoryPrompts.map((item) => (
84-
<RecursiveItem item={item} handleGenerate={handleGenerate} />
84+
<RecursiveItem
85+
item={item}
86+
key={item.id}
87+
handleGenerate={handleGenerate}
88+
/>
8589
))}
8690
</DropdownMenu.Group>
8791
</DropdownMenu.Content>

src/components/Settings/Elements/FieldWrapper.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ const FieldWrapper = ({
2222
onSubmit={onSubmit}
2323
>
2424
<div>
25-
<label className="cdx-text-xl dark:cdx-text-neutral-200 cdx-text-neutral-700">
25+
<div className="cdx-text-xl dark:cdx-text-neutral-200 cdx-text-neutral-700">
2626
{title}
27-
</label>
27+
</div>
2828
{description && (
2929
<p className="cdx-text-sm cdx-mt-2 cdx-text-neutral-400">
3030
{description}

src/components/Settings/Elements/QuickMenuCustomize.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {
22
FolderTreeItemWrapper,
33
SortableTree,
4-
TreeItemComponentProps,
5-
TreeItems,
4+
type TreeItemComponentProps,
5+
type TreeItems,
66
} from 'dnd-kit-sortable-tree'
77
import React from 'react'
88
import { IoMove } from 'react-icons/io5'
9-
import { Prompt, usePrompts } from '../../../hooks/usePrompts'
9+
import { type Prompt, usePrompts } from '../../../hooks/usePrompts'
1010
import { AddItemButton } from './AddItemButton'
1111
import { DeletePromptButton } from './DeletePromptButton'
1212
import { EditPromptButton } from './EditPromptButton'

src/components/Settings/Sections/GeneralSettings.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import type React from 'react'
22
import SectionHeading from '../Elements/SectionHeading'
33
import FieldWrapper from '../Elements/FieldWrapper'
44
import { useSettings } from '../../../hooks/useSettings'

src/components/Settings/Sections/QuickMenuSettings.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Switch from '@radix-ui/react-switch'
2-
import React from 'react'
2+
import type React from 'react'
33
import TextareaAutosize from 'react-textarea-autosize'
44
import { useSettings } from '../../../hooks/useSettings'
55
import FieldWrapper from '../Elements/FieldWrapper'
@@ -41,7 +41,7 @@ const QuickMenuSettings = () => {
4141
<SectionHeading title="Quick Menu" />
4242

4343
{/* =========================
44-
Enable Visible Quick Menu
44+
Enable Visible Quick Menu
4545
===========================*/}
4646
<FieldWrapper
4747
title="Enable Quick Menu"

src/components/Sidebar/chat/ChatList.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const ChatList = ({
2424
}: ChatListProps) => {
2525
const containerRef = useRef<HTMLDivElement>(null)
2626

27+
// biome-ignore lint/correctness/useExhaustiveDependencies: This is intentional, we need this for scroll to bottom
2728
useEffect(() => {
2829
if (containerRef.current) {
2930
containerRef.current.scrollTop = containerRef.current.scrollHeight

src/components/Sidebar/chat/FilePreviewBar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RiCloseLine } from 'react-icons/ri'
2-
import { MessageFile } from '../../../hooks/useMessageDraft'
2+
import type { MessageFile } from '../../../hooks/useMessageDraft'
33

44
interface FilePreviewBarProps {
55
files: MessageFile[]

src/components/Sidebar/chat/InsertPromptToDraftButton.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ const InsertPromptToDraftButton = ({
5353
</DropdownMenu.Label>
5454
)}
5555
{noCategoryPrompts.map((item) => (
56-
<RecursiveItem item={item} handleGenerate={setMessageDraftText} />
56+
<RecursiveItem
57+
item={item}
58+
key={item.id}
59+
handleGenerate={setMessageDraftText}
60+
/>
5761
))}
5862
</DropdownMenu.Group>
5963
</DropdownMenu.Content>

src/components/Sidebar/chat/markdown-components/CodeBlock.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CodeProps } from 'react-markdown/lib/ast-to-react'
1+
import type { CodeProps } from 'react-markdown/lib/ast-to-react'
22
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
33
import {
44
atomDark,
@@ -8,9 +8,8 @@ import {
88
const isDarkMode = () => {
99
if (window.matchMedia?.('(prefers-color-scheme: dark)').matches) {
1010
return true
11-
} else {
12-
return false
1311
}
12+
return false
1413
}
1514

1615
const CodeBlock = (props: CodeProps) => {

src/components/Sidebar/chat/markdown-components/Table.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReactMarkdownProps } from 'react-markdown/lib/ast-to-react'
1+
import type { ReactMarkdownProps } from 'react-markdown/lib/ast-to-react'
22

33
type TableType =
44
| keyof JSX.IntrinsicElements

0 commit comments

Comments
 (0)