This commit is contained in:
Gregory Brzezinski 2023-03-22 21:00:04 +03:00
parent b261e43465
commit c822387863
9 changed files with 78 additions and 81 deletions

View File

@ -90,7 +90,12 @@ func main() {
ctx.HTML(http.StatusOK, "personal-properties/app.tmpl", persPropsApp.Render()) 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) { router.GET("/test", func(ctx *gin.Context) {
ctx.HTML(200, "kek/kek.tmpl", gin.H{}) ctx.HTML(200, "kek/kek.tmpl", gin.H{})

View File

@ -1,25 +1,28 @@
class Finder{ class Finder{
appId = "finder" appId = "finder"
/** /**
* @param {HTMLElement} appElem * @param {HTMLElement} appElem
*/ */
constructor(appElem){ constructor(appElem){
this.appElem = appElem this.appElem = appElem
} }
Init(){ NewWindow(){
console.log("Init") 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((response) => response.text())
.then((html) => { .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 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) { closeButton.addEventListener('click', function (params) {
WebDesktopEnvironment.CloseWindow(newWindow) WebDesktopEnvironment.CloseWindow(newWindow)
}) })
@ -28,13 +31,4 @@ class Finder{
WebDesktopEnvironment.Alert(error); WebDesktopEnvironment.Alert(error);
}); });
} }
CloseWindow(id){
console.log(id+"Close")
}
} }
function reply_click(){
console.log("QQQQQQQQQQQQQQQQQQQ")
}

View File

@ -12,8 +12,8 @@ class WebDesktopEnvironment{
.then((response) => response.text()) .then((response) => response.text())
.then((html) => { .then((html) => {
WebDesktopEnvironment.SetBasicWindow(html) WebDesktopEnvironment.SetBasicWindow(html)
let app = this.loadApp("personal-properties") // let app = this.loadApp("personal-properties")
// let finder = this.loadApp("finder") let finder = this.loadApp("finder")
}) })
.catch((error) => { .catch((error) => {
WebDesktopEnvironment.Alert(error); WebDesktopEnvironment.Alert(error);
@ -36,8 +36,17 @@ class WebDesktopEnvironment{
script.setAttribute("async", "false") script.setAttribute("async", "false")
appElem.appendChild(script) appElem.appendChild(script)
script.addEventListener("load", function () { script.addEventListener("load", function () {
let newApp = new PersonalProperties(appElem) newApp
newApp.Init() switch (appId) {
case "finder":
let newApp = new Finder(appElem)
newApp.NewWindow()
break;
default:
break;
}
}, false) }, false)
} }
@ -157,4 +166,3 @@ class WindowsCompositor{
element.style.top = (posY - element.children[0].clientHeight*0.5) + "px"; element.style.top = (posY - element.children[0].clientHeight*0.5) + "px";
} }
} }

View File

@ -197,4 +197,10 @@
/* TODO white pixels in rows start */ /* TODO white pixels in rows start */
filter: drop-shadow(1px 1px 0px #333399); filter: drop-shadow(1px 1px 0px #333399);
}
.FileTileView{
width: 100%;
height: 100%;
} }

View File

@ -0,0 +1,20 @@
{{ define "about-me/app.tmpl" }}
<div class="StandartWindowFrame">
<div>
<div class="StandartWindowFrameTopBar">
<button id="closeWindowButton" class="StandartWindowFrameTopBarButton" title="Close Window"></button>
<div id="Drag" class="WindowDragArea"></div>
<div class="StandartWindowFrameTitle">
About me
</div>
<div id="Drag" class="WindowDragArea"></div>
</div>
<div class="ContentBorder">
<div class="ScrollContent">
TEST CONTENT
</div>
{{template "wde-widgets/scrollbar.tmpl" .}}
</div>
</div>
{{ end }}

View File

@ -1,5 +1,13 @@
{{ define "finder/app.tmpl" }} {{ define "finder/app.tmpl" }}
Test Finder <div id="TestWindowHeader" class="WindowFrameTopBar">
<button id="closeWindowButton" class="WindowFrameTopBarButton" title="Close Window"></button>
<div id="Drag" class="WindowDragArea"></div>
<div class="WindowFrameTitle">
Files
</div>
<div id="Drag" class="WindowDragArea"></div>
</div>
{{template "wde-widgets/file-tile-view.tmpl" .}}
{{ end }} {{ end }}

View File

@ -49,65 +49,8 @@
{{ end }} {{ end }}
</div> </div>
</div> </div>
<div class="ScrollbarPlace"> {{template "wde-widgets/scrollbar.tmpl" .}}
<div class="ScrollBarScrollElement">
<div class="ScrollBarScrollElementDrag">
</div>
</div>
</div>
<!-- <div class="TestContent" style="width: 100%; height: auto; background-color: aquamarine;">AAAAAAAAAAAAAA</div>
<div id="ContentFrame " class="ContentFrame">
<div class="Personal-properties-bio">
<img src="res/img/default-avatar-photo-placeholder-profile-picture-vector.jpg" alt="My Photo" style="width: 48px;height: 48px;">
<div class="Personal-properties-textbio">
<div>{{ .Name }}</div>
<div>{{ .BasicBio }}</div>
</div>
</div>
<div id="Test content" style="width: 100%; height: 1000px; background-color: aqua;">
</div>
{{ range $propIsland := .allprops }}
<div id="prop" class="Personal-properties-prop">
<div class="Personal-properties-prop-title">
{{$propIsland.Header}}:
</div>
<div class="Personal-properties-prop-content">
{{range $prop := $propIsland.Props}}
<div class="Personal-properties-prop-row">
<div class="Personal-properties-prop-key">
{{$prop.Key}}:
{{ range $value := $prop.KeyComments }}
<div class="Personal-properties-prop-key-comments">
{{ $value }}
</div>
{{ end }}
</div>
<div class="Personal-properties-prop-values">
{{ range $value := $prop.Values }}
<div class="Personal-properties-prop-value">
{{ $value }}
</div>
{{ end }}
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
</div>
<div class="ScrollbarPlace">
<div class="ScrollBarScrollElement">
<div class="ScrollBarScrollElementDrag">
</div>
</div>
</div> -->
</div> </div>
<!-- </div> -->
{{ end }} {{ end }}

View File

@ -0,0 +1,5 @@
{{ define "wde-widgets/file-tile-view.tmpl" }}
<div class="FileTileView">
</div>
{{ end }}

View File

@ -0,0 +1,8 @@
{{ define "wde-widgets/scrollbar.tmpl" }}
<div class="ScrollbarPlace">
<div class="ScrollBarScrollElement">
<div class="ScrollBarScrollElementDrag">
</div>
</div>
</div>
{{ end }}