personal-website/apps/finder/finderadmin.go

69 lines
1.5 KiB
Go
Raw Normal View History

2023-05-03 21:50:08 +00:00
package finder
import (
"personalwebsite/apps"
2023-05-16 12:12:55 +00:00
"personalwebsite/wde"
2023-05-03 21:50:08 +00:00
"personalwebsite/webfilesystem"
2023-05-16 12:12:55 +00:00
"github.com/gin-gonic/gin"
2023-05-03 21:50:08 +00:00
)
type FinderAdminApp struct {
fs *webfilesystem.WebFileSystem
manifest apps.ApplicationManifest
}
func NewFinderAdminApp(webfs *webfilesystem.WebFileSystem) FinderAdminApp {
return FinderAdminApp{
fs: webfs,
manifest: apps.ApplicationManifest{},
}
}
func (f *FinderAdminApp) RenderWindow() {
}
2023-05-16 12:12:55 +00:00
func (f *FinderApplication) RenderPrivateContextMenu(context string, filePath string, data string) gin.H {
islands := [][]wde.ContexMenuRow{}
islands = append(islands, []wde.ContexMenuRow{})
islands = append(islands, []wde.ContexMenuRow{
{Label: "Get Info", Action: "getInfo"},
})
if context == "FileTileView" {
islands = append(islands, []wde.ContexMenuRow{
{Label: "New Directory", Action: "createDir"},
})
return gin.H{
"Islands": islands,
}
}
islands = append(islands, []wde.ContexMenuRow{
{Label: "Create path link", Action: "createPathLink"},
})
switch context {
case "directory":
if f.fs.GetExtension(filePath) == "app" {
islands = append(islands, []wde.ContexMenuRow{
{Label: "Open as Directory", Action: "openAsDir"},
})
}
default:
islands = append(islands, []wde.ContexMenuRow{
{Label: "temp Menu 1", Action: ""},
{Label: "temp Menu 2", Action: ""},
})
}
islands = append(islands, []wde.ContexMenuRow{
{Label: "Delete File", Action: "deleteFile"},
})
return gin.H{
"Islands": islands,
}
}