Skip to content

Commit

Permalink
hide sidebar shortcut icons outside excel hosting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jan 12, 2024
1 parent 33e305a commit 4135549
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 16 deletions.
11 changes: 8 additions & 3 deletions src/Client/Arcitect/Arcitect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ open Model
open Model.ARCitect
open Shared
open Messages
open Elmish

let send (msg:ARCitect.Msg) =
let (data: obj) =
match msg with
| Init ->
"Hello from Swate!"
| TriggerSwateClose ->
null
| AssayToARCitect assay ->
ARCtrl.ISA.Json.ArcAssay.toJsonString assay
let assay = ARCtrl.ISA.Json.ArcAssay.toJsonString assay
assay
| StudyToARCitect study ->
ARCtrl.ISA.Json.ArcStudy.toJsonString study
let json = ARCtrl.ISA.Json.ArcStudy.toJsonString study (ResizeArray([]))
json
| Error exn ->
exn
postMessageToARCitect(msg, data)
Expand All @@ -31,5 +36,5 @@ let EventHandler (dispatch: Messages.Msg -> unit) : IEventHandler =
log($"Received Study {study.Identifier} from ARCitect!")
Browser.Dom.console.log(study)
Error = fun exn ->
Browser.Dom.window.alert(exn)
GenericError (Cmd.none, exn) |> DevMsg |> dispatch
}
51 changes: 41 additions & 10 deletions src/Client/MainComponents/Navbar.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,49 @@ let Main (model: Messages.Model) dispatch =
]
prop.ariaLabel "menu"
prop.children [
Bulma.navbarStart.div [
prop.style [style.display.flex; style.alignItems.stretch; style.justifyContent.flexStart; style.custom("marginRight", "auto")]
prop.children [
quickAccessButtonListStart model.History dispatch
match model.PersistentStorageState.Host with
| Some Swatehost.ARCitect ->
Bulma.navbarStart.div [
prop.style [style.display.flex; style.alignItems.stretch; style.justifyContent.flexStart; style.custom("marginRight", "auto")]
prop.children [
Html.div [
prop.style [
style.display.flex; style.flexDirection.row
]
prop.children [
QuickAccessButton.create(
"Return to ARCitect",
[
Bulma.icon [Html.i [prop.className "fa-solid fa-circle-left";]]
],
(fun _ -> ARCitect.ARCitect.send Model.ARCitect.TriggerSwateClose)
).toReactElement()
QuickAccessButton.create(
"Alpha State",
[
Html.span "ALPHA STATE"
],
(fun e -> ()),
false
).toReactElement()
]
]
]
]
]
Bulma.navbarEnd.div [
prop.style [style.display.flex; style.alignItems.stretch; style.justifyContent.flexEnd; style.custom("marginLeft", "auto")]
prop.children [
quickAccessButtonListEnd model dispatch
| Some _ ->
Bulma.navbarStart.div [
prop.style [style.display.flex; style.alignItems.stretch; style.justifyContent.flexStart; style.custom("marginRight", "auto")]
prop.children [
quickAccessButtonListStart model.History dispatch
]
]
]
Bulma.navbarEnd.div [
prop.style [style.display.flex; style.alignItems.stretch; style.justifyContent.flexEnd; style.custom("marginLeft", "auto")]
prop.children [
quickAccessButtonListEnd model dispatch
]
]
| _ -> Html.none
]
]
]
Expand Down
7 changes: 4 additions & 3 deletions src/Client/SidebarComponents/Navbar.fs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,12 @@ let NavbarComponent (model : Model) (dispatch : Msg -> unit) (sidebarsize: Model
]

// Quick access buttons
match sidebarsize with
| WindowSize.Mini ->
match sidebarsize, model.PersistentStorageState.Host with
| WindowSize.Mini, Some Swatehost.Excel ->
quickAccessDropdownElement model dispatch state setState false
| _ ->
| _, Some Swatehost.Excel ->
quickAccessListElement model dispatch
| _,_ -> Html.none

Bulma.navbarBurger [
if state.BurgerActive then Bulma.navbarBurger.isActive
Expand Down
1 change: 1 addition & 0 deletions src/Client/States/Arcitect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Msg =
| Error of exn
| AssayToARCitect of ArcAssay
| StudyToARCitect of ArcStudy
| TriggerSwateClose

type IEventHandler = {
Error: exn -> unit
Expand Down

0 comments on commit 4135549

Please sign in to comment.