radames commited on
Commit
08cb669
1 Parent(s): f98eb35

fix initial mask

Browse files
frontend/src/lib/Buttons/AboutButton.svelte CHANGED
@@ -1,7 +1,11 @@
1
  <script lang="ts">
2
  import { onMount } from 'svelte';
3
  import ShareWithCommunity from './ShareWithCommunity.svelte';
 
 
 
4
  let open = true;
 
5
  onMount(() => {
6
  autoOpen();
7
  window.addEventListener('resize', autoOpen);
@@ -33,7 +37,7 @@
33
  >
34
  About
35
  </button>
36
- <ShareWithCommunity classList={''} />
37
  </div>
38
  </details>
39
  </div>
 
1
  <script lang="ts">
2
  import { onMount } from 'svelte';
3
  import ShareWithCommunity from './ShareWithCommunity.svelte';
4
+
5
+ export let isLoading = false;
6
+
7
  let open = true;
8
+
9
  onMount(() => {
10
  autoOpen();
11
  window.addEventListener('resize', autoOpen);
 
37
  >
38
  About
39
  </button>
40
+ <ShareWithCommunity {isLoading} />
41
  </div>
42
  </details>
43
  </div>
frontend/src/lib/Buttons/ShareWithCommunity.svelte CHANGED
@@ -5,7 +5,7 @@
5
  import { canvasEl, selectedRoomID } from '$lib/store';
6
  import { nanoid } from 'nanoid';
7
 
8
- export let classList = '';
9
 
10
  let isUploading: boolean = false;
11
  async function handleClick() {
@@ -63,9 +63,12 @@ ${canvasImage}
63
  </script>
64
 
65
  <!-- svelte-ignore a11y-click-events-have-key-events -->
66
- <div
67
- class="{classList} text-xs font-mono flex items-center justify-center bg-black gap-x-1 rounded-xl cursor-pointer px-2 py-1 whitespace-nowrap"
 
 
68
  on:click={handleClick}
 
69
  title="Share with community"
70
  >
71
  {#if isUploading}
@@ -74,4 +77,4 @@ ${canvasImage}
74
  <IconCommunity />
75
  {/if}
76
  <p class="text-white font-semibold">Share to community</p>
77
- </div>
 
5
  import { canvasEl, selectedRoomID } from '$lib/store';
6
  import { nanoid } from 'nanoid';
7
 
8
+ export let isLoading = false;
9
 
10
  let isUploading: boolean = false;
11
  async function handleClick() {
 
63
  </script>
64
 
65
  <!-- svelte-ignore a11y-click-events-have-key-events -->
66
+ <button
67
+ class="{isLoading || isUploading
68
+ ? 'cursor-wait'
69
+ : 'cursor-pointer'} text-xs font-mono flex items-center justify-center bg-black gap-x-1 rounded-xl px-2 py-1 whitespace-nowrap"
70
  on:click={handleClick}
71
+ disabled={isUploading || isLoading}
72
  title="Share with community"
73
  >
74
  {#if isUploading}
 
77
  <IconCommunity />
78
  {/if}
79
  <p class="text-white font-semibold">Share to community</p>
80
+ </button>
frontend/src/lib/Menu.svelte CHANGED
@@ -19,6 +19,7 @@
19
  />
20
  <div class="flex flex-col md:flex-row items-center justify-between px-4 md:px-12 gap-3 md:gap-0">
21
  <AboutButton
 
22
  on:click={() => {
23
  $toggleAbout = !$toggleAbout;
24
  }}
 
19
  />
20
  <div class="flex flex-col md:flex-row items-center justify-between px-4 md:px-12 gap-3 md:gap-0">
21
  <AboutButton
22
+ {isLoading}
23
  on:click={() => {
24
  $toggleAbout = !$toggleAbout;
25
  }}
frontend/src/lib/PaintCanvas.svelte CHANGED
@@ -150,7 +150,9 @@
150
  id: string;
151
  };
152
  async function renderImages(promptImgList: PromptImgObject[]) {
 
153
  $isRenderingCanvas = true;
 
154
  await Promise.allSettled(
155
  promptImgList.map(
156
  ({ imgURL, position, id, room }) =>
 
150
  id: string;
151
  };
152
  async function renderImages(promptImgList: PromptImgObject[]) {
153
+ if (promptImgList.length === 0) return;
154
  $isRenderingCanvas = true;
155
+
156
  await Promise.allSettled(
157
  promptImgList.map(
158
  ({ imgURL, position, id, room }) =>