diff --git a/services/bookmark.services.go b/services/bookmark.services.go index 6048ade..ba81c64 100644 --- a/services/bookmark.services.go +++ b/services/bookmark.services.go @@ -145,9 +145,9 @@ func handleLocalIcons(title, ext string) (string, string) { filePathLight := strings.Replace(title, ext, "-light"+ext, 1) _, err = os.Stat(filePathLight) if os.IsNotExist(err) { - return filePath, "" + return "/" + strings.TrimPrefix(filePath, storageFolder), "" } - return "/" + filePath, "/" + filePathLight + return "/" + strings.TrimPrefix(filePath, storageFolder), "/" + strings.TrimPrefix(filePathLight, storageFolder) } func (bs *BookmarkService) parseBookmarks() { diff --git a/views/components/application.templ b/views/components/application.templ index cb515ac..de3f6b5 100644 --- a/views/components/application.templ +++ b/views/components/application.templ @@ -10,8 +10,8 @@ func placeHolder(app services.Application) string { return strings.ToUpper(app.Name[:1]) } -func displayLight(app services.Application) bool { - return app.Icon != "" +func noIcon(app services.Application) bool { + return app.Icon == "" } func displayDark(app services.Application) bool { @@ -19,6 +19,10 @@ func displayDark(app services.Application) bool { } var bgTemplate = template.Must(template.New("bgTemplate").Parse( + `
`, +)) + +var bgTemplateLight = template.Must(template.New("bgTemplate").Parse( ``, )) @@ -32,17 +36,17 @@ type Icon struct { templ Application(application services.Application) { - if displayLight(application) { - @templ.FromGoHTML(bgTemplate, Icon{Path: application.Icon}) - } else { + if displayDark(application) { + @templ.FromGoHTML(bgTemplateLight, Icon{Path: application.Icon}) + @templ.FromGoHTML(bgTemplateDark, Icon{Path: application.IconLight}) + } else if noIcon(application) {