@@ -244,9 +244,32 @@ const clear_conversation = async () => {
244
244
}
245
245
} ;
246
246
247
+ const show_option = async ( conversation_id ) => {
248
+ const conv = document . getElementById ( `conv-${ conversation_id } ` ) ;
249
+ const yes = document . getElementById ( `yes-${ conversation_id } ` ) ;
250
+ const not = document . getElementById ( `not-${ conversation_id } ` ) ;
251
+
252
+ conv . style . display = "none" ;
253
+ yes . style . display = "block" ;
254
+ not . style . display = "block" ;
255
+ }
256
+
257
+ const hide_option = async ( conversation_id ) => {
258
+ const conv = document . getElementById ( `conv-${ conversation_id } ` ) ;
259
+ const yes = document . getElementById ( `yes-${ conversation_id } ` ) ;
260
+ const not = document . getElementById ( `not-${ conversation_id } ` ) ;
261
+
262
+ conv . style . display = "block" ;
263
+ yes . style . display = "none" ;
264
+ not . style . display = "none" ;
265
+ }
266
+
247
267
const delete_conversation = async ( conversation_id ) => {
248
268
localStorage . removeItem ( `conversation:${ conversation_id } ` ) ;
249
269
270
+ const conversation = document . getElementById ( `convo-${ conversation_id } ` ) ;
271
+ conversation . remove ( ) ;
272
+
250
273
if ( window . conversation_id == conversation_id ) {
251
274
await new_conversation ( ) ;
252
275
}
@@ -363,14 +386,16 @@ const load_conversations = async (limit, offset, loader) => {
363
386
364
387
for ( conversation of conversations ) {
365
388
box_conversations . innerHTML += `
366
- <div class="convo">
367
- <div class="left" onclick="set_conversation('${ conversation . id } ')">
368
- <i class="fa-regular fa-comments"></i>
369
- <span class="convo-title">${ conversation . title } </span>
370
- </div>
371
- <i onclick="delete_conversation('${ conversation . id } ')" class="fa-regular fa-trash"></i>
372
- </div>
373
- ` ;
389
+ <div class="convo" id="convo-${ conversation . id } ">
390
+ <div class="left" onclick="set_conversation('${ conversation . id } ')">
391
+ <i class="fa-regular fa-comments"></i>
392
+ <span class="convo-title">${ conversation . title } </span>
393
+ </div>
394
+ <i onclick="show_option('${ conversation . id } ')" class="fa-regular fa-trash" id="conv-${ conversation . id } "></i>
395
+ <i onclick="delete_conversation('${ conversation . id } ')" class="fa-regular fa-check" id="yes-${ conversation . id } " style="display:none;"></i>
396
+ <i onclick="hide_option('${ conversation . id } ')" class="fa-regular fa-x" id="not-${ conversation . id } " style="display:none;"></i>
397
+ </div>
398
+ ` ;
374
399
}
375
400
376
401
document . querySelectorAll ( `code` ) . forEach ( ( el ) => {
0 commit comments