Skip to content

Commit 2fe3ec3

Browse files
committed
chore: Add components for the plain art tab
1 parent 365bc0a commit 2fe3ec3

File tree

12 files changed

+236
-21
lines changed

12 files changed

+236
-21
lines changed

app.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,14 @@ func deleteFilesWithPrefix(dir, prf string) error {
243243
return nil
244244
}
245245

246+
func (a *App) GetGradient() error {
247+
err := internal.GenerateGradientImage()
248+
if err != nil {
249+
return err
250+
}
251+
252+
return nil
253+
}
254+
246255
// https://gist.github.com/stupidbodo/0db61fa874213a31dc57 - replacement for cronjob
247256
// https://gist.github.com/harubaru/f727cedacae336d1f7877c4bbe2196e1#model-overview

frontend/dist/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
--main-color: orange;
1111
}
1212
</style>
13-
<script type="module" crossorigin src="/assets/index.01ebe55a.js"></script>
14-
<link rel="stylesheet" href="/assets/index.9759aaa1.css">
13+
<script type="module" crossorigin src="/assets/index.f16bcb2d.js"></script>
14+
<link rel="stylesheet" href="/assets/index.77bdd74d.css">
1515
</head>
1616
<body class="dark:bg-gray-700 dark:text-gray-50">
1717
<div id="app"></div>

frontend/src/App.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script type="ts">
22
import Main from './pages/Main.svelte';
33
import Setting from './pages/Setting.svelte';
4+
import PlainArt from './pages/PlainArt.svelte';
5+
46
import { Router, Route } from 'svelte-routing';
57
export let url = '';
68
</script>
@@ -9,5 +11,6 @@
911
<Router {url}>
1012
<Route path="/setting" component={Setting} />
1113
<Route path="/"><Main /></Route>
14+
<Route path="/plain-art"><PlainArt /></Route>
1215
</Router>
1316
</main>

frontend/src/components/ListImages.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<div class="flex flex-wrap justify-between">
5656
{#each images as image}
5757
<div
58-
class="bg-gray-800 w-[300px] h-[300px] mb-3 cursor-pointer"
58+
class="bg-gray-800 w-[300px] h-[300px] mb-3 cursor-default"
5959
on:click={() => setImagePath(image)}
6060
on:keydown={() => setImagePath(image)}
6161
>

frontend/src/components/Modal.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747
<template>
4848
<div>
49-
<p class="text-red-900">{image} wallpaper here</p>
5049
{#if path !== ''}
5150
<div
5251
class="modal-background"

frontend/src/components/Navigation.svelte

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,39 @@
3535

3636
<template>
3737
<div
38-
class="bg-gray-50 p-3 border-b dark:border-gray-600 flex justify-between fixed w-[100%] top-0 left-0"
38+
class=" dark:bg-gray-700 dark:text-gray-50 bg-gray-50 p-3 border-b dark:border-gray-600 flex justify-between fixed w-[100%] top-0 left-0"
3939
>
4040
<div class="flex">
41-
<a href="#" class="dark:text-gray-50 text-gray-500 text-xs flex">
41+
<a
42+
href="/"
43+
use:link
44+
class="dark:text-gray-50 text-gray-500 text-xs flex hover:cursor-default"
45+
>
4246
<img
4347
src={DownloadImage}
4448
width="15"
4549
alt=""
4650
class="mr-1 dark:brightness-0 dark:invert-[1]"
47-
/> Download images</a
51+
/> Images</a
4852
>
4953

50-
<a href="#/" class="dark:text-gray-50 text-gray-500 text-xs flex ml-10">
54+
<a
55+
href="/plain-art"
56+
use:link
57+
class="dark:text-gray-50 text-gray-500 text-xs flex ml-10 hover:cursor-default"
58+
>
5159
<img
5260
src={PlainArtImage}
5361
width="15"
5462
alt=""
5563
class="mr-1 dark:brightness-0 dark:invert-[1]"
56-
/> Plain</a
64+
/> Plain Art</a
5765
>
5866

59-
<a href="#/" class="dark:text-gray-50 text-gray-500 text-xs flex ml-10">
67+
<a
68+
href="#/"
69+
class="dark:text-gray-50 text-gray-500 text-xs flex ml-10 hover:cursor-default"
70+
>
6071
<img
6172
src={AbstractArt}
6273
width="15"
@@ -68,7 +79,7 @@
6879
<a
6980
href="#/"
7081
on:click={downloadImages}
71-
class="dark:text-gray-50 text-gray-500 text-xs flex ml-10"
82+
class="dark:text-gray-50 text-gray-500 text-xs flex ml-10 hover:cursor-default"
7283
>
7384
<img
7485
src={AIArt}
@@ -77,11 +88,35 @@
7788
class="mr-1 dark:brightness-0 dark:invert-[1]"
7889
/> AI
7990
</a>
91+
92+
<a
93+
href="#"
94+
class="dark:text-gray-50 text-gray-500 text-xs flex ml-10 hover:cursor-default"
95+
>
96+
<img
97+
src={DownloadImage}
98+
width="15"
99+
alt=""
100+
class="mr-1 dark:brightness-0 dark:invert-[1]"
101+
/> Upload folder</a
102+
>
80103
</div>
81-
<div>
104+
<div class="flex">
105+
<a
106+
href="#"
107+
class="dark:text-gray-50 text-gray-500 text-xs flex mr-5 hover:cursor-default"
108+
>
109+
<img
110+
src={DownloadImage}
111+
width="15"
112+
alt=""
113+
class="mr-1 dark:brightness-0 dark:invert-[1]"
114+
/>Download
115+
</a>
116+
82117
<a
83118
href="/setting"
84-
class=" text-xs flex text-gray-500 dark:text-gray-50"
119+
class=" text-xs flex text-gray-500 dark:text-gray-50 hover:cursor-default"
85120
use:link
86121
>
87122
<img

frontend/src/pages/PlainArt.svelte

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<script lang="ts">
2+
import Navigation from '../components/Navigation.svelte';
3+
import { GetGradient } from '../../wailsjs/go/main/App.js';
4+
5+
let style: string = 'linear';
6+
7+
let commonColors = [
8+
'green',
9+
'blue',
10+
'gray',
11+
'pink',
12+
'orange',
13+
'brown',
14+
'red',
15+
'violet',
16+
'yellow',
17+
'purple',
18+
'black',
19+
'#2589bd',
20+
'#a3b4a2',
21+
'#38686a',
22+
'#023047',
23+
'#ffb703',
24+
];
25+
26+
const handleGenerateColor = () => {
27+
console.log('Clicked');
28+
GetGradient().then(() => {});
29+
};
30+
31+
const handleSelectGradientStyle = (gradient: string) => {
32+
style = gradient;
33+
console.log(gradient);
34+
};
35+
</script>
36+
37+
<template>
38+
<section>
39+
<Navigation />
40+
41+
<div class="mt-20 text-gray-900">
42+
<div class="flex flex-wrap w-full p-2">
43+
{#each commonColors as c, key}
44+
<div
45+
style="background-color: {c}"
46+
class={`mt-5 cursor-default transition-all hover:opacity-70 rounded-full pt-9 text-center w-[100px] h-[100px] ml-5`}
47+
></div>
48+
{/each}
49+
</div>
50+
51+
<div class="mt-10 flex mx-auto w-1/2">
52+
<button
53+
on:click={() => handleSelectGradientStyle('linear')}
54+
class={`bg-gray-500 cursor-default text-white py-2 px-10 mb-3 rounded-l-md`}
55+
>
56+
Linear {style === 'linear' ? 'selected' : 'n.a'}
57+
</button>
58+
<button
59+
on:click={() => handleSelectGradientStyle('radial')}
60+
class="hover:bg-gray-500 cursor-default bg-gray-900 text-white py-2 px-10 mb-3"
61+
>
62+
Radical
63+
</button>
64+
<button
65+
on:click={() => handleSelectGradientStyle('spiral')}
66+
class=" hover:bg-gray-500 cursor-default bg-gray-900 text-white py-2 px-10 mb-3 rounded-r-md"
67+
>
68+
Spiral
69+
</button>
70+
</div>
71+
72+
<p class="text-white">{style} is here</p>
73+
<div class="mt-10">
74+
<button
75+
on:click={handleGenerateColor}
76+
class="bg-gray-900 text-white py-2 px-10 mb-3 rounded-md"
77+
>Generate
78+
</button>
79+
</div>
80+
</div>
81+
</section>
82+
</template>

frontend/src/pages/PlanArt.svelte

Lines changed: 0 additions & 8 deletions
This file was deleted.

frontend/tsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,10 @@
2121
{
2222
"path": "./tsconfig.node.json"
2323
}
24+
],
25+
"plugins": [
26+
{
27+
"name": "typescript-svelte-plugin"
28+
}
2429
]
2530
}

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ toolchain go1.21.1
66

77
require (
88
github.com/akrylysov/pogreb v0.10.2
9+
github.com/fogleman/gg v1.3.0
910
github.com/sirupsen/logrus v1.9.3
1011
github.com/spf13/viper v1.19.0
1112
github.com/stretchr/testify v1.9.0
@@ -18,6 +19,7 @@ require (
1819
github.com/fsnotify/fsnotify v1.7.0 // indirect
1920
github.com/go-ole/go-ole v1.2.6 // indirect
2021
github.com/godbus/dbus/v5 v5.1.0 // indirect
22+
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
2123
github.com/google/uuid v1.4.0 // indirect
2224
github.com/hashicorp/hcl v1.0.0 // indirect
2325
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
@@ -54,6 +56,7 @@ require (
5456
go.uber.org/multierr v1.9.0 // indirect
5557
golang.org/x/crypto v0.23.0 // indirect
5658
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
59+
golang.org/x/image v0.12.0 // indirect
5760
golang.org/x/net v0.25.0 // indirect
5861
golang.org/x/sys v0.20.0 // indirect
5962
golang.org/x/text v0.15.0 // indirect

0 commit comments

Comments
 (0)