nsarrazin HF Staff commited on
Commit
0ee7e09
·
unverified ·
1 Parent(s): b831f4b

feat(confirm): add confirm on deleting branch & sharing conversation (#1381)

Browse files

* feat(confirm): add confirm on deleting branch & sharing conversation

* lint

src/lib/components/chat/ChatMessage.svelte CHANGED
@@ -34,6 +34,7 @@
34
  import ToolUpdate from "./ToolUpdate.svelte";
35
  import { useSettingsStore } from "$lib/stores/settings";
36
  import DOMPurify from "isomorphic-dompurify";
 
37
 
38
  function sanitizeMd(md: string) {
39
  let ret = md
@@ -538,6 +539,11 @@
538
  method="POST"
539
  action="?/deleteBranch"
540
  class="hidden group-hover/navbranch:block"
 
 
 
 
 
541
  >
542
  <input name="messageId" value={message.children[childrenToRender]} type="hidden" />
543
  <button
 
34
  import ToolUpdate from "./ToolUpdate.svelte";
35
  import { useSettingsStore } from "$lib/stores/settings";
36
  import DOMPurify from "isomorphic-dompurify";
37
+ import { enhance } from "$app/forms";
38
 
39
  function sanitizeMd(md: string) {
40
  let ret = md
 
539
  method="POST"
540
  action="?/deleteBranch"
541
  class="hidden group-hover/navbranch:block"
542
+ use:enhance={({ cancel }) => {
543
+ if (!confirm("Are you sure you want to delete this branch?")) {
544
+ cancel();
545
+ }
546
+ }}
547
  >
548
  <input name="messageId" value={message.children[childrenToRender]} type="hidden" />
549
  <button
src/lib/components/chat/ChatWindow.svelte CHANGED
@@ -120,6 +120,10 @@
120
  );
121
 
122
  function onShare() {
 
 
 
 
123
  dispatch("share");
124
  isSharedRecently = true;
125
  if (timeout) {
 
120
  );
121
 
122
  function onShare() {
123
+ if (!confirm("Are you sure you want to share this conversation? This cannot be undone.")) {
124
+ return;
125
+ }
126
+
127
  dispatch("share");
128
  isSharedRecently = true;
129
  if (timeout) {