From d1c5e8ea151da2da1f77177f44d89ff8a591e949 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 23 Jul 2023 01:00:51 +0300 Subject: [PATCH] mobile finder --- apps/finder/routes.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/finder/routes.go b/apps/finder/routes.go index 2da8522..92abba0 100644 --- a/apps/finder/routes.go +++ b/apps/finder/routes.go @@ -5,6 +5,7 @@ import ( "personalwebsite/apps/appCtx" "personalwebsite/errormessage" + mobile "github.com/floresj/go-contrib-mobile" "github.com/gin-gonic/gin" ) @@ -18,7 +19,15 @@ func (f *FinderApplication) PublicRoutes(routes *gin.RouterGroup) { }) return } - ctx.HTML(http.StatusOK, "finder/app.tmpl", f.Render(appCtx)) + d := mobile.GetDevice(ctx) + switch { + case d.Mobile(): + ctx.HTML(http.StatusOK, "templates/finder/mobile-app.tmpl", gin.H{ + // "autostart": autostart, + }) + default: + ctx.HTML(http.StatusOK, "finder/app.tmpl", f.Render(appCtx)) + } }) routes.GET("renderMobileDesktop", func(ctx *gin.Context) { @@ -66,7 +75,13 @@ func (f *FinderApplication) PrivateRoutes(routes *gin.RouterGroup) { }) return } - ctx.HTML(http.StatusOK, "finder/admin-app.tmpl", f.Render(appCtx)) + d := mobile.GetDevice(ctx) + switch { + case d.Mobile(): + ctx.HTML(http.StatusOK, "finder/mobile-app.tmpl", f.Render(appCtx)) + default: + ctx.HTML(http.StatusOK, "finder/admin-app.tmpl", f.Render(appCtx)) + } }) routes.GET("renderMobileDesktop", func(ctx *gin.Context) {