Spaces:
Runtime error
Runtime error
local dev
Browse files- frontend/package-lock.json +16 -16
- frontend/package.json +2 -2
- frontend/src/lib/Result.svelte +3 -2
- frontend/src/routes/index.svelte +4 -4
frontend/package-lock.json
CHANGED
@@ -21,12 +21,12 @@
|
|
21 |
"eslint-config-prettier": "^8.3.0",
|
22 |
"eslint-plugin-svelte3": "^4.0.0",
|
23 |
"postcss": "^8.4.14",
|
24 |
-
"prettier": "^2.
|
25 |
"prettier-plugin-svelte": "^2.7.0",
|
26 |
"svelte": "^3.44.0",
|
27 |
"svelte-check": "^2.7.1",
|
28 |
"svelte-preprocess": "^4.10.7",
|
29 |
-
"tailwindcss": "^3.1.
|
30 |
"tslib": "^2.3.1",
|
31 |
"typescript": "^4.7.2"
|
32 |
}
|
@@ -2304,9 +2304,9 @@
|
|
2304 |
}
|
2305 |
},
|
2306 |
"node_modules/prettier": {
|
2307 |
-
"version": "2.
|
2308 |
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.
|
2309 |
-
"integrity": "sha512-
|
2310 |
"dev": true,
|
2311 |
"bin": {
|
2312 |
"prettier": "bin-prettier.js"
|
@@ -2781,12 +2781,12 @@
|
|
2781 |
}
|
2782 |
},
|
2783 |
"node_modules/tailwindcss": {
|
2784 |
-
"version": "3.1.
|
2785 |
-
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.
|
2786 |
-
"integrity": "sha512-
|
2787 |
"dev": true,
|
2788 |
"dependencies": {
|
2789 |
-
"arg": "^5.0.
|
2790 |
"chokidar": "^3.5.3",
|
2791 |
"color-name": "^1.1.4",
|
2792 |
"detective": "^5.2.1",
|
@@ -4558,9 +4558,9 @@
|
|
4558 |
"dev": true
|
4559 |
},
|
4560 |
"prettier": {
|
4561 |
-
"version": "2.
|
4562 |
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.
|
4563 |
-
"integrity": "sha512-
|
4564 |
"dev": true
|
4565 |
},
|
4566 |
"prettier-plugin-svelte": {
|
@@ -4842,12 +4842,12 @@
|
|
4842 |
}
|
4843 |
},
|
4844 |
"tailwindcss": {
|
4845 |
-
"version": "3.1.
|
4846 |
-
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.
|
4847 |
-
"integrity": "sha512-
|
4848 |
"dev": true,
|
4849 |
"requires": {
|
4850 |
-
"arg": "^5.0.
|
4851 |
"chokidar": "^3.5.3",
|
4852 |
"color-name": "^1.1.4",
|
4853 |
"detective": "^5.2.1",
|
|
|
21 |
"eslint-config-prettier": "^8.3.0",
|
22 |
"eslint-plugin-svelte3": "^4.0.0",
|
23 |
"postcss": "^8.4.14",
|
24 |
+
"prettier": "^2.7.0",
|
25 |
"prettier-plugin-svelte": "^2.7.0",
|
26 |
"svelte": "^3.44.0",
|
27 |
"svelte-check": "^2.7.1",
|
28 |
"svelte-preprocess": "^4.10.7",
|
29 |
+
"tailwindcss": "^3.1.3",
|
30 |
"tslib": "^2.3.1",
|
31 |
"typescript": "^4.7.2"
|
32 |
}
|
|
|
2304 |
}
|
2305 |
},
|
2306 |
"node_modules/prettier": {
|
2307 |
+
"version": "2.7.0",
|
2308 |
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.0.tgz",
|
2309 |
+
"integrity": "sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ==",
|
2310 |
"dev": true,
|
2311 |
"bin": {
|
2312 |
"prettier": "bin-prettier.js"
|
|
|
2781 |
}
|
2782 |
},
|
2783 |
"node_modules/tailwindcss": {
|
2784 |
+
"version": "3.1.3",
|
2785 |
+
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.3.tgz",
|
2786 |
+
"integrity": "sha512-PRJNYdSIthrb8hjmAyymEyEN8Yo61TMXpzyFUpxULeeyRn3Y3gpvuw6FlRTKrJvK7thSGKRnhT36VovVx4WeMA==",
|
2787 |
"dev": true,
|
2788 |
"dependencies": {
|
2789 |
+
"arg": "^5.0.2",
|
2790 |
"chokidar": "^3.5.3",
|
2791 |
"color-name": "^1.1.4",
|
2792 |
"detective": "^5.2.1",
|
|
|
4558 |
"dev": true
|
4559 |
},
|
4560 |
"prettier": {
|
4561 |
+
"version": "2.7.0",
|
4562 |
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.0.tgz",
|
4563 |
+
"integrity": "sha512-nwoX4GMFgxoPC6diHvSwmK/4yU8FFH3V8XWtLQrbj4IBsK2pkYhG4kf/ljF/haaZ/aii+wNJqISrCDPgxGWDVQ==",
|
4564 |
"dev": true
|
4565 |
},
|
4566 |
"prettier-plugin-svelte": {
|
|
|
4842 |
}
|
4843 |
},
|
4844 |
"tailwindcss": {
|
4845 |
+
"version": "3.1.3",
|
4846 |
+
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.3.tgz",
|
4847 |
+
"integrity": "sha512-PRJNYdSIthrb8hjmAyymEyEN8Yo61TMXpzyFUpxULeeyRn3Y3gpvuw6FlRTKrJvK7thSGKRnhT36VovVx4WeMA==",
|
4848 |
"dev": true,
|
4849 |
"requires": {
|
4850 |
+
"arg": "^5.0.2",
|
4851 |
"chokidar": "^3.5.3",
|
4852 |
"color-name": "^1.1.4",
|
4853 |
"detective": "^5.2.1",
|
frontend/package.json
CHANGED
@@ -24,12 +24,12 @@
|
|
24 |
"eslint-config-prettier": "^8.3.0",
|
25 |
"eslint-plugin-svelte3": "^4.0.0",
|
26 |
"postcss": "^8.4.14",
|
27 |
-
"prettier": "^2.
|
28 |
"prettier-plugin-svelte": "^2.7.0",
|
29 |
"svelte": "^3.44.0",
|
30 |
"svelte-check": "^2.7.1",
|
31 |
"svelte-preprocess": "^4.10.7",
|
32 |
-
"tailwindcss": "^3.1.
|
33 |
"tslib": "^2.3.1",
|
34 |
"typescript": "^4.7.2"
|
35 |
},
|
|
|
24 |
"eslint-config-prettier": "^8.3.0",
|
25 |
"eslint-plugin-svelte3": "^4.0.0",
|
26 |
"postcss": "^8.4.14",
|
27 |
+
"prettier": "^2.7.0",
|
28 |
"prettier-plugin-svelte": "^2.7.0",
|
29 |
"svelte": "^3.44.0",
|
30 |
"svelte-check": "^2.7.1",
|
31 |
"svelte-preprocess": "^4.10.7",
|
32 |
+
"tailwindcss": "^3.1.3",
|
33 |
"tslib": "^2.3.1",
|
34 |
"typescript": "^4.7.2"
|
35 |
},
|
frontend/src/lib/Result.svelte
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
export let imagePaths: string[];
|
9 |
|
10 |
import domtoimage from 'dom-to-image';
|
|
|
11 |
|
12 |
let elToShare: HTMLDivElement;
|
13 |
// let domToImage: DomToImage;
|
@@ -25,7 +26,7 @@
|
|
25 |
copyState = true;
|
26 |
setTimeout(() => (copyState = false), 1000);
|
27 |
console.log('Fetched image copied.');
|
28 |
-
} catch (err) {
|
29 |
console.log(err.name, err.message);
|
30 |
}
|
31 |
}
|
@@ -44,7 +45,7 @@
|
|
44 |
<div class="grid grid-cols-3 gap-2 max-w-md mx-auto p-3">
|
45 |
{#each imagePaths as image}
|
46 |
<div>
|
47 |
-
<img src={image} alt="" class="w-full h-full" />
|
48 |
</div>
|
49 |
{/each}
|
50 |
</div>
|
|
|
8 |
export let imagePaths: string[];
|
9 |
|
10 |
import domtoimage from 'dom-to-image';
|
11 |
+
const imageBaseUrl = import.meta.env.MODE === 'development' ? 'http://localhost:7860/' : '';
|
12 |
|
13 |
let elToShare: HTMLDivElement;
|
14 |
// let domToImage: DomToImage;
|
|
|
26 |
copyState = true;
|
27 |
setTimeout(() => (copyState = false), 1000);
|
28 |
console.log('Fetched image copied.');
|
29 |
+
} catch (err: DomToImageError) {
|
30 |
console.log(err.name, err.message);
|
31 |
}
|
32 |
}
|
|
|
45 |
<div class="grid grid-cols-3 gap-2 max-w-md mx-auto p-3">
|
46 |
{#each imagePaths as image}
|
47 |
<div>
|
48 |
+
<img src={imageBaseUrl + image} alt="" class="w-full h-full" />
|
49 |
</div>
|
50 |
{/each}
|
51 |
</div>
|
frontend/src/routes/index.svelte
CHANGED
@@ -9,10 +9,10 @@
|
|
9 |
import Message from '$lib/Message.svelte';
|
10 |
|
11 |
import { onMount } from 'svelte';
|
12 |
-
import image from '$lib/assets/image1.jpg';
|
13 |
|
14 |
const totalTime = 1000;
|
15 |
-
|
|
|
16 |
// Get word of the day
|
17 |
let answer: string;
|
18 |
let imagePaths: string[];
|
@@ -35,7 +35,7 @@
|
|
35 |
let allowInput = true;
|
36 |
|
37 |
onMount(async () => {
|
38 |
-
const data = await fetch(
|
39 |
const prompts: string[] = Object.keys(data);
|
40 |
const randomPrompt: string = prompts[~~(Math.random() * prompts.length)];
|
41 |
answer = randomPrompt.replace(/_/g, ' ');
|
@@ -180,7 +180,7 @@
|
|
180 |
<div class="grid grid-cols-3 gap-2 max-w-md mx-auto p-3">
|
181 |
{#each imagePaths as image}
|
182 |
<div>
|
183 |
-
<img src={image} alt="" class="w-full h-full" />
|
184 |
</div>
|
185 |
{/each}
|
186 |
</div>
|
|
|
9 |
import Message from '$lib/Message.svelte';
|
10 |
|
11 |
import { onMount } from 'svelte';
|
|
|
12 |
|
13 |
const totalTime = 1000;
|
14 |
+
const apiUrl = import.meta.env.MODE === 'development' ? 'http://localhost:7860/data' : 'data';
|
15 |
+
const imageBaseUrl = import.meta.env.MODE === 'development' ? 'http://localhost:7860/' : '';
|
16 |
// Get word of the day
|
17 |
let answer: string;
|
18 |
let imagePaths: string[];
|
|
|
35 |
let allowInput = true;
|
36 |
|
37 |
onMount(async () => {
|
38 |
+
const data = await fetch(apiUrl).then((d) => d.json());
|
39 |
const prompts: string[] = Object.keys(data);
|
40 |
const randomPrompt: string = prompts[~~(Math.random() * prompts.length)];
|
41 |
answer = randomPrompt.replace(/_/g, ' ');
|
|
|
180 |
<div class="grid grid-cols-3 gap-2 max-w-md mx-auto p-3">
|
181 |
{#each imagePaths as image}
|
182 |
<div>
|
183 |
+
<img src={imageBaseUrl + image} alt="" class="w-full h-full" />
|
184 |
</div>
|
185 |
{/each}
|
186 |
</div>
|