Skip to content

Commit 537dce4

Browse files
committed
Rename the ChatInput component and related files to PromptField for improved clarity and consistency
1 parent a93802c commit 537dce4

14 files changed

Lines changed: 24 additions & 24 deletions

File tree

‎packages/ui/src/components/editor/panel/ChatInput/index.ts‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/ui/src/components/editor/panel/ChatInput/ChatInput.module.scss renamed to packages/ui/src/components/editor/panel/PromptField/PromptField.module.scss

File renamed without changes.

packages/ui/src/components/editor/panel/ChatInput/ChatInput.stories.tsx renamed to packages/ui/src/components/editor/panel/PromptField/PromptField.stories.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { useState } from 'react'
2-
import { ChatInput, type EditFormat } from './ChatInput'
2+
import { PromptField, type EditFormat } from './PromptField'
33

44
export default {
5-
component: ChatInput
5+
component: PromptField
66
}
77

88
export const Empty = () => (
9-
<ChatInput
9+
<PromptField
1010
value=""
1111
chat_history={[]}
1212
on_change={(value) => console.log('Changed:', value)}
@@ -28,7 +28,7 @@ export const Empty = () => (
2828
)
2929

3030
export const WithText = () => (
31-
<ChatInput
31+
<PromptField
3232
value="Hello, this is a sample message"
3333
chat_history={[]}
3434
on_change={(value) => console.log('Changed:', value)}
@@ -50,7 +50,7 @@ export const WithText = () => (
5050
)
5151

5252
export const LongText = () => (
53-
<ChatInput
53+
<PromptField
5454
value="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
5555
chat_history={[]}
5656
on_change={(value) => console.log('Changed:', value)}
@@ -72,7 +72,7 @@ export const LongText = () => (
7272
)
7373

7474
export const WithPlaceholderSavedContext = () => (
75-
<ChatInput
75+
<PromptField
7676
value='Ask about the #SavedContext:JSON "My Context"'
7777
chat_history={[]}
7878
on_change={(value) => console.log('Changed:', value)}
@@ -94,7 +94,7 @@ export const WithPlaceholderSavedContext = () => (
9494
)
9595

9696
export const WithPlaceholderSelection = () => (
97-
<ChatInput
97+
<PromptField
9898
value="Ask about the #Selection"
9999
chat_history={[]}
100100
on_change={(value) => console.log('Changed:', value)}
@@ -116,7 +116,7 @@ export const WithPlaceholderSelection = () => (
116116
)
117117

118118
export const WithCommit = () => (
119-
<ChatInput
119+
<PromptField
120120
value='Ask about #Commit:my-repo:a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0 "Initial commit"'
121121
chat_history={[]}
122122
on_change={(value) => console.log('Changed:', value)}
@@ -140,7 +140,7 @@ export const WithCommit = () => (
140140
export const WithEditFormatSelector = () => {
141141
const [edit_format, set_edit_format] = useState<EditFormat>('diff')
142142
return (
143-
<ChatInput
143+
<PromptField
144144
value="Hello, this is a sample message"
145145
chat_history={[]}
146146
on_change={(value) => console.log('Changed:', value)}
@@ -171,7 +171,7 @@ export const WithEditFormatSelector = () => {
171171
}
172172

173173
export const WithFilePaths = () => (
174-
<ChatInput
174+
<PromptField
175175
value="This is about `path/to/my/file.ts` and not about `another/file.txt`"
176176
chat_history={[]}
177177
on_change={(value) => console.log('Changed:', value)}

packages/ui/src/components/editor/panel/ChatInput/ChatInput.tsx renamed to packages/ui/src/components/editor/panel/PromptField/PromptField.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useRef, useEffect, useMemo, useState } from 'react'
2-
import styles from './ChatInput.module.scss'
2+
import styles from './PromptField.module.scss'
33
import cn from 'classnames'
44
import { Icon } from '../../common/Icon'
55
import { get_highlighted_text } from './utils/get-highlighted-text'
@@ -43,7 +43,7 @@ const Tooltip: React.FC<{
4343

4444
export type EditFormat = 'whole' | 'truncated' | 'diff'
4545

46-
export type ChatInputProps = {
46+
export type PromptFieldProps = {
4747
value: string
4848
chat_history: string[]
4949
on_change: (value: string) => void
@@ -73,7 +73,7 @@ export type ChatInputProps = {
7373
on_go_to_file?: (file_path: string) => void
7474
}
7575

76-
export const ChatInput: React.FC<ChatInputProps> = (props) => {
76+
export const PromptField: React.FC<PromptFieldProps> = (props) => {
7777
const input_ref = useRef<HTMLDivElement>(null)
7878
const container_ref = useRef<HTMLDivElement>(null)
7979
const [caret_position, set_caret_position] = useState(0)

packages/ui/src/components/editor/panel/ChatInput/hooks/use-dropdown.ts renamed to packages/ui/src/components/editor/panel/PromptField/hooks/use-dropdown.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useState, useRef, useEffect } from 'react'
2-
import type { ChatInputProps } from '../ChatInput'
2+
import type { PromptFieldProps } from '../PromptField'
33

44
type UseDropdownParams = Pick<
5-
ChatInputProps,
5+
PromptFieldProps,
66
'on_copy' | 'on_submit_with_control'
77
>
88

packages/ui/src/components/editor/panel/ChatInput/hooks/use-handlers.ts renamed to packages/ui/src/components/editor/panel/PromptField/hooks/use-handlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RefObject, useState } from 'react'
2-
import { ChatInputProps } from '../ChatInput'
2+
import { PromptFieldProps } from '../PromptField'
33
import { get_display_text } from '../utils/get-display-text'
44
import {
55
get_caret_position_from_div,
@@ -79,7 +79,7 @@ const set_caret_position_after_change = (
7979
}
8080

8181
export const use_handlers = (
82-
props: ChatInputProps,
82+
props: PromptFieldProps,
8383
input_ref: RefObject<HTMLDivElement>
8484
) => {
8585
const [history_index, set_history_index] = useState(-1)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './PromptField'

packages/ui/src/components/editor/panel/ChatInput/utils/caret.ts renamed to packages/ui/src/components/editor/panel/PromptField/utils/caret.ts

File renamed without changes.

packages/ui/src/components/editor/panel/ChatInput/utils/format-token-count.ts renamed to packages/ui/src/components/editor/panel/PromptField/utils/format-token-count.ts

File renamed without changes.

packages/ui/src/components/editor/panel/ChatInput/utils/get-display-text.ts renamed to packages/ui/src/components/editor/panel/PromptField/utils/get-display-text.ts

File renamed without changes.

0 commit comments

Comments
 (0)