Skip to content

Commit 1c7e797

Browse files
committed
Lotta of freaking changes 😎😎😎
No chnages in code or implementation, just file & codebase re-arrangements. Factoring for wails desktop app. Signed-off-by: tobigiwa <[email protected]>
1 parent 5084c74 commit 1c7e797

File tree

1,782 files changed

+590803
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,782 files changed

+590803
-68
lines changed
File renamed without changes.

β€Žfrontend/go.mod β€Žagent/go.mod

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
module frontend
1+
module agent
22

33
go 1.22.1
44

55
replace pkg v0.0.0 => ../pkg
66

77
require (
88
github.com/a-h/templ v0.2.747
9+
github.com/go-echarts/go-echarts/v2 v2.4.0-rc2
10+
github.com/google/uuid v1.6.0
911
pkg v0.0.0
1012
)
1113

@@ -14,7 +16,6 @@ require (
1416
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4 // indirect
1517
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect
1618
github.com/godbus/dbus/v5 v5.1.0 // indirect
17-
github.com/google/uuid v1.6.0 // indirect
1819
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
1920
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
2021
golang.org/x/sys v0.21.0 // indirect

β€Žfrontend/go.sum β€Žagent/go.sum

+10
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ github.com/BurntSushi/xgb v0.0.0-20210121224620-deaf085860bc h1:7D+Bh06CRPCJO3gr
22
github.com/BurntSushi/xgb v0.0.0-20210121224620-deaf085860bc/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
33
github.com/a-h/templ v0.2.747 h1:D0dQ2lxC3W7Dxl6fxQ/1zZHBQslSkTSvl5FxP/CfdKg=
44
github.com/a-h/templ v0.2.747/go.mod h1:69ObQIbrcuwPCU32ohNaWce3Cb7qM5GMiqN1K+2yop4=
5+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
6+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
57
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4 h1:ygs9POGDQpQGLJPlq4+0LBUmMBNox1N4JSpw+OETcvI=
68
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4/go.mod h1:0W7dI87PvXJ1Sjs0QPvWXKcQmNERY77e8l7GFhZB/s4=
9+
github.com/go-echarts/go-echarts/v2 v2.4.0-rc2 h1:Od2aC5TsRf+HKoh0MHkdg2zIUXPfzB9GC4kEWTLSHAk=
10+
github.com/go-echarts/go-echarts/v2 v2.4.0-rc2/go.mod h1:56YlvzhW/a+du15f3S2qUGNDfKnFOeJSThBIrVFHDtI=
711
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/OqtnntR4DfOY2+BgwR60cAcu/i3SE=
812
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10=
913
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
@@ -14,8 +18,14 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
1418
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1519
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
1620
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
21+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
22+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
23+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
24+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
1725
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk=
1826
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o=
1927
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
2028
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
2129
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
30+
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
31+
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
File renamed without changes.
File renamed without changes.
File renamed without changes.

β€Žbrowser/server/closeConn.handler.go β€Žagent/internal/backend/closeConn.handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package webserver
1+
package backend
22

33
import (
44
"context"

β€Žbrowser/server/errors.go β€Žagent/internal/backend/errors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package webserver
1+
package backend
22

33
import (
44
"fmt"

β€Žbrowser/server/handler.day.dayStat.go β€Žagent/internal/backend/handler.day.dayStat.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
package webserver
1+
package backend
22

33
import (
4+
"agent/internal/backend/chart"
45
"context"
56
"errors"
67
"fmt"
78
"net/http"
8-
"pkg/chart"
99
helperFuncs "pkg/helper"
1010
"pkg/types"
1111
"strings"
1212

13-
views "views/components"
13+
views "agent/internal/frontend/components"
1414

1515
"github.com/a-h/templ"
1616
)

β€Žbrowser/server/handler.page.index.go β€Žagent/internal/backend/handler.page.index.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package webserver
1+
package backend
22

33
import (
4+
views "agent/internal/frontend/components"
45
"context"
56
"log/slog"
67
"net/http"
7-
views "views/components"
88
)
99

1010
func (a *App) IndexPageHandler(w http.ResponseWriter, r *http.Request) {

β€Žbrowser/server/handler.page.tasks.go β€Žagent/internal/backend/handler.page.tasks.go

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package webserver
1+
package backend
22

33
import (
44
"context"
@@ -9,7 +9,7 @@ import (
99
"strings"
1010
"time"
1111

12-
views "views/components"
12+
views "agent/internal/frontend/components"
1313

1414
"github.com/a-h/templ"
1515
"github.com/google/uuid"
@@ -235,6 +235,10 @@ func (a *App) newAppLimitHandler(w http.ResponseWriter, r *http.Request) {
235235
hours, minutes := time.Duration(hrs)*time.Hour, time.Duration(min)*time.Minute
236236

237237
task.AppLimit.Limit = hours.Hours() + minutes.Hours()
238+
if task.AppLimit.Limit <= 0 {
239+
a.clientError(w, http.StatusBadRequest, fmt.Errorf("cannot watch for zero-time limit"))
240+
return
241+
}
238242
task.AppLimit.Today = helperFuncs.Today()
239243
task.UUID = uuid.New()
240244

@@ -243,16 +247,22 @@ func (a *App) newAppLimitHandler(w http.ResponseWriter, r *http.Request) {
243247
ReminderAndLimitRequest: task,
244248
}
245249

246-
if _, err = a.commWithDaemonService(msg); err != nil {
250+
if msg, err = a.commWithDaemonService(msg); err != nil {
247251
if strings.Contains(err.Error(), types.ErrLimitAppExist.Error()) {
252+
// return
248253
}
249254

250255
a.serverError(w, err)
251256
return
252257
}
253-
fmt.Println(r.Method)
254-
http.Redirect(w, r, "/appLimits", http.StatusCreated)
255258

259+
allDailyAppLimitTask := msg.ReminderAndLimitResponse.AllTask
260+
if len(allDailyAppLimitTask) == 0 {
261+
views.RenderTasks(true, templ.NopComponent).Render(context.TODO(), w)
262+
return
263+
}
264+
265+
views.RenderTasks(false, views.AppLimitTasks(allDailyAppLimitTask)).Render(context.TODO(), w)
256266
}
257267

258268
func (a *App) removeTask(w http.ResponseWriter, r *http.Request) {

β€Žbrowser/server/handler.week.appStat.go β€Žagent/internal/backend/handler.week.appStat.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package webserver
1+
package backend
22

33
import (
4+
"agent/internal/backend/chart"
5+
views "agent/internal/frontend/components"
46
"context"
57
"errors"
68
"fmt"
79
"net/http"
8-
"pkg/chart"
910
"pkg/types"
1011
"strings"
11-
views "views/components"
1212

1313
"github.com/a-h/templ"
1414
)

β€Žbrowser/server/handler.week.setCategory.go β€Žagent/internal/backend/handler.week.setCategory.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package webserver
1+
package backend
22

33
import (
44
"fmt"

β€Žbrowser/server/handler.week.weekStat.go β€Žagent/internal/backend/handler.week.weekStat.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
package webserver
1+
package backend
22

33
import (
4+
"agent/internal/backend/chart"
45
"context"
56
"errors"
67
"fmt"
78
"net/http"
8-
"pkg/chart"
99
"pkg/types"
1010
"strings"
1111
"time"
1212

1313
helperFuncs "pkg/helper"
1414

15-
views "views/components"
15+
views "agent/internal/frontend/components"
1616

1717
"github.com/a-h/templ"
1818
)

β€Žbrowser/server/routes.go β€Žagent/internal/backend/routes.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package webserver
1+
package backend
22

33
import "net/http"
44

@@ -8,7 +8,7 @@ func (a *App) Routes() *http.ServeMux {
88
tmp := http.FileServer(http.Dir("/tmp/"))
99
mux.Handle("/tmp/", http.StripPrefix("/tmp", tmp))
1010

11-
fs := http.FileServer(http.Dir("../frontend/assets"))
11+
fs := http.FileServer(http.Dir("../agent/internal/frontend/assets"))
1212
mux.Handle("/assets/", http.StripPrefix("/assets", fs))
1313

1414
// screentimePage

β€Žbrowser/server/server.go β€Žagent/internal/backend/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package webserver
1+
package backend
22

33
import (
44
"bytes"

β€Žagent/internal/frontend/assets/styles/jquery-ui.min.css

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

β€Žfrontend/components/tasks.index.page.templ β€Žagent/internal/frontend/components/tasks.index.page.templ

+18-15
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ templ TasksPage(taskType string, allApps []types.AppIconCategoryAndCmdLine) {
1111
<link rel="stylesheet" href="/assets/styles/index.css"/>
1212
<link rel="stylesheet" href="/assets/styles/tasks.css"/>
1313
<link rel="stylesheet" href="/assets/styles/dd.min.css"/>
14-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.3/themes/base/jquery-ui.min.css" crossorigin="anonymous" referrerpolicy="no-referrer"/>
15-
// <link rel="styleshhet" href="/assets/styles/jquery-ui.css"/>
16-
<script src="assets/javascript/script.out.js"></script>
17-
<script src="assets/libraries/htmx.min.js"></script>
18-
<script src="assets/libraries/dd.min.js"></script>
19-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.3/jquery-ui.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
20-
// <script src="assets/libraries/jquery-ui.js"></script>
21-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
22-
// <script src="assets/libraries/jquery-3.7.1.js"></script>
14+
// <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.3/themes/base/jquery-ui.min.css" crossorigin="anonymous" referrerpolicy="no-referrer"/>
15+
<link rel="stylesheet" href="/assets/styles/jquery-ui.min.css"/>
16+
<script src="/assets/javascript/script.out.js"></script>
17+
<script src="/assets/libraries/htmx.min.js"></script>
18+
<script src="/assets/libraries/dd.min.js"></script>
19+
// <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
20+
<script src="/assets/libraries/jquery-3.7.1.js"></script>
21+
// <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.3/jquery-ui.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
22+
<script src="/assets/libraries/jquery-ui.js"></script>
2323
<title>ScreenTime</title>
2424
</head>
2525
<body>
@@ -77,22 +77,25 @@ templ reminderAndLimitDialog(allApps []types.AppIconCategoryAndCmdLine) {
7777
modal: true,
7878
buttons: {
7979
"Create AppLimit": function() {
80-
console.log(form[0]);
81-
form[0].submit();
80+
// $("#appLimit-form")[0];
81+
// htmx.trigger(form, 'submit');
82+
appLimitdialog.dialog( "close" );
83+
console.log(createLimitButton)
84+
var createLimitButton = $("#appLimit-form .submit")[0];
85+
createLimitButton.click()
8286
},
8387
Cancel: function() {
8488
appLimitdialog.dialog( "close" );
8589
}
8690
},
8791
close: function() {
88-
form[ 0 ].reset();
92+
form[0].reset();
8993
}
9094
});
9195

9296
form = appLimitdialog.find( "form" );
9397

9498
$("#limit-dialog__btn").button().click(function() {
95-
console.log("clicked");
9699
appLimitdialog.dialog("open");
97100
});
98101
</script>
@@ -294,7 +297,7 @@ templ reminderDialog() {
294297
templ limitDialog(allApp []types.AppIconCategoryAndCmdLine) {
295298
// <dialog class="limit-dialog">
296299
<div id="appLimit-dialog">
297-
<form hx-post="/newAppLimit" hx-swap="none" hx-select-oob="#task-holder:outerHTML">
300+
<form id="appLimit-form" hx-post="/newAppLimit" hx-swap="none" hx-select-oob="#task-holder:outerHTML">
298301
<select
299302
name="app"
300303
is="ms-dropdown"
@@ -350,7 +353,7 @@ templ limitDialog(allApp []types.AppIconCategoryAndCmdLine) {
350353
</div>
351354
</div>
352355
<div class="button-container">
353-
<button type="submit">Create Limit</button>
356+
<button class="submit" type="submit">Create Limit</button>
354357
<button
355358
class="close-modal"
356359
formmethod="dialog"
File renamed without changes.

β€Žagent/internal/frontend/node_modules/.bin/esbuild

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žagent/internal/frontend/node_modules/.package-lock.json

+84
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žagent/internal/frontend/node_modules/@esbuild/linux-x64/README.md

+3
Binary file not shown.

0 commit comments

Comments
Β (0)