From 93542e4e90204b82cab7062fce82610c27f620da Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Mon, 6 Apr 2020 20:22:10 +0200 Subject: [PATCH] add help page 1 --- backend/src/info.rs | 28 ++++++ backend/src/main.rs | 2 + backend/src/util.rs | 3 +- backend/static/style/arrow.svg | 91 ++++++++++++++++++ backend/static/style/help.css | 122 ++++++++++++++++++++++++ backend/templates/base.html.tera | 2 +- backend/templates/help/base.html.tera | 37 +++++++ backend/templates/help/help_1.html.tera | 42 ++++++++ backend/templates/help/help_2.html.tera | 14 +++ backend/templates/help/help_3.html.tera | 14 +++ backend/templates/index2.html.tera | 77 +++++++++++++++ 11 files changed, 430 insertions(+), 2 deletions(-) create mode 100644 backend/src/info.rs create mode 100644 backend/static/style/arrow.svg create mode 100644 backend/static/style/help.css create mode 100644 backend/templates/help/base.html.tera create mode 100644 backend/templates/help/help_1.html.tera create mode 100644 backend/templates/help/help_2.html.tera create mode 100644 backend/templates/help/help_3.html.tera create mode 100644 backend/templates/index2.html.tera diff --git a/backend/src/info.rs b/backend/src/info.rs new file mode 100644 index 0000000..688b987 --- /dev/null +++ b/backend/src/info.rs @@ -0,0 +1,28 @@ +use rocket::{Route}; +use rocket::response::Redirect; + +use rocket_contrib::templates::Template; + +use crate::util::*; + +const MAX: usize = 3; + +#[get("/info")] +fn help_base() -> Redirect { + Redirect::to("/info/1") +} + +#[get("/info/")] +async fn help(page: usize) -> Template { + let context = Context::new_with("info", json!({ + "page": page, + "next": if page + 1 <= MAX { Some(page + 1) } else { None }, + "prev": if page - 1 > 0 { Some(page - 1) } else { None } + })); + + Template::render(format!("help/help_{}", page), &context) +} + +pub fn fuel(routes: &mut Vec) { + routes.extend(routes![help_base, help]); +} diff --git a/backend/src/main.rs b/backend/src/main.rs index 2c874ba..9de4ac1 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -33,6 +33,7 @@ use futures::future::FutureExt; use mozaic::graph; use mozaic::modules::*; +mod info; mod planetwars; mod routes; mod util; @@ -80,6 +81,7 @@ async fn main() { let mut routes = Vec::new(); routes::fuel(&mut routes); + info::fuel(&mut routes); let tera = Template::custom(|engines: &mut Engines| { engines.tera.register_filter("calc_viewbox", calc_viewbox); diff --git a/backend/src/util.rs b/backend/src/util.rs index 4282ae3..2546cf8 100644 --- a/backend/src/util.rs +++ b/backend/src/util.rs @@ -1,12 +1,13 @@ use async_std::fs; use async_std::prelude::*; -static NAV: [(&'static str, &'static str); 5] = [ +static NAV: [(&'static str, &'static str); 6] = [ ("/", "Home"), ("/mapbuilder", "Map Builder"), ("/lobby", "Lobby"), ("/visualizer", "Visualizer"), ("/debug", "Debug Station"), + ("/info", "Info"), ]; pub static COLOURS: [&'static str; 9] = [ diff --git a/backend/static/style/arrow.svg b/backend/static/style/arrow.svg new file mode 100644 index 0000000..6a9317c --- /dev/null +++ b/backend/static/style/arrow.svg @@ -0,0 +1,91 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/backend/static/style/help.css b/backend/static/style/help.css new file mode 100644 index 0000000..044ae89 --- /dev/null +++ b/backend/static/style/help.css @@ -0,0 +1,122 @@ +.content { + justify-content: center; +} + +.pointer { + align-items: center; + justify-content: center; + display: flex; + height: 100%; + width: 10%; + max-width: 150px; +} + +.p_left { + margin: 5px; + height: 70%; + width: 100%; + clip-path: polygon(100% 0%, 50% 48%, 100% 100%, 50% 100%, 0% 50%, 50% 0); + background-color: #ff7f00; +} + +.p_right { + margin: 5px; + height: 70%; + width: 100%; + background-color: #ff7f00; + clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0% 100%, 50% 50%, 0% 0%); +} + +.content_wrapper { + width: 70%; + height: 100%; + display: flex; + flex-direction: column; +} + +.header { + width: 100%; + display: flex; + justify-content: space-between; + font-size: 2em; + font-weight: bolder; +} + +.help_content_1 { + display: flex; + width: 80%; + justify-content: space-evenly; + margin: 0 auto; +} + +.help_content_1_sub { + margin: 10px auto; + width: 60%; + height: 200px; + background-image: url(arrow.svg); + background-repeat: no-repeat; + background-size: contain; + background-position: center; + position: relative; +} + +.help_content_1_sub>div { + position: absolute; + top: 100%; + left: 50%; + transform: translate(-50%, -120%); + color: #eee; + font-size: 1.5em; + margin: auto; +} + +.boxed { + border: 3px #A35200 solid; + border-radius: 50px; + position: relative; + width: 30%; +} + +.boxed:after { + content: ""; + display: block; + padding-bottom: 100%; +} + +.boxed>div { + margin: 0; + font-size: 1.7em; + text-align: center; +} + +.centering { + position: relative; +} + +.centering>div { + margin: 0; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.help_content_1 { + color: #eee; +} + +.help_content_1>div { + margin: 10px; +} + +.arrow { + width: 20%; + background-color: #A35200; + clip-path: polygon(0% 20%, 60% 20%, 60% 0%, 100% 50%, 60% 100%, 60% 80%, 0% 80%); + font-weight: bolder; + font-size: 1.5em; +} + +.arrow>div { + text-align: center; +} \ No newline at end of file diff --git a/backend/templates/base.html.tera b/backend/templates/base.html.tera index 7e7284e..cc56734 100644 --- a/backend/templates/base.html.tera +++ b/backend/templates/base.html.tera @@ -5,7 +5,7 @@ Planetwars - +