From c822387863547b3277bdb647c5ffd35ec04a4200 Mon Sep 17 00:00:00 2001 From: Gregory Brzezinski Date: Wed, 22 Mar 2023 21:00:04 +0300 Subject: [PATCH] commit)) --- main.go | 7 ++- .../{apps/finder/app.js => finder/finder.js} | 26 ++++---- resources/wde.js | 18 ++++-- resources/wdeUI.css | 6 ++ templates/about-me/app.tmpl | 20 +++++++ templates/finder/app.tmpl | 10 +++- templates/personal-properties/app.tmpl | 59 +------------------ templates/wde-widgets/file-tile-view.tmpl | 5 ++ templates/wde-widgets/scrollbar.tmpl | 8 +++ 9 files changed, 78 insertions(+), 81 deletions(-) rename resources/sys/{apps/finder/app.js => finder/finder.js} (60%) create mode 100644 templates/about-me/app.tmpl create mode 100644 templates/wde-widgets/file-tile-view.tmpl create mode 100644 templates/wde-widgets/scrollbar.tmpl diff --git a/main.go b/main.go index 6e1dc4e..aeec993 100644 --- a/main.go +++ b/main.go @@ -90,7 +90,12 @@ func main() { ctx.HTML(http.StatusOK, "personal-properties/app.tmpl", persPropsApp.Render()) }) } - + finderAppRoute := app.Group("finder") + { + finderAppRoute.GET("render", func(ctx *gin.Context) { + ctx.HTML(http.StatusOK, "finder/app.tmpl", finderApp.Render()) + }) + } } router.GET("/test", func(ctx *gin.Context) { ctx.HTML(200, "kek/kek.tmpl", gin.H{}) diff --git a/resources/sys/apps/finder/app.js b/resources/sys/finder/finder.js similarity index 60% rename from resources/sys/apps/finder/app.js rename to resources/sys/finder/finder.js index a07ccfa..c63081c 100644 --- a/resources/sys/apps/finder/app.js +++ b/resources/sys/finder/finder.js @@ -1,25 +1,28 @@ - - class Finder{ appId = "finder" /** * @param {HTMLElement} appElem */ constructor(appElem){ - this.appElem = appElem + this.appElem = appElem } - Init(){ + NewWindow(){ console.log("Init") - fetch(`${window.location.origin}/application/${this.appId}/render`) //TODO Move to wde func + fetch(`${window.location.origin}/application/${this.appId}/render`) //TODO Move to wde func. Or Not? .then((response) => response.text()) .then((html) => { - let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Finder", 600, 500) + // console.log(document.body) + // let heigth = Math.max(document.body.clientHeight*0.8, scrollDiv.children[0].scrollHeight) //TODO + let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Personal Properties", 500, 400 ) newWindow.innerHTML = html - let closeButton = newWindow.children[0].children[0] + + // let scrollDiv = newWindow.children[1] + // let scrollBar = new WdeScrollBar(scrollDiv.children[1].children[0], scrollDiv.children[0]) + let closeButton = newWindow.children[0].children[0] closeButton.addEventListener('click', function (params) { WebDesktopEnvironment.CloseWindow(newWindow) }) @@ -28,13 +31,4 @@ class Finder{ WebDesktopEnvironment.Alert(error); }); } - - CloseWindow(id){ - console.log(id+"Close") - } - } - -function reply_click(){ - console.log("QQQQQQQQQQQQQQQQQQQ") -} \ No newline at end of file diff --git a/resources/wde.js b/resources/wde.js index 415ef0b..c2fdda7 100644 --- a/resources/wde.js +++ b/resources/wde.js @@ -12,8 +12,8 @@ class WebDesktopEnvironment{ .then((response) => response.text()) .then((html) => { WebDesktopEnvironment.SetBasicWindow(html) - let app = this.loadApp("personal-properties") - // let finder = this.loadApp("finder") + // let app = this.loadApp("personal-properties") + let finder = this.loadApp("finder") }) .catch((error) => { WebDesktopEnvironment.Alert(error); @@ -36,8 +36,17 @@ class WebDesktopEnvironment{ script.setAttribute("async", "false") appElem.appendChild(script) script.addEventListener("load", function () { - let newApp = new PersonalProperties(appElem) - newApp.Init() + newApp + switch (appId) { + case "finder": + let newApp = new Finder(appElem) + newApp.NewWindow() + break; + + default: + break; + } + }, false) } @@ -157,4 +166,3 @@ class WindowsCompositor{ element.style.top = (posY - element.children[0].clientHeight*0.5) + "px"; } } - diff --git a/resources/wdeUI.css b/resources/wdeUI.css index 93c9320..c294390 100644 --- a/resources/wdeUI.css +++ b/resources/wdeUI.css @@ -197,4 +197,10 @@ /* TODO white pixels in rows start */ filter: drop-shadow(1px 1px 0px #333399); +} + + +.FileTileView{ + width: 100%; + height: 100%; } \ No newline at end of file diff --git a/templates/about-me/app.tmpl b/templates/about-me/app.tmpl new file mode 100644 index 0000000..62c52a2 --- /dev/null +++ b/templates/about-me/app.tmpl @@ -0,0 +1,20 @@ +{{ define "about-me/app.tmpl" }} + +
+
+
+ +
+
+ About me +
+
+
+
+
+ TEST CONTENT +
+ {{template "wde-widgets/scrollbar.tmpl" .}} +
+
+{{ end }} \ No newline at end of file diff --git a/templates/finder/app.tmpl b/templates/finder/app.tmpl index 3bdce64..6a42c0d 100644 --- a/templates/finder/app.tmpl +++ b/templates/finder/app.tmpl @@ -1,5 +1,13 @@ {{ define "finder/app.tmpl" }} - Test Finder +
+ +
+
+ Files +
+
+
+ {{template "wde-widgets/file-tile-view.tmpl" .}} {{ end }} \ No newline at end of file diff --git a/templates/personal-properties/app.tmpl b/templates/personal-properties/app.tmpl index 195d5f4..3390786 100644 --- a/templates/personal-properties/app.tmpl +++ b/templates/personal-properties/app.tmpl @@ -49,65 +49,8 @@ {{ end }}
-
-
-
-
-
-
- - + {{template "wde-widgets/scrollbar.tmpl" .}} - - {{ end }} \ No newline at end of file diff --git a/templates/wde-widgets/file-tile-view.tmpl b/templates/wde-widgets/file-tile-view.tmpl new file mode 100644 index 0000000..e690268 --- /dev/null +++ b/templates/wde-widgets/file-tile-view.tmpl @@ -0,0 +1,5 @@ +{{ define "wde-widgets/file-tile-view.tmpl" }} +
+ +
+{{ end }} \ No newline at end of file diff --git a/templates/wde-widgets/scrollbar.tmpl b/templates/wde-widgets/scrollbar.tmpl new file mode 100644 index 0000000..4dc0cde --- /dev/null +++ b/templates/wde-widgets/scrollbar.tmpl @@ -0,0 +1,8 @@ +{{ define "wde-widgets/scrollbar.tmpl" }} +
+
+
+
+
+
+{{ end }} \ No newline at end of file