From fb6b310a49509e9c48b1df3dd415576da9e1af96 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Wed, 7 Jun 2023 04:22:25 +0300 Subject: [PATCH] Links in about-me app --- apps/aboutme/personalprops.go | 31 +++++++++++++++++++++++++- res/dev-fs/apps/AboutMe/about-me.css | 20 +++++++++++++++++ routes/private.go | 10 ++++----- templates/personal-properties/app.tmpl | 13 ++++++----- 4 files changed, 63 insertions(+), 11 deletions(-) diff --git a/apps/aboutme/personalprops.go b/apps/aboutme/personalprops.go index 7df1369..8e375f9 100644 --- a/apps/aboutme/personalprops.go +++ b/apps/aboutme/personalprops.go @@ -67,7 +67,19 @@ func (p *AboutMeApp) PrivateRoutes(router *gin.RouterGroup) { router.GET("getMock", func(ctx *gin.Context) { ctx.JSON(http.StatusOK, PropertiesFileData{ - Header: HeaderIsland{}, + Header: HeaderIsland{ + Name: "", + IconPath: "", + Value1: "", + Value2: "", + }, + Links: []HeaderLink{ + { + Text: "", + Url: "", + Icon: "", + }, + }, Islands: []Island{ { Header: "qq", @@ -276,14 +288,25 @@ func (p *AboutMeApp) Render(appCtx appCtx.AppContext, filePath string) (gin.H, e //Make icon path absolute propsData.Header.IconPath = p.fs.RelativeToAbsolute(appCtx, propsData.Header.IconPath) + absoluteLinks := []HeaderLink{} + for _, link := range propsData.Links { + absoluteLinks = append(absoluteLinks, HeaderLink{ + Text: link.Text, + Url: link.Url, + Icon: p.fs.RelativeToAbsolute(appCtx, link.Icon), + }) + } + return gin.H{ "HeaderProps": propsData.Header, + "Links": absoluteLinks, "Islands": renderedIslands, }, nil } type PropertiesFileData struct { Header HeaderIsland `bson:"header" json:"header"` + Links []HeaderLink `bson:"links" json:"links"` Islands []Island `bson:"islands" json:"islands"` //TODO rename } @@ -294,6 +317,12 @@ type HeaderIsland struct { Value2 string `bson:"value2" json:"value2"` } +type HeaderLink struct { + Text string `bson:"text" json:"text"` + Url string `bson:"url" json:"url"` + Icon string `bson:"icon" json:"icon"` +} + type Island struct { Header string `bson:"header" json:"header"` Properties []IslandProperty `bson:"properties" json:"properties"` diff --git a/res/dev-fs/apps/AboutMe/about-me.css b/res/dev-fs/apps/AboutMe/about-me.css index 894ba9d..63b0c1b 100644 --- a/res/dev-fs/apps/AboutMe/about-me.css +++ b/res/dev-fs/apps/AboutMe/about-me.css @@ -107,7 +107,27 @@ letter-spacing: 0.35px; } +.PropertiesList .Links { + position: absolute; + right: 14px; + top: 27px; + /* background-color: aqua; */ + height: auto; + width: auto; + /* Auto layout */ + display: flex; + flex-direction: row; + align-items: left; + padding: 0px; + gap:4px; +} + +.PropertiesList .Links .Link { + /* background-color:brown; */ + width: 16px; + height: 16px; +} .PropertiesList .Island{ width: 100%; diff --git a/routes/private.go b/routes/private.go index 44d5ef7..e9032bd 100644 --- a/routes/private.go +++ b/routes/private.go @@ -47,12 +47,12 @@ func PrivateRoutes(port string, webfs *webfilesystem.WebFileSystem, webde *wde.W Args: []string{}, } - // appString2 := AppString{ - // AppPath: "/Applications/Finder.app", - // Args: []string{"/home/user/", "--desktop", "desktop-layer"}, - // } + desktop := AppString{ + AppPath: "/Applications/Finder.app", + Args: []string{"/home/user/", "--desktop", "desktop-layer"}, + } - autostart := []AppString{appString, aboutMe} + autostart := []AppString{desktop, appString, aboutMe} ctx.HTML(http.StatusOK, "index.tmpl", gin.H{ "autostart": autostart, }) diff --git a/templates/personal-properties/app.tmpl b/templates/personal-properties/app.tmpl index 78edd59..d45e1b2 100644 --- a/templates/personal-properties/app.tmpl +++ b/templates/personal-properties/app.tmpl @@ -2,15 +2,20 @@
-
- About me -
+
About me
+
My Photo
@@ -21,11 +26,9 @@
{{ range $island := .Islands }} -
{{$island.Header}}:
- {{range $property := $island.Properties}}