Skip to content

Commit 3c2a0ee

Browse files
committed
Update AutoClosingModal to support icons and add success icon to initialization messages
1 parent 7ba8a21 commit 3c2a0ee

9 files changed

Lines changed: 48 additions & 12 deletions

File tree

‎packages/ui/src/components/editor/panel/modals/AutoClosingModal/AutoClosingModal.stories.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ export const Default = () => {
1414

1515
return visible ? (
1616
<AutoClosingModal
17-
title="Chat has been initialized in the connected browser"
17+
title="Initialized in the connected browser"
1818
duration={3000}
1919
on_close={handle_close}
20+
icon='success'
2021
/>
2122
) : null
2223
}

‎packages/ui/src/components/editor/panel/modals/AutoClosingModal/AutoClosingModal.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Modal } from '../Modal'
66
type Props = {
77
title: string
88
duration: number
9+
icon?: 'success' | 'warning'
910
on_close: () => void
1011
}
1112

@@ -26,6 +27,7 @@ export const AutoClosingModal: React.FC<Props> = (props) => {
2627
return (
2728
<Modal
2829
title={props.title}
30+
icon={props.icon}
2931
content_slot={
3032
<div className={styles.progress}>
3133
<div

‎packages/ui/src/components/editor/panel/modals/Modal/Modal.module.scss‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
}
2222
}
2323

24+
.icon {
25+
font-size: 30px !important;
26+
text-align: center;
27+
margin-top: 24px;
28+
display: flex;
29+
justify-content: center;
30+
31+
&--success {
32+
color: var(--vscode-testing-iconPassed);
33+
}
34+
35+
&--warning {
36+
color: var(--vscode-list-warningForeground);
37+
}
38+
}
39+
2440
.title {
2541
text-align: center;
2642
font-weight: 500;

‎packages/ui/src/components/editor/panel/modals/Modal/Modal.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import styles from './Modal.module.scss'
44

55
type Props = {
66
title?: string
7+
icon?: 'success' | 'warning'
78
content_slot?: React.ReactNode
89
footer_slot?: React.ReactNode
910
content_max_height?: string
@@ -25,6 +26,17 @@ export const Modal: React.FC<Props> = (props) => {
2526
[styles['container--full-width']]: props.use_full_width
2627
})}
2728
>
29+
{props.icon && (
30+
<div
31+
className={cn(styles.icon, 'codicon', {
32+
'codicon-check': props.icon == 'success',
33+
'codicon-warning': props.icon == 'warning',
34+
[styles['icon--success']]: props.icon == 'success',
35+
[styles['icon--warning']]: props.icon == 'warning'
36+
})}
37+
/>
38+
)}
39+
2840
{props.title && <div className={styles.title}>{props.title}</div>}
2941

3042
{props.content_slot &&

‎packages/vscode/src/commands/checkpoints-command/actions/restore-checkpoint.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ export const restore_checkpoint = async (params: {
551551
if (params.options?.show_auto_closing_modal_on_success) {
552552
params.panel_provider.send_message({
553553
command: 'SHOW_AUTO_CLOSING_MODAL',
554-
title: message
554+
title: message.slice(0, -1)
555555
})
556556
} else if (temp_checkpoint) {
557557
const action = await vscode.window.showInformationMessage(

‎packages/vscode/src/constants/edit-format-instructions.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,21 @@ Updated the greeting text.
4747
\`\`\``
4848

4949
export const EDIT_FORMAT_INSTRUCTIONS_BEFORE_AFTER = `${intro}, followed by a markdown code block showing the original and updated code snippets with Git-style merge conflict markers. Example:
50-
Updated the greeting text.
50+
Changed greeting to wishes.
5151
5252
### Updated file: \`src/examples/hello.py\`
5353
5454
\`\`\`python
5555
<<<<<<< ORIGINAL
5656
GREETING = "Welcome everyone!"
5757
=======
58-
GREETING = "Hello, World!"
58+
WISHES = "Have a nice day!"
59+
>>>>>>> UPDATED
60+
<<<<<<< ORIGINAL
61+
def show_greeting():
62+
print(GREETING)
63+
=======
64+
def show_wishes():
65+
print(WISHES)
5966
>>>>>>> UPDATED
6067
\`\`\``

‎packages/vscode/src/utils/files-collector.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ export class FilesCollector {
5252

5353
const context_files = [...new Set(context_files_list)]
5454
const now = Date.now()
55-
const ONE_HOUR = 60 * 60 * 1000
55+
const THREE_HOURS = 3 * 60 * 60 * 1000
5656

5757
// Recently modified files are placed at the end for better cache efficiency
5858
context_files.sort((a, b) => {
5959
try {
6060
const mtime_a = fs.statSync(a).mtime.getTime()
6161
const mtime_b = fs.statSync(b).mtime.getTime()
6262

63-
const is_recent_a = now - mtime_a < ONE_HOUR
64-
const is_recent_b = now - mtime_b < ONE_HOUR
63+
const is_recent_a = now - mtime_a < THREE_HOURS
64+
const is_recent_b = now - mtime_b < THREE_HOURS
6565

6666
if (is_recent_a != is_recent_b) {
6767
return is_recent_a ? 1 : -1

‎packages/vscode/src/views/panel/backend/message-handlers/handle-send-prompt.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export const handle_send_prompt = async (params: {
212212
processed_instructions = await replace_saved_context_placeholder({
213213
instruction: processed_instructions,
214214
context: params.panel_provider.context,
215-
workspace_provider: params.panel_provider.workspace_provider,
215+
workspace_provider: params.panel_provider.workspace_provider
216216
})
217217
}
218218

@@ -267,10 +267,7 @@ export const handle_send_prompt = async (params: {
267267

268268
params.panel_provider.send_message({
269269
command: 'SHOW_AUTO_CLOSING_MODAL',
270-
title:
271-
resolved_preset_names.length > 1
272-
? 'Chats have been initialized in the connected browser'
273-
: 'Chat has been initialized in the connected browser'
270+
title: 'Initialized in the connected browser'
274271
})
275272
}
276273

‎packages/vscode/src/views/panel/frontend/Panel.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ export const Panel = () => {
542542
<UiAutoClosingModal
543543
title={auto_closing_modal_title}
544544
duration={3000}
545+
icon="success"
545546
on_close={() => {
546547
set_auto_closing_modal_title(undefined)
547548
}}

0 commit comments

Comments
 (0)