fable-compiler / repl-legacy

http://fable.io/repl
MIT License
14 stars 10 forks source link

Fix #24 improve sidebar experience and implements widgets asbtraction #29

Closed MangelMaxime closed 6 years ago

MangelMaxime commented 6 years ago

Here is a preview of the new sidebar experience. I based this changes on youtube website.

demo_repl_sidebar

I believe, we probably should display by default the sidebar ?

I also decided, to add an abstraction on top of the widgets. So in order to add a new widget, you just need to supply a tuple of ( "My awesome title", view to render the widget).

The abstraction, will work as long as we don't provide the same title to two widgets so it's should be fine :)

See:

let view (model: Model) dispatch =
    if model.IsExpanded then
        [ "Samples", Widgets.Samples.view model.Samples (SamplesMsg >> dispatch)
          "About", Widgets.About.view ]
        |> List.map (renderWidgets model.WidgetsState dispatch)
        |> div [ ClassName "sidebar" ]
        |> Some
    else
        None
    |> ofOption
alfonsogarciacaro commented 6 years ago

This is great, @MangelMaxime! Thanks a lot for this :clap: 🥇 👏 It will make it much easier for contributors to add new widgets. As long as it can be collapsed, I'm ok to show the side menu by default ...actually we need to make About clickable and show a message saying there's no server and the REPL works by compiling the full F# compiler to JS using Fable :)

MangelMaxime commented 6 years ago

You are right for the about. I just added it, to make it an example :)

We still need to decide how to upgrade the version etc. :D

alfonsogarciacaro commented 6 years ago

I just did it :wink: So now the version is updated with every build to match Fable.Compiler. I also removed the REPL files from fable-compiler.github.io and published it in this repo, so now requests are being redirected here 💪