Skip to content

Commit 365bc0a

Browse files
authored
Merge pull request #19 from iamhabbeboy/iamhabbeboy/fixes
chore: add support for other features via navigation
2 parents b8af121 + 89e6c2d commit 365bc0a

File tree

10 files changed

+121
-148
lines changed

10 files changed

+121
-148
lines changed

app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (a *App) startup(ctx context.Context) {
6161
menu := SetMenuItem(ctx, a)
6262
runtime.MenuSetApplicationMenu(ctx, menu)
6363
appConf.Init("$HOME/.picasa")
64-
startSchedulerWorker()
64+
// startSchedulerWorker()
6565
}
6666

6767
func (a *App) GetDownloadedImages() []string {

application_icon.icns

38.5 KB
Binary file not shown.

commit.log

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
af87ff6 chore: Delete old images when downloading new ones
2+
c292b9a Merge pull request #15 from iamhabbeboy/iamhabbeboy/scheduler
3+
253d145 Merge pull request #14 from iamhabbeboy/iamhabbeboy/fixes
4+
5062ba0 chore: Add launchctl agent for scheduler startup
5+
26bba43 chore: Update Makefile config
6+
b12ea23 Merge pull request #13 from iamhabbeboy/iamhabbeboy/scheduler
7+
136d5a8 chore: Update scheduler text
8+
5e163bf Merge pull request #12 from iamhabbeboy/iamhabbeboy/scheduler
9+
3137921 chore: Add scheduler to system bin
10+
3397a4d Merge pull request #11 from iamhabbeboy/iamhabbeboy/scheduler
11+
111a7d4 chore: Disable right-click
12+
1795c63 Merge pull request #10 from iamhabbeboy/iamhabbeboy/scheduler
13+
fa17f0d chore: Update the appicon
14+
b239408 chore: Add app icon, rename the workder to scheduler
15+
d2abe50 Merge pull request #9 from iamhabbeboy/iamhabbeboy/scheduler
16+
e981cf9 chore: Add image author username to image filename
17+
8b43282 Merge pull request #8 from iamhabbeboy/iamhabbeboy/scheduler
18+
ea5c497 chore: Update TODO doc
19+
a6064a4 chore: Add unsplash api key to default
20+
c059ff6 Merge pull request #7 from iamhabbeboy/iamhabbeboy/scheduler
21+
304b2f9 chore: Add download images scheduler
22+
4640e10 chore: Remove unused code
23+
d017688 chore: Add unsplash api input field
24+
95d1ea4 chore: Update scheduler
25+
ddc0e43 Merge pull request #6 from iamhabbeboy/iamhabbeboy/scheduler
26+
d581827 chore: Update picasa.yaml
27+
2cc3e9f chore: WIP: update worker
28+
ee169f9 chore: Implement background worker
29+
251e7a5 Merge pull request #5 from iamhabbeboy/iamhabbeboy/refactoring
30+
7fb012c chore: Update config
31+
65ac1b0 chore: Update image gallery
32+
7745a9b Merge pull request #4 from iamhabbeboy/iamhabbeboy/refactoring
33+
4830c4f chore: Remove yaml config
34+
71b35f7 chore: Remove build dir
35+
dc90d97 chore: Delete old code base
36+
8af2e45 chore: Update view UI
37+
fc6c0df chore: Remove unused old code
38+
66cd126 Merge pull request #3 from iamhabbeboy/setup-local-database
39+
30b1c20 chore: Add background worker
40+
5b92bd6 Merge pull request #2 from iamhabbeboy/setup-local-database
41+
d5ee792 chore: Implement dark mode
42+
afbad37 feat: Setup desktop app
43+
40bf54e feat: Setup wails desktop app ui
44+
34f4697 Setup database
45+
0970a33 Update config
46+
e11e404 Delete config when user stop service
47+
5a8fa70 Change the name to picasa
48+
1e6f088 Update README.md
49+
3471475 Update README.md
50+
e7a9020 Update README.md
51+
2c34e9b Update Makefile
52+
e1196cb Merge remote-tracking branch 'origin/master'
53+
2f2f52d Add build file
54+
d84ceee Update README.md
55+
8f9a0c8 Merge pull request #1 from iamhabbeboy/add-code-of-conduct-1
56+
94a3c83 Create CODE_OF_CONDUCT.md
57+
5a77dba Fix bugfixes
58+
6a99005 Remove build file
59+
db75529 Add Makefile
60+
1188c06 Add app name to reduce DRY
61+
119576c Update unsplash api logic
62+
e02198c Rename pkg to internal
63+
e46d101 Update typo word
64+
9237381 Update util
65+
2c90a4b Update config command to update configuration
66+
9f855b6 Add stop cronjob services
67+
c0732a7 Update modules
68+
2e0f13b Refactoring code
69+
5e9b9cc Merge remote-tracking branch 'origin/master'
70+
bad4f0d Check if cron already exist
71+
c827dc5 Add service test
72+
deef317 Create go.yml
73+
ecb79c0 Add test, clean up code
74+
4b53060 Update config service
75+
6d2b45f Refactoring code
76+
8679bcd Add viper to manage config
77+
4853764 Merge remote-tracking branch 'origin/master'
78+
95d0bb4 Add new command
79+
d13b4f5 Update README.md
80+
e141749 Create image directory on command entry
81+
24a539b Merge remote-tracking branch 'origin/master'
82+
1717b30 Initial commit
83+
43932b4 Initial commit

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.9bc68c4f.js"></script>
14-
<link rel="stylesheet" href="/assets/index.ed68e1a6.css">
13+
<script type="module" crossorigin src="/assets/index.01ebe55a.js"></script>
14+
<link rel="stylesheet" href="/assets/index.9759aaa1.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: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<script type="ts">
2-
import { routes } from "./routes";
3-
import Router from "svelte-spa-router";
2+
import Main from './pages/Main.svelte';
3+
import Setting from './pages/Setting.svelte';
4+
import { Router, Route } from 'svelte-routing';
5+
export let url = '';
46
</script>
57

68
<main>
7-
<Router {routes} />
9+
<Router {url}>
10+
<Route path="/setting" component={Setting} />
11+
<Route path="/"><Main /></Route>
12+
</Router>
813
</main>

frontend/src/components/ImageConfig.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script type="ts">
2-
import Image from "../assets/images/no-image.svg";
2+
import Image from '../assets/images/no-image.svg';
33
44
async function handleDownloadImages() {
55
// --
6-
console.log("Hello, world");
6+
console.log('Hello, world');
77
}
88
</script>
99

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<script>
2-
import { link } from "svelte-spa-router";
2+
import { link } from 'svelte-routing';
33
4-
import IconifyIcon from "@iconify/svelte";
5-
6-
let defaultLink = "/";
4+
import IconifyIcon from '@iconify/svelte';
75
</script>
86

97
<template>
108
<div>
119
<div class="mt-0 p-10 text-left">
1210
<a
1311
class="no-underline pl-3 text-gray-600 dark:text-white flex"
14-
href={""}
15-
use:link={defaultLink}
12+
href={'/'}
13+
use:link
1614
>
1715
<IconifyIcon
1816
icon="bi:arrow-left"
@@ -23,12 +21,3 @@
2321
<slot />
2422
</div>
2523
</template>
26-
27-
<style>
28-
.nav-link {
29-
margin-top: 30px;
30-
padding: 20px;
31-
text-align: left;
32-
font-size: 18px;
33-
}
34-
</style>

frontend/src/components/Modal.svelte

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import { SetWallpaper } from '../../wailsjs/go/main/App.js';
66
import { BrowserOpenURL } from '../../wailsjs/runtime';
77
8-
let path = '';
8+
export let path: string;
9+
let image: string = 'dsfsdf';
910
1011
function getUsername(imageFileName: string) {
1112
const [_, user] = imageFileName.split('_@');
@@ -17,12 +18,12 @@
1718
return `@${u}`;
1819
}
1920
20-
imagePathStore.subscribe((value) => {
21+
/*imagePathStore.subscribe((value) => {
2122
path = value;
22-
});
23+
});*/
2324
2425
const closeModal = () => {
25-
imagePathStore.update((value) => (value = ''));
26+
path = '';
2627
return;
2728
};
2829
@@ -45,33 +46,28 @@
4546

4647
<template>
4748
<div>
49+
<p class="text-red-900">{image} wallpaper here</p>
4850
{#if path !== ''}
4951
<div
5052
class="modal-background"
5153
on:click={closeModal}
5254
on:keydown={handleKeydown}
53-
transition:fade|global={{ duration: 300 }}
5455
>
55-
<div
56-
transition:fade|global={{ duration: 300 }}
57-
class="modal"
58-
on:click|stopPropagation
59-
on:keydown|stopPropagation
60-
>
56+
<div class="modal" on:click|stopPropagation on:keydown|stopPropagation>
6157
<div class="layout">
6258
<button
6359
class=" p-2 text-sm underline bg-transparent text-gray-900 hover:text-gray-600"
6460
on:click={() => setAsWallpaper(path)}>Set as wallpaper</button
6561
>
66-
<a href="#" class="close-btn" on:click|preventDefault={closeModal}>
62+
<a href="#/" class="close-btn" on:click|preventDefault={closeModal}>
6763
<img src={CloseIcon} width="20" alt="close icon" />
6864
</a>
6965
</div>
7066
{#if getUsername(path) !== ''}
7167
<div class="align-left text-gray-700 text-xs py-2">
7268
<span class="mr-3"
7369
>Credit: <a
74-
href="#"
70+
href="#/"
7571
on:click={() => openBrowser('unsplash.com')}>Unsplash</a
7672
></span
7773
>
@@ -80,7 +76,7 @@
8076
>Author: <a
8177
on:click={() =>
8278
openBrowser(`unsplash.com/${getUsername(path)}`)}
83-
href="#"
79+
href="#/"
8480
class="underline hover:no-underline"
8581
>{getUsername(path)}
8682
</a></span

frontend/src/pages/Main.svelte

Lines changed: 11 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
<script lang="ts">
2-
import {
3-
GetDownloadedImages,
4-
SelectImageDir,
5-
DownloadImages,
6-
} from '../../wailsjs/go/main/App.js';
7-
8-
import rpc from '../rpc';
9-
import { replace, link } from 'svelte-spa-router';
2+
import { link } from 'svelte-routing';
103
import Modal from '../components/Modal.svelte';
114
import { imagePathStore } from '../store/app';
125
import { onMount } from 'svelte';
136
import ImageConfig from '../components/ImageConfig.svelte';
147
import DownloadImage from '../../src/assets/images/download.svg';
158
import ConfigImage from '../../src/assets/images/config.svg';
169
17-
import LoaderImage from '../../src/assets/images/loader.svg';
10+
import Navigation from '../components/Navigation.svelte';
11+
import ListImages from '../components/ListImages.svelte';
1812
1913
let images: string[] = [];
2014
let path: string;
@@ -26,112 +20,26 @@
2620
});
2721
2822
function dispatcher(image: string) {
23+
console.log('Clicked...');
2924
imagePathStore.set(image);
3025
}
3126
32-
async function handleOpenSelectFolder() {
33-
const path = await SelectImageDir();
34-
images = path;
35-
isFolderSelected = true;
36-
}
37-
38-
async function downloadImages() {
39-
try {
40-
isLoading = true;
41-
const res = await DownloadImages();
42-
} catch (e) {
43-
} finally {
44-
const result = await GetDownloadedImages();
45-
images = result ?? [];
46-
isLoading = false;
47-
}
48-
}
49-
5027
const disableRightClick = (event) => {
5128
event.preventDefault();
5229
};
5330
5431
onMount(async (): Promise<any> => {
55-
const result = await GetDownloadedImages();
56-
images = result ?? [];
57-
isLoading = false;
58-
59-
rpc.on('shortcut.page.setting', () => {
60-
replace('/setting');
61-
});
62-
63-
document.addEventListener('contextmenu', disableRightClick);
64-
65-
return () => {
32+
//document.addEventListener('contextmenu', disableRightClick);
33+
/*return () => {
6634
document.removeEventListener('contextmenu', disableRightClick);
67-
};
35+
};*/
6836
});
6937
</script>
7038

7139
<template>
72-
<div
73-
class="image-config border-b dark:border-gray-600 flex justify-between"
74-
on:contextmenu={disableRightClick}
75-
>
76-
<a
77-
href="#"
78-
on:click={downloadImages}
79-
class="dark:text-gray-50 text-gray-500 text-xs flex"
80-
>
81-
<img
82-
src={DownloadImage}
83-
width="15"
84-
alt=""
85-
class="mr-1 dark:brightness-0 dark:invert-[1]"
86-
/> Download images</a
87-
>
88-
<a
89-
href="/setting"
90-
class=" text-xs flex text-gray-500 dark:text-gray-50"
91-
use:link
92-
>
93-
<img
94-
src={ConfigImage}
95-
width="15"
96-
alt=""
97-
class="mr-1 dark:brightness-0 dark:invert-[1]"
98-
/> Config
99-
</a>
100-
</div>
101-
<section class=" w-[95%] mx-auto mt-3">
102-
{#if isLoading}
103-
<div class="mx-auto w-48 h-screen flex justify-center items-center">
104-
<img src={LoaderImage} alt="" />
105-
<h4 class="font-bold">Processing...</h4>
106-
</div>
107-
{:else}
108-
<div class="flex flex-wrap justify-between">
109-
{#each images as image}
110-
<div
111-
class="bg-gray-800 w-[300px] h-[300px] mb-3 cursor-pointer"
112-
on:click={() => dispatcher(image)}
113-
on:keydown={() => dispatcher(image)}
114-
>
115-
<img
116-
src={image.toString()}
117-
alt=""
118-
class="object-cover h-[100%] w-[100%]"
119-
/>
120-
</div>
121-
{/each}
122-
</div>
123-
{/if}
124-
<Modal />
125-
</section>
40+
<div on:contextmenu={disableRightClick}>
41+
<Navigation />
12642

127-
{#if images.length === 0}
128-
<ImageConfig on:click={handleOpenSelectFolder} />
129-
{/if}
43+
<ListImages />
44+
</div>
13045
</template>
131-
132-
<style>
133-
.image-config {
134-
padding: 10px;
135-
text-align: left;
136-
}
137-
</style>

frontend/src/routes.ts

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

0 commit comments

Comments
 (0)