This commit is contained in:
cyber-dream 2023-07-24 03:27:53 +03:00
parent 3b5b00f5b0
commit e76c55f2c3
11 changed files with 59 additions and 35 deletions

View File

@ -38,6 +38,9 @@ func NewAboutMeApp(webFs *webfilesystem.WebFileSystem) *AboutMeApp {
titleBarConfig: wde.TitleBarConfig{ titleBarConfig: wde.TitleBarConfig{
Lable: "About Me", Lable: "About Me",
CloseButton: true, CloseButton: true,
HasIcon: true,
IconPath: "/Icons/GenericApp.icn",
IconSize: "16",
}, },
manifest: manifest, manifest: manifest,
} }

View File

@ -32,6 +32,9 @@ func NewFinderApplication(webFs *webfilesystem.WebFileSystem) *FinderApplication
titleBarConfig: wde.TitleBarConfig{ titleBarConfig: wde.TitleBarConfig{
Lable: "Finder", Lable: "Finder",
CloseButton: true, CloseButton: true,
HasIcon: true,
IconPath: "/Icons/GenericFolder.icn",
IconSize: "16",
}, },
manifest: manifest, manifest: manifest,
} }

View File

@ -40,18 +40,20 @@
height: auto; */ height: auto; */
/* margin-right: -20px; */ /* margin-right: -20px; */
/* Inside auto layout */ // background-color: aquamarine;
flex: none; /* Inside auto layout */
order: 0; width: 100%;
align-self: stretch; // flex: none;
flex-grow: 1; // order: 0;
// align-self: stretch;
// flex-grow: 1;
/* Auto layout */ /* Auto layout */
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
padding: 0px; // padding: 0px;
margin-right: 20; // margin-right: 20;
gap:15px; gap:15px;
} }
@ -85,10 +87,10 @@
} }
.PropertiesList .Links { .PropertiesList .Links {
position: absolute; // position: absolute;
right: 14px; // right: 14px;
top: 27px; // top: 27px;
/* background-color: aqua; */ // background-color: aqua;
height: auto; height: auto;
width: auto; width: auto;

View File

@ -87,7 +87,8 @@ export default class FinderWindow{
let newWindow = this.#wde.Decorat.CreateNewWindow(this.#appId, 500, 350 ) let newWindow = this.#wde.Decorat.CreateNewWindow(this.#appId, 500, 350 )
newWindow.innerHTML = html newWindow.innerHTML = html
newWindow.querySelector(".title-bar").querySelector(".icon").setAttribute("src","/system/libs/img/icon/get?path=/Icons/GenericFolder.icn&size=16") //TODO change icons for every folder
// newWindow.querySelector(".title-bar").querySelector(".icon").setAttribute("src","/system/libs/img/icon/get?path=/Icons/GenericFolder.icn&size=16")
// console.log(newWindow.querySelector(".FileTileView")) // console.log(newWindow.querySelector(".FileTileView"))

View File

@ -21,7 +21,6 @@ export default class Finder extends WDEApplication{
* @param {import("../../wde/wde.js").runContext} runContext * @param {import("../../wde/wde.js").runContext} runContext
*/ */
async NewWindow(args, runContext){ async NewWindow(args, runContext){
let newFinder = new FinderWindow(this, super.WDE()) let newFinder = new FinderWindow(this, super.WDE())
await newFinder.Init(this, args, runContext) await newFinder.Init(this, args, runContext)
} }
@ -31,7 +30,6 @@ export default class Finder extends WDEApplication{
* @param {import("../../wde/wde.js").runContext} runContext * @param {import("../../wde/wde.js").runContext} runContext
*/ */
async NewView(args, runContext){ async NewView(args, runContext){
// console.log(super.WDE())
let newFinderView = new FinderWindow(this, super.WDE()) let newFinderView = new FinderWindow(this, super.WDE())
await newFinderView.Init(this, args, runContext) await newFinderView.Init(this, args, runContext)
} }
@ -50,15 +48,16 @@ export default class Finder extends WDEApplication{
const response = await fetch(`/app/${this.AppId}/renderProps?` + params) const response = await fetch(`/app/${this.AppId}/renderProps?` + params)
if (response.status != 200){ if (response.status != 200){
// WebDesktopEnvironment.Alert("Error in properties render") //TODO this.WDE().Alert("Error in render properties widget") //TODO
return false return false
} }
const html = await response.text() const html = await response.text()
let newWindow = super.WDE().Decorat.CreateNewWindow(this.AppId, 350, 500 ) let newWindow = this.WDE().Decorat.CreateNewWindow(this.AppId, 350, 500 )
newWindow.innerHTML = html newWindow.innerHTML = html
newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) { newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
// WebDesktopEnvironment.CloseWindow(newWindow) // console.log(this.WDE().Decorat())
this.WDE().Decorat.CloseWindow(newWindow)
}) })
} }
} }

View File

@ -17,10 +17,13 @@ export default class WebDesktopEnvironment extends AbstractWebDesktopEnvironment
Decorat Decorat
/** @type {Object<string, WDEApplication>} */ /** @type {Object<string, WDEApplication>} */
static Applications = {}; static Applications = {};
/** Deprecated */ /** @deprecated */
static isMobile = false static isMobile = false
// static decorat // static decorat
static webFs static webFs
/** @deprecated */
basicWindow
constructor(){ constructor(){
super("localhost:8080") super("localhost:8080")
@ -35,9 +38,9 @@ export default class WebDesktopEnvironment extends AbstractWebDesktopEnvironment
} }
async loadWDE(){ async loadWDE(){
await this.Open("/Applications/Finder.app", ["/","--desktop", "desktop-layer"]) await this.Open("/Applications/Finder.app", ["/home/user/.Desktop","--desktop", "desktop-layer"])
// await this.Open("/Applications/Finder.app", ["/", "desktop-layer"]) await this.Open("/Applications/Finder.app", ["/", ""])
await this.Open("/Applications/AboutMe.app", ["/", "desktop-layer"]) // await this.Open("/Applications/AboutMe.app", [])
return return
let autoStart = document.body.querySelector("wde-autostart") let autoStart = document.body.querySelector("wde-autostart")
@ -84,6 +87,7 @@ export default class WebDesktopEnvironment extends AbstractWebDesktopEnvironment
} }
/** /**
* @deprecated
* @param {string} html * @param {string} html
*/ */
static SetBasicWindow(html){ static SetBasicWindow(html){
@ -91,6 +95,7 @@ export default class WebDesktopEnvironment extends AbstractWebDesktopEnvironment
} }
/** /**
* @deprecated
* @returns {string} * @returns {string}
*/ */
static GetBasicWindow(){ static GetBasicWindow(){
@ -100,15 +105,15 @@ export default class WebDesktopEnvironment extends AbstractWebDesktopEnvironment
/** /**
* @param {string} alertText * @param {string} alertText
*/ */
static Alert(alertText){ Alert(alertText){
WebDesktopEnvironment.CreateAlertWindow(alertText) this.#createAlertWindow(alertText)
console.log(alertText) console.log(alertText)
} }
/** /**
* @param {string} alertText * @param {string} alertText
*/ */
static CreateAlertWindow(alertText){ #createAlertWindow(alertText){
let newWindow = document.createElement("div") let newWindow = document.createElement("div")
newWindow.setAttribute("class", "WindowFrameless") newWindow.setAttribute("class", "WindowFrameless")
newWindow.setAttribute("windowId", "SuperUniqUUID") //TODO: newWindow.setAttribute("windowId", "SuperUniqUUID") //TODO:

View File

@ -97,6 +97,11 @@ export default class AbstractWebDesktopEnvironment{
WebFS(){ WebFS(){
return this.#webFS return this.#webFS
} }
/**
* @param {string} alertText
*/
Alert(alertText){}
} }
/** /**

View File

@ -129,7 +129,7 @@ export default class WDEFileView{
const response = await fetch(`/system/wde/widgets/file-tile-view?` + params) const response = await fetch(`/system/wde/widgets/file-tile-view?` + params)
if (response.status != 200){ if (response.status != 200){
//TODO Error text message //TODO Error text message
WebDesktopEnvironment.Alert("TODO") //TODO this.#wde.Alert("Error in render folder view") //TODO
return return
} }
let html = await response.text() let html = await response.text()

View File

@ -4,14 +4,7 @@
<div class="PersPropsContent"> <div class="PersPropsContent">
<div class="PropsView"> <div class="PropsView">
<div class="PropertiesList"> <div class="PropertiesList">
<div class="Links">
{{ range $link := .Links }}
<a href="{{$link.Url}}" target="_blank">
<div class="link-lable">{{$link.Text}}</div>
<img class="Link" src="/system/libs/img/get?path={{$link.Icon}}" >
</a>
{{ end }}
</div>
<div class="ShortBio"> <div class="ShortBio">
<img class="Image" src="/system/libs/img/get?path={{ .HeaderProps.IconPath }}" alt="My Photo"> <img class="Image" src="/system/libs/img/get?path={{ .HeaderProps.IconPath }}" alt="My Photo">
<div class="Text"> <div class="Text">
@ -19,6 +12,14 @@
<div>{{ .HeaderProps.Value1 }}</div> <div>{{ .HeaderProps.Value1 }}</div>
<div>{{ .HeaderProps.Value2 }}</div> <div>{{ .HeaderProps.Value2 }}</div>
</div> </div>
<div class="Links">
{{ range $link := .Links }}
<a href="{{$link.Url}}" target="_blank">
<div class="link-lable">{{$link.Text}}</div>
<img class="Link" src="/system/libs/img/get?path={{$link.Icon}}" >
</a>
{{ end }}
</div>
</div> </div>
{{ range $island := .Islands }} {{ range $island := .Islands }}
<!-- FIXME --> <!-- FIXME -->

View File

@ -5,7 +5,9 @@
{{end}} {{end}}
<div id="Drag" class="visual-drag-area"></div> <div id="Drag" class="visual-drag-area"></div>
<!-- TODO:Disable dragging of icon --> <!-- TODO:Disable dragging of icon -->
<img class="icon"> {{if .HasIcon}}
<img class="icon" src="/system/libs/img/icon/get?path={{.IconPath}}&size={{.IconSize}}">
{{ end }}
<div class="lable"> <div class="lable">
{{.Lable}} {{.Lable}}
</div> </div>

View File

@ -3,4 +3,7 @@ package wde
type TitleBarConfig struct { type TitleBarConfig struct {
Lable string Lable string
CloseButton bool CloseButton bool
HasIcon bool
IconPath string
IconSize string
} }