diff --git a/elm-package.json b/elm-package.json index acfffd3..6d62a13 100644 --- a/elm-package.json +++ b/elm-package.json @@ -1,15 +1,18 @@ { - "version": "1.0.0", - "summary": "an elm boilerplate", - "repository": "https://github.com/astroash/elm-spa-boiler-plate.git", - "license": "BSD3", - "source-directories": ["src/elm"], - "exposed-modules": [], - "dependencies": { - "elm-community/elm-datepicker": "7.2.5 <= v < 8.0.0", - "elm-lang/core": "5.1.1 <= v < 6.0.0", - "elm-lang/html": "2.0.0 <= v < 3.0.0", - "elm-lang/navigation": "2.1.0 <= v < 3.0.0" - }, - "elm-version": "0.18.0 <= v < 0.19.0" + "version": "1.0.0", + "summary": "an elm boilerplate", + "repository": "https://github.com/astroash/elm-spa-boiler-plate.git", + "license": "BSD3", + "source-directories": [ + "src/elm" + ], + "exposed-modules": [], + "dependencies": { + "elm-community/elm-datepicker": "7.2.5 <= v < 8.0.0", + "elm-lang/core": "5.1.1 <= v < 6.0.0", + "elm-lang/html": "2.0.0 <= v < 3.0.0", + "elm-lang/navigation": "2.1.0 <= v < 3.0.0", + "mgold/elm-date-format": "1.4.2 <= v < 2.0.0" + }, + "elm-version": "0.18.0 <= v < 0.19.0" } diff --git a/src/css/_custom.css b/src/css/_custom.css index f424b91..f877c63 100644 --- a/src/css/_custom.css +++ b/src/css/_custom.css @@ -166,6 +166,7 @@ button { /**/ .interactionDetailsImage { background: url('./assets/png/record_bg.png') no-repeat; + background-size: contain; } .imageInteractionItem { @@ -179,12 +180,6 @@ button { background-color: #ffffffcf; } -.interactionDetailsImage { - background: url('./assets/png/record_bg.png') no-repeat; - background-size: cover; - z-index: -1; -} - .h6 { height: 25rem; } diff --git a/src/elm/Routes/NewContactDetailsPage.elm b/src/elm/Routes/NewContactDetailsPage.elm index eb8e5a1..43dd556 100644 --- a/src/elm/Routes/NewContactDetailsPage.elm +++ b/src/elm/Routes/NewContactDetailsPage.elm @@ -16,6 +16,7 @@ newContactDetailsPage model = , formItem "assets/svg_icons/email.svg" "Email" model.currentInteraction.email SetContactEmail , formItem "assets/svg_icons/phone.svg" "Phone" model.currentInteraction.phone SetContactPhone , formItem "assets/svg_icons/company.svg" "Organisation" model.currentInteraction.organisation SetContactOrganisation + , formItem "assets/svg_icons/handshake_icn.svg" "Where did you meet" model.currentInteraction.event SetContactWhere , div [ class "bb b--blue bw1 w-80 center flex items-center pb2 mb2" ] [ img [ src "assets/svg_icons/cal.svg", class "w2" ] [] , div [ class "" ] diff --git a/src/elm/Routes/NewNotesPage.elm b/src/elm/Routes/NewNotesPage.elm index 5f62f78..34df38f 100644 --- a/src/elm/Routes/NewNotesPage.elm +++ b/src/elm/Routes/NewNotesPage.elm @@ -81,7 +81,7 @@ audioView model = buttonClass = - "dim b pointer w7 h3 f4 ma2" + "dim b pointer w7 h3 f4 ma2 button-transparent" textView : Model -> Html Msg diff --git a/src/elm/Routes/NewRecommendPage.elm b/src/elm/Routes/NewRecommendPage.elm index 5c77575..85b1889 100644 --- a/src/elm/Routes/NewRecommendPage.elm +++ b/src/elm/Routes/NewRecommendPage.elm @@ -67,7 +67,7 @@ viewMaker : Html Types.Msg -> Html Types.Msg viewMaker filler = div [ class "fixed bottom-0 left-0 vh-100 w-100 pt5" ] [ div [ class "ba b--blue bw2 br3 bg-white z-999 w-90 vh-75 pa0 ma0 center mt5 grows transition-none " ] - [ button [ class "link ma2 relative top-0 left-0", onClick <| ChangeDetails ChooseDeets ] + [ button [ class "button-transparent link ma2 relative top-0 left-0", onClick <| ChangeDetails ChooseDeets ] [ img [ src "./assets/svg_icons/remove.svg" ] [] ] , filler diff --git a/src/elm/Routes/NewSharePage.elm b/src/elm/Routes/NewSharePage.elm deleted file mode 100644 index c71c88c..0000000 --- a/src/elm/Routes/NewSharePage.elm +++ /dev/null @@ -1,15 +0,0 @@ -module Routes.NewSharePage exposing (..) - -import Html exposing (..) -import Html.Attributes exposing (..) -import Html.Events exposing (..) -import Types exposing (..) - - -newSharePage : Model -> Html Msg -newSharePage model = - div [ class "w-60-ns center" ] - [ h1 [ class "tc f1" ] [ text "Do you want to share this with your contacts?" ] - , p [ class "f3 w60 mh1 tc" ] [ text "newShareRoute." ] - , input [ class "newShareRoute" ] [] - ] diff --git a/src/elm/Routes/NewThankYouPage.elm b/src/elm/Routes/NewThankYouPage.elm deleted file mode 100644 index 580209f..0000000 --- a/src/elm/Routes/NewThankYouPage.elm +++ /dev/null @@ -1,14 +0,0 @@ -module Routes.NewThankYouPage exposing (..) - -import Html exposing (..) -import Html.Attributes exposing (..) -import Html.Events exposing (..) -import Types exposing (..) - - -newThankYouPage : Model -> Html Msg -newThankYouPage model = - div [ class "w-60-ns center" ] - [ h1 [ class "tc f1" ] [ text "endroute" ] - , p [ class "f3 w60 mh1 tc" ] [ text "endroute" ] - ] diff --git a/src/elm/Routes/PreviousDetailPage.elm b/src/elm/Routes/PreviousDetailPage.elm index 2f54975..8d95078 100644 --- a/src/elm/Routes/PreviousDetailPage.elm +++ b/src/elm/Routes/PreviousDetailPage.elm @@ -1,5 +1,6 @@ module Routes.PreviousDetailPage exposing (..) +import Date.Format exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) @@ -21,46 +22,62 @@ previousDetailPage model = case model.liveInteraction.notes.audioUrl of audioUrl -> audio [ controls False, class " mv3 pa3", id "audio", src audioUrl ] [] + + date = + case model.liveInteraction.interactionDate of + Just d -> + Date.Format.format "%A, %B %d, %Y" d + + _ -> + "No date given" + + fUDate = + case model.liveInteraction.followUpDate of + Just d -> + Date.Format.format "%A, %B %d, %Y" d + + _ -> + "No date given" in - div [ class "interactionDetailsImage w-60-ns center brand tc" ] - [ div [ class "w-100 h4 bg-white bb b--black-10 v-mid flex" ] - [ a [ href "#" ] [ img [ class "pa3 h3", src "./assets/png/icon.png" ] [] ] - , h2 [ class "blue center pt2" ] [ text model.liveInteraction.name ] + div [ class "interactionDetailsImage w-60-ns center brand tc" ] + [ div [ class "w-100 h4 bg-white bb b--black-10 v-mid flex" ] + [ a [ href "#" ] [ img [ class "pa3 h3", src "./assets/png/icon.png" ] [] ] + , h2 [ class "blue center pt2" ] [ text model.liveInteraction.name ] + ] + , div [ class "w-100 center ma0 pa0" ] + [ div [ class "inline-flex flex-wrap" ] + [ button [ onClick <| PlayAudio True, class "button-transparent" ] [ img [ class "ma2 br-100", src "./assets/svg_icons/hear_rec.svg" ] [ interactionAudioHtml ] ] + , img [ class "ma2", src "./assets/svg_icons/man.svg" ] [] + , button [ class "button-transparent" ] [ img [ class "ma2 br-100", src "./assets/svg_icons/cal.svg" ] [] ] ] - , div [ class "w-100 center ma0 pa0" ] - [ div [ class "inline-flex flex-wrap" ] - [ button [ onClick <| PlayAudio True, class "button-transparent" ] [ img [ class "ma3 br-100", src "./assets/svg_icons/hear_rec.svg" ] [ interactionAudioHtml ] ] - , img [ class "ma3", src "./assets/svg_icons/man.svg" ] [] - , button [ class "button-transparent" ] [ img [ class "ma3 br-100", src "./assets/svg_icons/cal.svg" ] [] ] - ] + ] + , interactionAudioHtml + , div [ class " w-100" ] + [ div [ class "bg-blue white pa0 ma0" ] + [ h3 [ class "center pt3 underline" ] [ text "Date:" ] + , p [ class "f5" ] [ text date ] + , p [ class "f5 ma0 pb3" ] [ text <| "at " ++ model.liveInteraction.event ] + ] + , div [ class "bg-moon-gray blue ma0" ] + [ h3 [ class "bold center pt3 mt0" ] [ text "Notes" ] + , interactionTextHtml ] - , interactionAudioHtml - , div [ class " w-100" ] - [ div [ class "bg-blue white pa0 ma0" ] - [ h3 [ class "center pt3 underline" ] [ text "Date and time" ] - , p [ class "f5" ] [ text "Met on Aug 3rd, 2017 at 6pm" ] - , p [ class "f5 ma0 pb3" ] [ text "at New Town Hall, GL8 9JDF" ] - ] - , div [ class "bg-moon-gray blue ma0" ] - [ h3 [ class "bold center pt3 mt0" ] [ text "Notes" ] - , interactionTextHtml - ] - , div [ class "bg-light-gray blue ma0" ] - [ h3 [ class "mt0 pt3" ] [ text "Contact" ] - , p [] [ text <| "Email: " ++ model.liveInteraction.email ] - , p [ class "pb3 ma0" ] [ text <| "Phone: " ++ model.liveInteraction.phone ] - ] - , div [ class "bg-near-white blue ma0" ] <| - [ h3 [ class "mt0 pt3" ] [ text "Actions" ] - , p [] [ text "Shared" ] - , p [ class "pb3 ma0" ] [ text "Reminders" ] - ] + , div [ class "bg-light-gray blue ma0" ] + [ h3 [ class "mt0 pt3" ] [ text "Contact" ] + , p [] [ text <| "Email: " ++ model.liveInteraction.email ] + , p [ class "pb3 ma0" ] [ text <| "Phone: " ++ model.liveInteraction.phone ] ] - , div [ class "bg-white blue ma0" ] <| - [ h3 [ class "mt0 pt3" ] [ text "Recommendations" ] + , div [ class "bg-near-white blue ma0" ] <| + [ h3 [ class "mt0 pt3" ] [ text "Actions" ] + , p [ class "f5 pb2" ] [ text "You shared this with " ] + , p [ class "f5 pb3" ] [ text <| "Follow this up on " ++ fUDate ] ] - ++ List.map recommendItem model.liveInteraction.recommendations ] + , div [ class "bg-white blue ma0" ] <| + [ h3 [ class "mt0 pt3" ] [ text "Recommendations" ] + ] + ++ List.map recommendItem model.liveInteraction.recommendations + ] recommendItem : Recommendation -> Html Msg diff --git a/src/elm/Routes/PreviousOverviewPage.elm b/src/elm/Routes/PreviousOverviewPage.elm index 9cabf3b..628baf4 100644 --- a/src/elm/Routes/PreviousOverviewPage.elm +++ b/src/elm/Routes/PreviousOverviewPage.elm @@ -1,10 +1,11 @@ module Routes.PreviousOverviewPage exposing (..) +import Components.TitleBar exposing (..) +import Date.Format exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import Types exposing (..) -import Components.TitleBar exposing (..) previousOverviewPage : Model -> Html Msg @@ -23,10 +24,21 @@ previousOverviewPage model = interactionItem : Interaction -> Html Msg interactionItem interaction = + let + date = + case interaction.interactionDate of + Just d -> + Date.Format.format "%d/%m/%Y" d + + _ -> + "No date given" + in button [ class "w-100 interactionItem button-border", onClick <| SelectInteractionItem interaction ] [ li [ class "db b--blue-10" ] - [ div [ class "flex justify-end" ] - [ p [ class "bg-blue w3 h1 br3 white mr3 mb0" ] [ text interaction.tags ] ] + [ div [ class "flex justify-between" ] + [ p [ class "bg-blue ph2 h1 br3 white mr3 mb0" ] [ text date ] + , p [ class "bg-blue ph2 h1 br3 white mr3 mb0" ] [ text interaction.tags ] + ] , h1 [ class "f4 b blue f3 mt0" ] [ text interaction.organisation ] , p [ class "ma1 b blue f4" ] [ text interaction.name ] , div [ class "b blue" ] [ text interaction.notes.text ] diff --git a/src/elm/State.elm b/src/elm/State.elm index d28d028..8688eb9 100644 --- a/src/elm/State.elm +++ b/src/elm/State.elm @@ -18,12 +18,12 @@ init = DatePicker.init in ( { route = HomeRoute - , currentInteraction = Interaction Nothing "" "" "" "" (Notes "" "") "" [] Nothing CurrentMemberNotSet + , currentInteraction = Interaction Nothing "" "" "" "" (Notes "" "") "" [] Nothing CurrentMemberNotSet "" , recordedInteractions = listRecordedInteractions , notesPage = Choose , isRecording = False , datePicker = datePicker - , liveInteraction = Interaction Nothing "" "" "" "" (Notes "" "") "" [] Nothing CurrentMemberNotSet + , liveInteraction = Interaction Nothing "" "" "" "" (Notes "" "") "" [] Nothing CurrentMemberNotSet "" , searchInput = "" , detailsPage = ChooseDeets , newRecommend = Recommendation "" "" @@ -40,14 +40,19 @@ init = listRecordedInteractions : List Interaction listRecordedInteractions = - [ Interaction Nothing "Alexa Vega" "PHS Limited" "alexavega@gmail.com" "+447598772611" (Notes "A grafitti artist from Stroud that is looking for work" "") "Visual Arts" [ Recommendation "Lucy" "TBSA ltd", Recommendation "Rebe" "NHS" ] Nothing CurrentMemberNotSet - , Interaction Nothing "Daryl Sabara" "Cortez Ltd" "darylsabara@cortez.com" "+447532172611" (Notes "school teacher looking for a grafitti artist" "") "Education" [ Recommendation "Mavis" "Monzo", Recommendation "Ronan" "AirBnb" ] Nothing CurrentMemberNotSet - , Interaction Nothing "Antonio Banderas" "Cargo S.L." "banderas@cargo.com" "+447598772987" (Notes "school teacher looking for a grafitti artist" "") "Theatre" [ Recommendation "Max" "Uber Eats", Recommendation "Zooey" "Queen" ] Nothing CurrentMemberNotSet - , Interaction Nothing "Carla Gugino" "Organisation" "darylsabara@cortez.com" "+447532172611" (Notes "school teacher looking for a grafitti artist" "") "Community" [ Recommendation "Jen" "Tate Modern", Recommendation "Ellie" "Deliveroo" ] Nothing CurrentMemberNotSet - , Interaction Nothing "Antonio Banderas" "Cargo S.L." "banderas@cargo.com" "+447598772987" (Notes "school teacher looking for a grafitti artist" "") "New Media" [ Recommendation "Dan" "Olympics ltd", Recommendation "Ash" "British Council" ] Nothing CurrentMemberNotSet + [ Interaction (makeDate "12/12/2017") "Alexa Vega" "PHS Limited" "alexavega@gmail.com" "+447598772611" (Notes "A grafitti artist from Stroud that is looking for work" "") "Artist" [ Recommendation "Lucy" "TBSA ltd", Recommendation "Rebe" "NHS" ] (makeDate "12/21/2017") CurrentMemberNotSet "Farmers Market" + , Interaction (makeDate "11/28/2017") "Daryl Sabara" "Cortez Ltd" "darylsabara@cortez.com" "+447532172611" (Notes "school teacher looking for a grafitti artist" "") "Fine Arts" [ Recommendation "Mavis" "Monzo", Recommendation "Ronan" "AirBnb" ] (makeDate "12/19/2017") CurrentMemberNotSet "Farmers Market" + , Interaction (makeDate "11/19/2017") "Antonio Banderas" "Cargo S.L." "banderas@cargo.com" "+447598772987" (Notes "school teacher looking for a grafitti artist" "") "Event" [ Recommendation "Max" "Uber Eats", Recommendation "Zooey" "Queen" ] (makeDate "12/01/2017") CurrentMemberNotSet "Farmers Market" + , Interaction (makeDate "11/12/2017") "Carla Gugino" "Organisation" "darylsabara@cortez.com" "+447532172611" (Notes "school teacher looking for a grafitti artist" "") "Community" [ Recommendation "Jen" "Tate Modern", Recommendation "Ellie" "Deliveroo" ] (makeDate "11/18/2017") CurrentMemberNotSet "Farmers Market" + , Interaction (makeDate "10/01/2017") "Antonio Banderas" "Cargo S.L." "banderas@cargo.com" "+447598772987" (Notes "school teacher looking for a grafitti artist" "") "New Media" [ Recommendation "Dan" "Olympics ltd", Recommendation "Ash" "British Council" ] (makeDate "10/29/2017") CurrentMemberNotSet "Farmers Market" ] +makeDate : String -> Maybe Date +makeDate string = + Result.toMaybe (Date.fromString string) + + --UPDATE @@ -67,12 +72,6 @@ getRoute hash = "#newRecommend" -> NewRecommendRoute - "#newShare" -> - NewShareRoute - - "#newThankYou" -> - NewThankYouRoute - "#previousOverview" -> PreviousInteractionsOverviewRoute @@ -193,6 +192,16 @@ update msg model = in ( { model | currentInteraction = newInteraction }, Cmd.none ) + SetContactWhere input -> + let + interaction = + model.currentInteraction + + newInteraction = + { interaction | event = input } + in + ( { model | currentInteraction = newInteraction }, Cmd.none ) + GoBack -> ( model, Navigation.back 1 ) @@ -352,7 +361,7 @@ update msg model = Navigation.newUrl "#previousDetail" resetInt = - Interaction Nothing "" "" "" "" (Notes "" "") "" [] Nothing CurrentMemberNotSet + Interaction Nothing "" "" "" "" (Notes "" "") "" [] Nothing CurrentMemberNotSet "" updateList = model.currentInteraction :: model.recordedInteractions diff --git a/src/elm/Types.elm b/src/elm/Types.elm index d3d44d8..9f3a50f 100644 --- a/src/elm/Types.elm +++ b/src/elm/Types.elm @@ -13,8 +13,6 @@ type Route | NewContactDetailsRoute | NewNotesRoute | NewRecommendRoute - | NewShareRoute --| with follow up date - | NewThankYouRoute | PreviousInteractionsOverviewRoute | PreviousInteractionsDetailRoute | NotFoundRoute @@ -64,6 +62,7 @@ type alias Interaction = , recommendations : List Recommendation , followUpDate : Maybe Date , currentMember : CurrentMemberOptions + , event : String } @@ -116,6 +115,7 @@ type Msg | SetContactEmail String | SetContactPhone String | SetContactOrganisation String + | SetContactWhere String | GoBack | SetCurrentContact CurrentMemberOptions | ChangeNotes NoteState diff --git a/src/elm/View.elm b/src/elm/View.elm index a392b17..61086f3 100644 --- a/src/elm/View.elm +++ b/src/elm/View.elm @@ -8,8 +8,6 @@ import Routes.Home exposing (..) import Routes.NewContactDetailsPage exposing (..) import Routes.NewNotesPage exposing (..) import Routes.NewRecommendPage exposing (..) -import Routes.NewSharePage exposing (..) -import Routes.NewThankYouPage exposing (..) import Routes.NotFoundPage exposing (..) import Routes.PreviousDetailPage exposing (..) import Routes.PreviousOverviewPage exposing (..) @@ -33,12 +31,6 @@ view model = NewRecommendRoute -> newRecommendPage model - NewShareRoute -> - newSharePage model - - NewThankYouRoute -> - newThankYouPage model - PreviousInteractionsOverviewRoute -> previousOverviewPage model @@ -48,5 +40,5 @@ view model = NotFoundRoute -> notFoundPage model in - div [] - [ page ] + div [] + [ page ]