Commit 60405b5 1 parent 669f917 commit 60405b5 Copy full SHA for 60405b5
File tree 20 files changed +354
-28
lines changed
20 files changed +354
-28
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"type" : " application" ,
3
3
"source-directories" : [
4
- " src"
4
+ " src" ,
5
+ " openapi" ,
6
+ " themes"
5
7
],
6
8
"elm-version" : " 0.19.1" ,
7
9
"dependencies" : {
8
10
"direct" : {
11
+ "BrianHicks/elm-css-reset" : " 1.0.2" ,
12
+ "danyx23/elm-uuid" : " 2.1.2" ,
9
13
"elm/browser" : " 1.0.2" ,
10
14
"elm/core" : " 1.0.5" ,
11
- "elm/html" : " 1.0.0"
12
- },
13
- "indirect" : {
15
+ "elm/html" : " 1.0.0" ,
16
+ "elm/http" : " 2.0.0" ,
14
17
"elm/json" : " 1.1.3" ,
15
18
"elm/time" : " 1.0.0" ,
16
19
"elm/url" : " 1.0.0" ,
17
- "elm/virtual-dom" : " 1.0.2"
20
+ "rtfeldman/elm-css" : " 16.1.1" ,
21
+ "rtfeldman/elm-iso8601-date-strings" : " 1.1.4"
22
+ },
23
+ "indirect" : {
24
+ "elm/bytes" : " 1.0.8" ,
25
+ "elm/file" : " 1.0.5" ,
26
+ "elm/parser" : " 1.1.0" ,
27
+ "elm/random" : " 1.0.0" ,
28
+ "elm/regex" : " 1.0.0" ,
29
+ "elm/virtual-dom" : " 1.0.2" ,
30
+ "rtfeldman/elm-hex" : " 1.0.0"
18
31
}
19
32
},
20
33
"test-dependencies" : {
21
34
"direct" : {
35
+ "avh4/elm-program-test" : " 3.6.3" ,
22
36
"elm-explorations/test" : " 1.2.2"
23
37
},
24
38
"indirect" : {
25
- "elm/random" : " 1.0.0"
39
+ "avh4/elm-fifo" : " 1.0.4" ,
40
+ "elm-community/list-extra" : " 8.5.2" ,
41
+ "hecrj/html-parser" : " 2.4.0" ,
42
+ "mgold/elm-nonempty-list" : " 4.2.0"
26
43
}
27
44
}
28
45
}
Original file line number Diff line number Diff line change 7
7
< title > Vite App</ title >
8
8
</ head >
9
9
< body >
10
- < div id ="app ">
11
- < div > </ div >
12
- </ div >
13
10
< script type ="module " src ="/src/main.js "> </ script >
14
11
</ body >
15
12
</ html >
Original file line number Diff line number Diff line change
1
+ module Effect exposing (Effect (..) , n , perform )
2
+
3
+ import Browser.Navigation as Nav
4
+ import Msg exposing (Msg )
5
+
6
+
7
+ type Effect
8
+ = NoEffect
9
+ | NavLoadEffect String
10
+ | NavPushUrlEffect Nav . Key String
11
+
12
+
13
+ n : model -> ( model , Effect )
14
+ n model =
15
+ ( model, NoEffect )
16
+
17
+
18
+ perform : Effect -> Cmd Msg
19
+ perform effect =
20
+ case effect of
21
+ NoEffect ->
22
+ Cmd . none
23
+
24
+ NavLoadEffect url ->
25
+ Nav . load url
26
+
27
+ NavPushUrlEffect key url ->
28
+ Nav . pushUrl key url
Original file line number Diff line number Diff line change
1
+ module Init exposing (init )
2
+
3
+ import Browser.Navigation as Nav
4
+ import Effect exposing (Effect (..) , n )
5
+ import Iknaio
6
+ import Locale.Init as Locale
7
+ import Model exposing (..)
8
+ import Url exposing (Url )
9
+
10
+
11
+ init : Flags -> Url -> Nav .Key -> ( Model , Effect )
12
+ init _ url key =
13
+ n
14
+ { url = url
15
+ , key = key
16
+ , locale = Locale . init
17
+ , theme = Iknaio . theme
18
+ , search = ()
19
+ , user = ()
20
+ }
Original file line number Diff line number Diff line change
1
+ module Locale.Update exposing (update )
2
+
3
+ import Locale.Effect exposing (Effect , n )
4
+ import Locale.Model exposing (Model )
5
+ import Locale.Msg exposing (Msg (..) )
6
+
7
+
8
+ update : Msg -> Model -> ( Model , Effect )
9
+ update msg model =
10
+ n model
Original file line number Diff line number Diff line change
1
+ module Locale.Effect exposing (Effect (..) , n )
2
+
3
+
4
+ type Effect
5
+ = NoEffect
6
+
7
+
8
+ n : model -> ( model , Effect )
9
+ n model =
10
+ ( model, NoEffect )
Original file line number Diff line number Diff line change
1
+ module Locale.Init exposing (init )
2
+
3
+ import Locale.Model as Model exposing (Model )
4
+
5
+
6
+ init : Model
7
+ init =
8
+ { getString = \ str -> str
9
+ }
Original file line number Diff line number Diff line change
1
+ module Locale.Model exposing (Model )
2
+
3
+
4
+ type alias Model =
5
+ { getString : String -> String
6
+ }
Original file line number Diff line number Diff line change
1
+ module Locale exposing (..)
2
+
3
+ import Locale.Effect as Effect exposing (n )
4
+ import Locale.Model as Model exposing (..)
5
+ import Locale.Msg as Msg exposing (Msg )
6
+
7
+
8
+ update : Msg -> Model -> Model
9
+ update msg model =
10
+ n model
Original file line number Diff line number Diff line change 1
1
module Main exposing (main )
2
2
3
3
import Browser
4
- import Msg exposing (Msg )
4
+ import Effect exposing (perform )
5
+ import Init exposing (init )
6
+ import Model exposing (Flags , Model )
7
+ import Msg exposing (Msg (..) )
8
+ import Sub exposing (subscriptions )
9
+ import Tuple
5
10
import Update exposing (update )
6
11
import View exposing (view )
7
12
8
13
9
- main : Program () Int Msg
14
+ main : Program Flags Model Msg
10
15
main =
11
- Browser . sandbox { init = 0 , update = update, view = view }
16
+ Browser . application
17
+ { init =
18
+ \ flags url key ->
19
+ init flags url key
20
+ |> Tuple . mapSecond perform
21
+ , update =
22
+ \ msg model ->
23
+ update msg model
24
+ |> Tuple . mapSecond perform
25
+ , view = view
26
+ , subscriptions = subscriptions
27
+ , onUrlChange = BrowserChangedUrl
28
+ , onUrlRequest = UserRequestsUrl
29
+ }
Original file line number Diff line number Diff line change
1
+ module Model exposing (..)
2
+
3
+ import Browser.Navigation as Nav
4
+ import Locale.Model as Locale
5
+ import Themes.Model exposing (Theme )
6
+ import Url exposing (Url )
7
+
8
+
9
+ type alias Flags =
10
+ {}
11
+
12
+
13
+ type alias Config =
14
+ { getString : String -> String
15
+ }
16
+
17
+
18
+ type alias Model =
19
+ { url : Url
20
+ , key : Nav . Key
21
+ , locale : Locale . Model
22
+ , theme : Theme
23
+ , search : ()
24
+ , user : ()
25
+ }
Original file line number Diff line number Diff line change 1
1
module Msg exposing (Msg (..) )
2
2
3
+ import Browser exposing (UrlRequest )
4
+ import Model exposing (..)
5
+ import Url exposing (Url )
6
+
7
+
3
8
type Msg
4
- = Increment
5
- | Decrement
9
+ = UserRequestsUrl UrlRequest
10
+ | BrowserChangedUrl Url
Original file line number Diff line number Diff line change
1
+ module Sub exposing (subscriptions )
2
+
3
+ import Model exposing (Model )
4
+ import Msg exposing (Msg )
5
+
6
+
7
+ subscriptions : Model -> Sub Msg
8
+ subscriptions _ =
9
+ Sub . none
Original file line number Diff line number Diff line change
1
+ module Themes.Model exposing (Theme )
2
+
3
+ import Css exposing (Style )
4
+
5
+
6
+ type alias Theme =
7
+ { header : Style
8
+ }
Original file line number Diff line number Diff line change 1
1
module Update exposing (update )
2
2
3
+ import Browser
4
+ import Effect exposing (Effect (..) , n )
5
+ import Model exposing (Model )
3
6
import Msg exposing (..)
7
+ import Url exposing (Url )
4
8
5
9
6
- update : Msg -> number -> number
10
+ update : Msg -> Model -> ( Model , Effect )
7
11
update msg model =
8
12
case msg of
9
- Increment ->
10
- model + 2
13
+ UserRequestsUrl request ->
14
+ case request of
15
+ Browser . Internal url ->
16
+ ( model
17
+ , Url . toString url
18
+ |> NavPushUrlEffect model. key
19
+ )
11
20
12
- Decrement ->
13
- model - 1
21
+ Browser . External url ->
22
+ ( model
23
+ , NavLoadEffect url
24
+ )
25
+
26
+ BrowserChangedUrl url ->
27
+ updateByUrl url model
28
+
29
+
30
+ updateByUrl : Url -> Model -> ( Model , Effect )
31
+ updateByUrl _ model =
32
+ n model
Original file line number Diff line number Diff line change 1
1
module View exposing (view )
2
2
3
- import HelloWorld exposing (helloWorld )
4
- import Html exposing (Html , div , img )
5
- import Html.Attributes exposing (src , style )
3
+ import Browser exposing (Document )
4
+ import Css exposing (..)
5
+ import Css.Reset
6
+ import Html.Styled exposing (..)
7
+ import Html.Styled.Attributes exposing (..)
8
+ import Model exposing (..)
6
9
import Msg exposing (..)
10
+ import View.Header as Header
7
11
8
12
9
- view : Int -> Html Msg
13
+ view : Model -> Document Msg
10
14
view model =
11
- div []
12
- [ img [ src " /logo.png" , style " width" " 400px" ] []
13
- , helloWorld model
15
+ { title = model. locale. getString " Iknaio Dashboard"
16
+ , body =
17
+ [ Css . Reset . meyerV2 |> toUnstyled
18
+ , body model |> toUnstyled
19
+ ]
20
+ }
21
+
22
+
23
+ body : Model -> Html Msg
24
+ body model =
25
+ div
26
+ [ css
27
+ [ Css . height <| vh 100
28
+ , displayFlex
29
+ , flexDirection column
30
+ , overflow Css . hidden
31
+ ]
32
+ ]
33
+ [ Header . header
34
+ { theme = model. theme
35
+ , search = model. search
36
+ , user = model. user
37
+ }
38
+ , section
39
+ [ css
40
+ [ displayFlex
41
+ , flexDirection row
42
+ , flexGrow ( num 1 )
43
+ ]
44
+ ]
45
+ [ nav
46
+ [ css
47
+ [ displayFlex
48
+ , flexDirection column
49
+ ]
50
+ ]
51
+ [ button
52
+ []
53
+ [ text " S"
54
+ ]
55
+ , button
56
+ []
57
+ [ text " D"
58
+ ]
59
+ ]
60
+ , main_
61
+ [ css
62
+ [ flexGrow ( num 1 )
63
+ ]
64
+ ]
65
+ [ text " MAIN"
66
+ ]
67
+ ]
14
68
]
You can’t perform that action at this time.
0 commit comments