Compare commits
No commits in common. "45ca677c87a7a10a7c0e0e71340f4b3f75e5c4d7" and "db0066980067ac0f1ecef76064389f7031115597" have entirely different histories.
45ca677c87
...
db00669800
6
Makefile
6
Makefile
|
@ -26,9 +26,12 @@ $(PUBLIC_DIR):
|
||||||
$(PUBLIC_DIR)/index.html: $(FRONTEND_DIR)/index.html $(PUBLIC_DIR)
|
$(PUBLIC_DIR)/index.html: $(FRONTEND_DIR)/index.html $(PUBLIC_DIR)
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
|
$(FRONTEND_DIR)/elm.min.js:
|
||||||
|
make -C $(FRONTEND_DIR)
|
||||||
|
|
||||||
.PHONY: frontend backend
|
.PHONY: frontend backend
|
||||||
|
|
||||||
frontend: $(PUBLIC_DIR)/index.html $(PUBLIC_DIR)
|
frontend: $(PUBLIC_DIR)/index.html $(FRONTEND_DIR)/elm.min.js $(PUBLIC_DIR)
|
||||||
cp $(FRONTEND_DIR)/elm.min.js $(PUBLIC_DIR)/
|
cp $(FRONTEND_DIR)/elm.min.js $(PUBLIC_DIR)/
|
||||||
cp $(FRONTEND_DIR)/src/ports.websocket.js $(PUBLIC_DIR)/
|
cp $(FRONTEND_DIR)/src/ports.websocket.js $(PUBLIC_DIR)/
|
||||||
mkdir -p $(PUBLIC_DIR)/assets
|
mkdir -p $(PUBLIC_DIR)/assets
|
||||||
|
@ -37,7 +40,6 @@ backend:
|
||||||
$(CARGO_BUILD) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
$(CARGO_BUILD) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
||||||
|
|
||||||
serve: frontend backend
|
serve: frontend backend
|
||||||
make -C $(FRONTEND_DIR)
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
||||||
else ifeq ($(RELEASE),1)
|
else ifeq ($(RELEASE),1)
|
||||||
|
|
|
@ -2,8 +2,6 @@ SRC_FILES := $(shell find src -name "*.elm")
|
||||||
|
|
||||||
all: elm.min.js
|
all: elm.min.js
|
||||||
|
|
||||||
.PHONY: elm.min.js
|
|
||||||
|
|
||||||
ifeq ($(DEBUG)$(RELEASE),) # Both are empty
|
ifeq ($(DEBUG)$(RELEASE),) # Both are empty
|
||||||
$(error You must set exactly one of DEBUG=1 or RELEASE=1)
|
$(error You must set exactly one of DEBUG=1 or RELEASE=1)
|
||||||
endif
|
endif
|
||||||
|
@ -13,7 +11,7 @@ $(error Both DEBUG and RELEASE cannot be set at the same time)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
elm.min.js:
|
elm.min.js: $(SRC_FILES)
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
./build.sh --debug src/Main.elm
|
./build.sh --debug src/Main.elm
|
||||||
else ifeq ($(RELEASE),1)
|
else ifeq ($(RELEASE),1)
|
||||||
|
|
|
@ -10,8 +10,6 @@ import Element exposing (Element)
|
||||||
import Websockets
|
import Websockets
|
||||||
import Ports
|
import Ports
|
||||||
import Json.Decode as Decode
|
import Json.Decode as Decode
|
||||||
import Html.Attributes exposing (placeholder)
|
|
||||||
import Element.Input
|
|
||||||
|
|
||||||
type alias Model = {
|
type alias Model = {
|
||||||
time : String
|
time : String
|
||||||
|
@ -22,7 +20,6 @@ type alias Landing = {
|
||||||
type Msg
|
type Msg
|
||||||
= ToFrontend Landing
|
= ToFrontend Landing
|
||||||
| DecodeError Decode.Error
|
| DecodeError Decode.Error
|
||||||
| GreetWidgetText String
|
|
||||||
| NoOp
|
| NoOp
|
||||||
|
|
||||||
init : () -> Model
|
init : () -> Model
|
||||||
|
@ -57,23 +54,9 @@ update msg model =
|
||||||
ToFrontend landing -> ( {model | time = landing.time}, Cmd.none )
|
ToFrontend landing -> ( {model | time = landing.time}, Cmd.none )
|
||||||
_ -> (model, Cmd.none)
|
_ -> (model, Cmd.none)
|
||||||
|
|
||||||
greetWidget =
|
|
||||||
let
|
|
||||||
textInput =
|
|
||||||
Element.Input.text []
|
|
||||||
{ onChange = GreetWidgetText
|
|
||||||
, text = "text"
|
|
||||||
, placeholder = Nothing
|
|
||||||
, label = Element.Input.labelHidden "Greet"
|
|
||||||
}
|
|
||||||
in
|
|
||||||
Element.row []
|
|
||||||
[ textInput ]
|
|
||||||
|
|
||||||
view : Model -> Element Msg
|
view : Model -> Element Msg
|
||||||
view model =
|
view model =
|
||||||
Element.column []
|
Element.column []
|
||||||
[ Element.text "Landing"
|
[ Element.text "Landing",
|
||||||
, Element.text <| "Current time is : " ++ model.time
|
Element.text <| "Current time is : " ++ model.time
|
||||||
, greetWidget
|
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue