@@ -4,13 +4,19 @@ import kotlinx.html.TagConsumer
4
4
import kotlinx.html.div
5
5
import kotlinx.html.main
6
6
import kotlinx.html.script
7
+ import misk.tailwind.Link
8
+ import misk.tailwind.pages.MenuSection
9
+ import misk.tailwind.pages.Navbar
7
10
import misk.web.dashboard.HtmlLayout
11
+ import wisp.deployment.getDeploymentFromEnvironmentVariable
8
12
9
13
fun TagConsumer <* >.DashboardLayout (
10
14
title : String ,
11
15
path : String ,
12
16
block : TagConsumer <* >.() -> Unit = {},
13
17
) {
18
+ val deployment = getDeploymentFromEnvironmentVariable()
19
+
14
20
HtmlLayout (
15
21
appRoot = " /" ,
16
22
title = title,
@@ -22,19 +28,90 @@ fun TagConsumer<*>.DashboardLayout(
22
28
type = " module"
23
29
src = " /static/js/autocomplete_controller.js"
24
30
}
31
+ script {
32
+ type = " module"
33
+ src = " /static/js/search_bar_controller.js"
34
+ }
25
35
},
26
36
) {
27
37
div(" min-h-full" ) {
28
- NavBar (path)
29
- div(" py-10" ) {
30
- main {
31
- div(" mx-auto max-w-7xl sm:px-6 lg:px-8" ) {
32
- // TODO remove when new UI is stable and preferred
33
- UseOldUIAlert ()
34
- block()
38
+ if (true ) {
39
+ // Uses Misk's Navbar with sidebar
40
+ Navbar (
41
+ appName = " Backfila" ,
42
+ deployment = deployment,
43
+ homeHref = " /" ,
44
+ menuSections = buildMenuSections(
45
+ currentPath = path,
46
+ ),
47
+ ) {
48
+ div(" py-10" ) {
49
+ main {
50
+ div(" mx-auto max-w-7xl sm:px-6 lg:px-8" ) {
51
+ // TODO remove when new UI is stable and preferred
52
+ UseOldUIAlert ()
53
+ block()
54
+ }
55
+ }
56
+ }
57
+ }
58
+ } else {
59
+ NavBar (path)
60
+ div(" py-10" ) {
61
+ main {
62
+ div(" mx-auto max-w-7xl sm:px-6 lg:px-8" ) {
63
+ // TODO remove when new UI is stable and preferred
64
+ UseOldUIAlert ()
65
+ block()
66
+ }
35
67
}
36
68
}
37
69
}
38
70
}
39
71
}
40
72
}
73
+
74
+ private fun buildMenuSections (
75
+ currentPath : String ,
76
+ ) = listOf (
77
+ MenuSection (
78
+ title = " Backfila" ,
79
+ links = listOf (
80
+ Link (
81
+ label = " Services" ,
82
+ href = " /services/" ,
83
+ isSelected = currentPath.startsWith(" /services/" ),
84
+ ),
85
+ Link (
86
+ label = " Backfills" ,
87
+ href = " /backfills/" ,
88
+ isSelected = currentPath.startsWith(" /backfills/" ),
89
+ ),
90
+ ),
91
+ ),
92
+ MenuSection (
93
+ title = " Your Services" ,
94
+ links = listOf (
95
+ Link (
96
+ label = " Fine Dining" ,
97
+ href = " /services/?q=FineDining" ,
98
+ isSelected = currentPath.startsWith(" /services/?q=FindDining" ),
99
+ ),
100
+ ),
101
+ ),
102
+ MenuSection (
103
+ title = " Your Backfills" ,
104
+ links = listOf (
105
+ Link (
106
+ label = " FineDining #0034" ,
107
+ href = " /services/" ,
108
+ isSelected = currentPath.startsWith(" /backfill/" ),
109
+ ),
110
+ Link (
111
+ label = " FineDining #0067" ,
112
+ href = " /backfill/" ,
113
+ isSelected = currentPath.startsWith(" /backfill/" ),
114
+ ),
115
+ ),
116
+ ),
117
+ )
0 commit comments