Skip to content

Commit

Permalink
Removed top bar from Registration and Welcome view (#2330)
Browse files Browse the repository at this point in the history
* Removed top bar from Registration and Welcome view
  • Loading branch information
Cheshiriks authored Jul 14, 2023
1 parent f2dd42b commit b9759b1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import web.html.HTMLElement
import kotlinx.browser.window
import kotlinx.coroutines.await
import kotlinx.coroutines.launch
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json

internal val topBarComponent = topBar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
package com.saveourtool.save.frontend.components.topbar

import com.saveourtool.save.frontend.externals.fontawesome.*
import com.saveourtool.save.frontend.utils.not
import com.saveourtool.save.info.UserInfo
import com.saveourtool.save.validation.FrontendRoutes
import js.core.jso

import react.*
Expand Down Expand Up @@ -62,21 +64,23 @@ fun ChildrenBuilder.dropdownEntry(
*/
fun topBar() = FC<TopBarProps> { props ->
val location = useLocation()
nav {
className =
ClassName("navbar navbar-expand navbar-dark bg-dark topbar mb-3 static-top shadow mr-1 ml-1 rounded")
style = jso {
width = 100.vw
}
id = "navigation-top-bar"
topBarUrlSplits {
this.location = location
}
topBarLinks {
this.location = location
}
topBarUserField {
userInfo = props.userInfo
if (location.not("/${FrontendRoutes.SAVE.path}") && location.not("/${FrontendRoutes.REGISTRATION.path}")) {
nav {
className =
ClassName("navbar navbar-expand navbar-dark bg-dark topbar mb-3 static-top shadow mr-1 ml-1 rounded")
style = jso {
width = 100.vw
}
id = "navigation-top-bar"
topBarUrlSplits {
this.location = location
}
topBarLinks {
this.location = location
}
topBarUserField {
userInfo = props.userInfo
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@file:Suppress("HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE")

package com.saveourtool.save.frontend.utils

import remix.run.router.Location

/**
* @param url url for comparison
*/
fun Location.not(url: String) = !pathname.startsWith(url)

0 comments on commit b9759b1

Please sign in to comment.