Skip to content

Commit b9616c5

Browse files
committed
feat(angelaweb): add dark mode
1 parent 3341ed5 commit b9616c5

File tree

12 files changed

+516
-280
lines changed

12 files changed

+516
-280
lines changed

go.mod

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ require (
1919
github.com/go-kratos/kratos/contrib/log/zap/v2 v2.0.0-20250321075247-025c2dc2b0ff
2020
github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20250321075247-025c2dc2b0ff
2121
github.com/go-kratos/kratos/v2 v2.8.4
22+
github.com/gofiber/contrib/fiberi18n/v2 v2.0.6
2223
github.com/gofiber/fiber/v2 v2.52.6
2324
github.com/gofiber/template/html/v2 v2.1.3
2425
github.com/golang-jwt/jwt/v5 v5.2.2
@@ -32,6 +33,7 @@ require (
3233
github.com/mattn/go-sqlite3 v1.14.24
3334
github.com/meilisearch/meilisearch-go v0.31.0
3435
github.com/minio/minio-go/v7 v7.0.89
36+
github.com/nicksnyder/go-i18n/v2 v2.6.0
3537
github.com/redis/go-redis/v9 v9.7.3
3638
github.com/samber/lo v1.49.1
3739
github.com/sony/sonyflake v1.2.0
@@ -52,6 +54,7 @@ require (
5254
go.uber.org/ratelimit v0.3.1
5355
go.uber.org/zap v1.27.0
5456
golang.org/x/crypto v0.36.0
57+
golang.org/x/text v0.23.0
5558
google.golang.org/grpc v1.71.0
5659
google.golang.org/protobuf v1.36.6
5760
gopkg.in/natefinch/lumberjack.v2 v2.2.1
@@ -154,7 +157,7 @@ require (
154157
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
155158
github.com/pkg/errors v0.9.1 // indirect
156159
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
157-
github.com/rivo/uniseg v0.2.0 // indirect
160+
github.com/rivo/uniseg v0.4.4 // indirect
158161
github.com/robfig/cron/v3 v3.0.1 // indirect
159162
github.com/rs/cors v1.8.3 // indirect
160163
github.com/rs/xid v1.6.0 // indirect
@@ -188,11 +191,11 @@ require (
188191
golang.org/x/net v0.37.0 // indirect
189192
golang.org/x/sync v0.12.0 // indirect
190193
golang.org/x/sys v0.31.0 // indirect
191-
golang.org/x/text v0.23.0 // indirect
192194
golang.org/x/tools v0.30.0 // indirect
193195
google.golang.org/appengine v1.6.8 // indirect
194196
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
195197
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
198+
gopkg.in/yaml.v2 v2.4.0 // indirect
196199
gopkg.in/yaml.v3 v3.0.1 // indirect
197200
nhooyr.io/websocket v1.8.7 // indirect
198201
)

go.sum

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
259259
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
260260
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
261261
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
262+
github.com/gofiber/contrib/fiberi18n/v2 v2.0.6 h1:DYVQwDCtMqRpuudpUx7XzpUF8bhfLKb8qdtRiOUqsmg=
263+
github.com/gofiber/contrib/fiberi18n/v2 v2.0.6/go.mod h1:GipSwS+5lSmIBPsee482o6mA2rdH0RqST6F092Us7uc=
262264
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
263265
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
264266
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
@@ -555,6 +557,8 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE
555557
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
556558
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
557559
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
560+
github.com/nicksnyder/go-i18n/v2 v2.6.0 h1:C/m2NNWNiTB6SK4Ao8df5EWm3JETSTIGNXBpMJTxzxQ=
561+
github.com/nicksnyder/go-i18n/v2 v2.6.0/go.mod h1:88sRqr0C6OPyJn0/KRNaEz1uWorjxIKP7rUUcvycecE=
558562
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
559563
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
560564
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
@@ -626,8 +630,9 @@ github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
626630
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
627631
github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM=
628632
github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA=
629-
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
630633
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
634+
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
635+
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
631636
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
632637
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
633638
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
@@ -1076,8 +1081,9 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
10761081
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
10771082
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
10781083
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
1079-
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
10801084
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
1085+
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
1086+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
10811087
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10821088
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10831089
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
@import "tailwindcss";
1+
@import "tailwindcss";
2+
3+
@custom-variant dark (&:where(.dark, .dark *));

internal/service/angelaweb/static/css/style.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,44 @@
1-
<div class="mb-6">
2-
<h2 class="text-2xl font-bold mb-4">{{localize .Ctx "ConfigTitle"}}</h2>
3-
<p class="text-gray-600 mb-4">{{localize .Ctx "ConfigDescription"}}</p>
4-
</div>
1+
<div class="p-6 max-w-7xl mx-auto">
2+
<div class="mb-6">
3+
<h2 class="text-2xl font-bold text-slate-900 dark:text-slate-100 mb-4">{{localize .Ctx "ConfigTitle"}}</h2>
4+
<p class="text-slate-600 dark:text-slate-300 mb-4">{{localize .Ctx "ConfigDescription"}}</p>
5+
</div>
56

6-
<div class="overflow-x-auto">
7-
<table class="min-w-full bg-white border border-gray-200">
8-
<thead>
9-
<tr class="bg-gray-100">
10-
<th class="py-2 px-4 border-b border-r text-left">{{localize .Ctx "Service"}}</th>
11-
<th class="py-2 px-4 border-b border-r text-left">{{localize .Ctx "Status"}}</th>
12-
</tr>
13-
</thead>
14-
<tbody>
15-
{{range .Configs}}
16-
<tr class="hover:bg-gray-50">
17-
<td class="py-2 px-4 border-b border-r">{{.Name}}</td>
18-
<td class="py-2 px-4 border-b border-r font-mono">{{.Status}}</td>
19-
</tr>
20-
{{else}}
21-
<tr>
22-
<td colspan="4" class="py-4 text-center text-gray-500">{{localize .Ctx "NoConfigData"}}</td>
23-
</tr>
24-
{{end}}
25-
</tbody>
26-
</table>
7+
<div class="bg-white dark:bg-slate-800 rounded-lg shadow-lg border border-slate-200 dark:border-slate-700 overflow-hidden">
8+
<div class="overflow-x-auto">
9+
<table class="min-w-full divide-y divide-slate-200 dark:divide-slate-700">
10+
<thead>
11+
<tr class="bg-slate-50 dark:bg-slate-700">
12+
<th class="px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider">{{localize .Ctx "Service"}}</th>
13+
<th class="px-6 py-3 text-left text-xs font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wider">{{localize .Ctx "Status"}}</th>
14+
</tr>
15+
</thead>
16+
<tbody class="bg-white dark:bg-slate-800 divide-y divide-slate-200 dark:divide-slate-700">
17+
{{range .Configs}}
18+
<tr class="hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors duration-200">
19+
<td class="px-6 py-4 whitespace-nowrap text-sm text-slate-900 dark:text-slate-100">{{.Name}}</td>
20+
<td class="px-6 py-4 whitespace-nowrap">
21+
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
22+
{{if eq .Status "Running"}}
23+
bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200
24+
{{else if eq .Status "Stopped"}}
25+
bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200
26+
{{else}}
27+
bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200
28+
{{end}}">
29+
{{.Status}}
30+
</span>
31+
</td>
32+
</tr>
33+
{{else}}
34+
<tr>
35+
<td colspan="2" class="px-6 py-4 text-center text-sm text-slate-500 dark:text-slate-400">
36+
{{localize .Ctx "NoConfigData"}}
37+
</td>
38+
</tr>
39+
{{end}}
40+
</tbody>
41+
</table>
42+
</div>
43+
</div>
2744
</div>
Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
1-
<div class="mb-6">
2-
<h2 class="text-2xl font-bold mb-4">{{localize .Ctx "DashboardTitle"}}</h2>
3-
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
4-
<div class="bg-blue-500 text-white rounded-lg p-6 shadow-md">
5-
<h3 class="text-lg font-semibold mb-2">{{localize .Ctx "TotalUsers"}}</h3>
6-
<p class="text-3xl font-bold">{{.UserCount}}</p>
1+
<div class="space-y-6">
2+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
3+
<div class="bg-white dark:bg-slate-900 rounded-lg border border-slate-200 dark:border-slate-700 shadow-lg">
4+
<div class="p-6">
5+
<h3 class="text-lg font-medium text-slate-900 dark:text-slate-100">{{localize .Ctx "UserStatistics"}}</h3>
6+
<dl class="mt-5 grid grid-cols-1 gap-5">
7+
<div class="relative overflow-hidden rounded-lg bg-slate-50 dark:bg-slate-800 px-4 py-5">
8+
<dt class="truncate text-sm font-medium text-slate-700 dark:text-slate-200">{{localize .Ctx "TotalUsers"}}</dt>
9+
<dd class="mt-1">
10+
<p class="text-2xl font-semibold text-blue-600 dark:text-blue-300">{{.UserCount}}</p>
11+
</dd>
12+
</div>
13+
<div class="relative overflow-hidden rounded-lg bg-slate-50 dark:bg-slate-800 px-4 py-5">
14+
<dt class="truncate text-sm font-medium text-slate-700 dark:text-slate-200">{{localize .Ctx "ActiveUsers"}}</dt>
15+
<dd class="mt-1">
16+
<p class="text-2xl font-semibold text-blue-600 dark:text-blue-300">{{.ActiveUserCount}}</p>
17+
</dd>
18+
</div>
19+
</dl>
20+
</div>
721
</div>
822
</div>
9-
</div>
1023

11-
<div>
12-
<h2 class="text-2xl font-bold mb-4">{{localize .Ctx "QuickActions"}}</h2>
13-
<div class="flex space-x-4">
14-
<a href="/users" class="bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded transition duration-200">
15-
{{localize .Ctx "ViewUserList"}}
16-
</a>
17-
<a href="/users/new" class="bg-green-500 hover:bg-green-600 text-white font-semibold py-2 px-4 rounded transition duration-200">
18-
{{localize .Ctx "CreateNewUser"}}
19-
</a>
24+
<div class="bg-white dark:bg-slate-900 rounded-lg border border-slate-200 dark:border-slate-700 shadow-lg p-6">
25+
<h3 class="text-lg font-medium text-slate-900 dark:text-slate-100 mb-4">{{localize .Ctx "QuickActions"}}</h3>
26+
<div class="flex flex-wrap gap-4">
27+
<a href="/users" class="inline-flex items-center px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white font-medium rounded-lg transition duration-200">
28+
<svg class="h-5 w-5 mr-2" viewBox="0 0 24 24" fill="currentColor">
29+
<path d="M12 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM6 8a6 6 0 1 1 12 0A6 6 0 0 1 6 8zm2 10a3 3 0 0 0-3 3 1 1 0 1 1-2 0 5 5 0 0 1 5-5h8a5 5 0 0 1 5 5 1 1 0 1 1-2 0 3 3 0 0 0-3-3H8z"/>
30+
</svg>
31+
{{localize .Ctx "ViewUserList"}}
32+
</a>
33+
<a href="/users/new" class="inline-flex items-center px-4 py-2 bg-green-500 hover:bg-green-600 text-white font-medium rounded-lg transition duration-200">
34+
<svg class="h-5 w-5 mr-2" viewBox="0 0 24 24" fill="currentColor">
35+
<path d="M12 4v16m8-8H4"/>
36+
</svg>
37+
{{localize .Ctx "CreateNewUser"}}
38+
</a>
39+
</div>
2040
</div>
2141
</div>

internal/service/angelaweb/view/error.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<div class="min-h-[70vh] flex flex-col justify-center items-center px-6 py-12">
22
<div class="text-center">
3-
<h2 class="text-3xl font-bold text-gray-900 mb-4">{{if eq .ErrorType "not_found"}}{{localize .Ctx "PageNotFound"}}{{else}}{{localize .Ctx "TokenExpired"}}{{end}}</h2>
4-
<p class="text-lg text-gray-600 mb-8">{{if eq .ErrorType "not_found"}}{{localize .Ctx "PageNotFoundMessage"}}{{else}}{{localize .Ctx "TokenExpiredMessage"}}{{end}}</p>
3+
<h2 class="text-3xl font-bold text-slate-900 dark:text-slate-50 mb-4">{{if eq .ErrorType "not_found"}}{{localize .Ctx "PageNotFound"}}{{else}}{{localize .Ctx "TokenExpired"}}{{end}}</h2>
4+
<p class="text-lg text-slate-600 dark:text-slate-300 mb-8">{{if eq .ErrorType "not_found"}}{{localize .Ctx "PageNotFoundMessage"}}{{else}}{{localize .Ctx "TokenExpiredMessage"}}{{end}}</p>
55

66
<div class="flex justify-center space-x-4">
77
{{if eq .ErrorType "token_expired"}}
8-
<a href="/login" class="bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-6 rounded-md transition duration-200">
8+
<a href="/login" class="bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-6 rounded-lg transition duration-200">
99
{{localize .Ctx "Login"}}
1010
</a>
1111
{{end}}
1212

13-
<a href="/" class="bg-gray-200 hover:bg-gray-300 text-gray-800 font-semibold py-2 px-6 rounded-md transition duration-200">
13+
<a href="/" class="bg-slate-100 hover:bg-slate-200 text-slate-800 font-semibold py-2 px-6 rounded-lg transition duration-200 dark:bg-slate-800 dark:hover:bg-slate-700 dark:text-slate-100">
1414
{{localize .Ctx "BackToHome"}}
1515
</a>
1616
</div>

0 commit comments

Comments
 (0)