Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit d4fdc91

Browse files
committed
webui: Fully migrate root page from AngularJS to React
This makes the root page (i.e. the index page) use React components instead of any AngularJS code. This also removes the old lightbox code which is used on that page.
1 parent 49dda0c commit d4fdc91

File tree

9 files changed

+60
-189
lines changed

9 files changed

+60
-189
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"cypress": "^12.3.0",
66
"react": "^18.2.0",
77
"react-dom": "^18.2.0",
8+
"react-modal-image": "^2.6.0",
89
"react-tabs": "^6.0.0",
910
"yarn": "^1.22.19"
1011
},

webui/css/angular-bootstrap-lightbox.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

webui/js/angular-bootstrap-lightbox-license.txt

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

webui/js/angular-bootstrap-lightbox.min.js

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

webui/js/app.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from "react";
22
import ReactDOM from "react-dom/client";
33

4+
import ModalImage from "react-modal-image";
5+
46
import Auth from "./auth";
57
import DbHeader from "./db-header";
68
import MarkdownEditor from "./markdown-editor";
@@ -22,7 +24,7 @@ import MarkdownEditor from "./markdown-editor";
2224
}
2325

2426
{
25-
document.querySelectorAll('.markdown-editor').forEach((rootNode) => {
27+
document.querySelectorAll(".markdown-editor").forEach((rootNode) => {
2628
const editorId = rootNode.dataset.id;
2729
const rows = rootNode.dataset.rows;
2830
const placeholder = rootNode.dataset.placeholder;
@@ -39,3 +41,19 @@ import MarkdownEditor from "./markdown-editor";
3941
}));
4042
});
4143
}
44+
45+
{
46+
document.querySelectorAll(".lightbox-image").forEach((rootNode) => {
47+
const small = rootNode.dataset.small;
48+
const large = rootNode.dataset.large;
49+
const alt = rootNode.dataset.alt;
50+
51+
const root = ReactDOM.createRoot(rootNode);
52+
root.render(React.createElement(ModalImage, {
53+
small: small,
54+
large: large,
55+
alt: alt
56+
}));
57+
});
58+
59+
}

webui/main.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3192,9 +3192,6 @@ func main() {
31923192
http.Handle("/css/local.css", gz.GzipHandler(logReq(func(w http.ResponseWriter, r *http.Request) {
31933193
http.ServeFile(w, r, filepath.Join(com.Conf.Web.BaseDir, "webui", "css", "local.css"))
31943194
})))
3195-
http.Handle("/css/angular-bootstrap-lightbox.min.css", gz.GzipHandler(logReq(func(w http.ResponseWriter, r *http.Request) {
3196-
http.ServeFile(w, r, filepath.Join(com.Conf.Web.BaseDir, "webui", "css", "angular-bootstrap-lightbox.min.css"))
3197-
})))
31983195

31993196
// Fonts
32003197
http.Handle("/css/FontAwesome.otf", gz.GzipHandler(logReq(func(w http.ResponseWriter, r *http.Request) {
@@ -3229,9 +3226,6 @@ func main() {
32293226
http.Handle("/js/angular-sanitize.min.js.map", gz.GzipHandler(logReq(func(w http.ResponseWriter, r *http.Request) {
32303227
http.ServeFile(w, r, filepath.Join(com.Conf.Web.BaseDir, "webui", "js", "angular-sanitize-1.8.2.min.js.map"))
32313228
})))
3232-
http.Handle("/js/angular-bootstrap-lightbox.min.js", gz.GzipHandler(logReq(func(w http.ResponseWriter, r *http.Request) {
3233-
http.ServeFile(w, r, filepath.Join(com.Conf.Web.BaseDir, "webui", "js", "angular-bootstrap-lightbox.min.js"))
3234-
})))
32353229

32363230
http.Handle("/js/dbhub.js", gz.GzipHandler(logReq(func(w http.ResponseWriter, r *http.Request) {
32373231
http.ServeFile(w, r, filepath.Join(com.Conf.Web.BaseDir, "webui", "js", "dbhub.js"))

webui/templates/headlightbox.html

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

0 commit comments

Comments
 (0)