enzostvs HF staff commited on
Commit
3d344de
β€’
1 Parent(s): 0d4cbee

fix click on reaction stopPropagation and already_saved is stored now

Browse files
src/lib/components/UserIsLogged.svelte CHANGED
@@ -6,6 +6,8 @@
6
  let user = get(userStore);
7
 
8
  const handleClick = (e: any) => {
 
 
9
  if (!user) {
10
  loginModalStore.update(() => true);
11
  }
 
6
  let user = get(userStore);
7
 
8
  const handleClick = (e: any) => {
9
+ e.preventDefault();
10
+ e.stopPropagation();
11
  if (!user) {
12
  loginModalStore.update(() => true);
13
  }
src/lib/components/community/reactions/Add.svelte CHANGED
@@ -51,7 +51,11 @@
51
  class:!text-white={isOpen}
52
  class:opacity-0={count >= 4}
53
  >
54
- <button on:click={() => isOpen = !isOpen}>
 
 
 
 
55
  <Icon icon="fluent:emoji-add-16-regular" class="w-6 h-6" />
56
  </button>
57
  <div
 
51
  class:!text-white={isOpen}
52
  class:opacity-0={count >= 4}
53
  >
54
+ <button on:click={(e) => {
55
+ e.preventDefault();
56
+ e.stopPropagation();
57
+ isOpen = !isOpen
58
+ }}>
59
  <Icon icon="fluent:emoji-add-16-regular" class="w-6 h-6" />
60
  </button>
61
  <div
src/lib/components/community/reactions/Reaction.svelte CHANGED
@@ -23,7 +23,11 @@
23
  <button
24
  class="rounded-full bg-white text-neutral-800 font-bold flex items-center justify-start gap-1.5 px-3 py-1 border border-white hover:bg-neutral-200 text-sm"
25
  class:bg-opacity-60={!liked}
26
- on:click={() => handleReaction(emoji)}
 
 
 
 
27
  >
28
  <span class="text-base">{emoji}</span>
29
  {count}
 
23
  <button
24
  class="rounded-full bg-white text-neutral-800 font-bold flex items-center justify-start gap-1.5 px-3 py-1 border border-white hover:bg-neutral-200 text-sm"
25
  class:bg-opacity-60={!liked}
26
+ on:click={(e) => {
27
+ e.preventDefault();
28
+ e.stopPropagation();
29
+ handleReaction(emoji)
30
+ }}
31
  >
32
  <span class="text-base">{emoji}</span>
33
  {count}
src/lib/components/generate/Response.svelte CHANGED
@@ -9,7 +9,6 @@
9
  export let loading_generation: boolean = false;
10
 
11
  let loading: boolean = false;
12
- let already_saved: boolean = false;
13
  let user = get(userStore)
14
 
15
  const saveImage = () => {
@@ -31,7 +30,12 @@
31
  },
32
  }).then(() => {
33
  loading = false;
34
- already_saved = true;
 
 
 
 
 
35
  })
36
  }
37
 
@@ -91,9 +95,9 @@
91
  iconPosition="right"
92
  loading={loading}
93
  onClick={share}
94
- disabled={loading || already_saved}
95
  >
96
- {#if already_saved}
97
  Shared!
98
  {:else}
99
  Share with community
 
9
  export let loading_generation: boolean = false;
10
 
11
  let loading: boolean = false;
 
12
  let user = get(userStore)
13
 
14
  const saveImage = () => {
 
30
  },
31
  }).then(() => {
32
  loading = false;
33
+ generationStore.update((value) => {
34
+ return {
35
+ ...value,
36
+ already_saved: true
37
+ }
38
+ })
39
  })
40
  }
41
 
 
95
  iconPosition="right"
96
  loading={loading}
97
  onClick={share}
98
+ disabled={loading || generation?.already_saved}
99
  >
100
+ {#if generation?.already_saved}
101
  Shared!
102
  {:else}
103
  Share with community
src/lib/stores/use-generation.ts CHANGED
@@ -7,4 +7,5 @@ export const generationStore = writable<{
7
  form?: Record<string, any>,
8
  gallery?: CommunityCard,
9
  image?: string | ArrayBuffer | null,
 
10
  }>(undefined);
 
7
  form?: Record<string, any>,
8
  gallery?: CommunityCard,
9
  image?: string | ArrayBuffer | null,
10
+ already_saved?: boolean,
11
  }>(undefined);