From d640c7d5a2317d945e90a751c5d5b592e6c1b1cd Mon Sep 17 00:00:00 2001 From: realaravinth Date: Wed, 13 Oct 2021 17:51:46 +0530 Subject: [PATCH] survey index page --- src/pages/mod.rs | 2 +- src/pages/panel/mod.rs | 29 +++--- src/static_assets/static_files.rs | 4 + static/cache/img/external-link.svg | 1 + templates/index.html | 139 +++++++++++++++++------------ templates/main.scss | 79 +++++++++++++--- 6 files changed, 173 insertions(+), 81 deletions(-) create mode 100644 static/cache/img/external-link.svg diff --git a/src/pages/mod.rs b/src/pages/mod.rs index 0dd86e2..da08c11 100644 --- a/src/pages/mod.rs +++ b/src/pages/mod.rs @@ -22,7 +22,7 @@ mod panel; pub mod routes; //mod sitemap; -pub const NAME: &str = "Kaizen"; +pub const NAME: &str = "mCaptcha"; pub fn services(cfg: &mut ServiceConfig) { auth::services(cfg); diff --git a/src/pages/panel/mod.rs b/src/pages/panel/mod.rs index d834afb..47d9e23 100644 --- a/src/pages/panel/mod.rs +++ b/src/pages/panel/mod.rs @@ -13,8 +13,10 @@ * * You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ -use actix_web::{http, HttpResponse, Responder}; +use actix_web::{HttpResponse, Responder}; +use lazy_static::lazy_static; use my_codegen::get; +use sailfish::TemplateOnce; use crate::PAGES; @@ -31,7 +33,7 @@ pub mod routes { pub const fn new() -> Panel { let campaigns = Campaigns::new(); Panel { - home: "/admin/home", + home: "/", campaigns, } } @@ -48,12 +50,19 @@ pub fn services(cfg: &mut actix_web::web::ServiceConfig) { campaigns::services(cfg); } -#[get( - path = "PAGES.panel.home", - wrap = "crate::pages::get_page_check_login()" -)] -pub async fn home() -> impl Responder { - HttpResponse::Found() - .insert_header((http::header::LOCATION, PAGES.panel.campaigns.home)) - .finish() +#[derive(TemplateOnce, Default)] +#[template(path = "index.html")] +struct HomePage; + +const PAGE: &str = "Survey"; + +lazy_static! { + static ref INDEX: String = HomePage::default().render_once().unwrap(); +} + +#[get(path = "PAGES.panel.home")] +pub async fn home() -> impl Responder { + HttpResponse::Ok() + .content_type("text/html; charset=utf-8") + .body(&*INDEX) } diff --git a/src/static_assets/static_files.rs b/src/static_assets/static_files.rs index 9c2d8fa..dfe0874 100644 --- a/src/static_assets/static_files.rs +++ b/src/static_assets/static_files.rs @@ -47,6 +47,10 @@ pub mod assets { path: FILES.get("./static/cache/img/headsets.jpg").unwrap(), name: "Headsets image" }; + pub static ref EXTERNAL_LINK: Img = Img { + path: FILES.get("./static/cache/img/external-link.svg").unwrap(), + name: "External Link" + }; } } diff --git a/static/cache/img/external-link.svg b/static/cache/img/external-link.svg new file mode 100644 index 0000000..feb2d26 --- /dev/null +++ b/static/cache/img/external-link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index b5ef88c..b2877a1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,63 +1,88 @@ <. include!("./components/base/top.html"); .> - -
-

mCaptcha device benchmark survey

-

Why should I participate

-

- mCaptcha - is a cutting edge, privacy respecting CAPTCHA system. We use a - proof of work - based mechanism to defend against - denial-of-service attacks - which allows for a non-interactive CAPTCHA experience. We require - performance metrics measured on a wide range of devices to fine-tune the - system for optimal user experience, see for yourself! -

-
- -
+ +
+

mCaptcha benchmark survey

+
+

Why should I participate

+

+ mCaptcha + is a cutting edge, privacy respecting CAPTCHA system. We use a + proof of work + based mechanism to defend against + denial-of-service attacks + which allows for a non-interactive CAPTCHA experience. We require + performance metrics measured on a wide range of devices to fine-tune the + system for optimal user experience, see for yourself! +

+
+ +
+
+
+

What do I get?

+
+

+ We are conducting a lucky draw. Two lucky participants, selected at + random, will win a pair of JBL headsets worth over ₹2,500! Also, you + will be helping us make the internet healthier :) +

+ + <.= crate::assets::HEADSETS.name .> +

+ Product details + <.= crate::assets::EXTERNAL_LINK.name .> +

+
+
+
-

What do I get?

-

- We are conducting a lucky draw. Two lucky participants, selected at - random, will win a pair of - JBL headsets worth over ₹2,500! Also, you will be helping us make the internet healthier :) -

+
+

Privacy policy

+

This survey collects the following information:

+
    +
  • Device name
  • +
  • Operating system
  • +
  • Processor information
  • +
  • Benchmark results
  • +
+ No Personally identifying information is collected +
-

Privacy policy

-

This survey collects the following information:

-
    -
  • Device name
  • -
  • Operating system
  • -
  • Processor information
  • -
  • Benchmark results
  • -
- No Personally identifying information is collected + Get started
- <. include!("../components/footer/index.html"); .> - Get started + <. include!("./components/footer/index.html"); .> - + <. include!("./components/base/bottom.html"); .> diff --git a/templates/main.scss b/templates/main.scss index e2a380f..fd02056 100644 --- a/templates/main.scss +++ b/templates/main.scss @@ -25,27 +25,80 @@ @import "./errors/main"; * { - margin: 0; - padding: 0; - font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + margin: 0; + padding: 0; + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; - font-family: "Inter UI", -apple-system, BlinkMacSystemFont, "Roboto", - "Segoe UI", Helvetica, Arial, sans-serif; + font-family: "Inter UI", -apple-system, BlinkMacSystemFont, "Roboto", + "Segoe UI", Helvetica, Arial, sans-serif; } a { - text-decoration: none; - color: rgb(0, 86, 179); + text-decoration: none; + color: rgb(0, 86, 179); } a:hover { - text-decoration: underline; + text-decoration: underline; } body { - max-width: 100vw; - overflow-x: hidden; - min-height: 100vh; - display: flex; - flex-direction: column; + max-width: 100vw; + overflow-x: hidden; + min-height: 100vh; + display: flex; + flex-direction: column; +} + +.survey__body { + width: 100vw; + min-height: 100vh; +} + +.survey__container { + width: 60%; + margin: 50px auto; + display: flex; + flex-direction: column; +} + +.survey__container { + h1 { + margin: auto; + } + + h2 { + margin: 10px 0px; + } + + .link__btn { + margin: auto; + width: 100%; + } + + section { + margin: 30px 0px; + } +} + +.survey__prize-section { + width: 100%; + display: flex; + flex-direction: column; +} + +.prize__preview { + display: flex; + margin: auto; + flex-direction: column; + align-items: center; +} + +.survey__prize { + height: 250px; +} + +.survey__captcha-widget { + margin: auto; + margin-top: 40px; }