diff --git a/ui/controllers/pages.go b/ui/controllers/pages.go index 17979b2..457be2a 100644 --- a/ui/controllers/pages.go +++ b/ui/controllers/pages.go @@ -25,5 +25,11 @@ func SignUpPage(c *gin.Context) { } func DashboardPage(c *gin.Context) { - c.JSON(200, gin.H{"response": "dashboard"}) + if raw, exists := c.Get(USER_OBJ_KEY); exists { + if user, ok := raw.(*models.User); ok { + renderTempl(c, templates.DashboardPage(user)) + return + } + } + renderTempl(c, templates.DashboardPage(nil)) } diff --git a/ui/templates/dashboard_page.templ b/ui/templates/dashboard_page.templ new file mode 100644 index 0000000..46bab5c --- /dev/null +++ b/ui/templates/dashboard_page.templ @@ -0,0 +1,692 @@ +package templates + +import ( + "git.preston-baxter.com/Preston_PLB/capstone/frontend-service/db/models" +) + +templ DashboardPage(user *models.User) { + + + @Head("Dashboard") + +
+ @DashboardNav(user) + @DashboardContent(user) + @Footer() +
+ + @DashboardScript() + +} + +templ DashboardNav(user *models.User) { + +} + +//Break this up + +templ DashboardContentNav(user *models.User) { + +} + +templ DashboardCard(title, primaryVal, secondaryVal, subtitle string) { +
+
+
+
+
+
+ { title } +
+ + { primaryVal } + +
+
+
+ +
+
+
+

+ + { secondaryVal } + + + { subtitle } + +

+
+
+
+} + +//Make fmt.stringer the new input +//make [][]string + +//make auth version of widget +//make action version of widget + +templ DashboardTableWidget(title string, table map[string][]string) { +
+
+
+
+
+

+ { title } +

+
+
+ +
+
+
+
+ + + + + for key := range table { + + } + + + + for _, values := range table { + + for _, val := range values { + + } + + } + +
+ { key } +
+ { val } +
+
+
+
+} + +templ DashboardContent(user *models.User) { + +
+ @DashboardContentNav(user) + +
+
+
+ +
+ @DashboardCard("Events Recieved", "420,696", "3.3%", "Since Last Month") + @DashboardCard("Live Streams Scheduled", "420,696", "3.3%", "Since Last Month") + @DashboardCard("Failed Schedules", "420,696", "3.3%", "Since Last Month") +
+
+
+
+
+
+ @DashboardTableWidget("Accounts", map[string][]string{"Service": []string{"YouTube", "PCO"}, "Active": []string{"Active", "Active"}}) +
+
+ @DashboardTableWidget("Accounts", map[string][]string{"Service": []string{"YouTube", "PCO"}, "Active": []string{"Active", "Active"}}) +
+
+
+} + +templ DashboardScript() { + + + +} diff --git a/ui/templates/landing_page.templ b/ui/templates/landing_page.templ index 190fd42..d9f398c 100644 --- a/ui/templates/landing_page.templ +++ b/ui/templates/landing_page.templ @@ -4,7 +4,7 @@ import "git.preston-baxter.com/Preston_PLB/capstone/frontend-service/db/models" //Head for scripts and such -templ Head() { +templ Head(msg string) { @@ -27,14 +27,14 @@ templ Head() { rel="stylesheet" href="https://cdn.jsdelivr.net/gh/creativetimofficial/tailwind-starter-kit/compiled-tailwind.min.css" /> - Dashboard | Capstone - Pbaxt10 + { msg } | Capstone - Pbaxt10 } templ LandingPage(user *models.User) { - @Head() + @Head("Welcome") @Nav(user) @LandingContent() diff --git a/ui/templates/login_page.templ b/ui/templates/login_page.templ index e509455..5798a9d 100644 --- a/ui/templates/login_page.templ +++ b/ui/templates/login_page.templ @@ -3,7 +3,7 @@ package templates templ LoginPage(errorMsg string) { - @Head() + @Head("Log in") @Nav(nil) @LoginContent(false, errorMsg) @@ -16,7 +16,7 @@ templ LoginPage(errorMsg string) { templ SignupPage(errorMsg string) { - @Head() + @Head("Sign up") @Nav(nil) @LoginContent(true, errorMsg)