Skip to content

Commit c1d6e95

Browse files
PoulphunterPoulphunter
authored andcommitted
feat: Add delete button for conversations with confirmation and navigation
This button includes a tooltip for accessibility, a confirmation dialog, and redirects to the home page after deletion. Improves user experience by allowing easy removal of conversations.
1 parent 7e307e8 commit c1d6e95

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/components/ConversationList.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,22 @@ export default function ConversationList() {
286286
dir="auto"
287287
>
288288
<span className="truncate">{conv.name}</span>
289+
<button
290+
className={'tooltip tooltip-bottom z-100 ml-auto'}
291+
data-tip={t('ConversationList.deleteBtn')}
292+
aria-label={t('ConversationList.deleteBtn')}
293+
onClick={() => {
294+
const convId = conv.id;
295+
if (window.confirm(t('ConversationList.deleteConfirm'))) {
296+
StorageUtils.remove(convId).then(() => {});
297+
navigate('/');
298+
}
299+
}}
300+
>
301+
<span className="btn">
302+
<BiX className="h-6 w-6" />
303+
</span>
304+
</button>
289305
</button>
290306
))}
291307

0 commit comments

Comments
 (0)