Skip to content

Commit

Permalink
renamed Landing -> EnterFleetUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
reactormonk committed Nov 20, 2016
1 parent e6403a3 commit 944dd6a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion client/Landing.elm → client/EnterFleetUrl.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Landing exposing (..)
module EnterFleetUrl exposing (..)

import List
import Html exposing (..)
Expand Down
42 changes: 21 additions & 21 deletions client/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Main exposing (..)

import FleetView
import Html
import Landing
import EnterFleetUrl
import Maybe
import Navigation exposing (Location)
import Result.Extra exposing (mapBoth)
Expand Down Expand Up @@ -35,7 +35,7 @@ type alias Model =


type ViewModel
= LandingModel Landing.Model
= EnterFleetUrlModel EnterFleetUrl.Model
| FleetViewModel FleetView.Model
| NotFound

Expand All @@ -48,31 +48,31 @@ type alias Flags =

init : Flags -> ( Model, Cmd Action )
init flags =
( { view = LandingModel Landing.init, host = flags.host, protocol = flags.protocol }, Cmd.none )
( { view = EnterFleetUrlModel EnterFleetUrl.init, host = flags.host, protocol = flags.protocol }, Cmd.none )


update : Action -> Model -> ( Model, Cmd Action )
update action model =
let
( newModel, cmd ) =
case model.view of
LandingModel landingM ->
EnterFleetUrlModel landingM ->
case action of
Switch ac ->
switch ac

FleetViewAction _ ->
( LandingModel landingM, Cmd.none )
( EnterFleetUrlModel landingM, Cmd.none )

LandingAction ac ->
case Landing.update ac landingM of
EnterFleetUrlAction ac ->
case EnterFleetUrl.update ac landingM of
( m, Just landingAction ) ->
case landingAction of
Landing.SwitchToFleet id ->
EnterFleetUrl.SwitchToFleet id ->
( FleetViewModel (FleetView.init { id = id, host = model.host, protocol = model.protocol }), Cmd.none )

( m, Nothing ) ->
( LandingModel m, Cmd.none )
( EnterFleetUrlModel m, Cmd.none )

FleetViewModel model ->
case action of
Expand All @@ -82,7 +82,7 @@ update action model =
FleetViewAction ac ->
FleetView.update ac model |> mapEach FleetViewModel (Cmd.map FleetViewAction)

LandingAction _ ->
EnterFleetUrlAction _ ->
( FleetViewModel model, Cmd.none )

NotFound ->
Expand All @@ -93,7 +93,7 @@ update action model =
FleetViewAction _ ->
model.view ! []

LandingAction _ ->
EnterFleetUrlAction _ ->
model.view ! []
in
( { model | view = newModel }, cmd )
Expand All @@ -102,8 +102,8 @@ update action model =
switch : SwitchAction -> ( ViewModel, Cmd Action )
switch action =
case action of
SwitchToLandingPage ->
LandingModel Landing.init ! []
SwitchToEnterFleetUrlPage ->
EnterFleetUrlModel EnterFleetUrl.init ! []

SwitchToFleetPage init ->
( FleetViewModel <| FleetView.init init, Cmd.none )
Expand All @@ -113,15 +113,15 @@ switch action =


type SwitchAction
= SwitchToLandingPage
= SwitchToEnterFleetUrlPage
| SwitchToFleetPage FleetView.FleetInit
| UrlNotFound


type Action
= Switch SwitchAction
| FleetViewAction FleetView.Action
| LandingAction Landing.Action
| EnterFleetUrlAction EnterFleetUrl.Action


location2messages : Location -> List Action
Expand All @@ -134,7 +134,7 @@ location2page location =
parse identity
(oneOf
[ format (\id -> SwitchToFleetPage { id = id, host = location.host, protocol = location.protocol }) (s "fleet" </> string)
, format SwitchToLandingPage (s "")
, format SwitchToEnterFleetUrlPage (s "")
]
)
<|
Expand All @@ -150,12 +150,12 @@ delta2url previous current =
delta2builder : ViewModel -> ViewModel -> Maybe Builder
delta2builder previous current =
case current of
LandingModel current ->
EnterFleetUrlModel current ->
Just (builder |> newEntry)

FleetViewModel current ->
case previous of
LandingModel previous ->
EnterFleetUrlModel previous ->
Just (FleetView.urlBuilder current.id)

FleetViewModel previous ->
Expand All @@ -177,7 +177,7 @@ subscriptions model =
FleetViewModel model ->
Sub.map FleetViewAction <| FleetView.subscriptions model

LandingModel model ->
EnterFleetUrlModel model ->
Sub.none

NotFound ->
Expand All @@ -187,8 +187,8 @@ subscriptions model =
view : Model -> Html.Html Action
view model =
case model.view of
LandingModel model ->
App.map LandingAction <| Landing.view model
EnterFleetUrlModel model ->
App.map EnterFleetUrlAction <| EnterFleetUrl.view model

FleetViewModel model ->
App.map FleetViewAction <| FleetView.view model
Expand Down

0 comments on commit 944dd6a

Please sign in to comment.