mirror of
https://github.com/fiatjaf/nak.git
synced 2024-10-30 09:09:08 -04:00
format button only when there is a JSON element.
This commit is contained in:
parent
8961eddc43
commit
4d23a4c6af
|
@ -35,17 +35,21 @@ object Main extends IOWebApp {
|
||||||
def actions(store: Store): Resource[IO, HtmlDivElement[IO]] =
|
def actions(store: Store): Resource[IO, HtmlDivElement[IO]] =
|
||||||
div(
|
div(
|
||||||
cls := "flex flex-col space-y-1 my-3",
|
cls := "flex flex-col space-y-1 my-3",
|
||||||
button(
|
store.result.map {
|
||||||
Styles.button,
|
case Right(_: Event) =>
|
||||||
"format",
|
button(
|
||||||
onClick --> (_.foreach(_ =>
|
Styles.button,
|
||||||
store.input.update(original =>
|
"format",
|
||||||
parse(original).toOption
|
onClick --> (_.foreach(_ =>
|
||||||
.map(_.printWith(jsonPrinter))
|
store.input.update(original =>
|
||||||
.getOrElse(original)
|
parse(original).toOption
|
||||||
|
.map(_.printWith(jsonPrinter))
|
||||||
|
.getOrElse(original)
|
||||||
|
)
|
||||||
|
))
|
||||||
)
|
)
|
||||||
))
|
case _ => div("")
|
||||||
),
|
},
|
||||||
button(
|
button(
|
||||||
Styles.button,
|
Styles.button,
|
||||||
"generate event",
|
"generate event",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user