diff --git a/gleam.toml b/gleam.toml index 837717d..60c6c76 100644 --- a/gleam.toml +++ b/gleam.toml @@ -8,3 +8,4 @@ gleam_http = "~> 3.5" gleam_json = "~> 0.6.0" gleam_javascript = "~> 0.6.0" gleam_fetch = "~> 0.2.0" +lustre = "~> 3.0" diff --git a/index.html b/index.html new file mode 120000 index 0000000..241d474 --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +build/dev/javascript/geo_therminator/priv/index.html \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 08f354d..4064956 100644 --- a/manifest.toml +++ b/manifest.toml @@ -2,11 +2,12 @@ # You typically do not need to edit this file packages = [ - { name = "gleam_fetch", version = "0.2.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript"], otp_app = "gleam_fetch", source = "hex", outer_checksum = "D0C9E9CAE8D6EFCCC3A9FF817DCA9ED327097222086D91DE4F6CA8FBAB02D79F" }, + { name = "gleam_fetch", version = "0.2.0", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_http"], otp_app = "gleam_fetch", source = "hex", outer_checksum = "D0C9E9CAE8D6EFCCC3A9FF817DCA9ED327097222086D91DE4F6CA8FBAB02D79F" }, { name = "gleam_http", version = "3.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "FAE9AE3EB1CA90C2194615D20FFFD1E28B630E84DACA670B28D959B37BCBB02C" }, { name = "gleam_javascript", version = "0.6.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "BFEBB63ABE4A1694E07DEFD19B160C2980304B5D775A89D4B02E7DE7C9D8008B" }, { name = "gleam_json", version = "0.6.0", build_tools = ["gleam"], requirements = ["thoas", "gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "C6CC5BEECA525117E97D0905013AB3F8836537455645DDDD10FE31A511B195EF" }, { name = "gleam_stdlib", version = "0.30.2", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "8D8BF3790AA31176B1E1C0B517DD74C86DA8235CF3389EA02043EE4FD82AE3DC" }, + { name = "lustre", version = "3.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "5D4938048F24F0F04EFCBF1ED62485228EBF4317F4235DB66DDBA6E1B33BAC50" }, { name = "thoas", version = "0.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "4918D50026C073C4AB1388437132C77A6F6F7C8AC43C60C13758CC0ADCE2134E" }, ] @@ -16,3 +17,4 @@ gleam_http = { version = "~> 3.5" } gleam_javascript = { version = "~> 0.6.0" } gleam_json = { version = "~> 0.6.0" } gleam_stdlib = { version = "~> 0.30" } +lustre = { version = "~> 3.0" } diff --git a/priv/index.html b/priv/index.html new file mode 100644 index 0000000..c063e5a --- /dev/null +++ b/priv/index.html @@ -0,0 +1,23 @@ + + + + + + + GeoTherminator + + + + + +
+ + + + diff --git a/src/geo_t/web.gleam b/src/geo_t/web.gleam new file mode 100644 index 0000000..bda7c0f --- /dev/null +++ b/src/geo_t/web.gleam @@ -0,0 +1,27 @@ +import lustre +import lustre/element/html.{div} +import geo_t/config.{Config} +import geo_t/web/login_view + +pub fn main() { + let app = lustre.simple(init, update, view) + let assert Ok(_) = lustre.start(app, "[data-lustre-app]", Nil) + + Nil +} + +pub type Model { + Model(config: Config, login: login_view.Model) +} + +fn init(_) { + Model(config: config.load_config(), login: login_view.init()) +} + +fn update(model: Model, _msg) { + model +} + +fn view(model: Model) { + div([], [login_view.view(model.login)]) +} diff --git a/src/geo_t/web/login_view.gleam b/src/geo_t/web/login_view.gleam new file mode 100644 index 0000000..fc59f10 --- /dev/null +++ b/src/geo_t/web/login_view.gleam @@ -0,0 +1,46 @@ +import gleam/int +import lustre/element.{Element} +import lustre/element/html +import lustre/attribute +import lustre/event + +pub type Model { + Model(username: String, password: String) +} + +pub fn init() -> Model { + Model("", "") +} + +pub type Msg { + AttemptLogin +} + +pub fn update(model: Model, msg: Msg) -> Model { + model +} + +pub fn view(model: Model) -> Element(Msg) { + html.div( + [], + [ + html.h1([], [element.text("Log in")]), + html.form( + [attribute.attribute("method", "post")], + [ + html.input([ + attribute.type_("text"), + attribute.name("username"), + attribute.required(True), + ]), + html.input([ + attribute.type_("password"), + attribute.name("password"), + attribute.required(True), + ]), + html.button([attribute.type_("submit")], [element.text("Log in")]), + ], + ), + ], + ) +}