Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fc1943s committed Nov 28, 2023
1 parent 5ce215c commit 25f8aa8
Show file tree
Hide file tree
Showing 12 changed files with 3,056 additions and 2,970 deletions.
3,218 changes: 1,622 additions & 1,596 deletions apps/dice/ui/dice_ui.fsx

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion apps/dice/ui/dice_ui.spi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ inl main (args : array_base string) =
|> leptos.mount_to_body

match body with
| Some _ =>
| Some body =>
body |> leptos.set_inner_html ""

mount ()
| _ =>
inl fn : rust.box (rust.dyn' rust.fn_unit) = rust.box_fn mount
Expand Down
2,602 changes: 1,333 additions & 1,269 deletions apps/dice/ui/dice_ui_wasm.rs

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions apps/dice/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta content="width=device-width,user-scalable=no" name="viewport">
<meta content="width=device-width,user-scalable=no" name="viewport" />
<link data-trunk rel="rust" data-wasm-opt="z" />
<link data-trunk rel="icon" type="image/ico" href="public/favicon.ico" />
<link data-trunk rel="css" href="target/tailwind.css" />
Expand All @@ -29,6 +29,13 @@
touch-action: pan-x pan-y;
overflow: hidden;
}
.static {
flex: 1;
align-items: center;
justify-content: center;
display: flex;
height: 90vh;
}
*::-webkit-scrollbar {
width: 9px;
}
Expand All @@ -54,5 +61,7 @@
}
</style>
</head>
<body></body>
<body>
<div class="static">Loading...</div>
</body>
</html>
5 changes: 2 additions & 3 deletions apps/dice/ui/src/components/app.spi
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ inl render () =

leptos.router fun () =>
leptos.routes fun () =>
;[
:>(;[
route' "" fun () => home.render { router = 1 }
route' "/" fun () => home.render { router = 2 }
route' "/*" fun () => home.render { router = 3 }
route' "*" fun () => home.render { router = 4 }
]
|> leptos.views_to_fragment
])
|> leptos.view_to_fragment
6 changes: 2 additions & 4 deletions apps/dice/ui/src/components/content.spi
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ inl render () : _ leptos.div =
leptos.div [
$'"class=\\\"[width:100vw] [max-width:100vw] max-[100px]:[min-width:800px] [height:100vh] [max-height:100vh] max-[60px]:[min-height:600px] bg-gray-50 flex flex-1 flex-col items-stretch text-gray-700 text-sm\\\""'
] fun () =>
;[
:>(;[
leptos.div [
$'"class=\\\"flex flex-100 flex-col [overflow-y:auto]\\\""'
] fun () =>
Expand All @@ -82,9 +82,7 @@ inl render () : _ leptos.div =
$'"class=\\\"flex flex-1 [align-items:flex-end]\\\""'
] fun () =>
menu_tabs.render tab
|> leptos.views_to_fragment
|> leptos.element_to_fragment
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_fragment
58 changes: 19 additions & 39 deletions apps/dice/ui/src/components/history.spi
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
leptos.div [
$'"class=\\\"flex flex-1 flex-col\\\""'
] fun () =>
;[
:>(;[
leptos.divider fun () =>
"Transaction" |> leptos.text_fragment
|> leptos.element_to_view

leptos.div [
$'"class=\\\"grid flex-1 divide-y-[1px] divide-gray-200/[.15]\\\""'
$'"class=\\\"grid flex-1 divide-y-[1px] divide-gray-500/[.10]\\\""'
] fun () =>
;[
:>(;[
leptos.grid_pair
{ padding = Some ""; cols = None; class = "items-center py-[4px]" }
fun () => "Block Timestamp" |> leptos.text_fragment
Expand All @@ -28,7 +28,6 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
|> resultm.from_option
|> to_string
|> leptos.text_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = Some ""; cols = None; class = "items-center py-[4px]" }
Expand All @@ -37,7 +36,6 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
transaction.signer_id
|> to_string
|> leptos.text_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = Some ""; cols = None; class = "items-center py-[4px]" }
Expand All @@ -46,7 +44,6 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
transaction.receiver_id
|> to_string
|> leptos.text_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = Some "sm:pr-[10px]"; cols = None; class = "items-center py-[4px]" }
Expand All @@ -57,12 +54,12 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
| FunctionCall { method_name args gas deposit } =>
leptos.grid_pair
{ padding = Some "items-center"; cols = Some ""; class = "" }
fun () => "Function Call" |> leptos.text_fragment
fun () => "Function Call:" |> leptos.text_fragment
fun () =>
leptos.div [
$'"class=\\\"flex flex-1 flex-col\\\""'
] fun () =>
;[
:>(;[
leptos.grid_pair
{ padding = Some ""; cols = None; class = "" }
fun () => "Method" |> leptos.text_fragment
Expand Down Expand Up @@ -100,8 +97,7 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
|> to_string
|> leptos.text_fragment
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_fragment
|> leptos.element_to_view
| AddKey { public_key access_key } =>
Expand All @@ -115,12 +111,12 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
| DeployContract { code } =>
leptos.grid_pair
{ padding = Some "items-center"; cols = Some ""; class = "" }
fun () => "Contract Deploy" |> leptos.text_fragment
fun () => "Contract Deploy:" |> leptos.text_fragment
fun () =>
leptos.div [
$'"class=\\\"flex flex-1 flex-col\\\""'
] fun () =>
;[
:>(;[
leptos.grid_pair
{ padding = Some ""; cols = None; class = "" }
fun () => "Code Hash" |> leptos.text_fragment
Expand All @@ -129,20 +125,17 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
|> sm'.from_std_string
|> leptos.text_fragment
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_fragment
|> leptos.element_to_view
| Transfer { deposit } =>
leptos.grid_pair
{ padding = Some "items-center"; cols = None; class = "" }
fun () => "Transfer" |> leptos.text_fragment
fun () => "Transfer:" |> leptos.text_fragment
fun () =>
deposit |> sm'.from_std_string |> leptos.text_fragment
|> leptos.element_to_view
|> fun (a x : _ i32 _) => x
|> leptos.views_to_fragment
|> leptos.element_to_view
|> fun (a x : _ i32 _) => :>x

leptos.grid_pair
{ padding = Some ""; cols = None; class = "items-center py-[4px]" }
Expand All @@ -151,7 +144,6 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
transaction.status
|> to_string
|> leptos.text_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = Some ""; cols = None; class = "items-center py-[4px]" }
Expand All @@ -160,7 +152,6 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
transaction.hash
|> to_string
|> leptos.text_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = Some ""; cols = None; class = "items-center py-[4px]" }
Expand All @@ -169,12 +160,9 @@ inl transaction_render (transaction : transaction) : _ leptos.div =
transaction.block_hash
|> to_string
|> leptos.text_fragment
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])

inl render () =
print_static "<history.render>"
Expand Down Expand Up @@ -396,30 +384,28 @@ inl render () =
|> leptos.view_to_fragment
|> leptos.element_to_fragment
| Some (Error error) =>
;[
:>(;[
leptos.x_red_svg () |> leptos.element_to_view
error |> leptos.text_view
]
|> leptos.views_to_fragment
])
| _ =>
leptos.div [
$'"class=\\\"grid place-content-center py-[10vh]\\\""'
] fun () =>
leptos.div [
$'"class=\\\"flex flex-1 [gap:4px] items-center\\\""'
] fun () =>
;[
:>(;[
leptos.loading_svg () |> leptos.element_to_view
$'"Loading..."' |> leptos.text_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_fragment
|> leptos.element_to_fragment
|> leptos.element_to_view

if leptos.rw_signal_get_untracked global_state.core_state .debug |> leptos.rw_signal_get then
leptos.accordion "Debug" true fun () =>
;[
:>(;[
leptos.grid_pair
{ padding = None; cols = None; class = "" }
fun () => "JSON" |> leptos.text_fragment
Expand All @@ -430,7 +416,6 @@ inl render () =
|> sm'.from_std_string
|> leptos.text_block_pre
|> leptos.element_to_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = None; cols = None; class = "" }
Expand All @@ -442,7 +427,6 @@ inl render () =
|> sm'.from_std_string
|> leptos.text_block_pre
|> leptos.element_to_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = None; cols = None; class = "" }
Expand All @@ -454,7 +438,6 @@ inl render () =
|> sm'.from_std_string
|> leptos.text_block_pre
|> leptos.element_to_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = None; cols = None; class = "" }
Expand All @@ -466,7 +449,6 @@ inl render () =
|> sm'.from_std_string
|> leptos.text_block_pre
|> leptos.element_to_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = None; cols = None; class = "" }
Expand All @@ -478,9 +460,7 @@ inl render () =
|> sm'.from_std_string
|> leptos.text_block_pre
|> leptos.element_to_fragment
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_view
else ;[] |> leptos.views_to_view
]
25 changes: 8 additions & 17 deletions apps/dice/ui/src/components/menu_tabs.spi
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ inl render tab =
leptos.log $'"menu_tabs.render ()"'

let url = leptos.use_url ()
;[
:>(;[
leptos.div [
$'"class=\\\"hidden\\\""'
] fun () =>
;[
:>(;[
leptos.label [
$'"for=\\\"Tab\\\""'
$'"class=\\\"sr-only\\\""'
Expand All @@ -24,22 +24,17 @@ inl render tab =
$'"id=\\\"Tab\\\""'
$'"class=\\\"w-full rounded-md border-gray-200\\\""'
] fun () =>
;[
:>(;[
leptos.option'
(fun () => (tab |> leptos.signal_get) = History)
"History"
|> leptos.element_to_view

leptos.option'
(fun () => (tab |> leptos.signal_get) = Settings)
"Settings"
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_view
]
|> leptos.views_to_fragment
|> leptos.element_to_view
])

leptos.div [
$'"class=\\\"flex flex-1 [overflow-x:auto] [overflow-y:hidden]\\\""'
Expand All @@ -51,23 +46,19 @@ inl render tab =
$'"class=\\\"-mb-px flex [flex-flow:wrap] [flex-grow:1] [flex-shrink:0] gap-[3px] [overflow-wrap:anywhere]\\\""'
$'"aria-label=\\\"Tabs\\\""'
] fun () =>
;[
:>(;[
leptos.tab_link
$'!url + "#/history"'
(leptos.history_svg ())
"History"
(fun () => (tab |> leptos.signal_get) = History)
|> leptos.element_to_view

leptos.tab_link
$'!url + "#/settings"'
(leptos.settings_svg ())
"Settings"
(fun () => (tab |> leptos.signal_get) = Settings)
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_fragment
|> leptos.element_to_fragment
|> leptos.element_to_view
]
])
7 changes: 2 additions & 5 deletions apps/dice/ui/src/components/settings.spi
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ inl render () =
;[
leptos.accordion "View" true fun () =>
inl grid_pair_padding_class = leptos.grid_pair_padding_class ()
;[
:>(;[
leptos.grid_pair
{ padding = None; cols = None; class = $'"items-center"' }
fun () => "Dark Mode" |> leptos.text_fragment
Expand All @@ -42,7 +42,6 @@ inl render () =
leptos.rw_signal_get_untracked global_state.core_state .dark_mode
|> leptos.rw_signal_get
|> leptos.element_to_fragment
|> leptos.element_to_view

leptos.grid_pair
{ padding = None; cols = None; class = $'"items-center"' }
Expand All @@ -57,9 +56,7 @@ inl render () =
leptos.rw_signal_get_untracked global_state.core_state .debug
|> leptos.rw_signal_get
|> leptos.element_to_fragment
|> leptos.element_to_view
]
|> leptos.views_to_fragment
])
|> leptos.element_to_view

leptos.accordion "Connection" true fun () =>
Expand Down
Loading

0 comments on commit 25f8aa8

Please sign in to comment.