From 0524208a3938235f19683cf6c47179843abcd6e4 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Wed, 27 Oct 2021 11:39:37 +0530 Subject: [PATCH] mobile styling --- package.json | 4 +- src/api/v1/admin/auth.rs | 18 +++++---- src/main.rs | 4 ++ src/static_assets/static_files.rs | 1 + templates/bench/index.html | 57 +++++++++++++++++++++------ templates/bench/index.ts | 26 ++++++++++-- templates/components/_button.scss | 1 - templates/components/base/top.html | 6 +++ templates/components/footer/main.scss | 20 +++++----- templates/index.html | 9 +++++ templates/main.scss | 1 + templates/mobile.scss | 29 ++++++++++++++ templates/panel/main.scss | 4 ++ 13 files changed, 145 insertions(+), 35 deletions(-) create mode 100644 templates/mobile.scss diff --git a/package.json b/package.json index edf1add..4d4d6de 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "version": "1.0.0", "scripts": { "build": "webpack --mode production", - "lint": "eslint templates", - "sass": "dart-sass -s compressed templates/main.scss ./static/cache/bundle/css/main.css", + "lint": "eslint templates", + "sass": "dart-sass -s compressed templates/main.scss ./static/cache/bundle/css/main.css && dart-sass -s compressed templates/mobile.scss ./static/cache/bundle/css/mobile.css", "start": "webpack-dev-server --mode development --progress --color", "test": "jest" }, diff --git a/src/api/v1/admin/auth.rs b/src/api/v1/admin/auth.rs index 6c1052c..30a2cd8 100644 --- a/src/api/v1/admin/auth.rs +++ b/src/api/v1/admin/auth.rs @@ -36,14 +36,18 @@ pub mod routes { impl GetLoginRoute for Auth { fn get_login_route(&self, src: Option<&str>) -> String { if let Some(redirect_to) = src { - let mut url = Url::parse("http://x/").unwrap(); - url.set_path(self.login); - url.query_pairs_mut() - .append_pair("redirect_to", redirect_to); - let path = format!("{}/?{}", url.path(), url.query().unwrap()); - path + // uri::Builder::new().path_and_query( + format!( + "{}?redirect_to={}", + self.register, + urlencoding::encode(redirect_to) + ) + // let mut url: Uri = self.register.parse().unwrap(); + // url.qu + // url.query_pairs_mut() + // .append_pair("redirect_to", redirect_to); } else { - self.login.to_string() + self.register.to_string() } } } diff --git a/src/main.rs b/src/main.rs index bf44f1a..0b83cac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,6 +52,10 @@ lazy_static! { pub static ref CSS: &'static str = FILES.get("./static/cache/bundle/css/main.css").unwrap(); + pub static ref MOBILE_CSS: &'static str = + FILES.get("./static/cache/bundle/css/mobile.css").unwrap(); + + pub static ref JS: &'static str = FILES.get("./static/cache/bundle/bundle.js").unwrap(); diff --git a/src/static_assets/static_files.rs b/src/static_assets/static_files.rs index d141d2f..39b0f30 100644 --- a/src/static_assets/static_files.rs +++ b/src/static_assets/static_files.rs @@ -132,6 +132,7 @@ mod tests { assets::HEADSETS.path, *crate::JS, *crate::CSS, + *crate::MOBILE_CSS, *crate::GLUE, ] .iter() diff --git a/templates/bench/index.html b/templates/bench/index.html index 320cf51..596743e 100644 --- a/templates/bench/index.html +++ b/templates/bench/index.html @@ -1,7 +1,7 @@ <. include!("../components/base/top.html"); .>
-<. include!("../components/error/index.html"); .> + <. include!("../components/error/index.html"); .>

Click to Start Benchmark

@@ -17,9 +17,7 @@ - +
@@ -27,7 +25,7 @@ This is a WASM benchmark, please enable JavScript to run it. We don't collect any data and - source code is available here @@ -35,13 +33,22 @@

Running benchmark

- -
-
-
+ - +
+

Winner Announcement

+

+ The winners will be announed on the organisation website on December + 1, 2021. The winning submission IDs will be published and the winners + expected to provide the submission proof to claim their rewards. +

+
+
+ +
+ +
@@ -59,7 +66,7 @@ width: 100%; display: flex; flex-direction: column; - padding: 40px 0; + padding: 0; display: hidden; align-items: center; } @@ -77,6 +84,11 @@ display: none; } + .survey__container { + flex: 2; + margin: 0 auto; + } + #status { max-width: 80%; margin: auto; @@ -101,7 +113,28 @@ #device-info { margin: auto; - font-size: 1.3rem; + font-size: 0.8rem; + } + + .advance-log > b, + div { + font-size: 0.8rem; + } + .advance-log { + display: none; + } + #winner-instructions { + display: none; + } + + #submission-proof { + margin: 15px auto; + } + + #submission-proof > div, + b { + font-size: 1.2rem; + font-family: monospace, monospace; } diff --git a/templates/bench/index.ts b/templates/bench/index.ts index 1d0b727..07c9334 100644 --- a/templates/bench/index.ts +++ b/templates/bench/index.ts @@ -21,6 +21,25 @@ import isBlankString from "../utils/isBlankString"; import createError from "../components/error/"; export const index = () => { + const ADV = document.getElementById("advance"); + + const toggleAdv = (e: Event) => { + e.preventDefault(); + if (ADV.innerText.includes("Show")) { + ADV.innerText = "Hide Advance Log"; + document + .querySelectorAll(".advance-log") + .forEach((e: HTMLElement) => (e.style.display = "block")); + } else { + ADV.innerText = "Show Advance Log"; + document + .querySelectorAll(".advance-log") + .forEach((e: HTMLElement) => (e.style.display = "none")); + } + }; + + ADV.addEventListener("click", (e) => toggleAdv(e)); + const initSession = async () => { fetch(ROUTES.register); }; @@ -64,7 +83,7 @@ export const index = () => { const data: SubmissionProof = await resp.json(); const element = document.createElement("div"); const token = document.createElement("b"); - token.innerText = "User Agent: "; + token.innerText = "Submissinon ID: "; const tokenText = document.createTextNode(`${data.token}`); const proof = document.createElement("b"); @@ -77,6 +96,7 @@ export const index = () => { element.appendChild(proof); element.appendChild(proofText); document.getElementById("submission-proof").appendChild(element); + document.getElementById("winner-instructions").style.display = "block"; } }; @@ -90,11 +110,11 @@ export const index = () => { console.log(INFO); const element = document.createElement("div"); - const ua = document.createElement("b"); + const ua = document.createElement("span"); ua.innerText = "User Agent: "; const os = document.createTextNode(`${INFO.oscup}`); - const threads = document.createElement("b"); + const threads = document.createElement("span"); threads.innerText = "Hardware concurrency: "; const threadsText = document.createTextNode(`${INFO.threads}`); diff --git a/templates/components/_button.scss b/templates/components/_button.scss index c6665b5..7bf973d 100644 --- a/templates/components/_button.scss +++ b/templates/components/_button.scss @@ -15,7 +15,6 @@ * along with this program. If not, see . */ - @mixin button { border: none; diff --git a/templates/components/base/top.html b/templates/components/base/top.html index 744e276..2ed6c29 100644 --- a/templates/components/base/top.html +++ b/templates/components/base/top.html @@ -5,4 +5,10 @@ <.= PAGE .> | <.= crate::pages::NAME .> + diff --git a/templates/components/footer/main.scss b/templates/components/footer/main.scss index 4ec25b3..e355b80 100644 --- a/templates/components/footer/main.scss +++ b/templates/components/footer/main.scss @@ -16,21 +16,21 @@ */ .footer { - font-size: 0.8rem; - padding: 0px 20px; + font-size: 0.8rem; + padding: 0px 20px; - position: relative; - bottom: 10px; - width: 100%; + position: relative; + bottom: 10px; + width: 100%; } .footer__section { - display: inline; - float: right; + display: inline; + float: right; } .footer__item { - display: inline; - list-style: none; - padding: 10px; + display: inline; + list-style: none; + padding: 10px; } diff --git a/templates/index.html b/templates/index.html index 8169aff..4563b19 100644 --- a/templates/index.html +++ b/templates/index.html @@ -75,6 +75,15 @@ No Personally identifying information is collected +
+

Winner Announcement

+

+ The winners will be announed on the organisation website on December 1, + 2021. The winning submission IDs will be published and the winners + expected to provide the submission proof to claim their rewards. +

+
+ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +.survey__container { + width: 90%; +} + +.footer { + margin: auto; + width: auto; +} + +.survey__container h2 { + font-weight: 550; +} diff --git a/templates/panel/main.scss b/templates/panel/main.scss index 3c68844..564d6fa 100644 --- a/templates/panel/main.scss +++ b/templates/panel/main.scss @@ -38,6 +38,10 @@ padding-bottom: 0.2rem; } +.btn { + @include button; +} + table { border-collapse: collapse; caption-side: bottom;
Difficulty factor