-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ai chat): Delete Conversation Confirmation Dialog
- Loading branch information
1 parent
22c3bf4
commit caf654e
Showing
9 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
components/ai_chat/resources/page/components/delete_conversation_modal/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* Copyright (c) 2025 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
import * as React from 'react' | ||
import Button from '@brave/leo/react/button' | ||
import Dialog from '@brave/leo/react/dialog' | ||
|
||
// Utils | ||
import { getLocale } from '$web-common/locale' | ||
|
||
// Hooks | ||
import { useAIChat } from '../../state/ai_chat_context' | ||
|
||
// Styles | ||
import styles from './style.module.scss' | ||
|
||
export default function DeleteConversationModal() { | ||
// Context | ||
const aiChatContext = useAIChat() | ||
|
||
// Computed | ||
const title = aiChatContext.visibleConversations.find( | ||
(conversation) => | ||
conversation.uuid === aiChatContext.deletingConversationId | ||
)?.title || getLocale('conversationListUntitled') | ||
|
||
return ( | ||
<Dialog | ||
isOpen={!!aiChatContext.deletingConversationId} | ||
showClose | ||
onClose={() => aiChatContext.setDeletingConversationId(null)} | ||
className={styles.deleteConversationDialog} | ||
> | ||
<div | ||
slot='title' | ||
className={styles.deleteConversationDialogTitle} | ||
> | ||
{getLocale('menuDeleteConversation')} | ||
</div> | ||
<div className={styles.deleteConversationBody}> | ||
<div className={styles.conversationNameWrapper}>{title}</div> | ||
{getLocale('deleteConversationWarning')} | ||
</div> | ||
<div | ||
slot='actions' | ||
className={styles.deleteConversationActionsRow} | ||
> | ||
<div className={styles.buttonsWrapper}> | ||
<Button | ||
kind='plain-faint' | ||
size='medium' | ||
onClick={() => aiChatContext.setDeletingConversationId(null)} | ||
> | ||
{getLocale('cancelButtonLabel')} | ||
</Button> | ||
<Button | ||
kind='filled' | ||
size='medium' | ||
onClick={() => { | ||
if (aiChatContext.deletingConversationId) { | ||
aiChatContext.service?.deleteConversation( | ||
aiChatContext.deletingConversationId | ||
) | ||
aiChatContext.setDeletingConversationId(null) | ||
} | ||
}} | ||
> | ||
{getLocale('deleteButtonLabel')} | ||
</Button> | ||
</div> | ||
</div> | ||
</Dialog> | ||
) | ||
} |
39 changes: 39 additions & 0 deletions
39
components/ai_chat/resources/page/components/delete_conversation_modal/style.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2025 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// you can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
.conversationNameWrapper { | ||
display: flex; | ||
align-items: flex-start; | ||
justify-content: flex-start; | ||
width: 100%; | ||
padding: var(--leo-spacing-l); | ||
border-radius: var(--leo-radius-m); | ||
border: 1px solid var(--leo-color-divider-subtle); | ||
font: var(--leo-font-heading-h4); | ||
color: var(--leo-color-text-secondary); | ||
} | ||
|
||
.deleteConversationDialogTitle { | ||
font: var(--leo-font-heading-h3); | ||
} | ||
|
||
.deleteConversationDialog { | ||
--leo-dialog-padding: 24px; | ||
} | ||
|
||
.deleteConversationBody { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--leo-spacing-xl); | ||
} | ||
|
||
.deleteConversationActionsRow { | ||
justify-content: flex-end; | ||
} | ||
|
||
.buttonsWrapper { | ||
display: flex; | ||
gap: var(--leo-spacing-m); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters