radames commited on
Commit
8239db2
1 Parent(s): 93b70aa

loading status

Browse files
frontend/src/lib/Frame.svelte CHANGED
@@ -10,6 +10,7 @@
10
  export let loadingState = '';
11
  export let interactive = false;
12
  export let isDragging = false;
 
13
  $: coord = {
14
  x: transform.applyX(position.x),
15
  y: transform.applyY(position.y)
@@ -17,19 +18,26 @@
17
  </script>
18
 
19
  <div
20
- class="frame z-0 flex relative
21
  {!interactive ? 'pointer-events-none touch-none' : ''}
22
  {isDragging ? 'cursor-grabbing' : 'cursor-grab'}"
23
  style={`transform: translateX(${coord.x}px) translateY(${coord.y}px) scale(${transform.k}); border-color: ${color};`}
24
  >
25
  {#if loadingState}
26
- <span class="text-white drop-shadow-lg">{loadingState}</span>
 
 
27
  {/if}
28
  <div class="small-frame z-0 flex relative" />
29
- <LoadingIcon />
 
 
 
 
 
30
  <h2 class="text-lg">Click to paint</h2>
31
 
32
- <div class="absolute bottom-0 font-bold">{prompt}</div>
33
  </div>
34
 
35
  <style lang="postcss" scoped>
 
10
  export let loadingState = '';
11
  export let interactive = false;
12
  export let isDragging = false;
13
+ export let isLoading = false;
14
  $: coord = {
15
  x: transform.applyX(position.x),
16
  y: transform.applyY(position.y)
 
18
  </script>
19
 
20
  <div
21
+ class="frame z-0 relative grid grid-cols-3 grid-rows-3
22
  {!interactive ? 'pointer-events-none touch-none' : ''}
23
  {isDragging ? 'cursor-grabbing' : 'cursor-grab'}"
24
  style={`transform: translateX(${coord.x}px) translateY(${coord.y}px) scale(${transform.k}); border-color: ${color};`}
25
  >
26
  {#if loadingState}
27
+ <div class="col-span-2 row-start-1">
28
+ <span class="text-white drop-shadow-lg">{loadingState}</span>
29
+ </div>
30
  {/if}
31
  <div class="small-frame z-0 flex relative" />
32
+ {#if isLoading}
33
+ <div class="col-start-2 row-start-2">
34
+ <LoadingIcon />
35
+ </div>
36
+ {/if}
37
+
38
  <h2 class="text-lg">Click to paint</h2>
39
 
40
+ <div class="absolute bottom-0 font-bold text-lg">{prompt}</div>
41
  </div>
42
 
43
  <style lang="postcss" scoped>
frontend/src/lib/LoadingIcon.svelte CHANGED
@@ -3,7 +3,7 @@
3
  fill="none"
4
  width="50"
5
  viewBox="0 0 24 24"
6
- class="animate-spin max-w-[1rem] inline-block"
7
  >
8
  <path
9
  fill="currentColor"
 
3
  fill="none"
4
  width="50"
5
  viewBox="0 0 24 24"
6
+ class="animate-spin block w-full opacity-60"
7
  >
8
  <path
9
  fill="currentColor"
frontend/src/lib/PaintFrame.svelte CHANGED
@@ -23,6 +23,7 @@
23
  let frameElement: HTMLDivElement;
24
  let isDragging = false;
25
  $: prompt = $myPresence?.currentPrompt;
 
26
 
27
  onMount(() => {
28
  function dragstarted() {
@@ -89,6 +90,7 @@
89
  loadingState={$loadingState}
90
  {prompt}
91
  {transform}
 
92
  {isDragging}
93
  {interactive}
94
  />
 
23
  let frameElement: HTMLDivElement;
24
  let isDragging = false;
25
  $: prompt = $myPresence?.currentPrompt;
26
+ $: isLoading = $myPresence?.isLoading || false;
27
 
28
  onMount(() => {
29
  function dragstarted() {
 
90
  loadingState={$loadingState}
91
  {prompt}
92
  {transform}
93
+ {isLoading}
94
  {isDragging}
95
  {interactive}
96
  />