personal-website/apps/finder/finderadmin.go
2023-05-16 15:12:55 +03:00

69 lines
1.5 KiB
Go

package finder
import (
"personalwebsite/apps"
"personalwebsite/wde"
"personalwebsite/webfilesystem"
"github.com/gin-gonic/gin"
)
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() {
}
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,
}
}