survey index page

This commit is contained in:
Aravinth Manivannan 2021-10-13 17:51:46 +05:30
parent 115b096008
commit d640c7d5a2
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
6 changed files with 173 additions and 81 deletions

View file

@ -22,7 +22,7 @@ mod panel;
pub mod routes; pub mod routes;
//mod sitemap; //mod sitemap;
pub const NAME: &str = "Kaizen"; pub const NAME: &str = "mCaptcha";
pub fn services(cfg: &mut ServiceConfig) { pub fn services(cfg: &mut ServiceConfig) {
auth::services(cfg); auth::services(cfg);

View file

@ -13,8 +13,10 @@
* *
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. * You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
use actix_web::{http, HttpResponse, Responder}; use actix_web::{HttpResponse, Responder};
use lazy_static::lazy_static;
use my_codegen::get; use my_codegen::get;
use sailfish::TemplateOnce;
use crate::PAGES; use crate::PAGES;
@ -31,7 +33,7 @@ pub mod routes {
pub const fn new() -> Panel { pub const fn new() -> Panel {
let campaigns = Campaigns::new(); let campaigns = Campaigns::new();
Panel { Panel {
home: "/admin/home", home: "/",
campaigns, campaigns,
} }
} }
@ -48,12 +50,19 @@ pub fn services(cfg: &mut actix_web::web::ServiceConfig) {
campaigns::services(cfg); campaigns::services(cfg);
} }
#[get( #[derive(TemplateOnce, Default)]
path = "PAGES.panel.home", #[template(path = "index.html")]
wrap = "crate::pages::get_page_check_login()" struct HomePage;
)]
pub async fn home() -> impl Responder { const PAGE: &str = "Survey";
HttpResponse::Found()
.insert_header((http::header::LOCATION, PAGES.panel.campaigns.home)) lazy_static! {
.finish() 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)
} }

View file

@ -47,6 +47,10 @@ pub mod assets {
path: FILES.get("./static/cache/img/headsets.jpg").unwrap(), path: FILES.get("./static/cache/img/headsets.jpg").unwrap(),
name: "Headsets image" name: "Headsets image"
}; };
pub static ref EXTERNAL_LINK: Img = Img {
path: FILES.get("./static/cache/img/external-link.svg").unwrap(),
name: "External Link"
};
} }
} }

1
static/cache/img/external-link.svg vendored Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="icon" class="feather feather-external-link"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>

After

Width:  |  Height:  |  Size: 398 B

View file

@ -1,7 +1,8 @@
<. include!("./components/base/top.html"); .> <. include!("./components/base/top.html"); .>
<body class="panel__body"> <body class="survey__body">
<main class="panel__container"> <main class="survey__container">
<h1>mCaptcha device benchmark survey</h1> <h1>mCaptcha benchmark survey</h1>
<section>
<h2>Why should I participate</h2> <h2>Why should I participate</h2>
<p> <p>
<a href="https://mcaptcha.org" target="_blank">mCaptcha</a> <a href="https://mcaptcha.org" target="_blank">mCaptcha</a>
@ -17,7 +18,7 @@
performance metrics measured on a wide range of devices to fine-tune the performance metrics measured on a wide range of devices to fine-tune the
system for optimal user experience, see for yourself! system for optimal user experience, see for yourself!
</p> </p>
<div style="width: 304px; height: 78px"> <div class="survey__captcha-widget" style="width: 304px; height: 78px">
<iframe <iframe
title="mCaptcha" title="mCaptcha"
src="https://demo.mcaptcha.org/widget/?sitekey=6o3p1Fx94hJRFm8g8IHBB7sv8D0em20k" src="https://demo.mcaptcha.org/widget/?sitekey=6o3p1Fx94hJRFm8g8IHBB7sv8D0em20k"
@ -32,18 +33,37 @@
frameborder="0" frameborder="0"
></iframe> ></iframe>
</div> </div>
</section>
<section>
<h2>What do I get?</h2> <h2>What do I get?</h2>
<div class="survey__prize-section">
<p> <p>
We are conducting a lucky draw. Two lucky participants, selected at We are conducting a lucky draw. Two lucky participants, selected at
random, will win a pair of random, will win a pair of JBL headsets worth over ₹2,500! Also, you
will be helping us make the internet healthier :)
</p>
<a <a
target="_blank" target="_blank"
class="prize__preview"
href="https://www.amazon.in/JBL-Detachable-Directional-Headphones-Conference/dp/B0948TG7H8" href="https://www.amazon.in/JBL-Detachable-Directional-Headphones-Conference/dp/B0948TG7H8"
>JBL headsets worth over ₹2,500</a >
>! Also, you will be helping us make the internet healthier :) <img
src="<.= crate::assets::HEADSETS.path .>"
alt="<.= crate::assets::HEADSETS.name .>"
class="survey__prize"
/>
<p>
Product details
<img
src="<.= crate::assets::EXTERNAL_LINK.path .>"
alt="<.= crate::assets::EXTERNAL_LINK.name .>"
/>
</p> </p>
</a>
</div>
</section>
<section>
<h2>Privacy policy</h2> <h2>Privacy policy</h2>
<p>This survey collects the following information:</p> <p>This survey collects the following information:</p>
<ul> <ul>
@ -53,11 +73,16 @@
<li>Benchmark results</li> <li>Benchmark results</li>
</ul> </ul>
<b>No Personally identifying information is collected</b> <b>No Personally identifying information is collected</b>
</main> </section>
<. include!("../components/footer/index.html"); .>
<a href="<.= crate::V1_API_ROUTES.benches.register .>" target="_blank" <a
class="link__btn"
href="<.= crate::V1_API_ROUTES.benches.register .>"
target="_blank"
>Get started</a >Get started</a
> >
</main>
<. include!("./components/footer/index.html"); .>
</body> </body>
<script src="./dist/bundle.js"></script> <script src="<.= &*crate::GLUE .>./dist/bundle.js"></script>
<. include!("./components/base/bottom.html"); .> <. include!("./components/base/bottom.html"); .>

View file

@ -49,3 +49,56 @@ body {
display: flex; display: flex;
flex-direction: column; 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;
}