Skip to content

Commit

Permalink
Refactor component imports to use "type" for better type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Royal-lobster committed Oct 25, 2024
1 parent f9e8022 commit 459b403
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 15 deletions.
6 changes: 5 additions & 1 deletion src/components/QuickMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export const QuickMenu = ({ selectedText, setMenuOpen }: QuickMenuProps) => {
</DropdownMenu.Label>
)}
{noCategoryPrompts.map((item) => (
<RecursiveItem item={item} handleGenerate={handleGenerate} />
<RecursiveItem
item={item}
key={item.id}
handleGenerate={handleGenerate}
/>
))}
</DropdownMenu.Group>
</DropdownMenu.Content>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Settings/Elements/FieldWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const FieldWrapper = ({
onSubmit={onSubmit}
>
<div>
<label className="cdx-text-xl dark:cdx-text-neutral-200 cdx-text-neutral-700">
<div className="cdx-text-xl dark:cdx-text-neutral-200 cdx-text-neutral-700">
{title}
</label>
</div>
{description && (
<p className="cdx-text-sm cdx-mt-2 cdx-text-neutral-400">
{description}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Settings/Elements/QuickMenuCustomize.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
FolderTreeItemWrapper,
SortableTree,
TreeItemComponentProps,
TreeItems,
type TreeItemComponentProps,
type TreeItems,
} from 'dnd-kit-sortable-tree'
import React from 'react'
import { IoMove } from 'react-icons/io5'
import { Prompt, usePrompts } from '../../../hooks/usePrompts'
import { type Prompt, usePrompts } from '../../../hooks/usePrompts'
import { AddItemButton } from './AddItemButton'
import { DeletePromptButton } from './DeletePromptButton'
import { EditPromptButton } from './EditPromptButton'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Settings/Sections/GeneralSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import type React from 'react'
import SectionHeading from '../Elements/SectionHeading'
import FieldWrapper from '../Elements/FieldWrapper'
import { useSettings } from '../../../hooks/useSettings'
Expand Down
4 changes: 2 additions & 2 deletions src/components/Settings/Sections/QuickMenuSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Switch from '@radix-ui/react-switch'
import React from 'react'
import type React from 'react'
import TextareaAutosize from 'react-textarea-autosize'
import { useSettings } from '../../../hooks/useSettings'
import FieldWrapper from '../Elements/FieldWrapper'
Expand Down Expand Up @@ -41,7 +41,7 @@ const QuickMenuSettings = () => {
<SectionHeading title="Quick Menu" />

{/* =========================
Enable Visible Quick Menu
Enable Visible Quick Menu
===========================*/}
<FieldWrapper
title="Enable Quick Menu"
Expand Down
1 change: 1 addition & 0 deletions src/components/Sidebar/chat/ChatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const ChatList = ({
}: ChatListProps) => {
const containerRef = useRef<HTMLDivElement>(null)

// biome-ignore lint/correctness/useExhaustiveDependencies: This is intentional, we need this for scroll to bottom
useEffect(() => {
if (containerRef.current) {
containerRef.current.scrollTop = containerRef.current.scrollHeight
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar/chat/FilePreviewBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RiCloseLine } from 'react-icons/ri'
import { MessageFile } from '../../../hooks/useMessageDraft'
import type { MessageFile } from '../../../hooks/useMessageDraft'

interface FilePreviewBarProps {
files: MessageFile[]
Expand Down
6 changes: 5 additions & 1 deletion src/components/Sidebar/chat/InsertPromptToDraftButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ const InsertPromptToDraftButton = ({
</DropdownMenu.Label>
)}
{noCategoryPrompts.map((item) => (
<RecursiveItem item={item} handleGenerate={setMessageDraftText} />
<RecursiveItem
item={item}
key={item.id}
handleGenerate={setMessageDraftText}
/>
))}
</DropdownMenu.Group>
</DropdownMenu.Content>
Expand Down
5 changes: 2 additions & 3 deletions src/components/Sidebar/chat/markdown-components/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeProps } from 'react-markdown/lib/ast-to-react'
import type { CodeProps } from 'react-markdown/lib/ast-to-react'
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import {
atomDark,
Expand All @@ -8,9 +8,8 @@ import {
const isDarkMode = () => {
if (window.matchMedia?.('(prefers-color-scheme: dark)').matches) {
return true
} else {
return false
}
return false
}

const CodeBlock = (props: CodeProps) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar/chat/markdown-components/Table.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactMarkdownProps } from 'react-markdown/lib/ast-to-react'
import type { ReactMarkdownProps } from 'react-markdown/lib/ast-to-react'

type TableType =
| keyof JSX.IntrinsicElements
Expand Down

0 comments on commit 459b403

Please sign in to comment.