Skip to content

Upgrade style using SCSS #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added frontend/assets/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/moz-fav-bw-rgb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/assets/moz-logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,24 @@
"eslint-plugin-mozilla": "^2.1.0",
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-prettier": "^3.1.0",
"file-loader": "^4.2.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.8.0",
"node-sass": "^4.12.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"prettier": "1.18.2",
"sass-loader": "^8.0.0",
"standard": "^14.1.0",
"terser-webpack-plugin": "^2.0.1",
"webpack": "^4.35.3",
"webpack": "^4.40.2",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.7.2",
"webpack-merge": "^4.2.1"
},
"dependencies": {
"chartist": "^0.11.3",
"mustache": "^3.0.1",
"normalize.css": "^8.0.1",
"prismjs": "^1.16.0"
}
}
40 changes: 27 additions & 13 deletions frontend/src/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>mozilla-central coverage</title>
<link rel="icon" href="<%=require('../assets/moz-fav-bw-rgb.png')%>" type="image/png" />
</head>
<body>
<script id="zerocoverage" type="x-tmpl-mustache">
<div class="directory">
<div id="browser">
<h2>
<nav>
{{#navbar}}
Expand Down Expand Up @@ -43,7 +44,7 @@ <h2>
</script>

<script id="file_coverage" type="x-tmpl-mustache">
<div class="file">
<div id="file">
<h2>
<nav>
{{#navbar}}
Expand All @@ -52,6 +53,12 @@ <h2>
</nav>
</h2>

<div class="help">
<p class="no_data"><samp>&nbsp;</samp><span>Non-instrumented</span></p>
<p class="uncovered"><samp>&nbsp;</samp><span>Uncovered</span></p>
<p class="covered"><samp>&nbsp;</samp><span>Covered</span></p>
</div>

<table>
<tbody>
{{#lines}}
Expand All @@ -68,8 +75,8 @@ <h2>
</div>
</script>

<script id="browser" type="x-tmpl-mustache">
<div class="directory">
<script id="file_browser" type="x-tmpl-mustache">
<div id="browser">
<h2>
<nav>
{{#navbar}}
Expand All @@ -90,7 +97,7 @@ <h2>
<div class="row">
<span class="filename"><a href="{{ route }}">{{ file_name }}</a></span>
<span>{{ children }}</span>
<span>{{ coveragePercent }} %</span>
<span class="coverage_{{ range }}">{{ coveragePercent }} %</span>
</div>
{{/files}}
</div>
Expand All @@ -103,10 +110,8 @@ <h2>
</script>

<script id="menu_browser" type="x-tmpl-mustache">
<a href="#view=zero">View the zero coverage report</a>
&bull;
<input type="text" name="revision" placeholder="Mercurial revision" value="{{revision}}"></input>
&bull;
<a class="item" href="#view=zero">View the zero coverage report</a>
<input class="revision" type="text" name="revision" placeholder="Mercurial revision" value="{{revision}}"></input>
<select name="platform">
<option value="all">All platforms</option>
{{#platforms}}
Expand Down Expand Up @@ -134,7 +139,13 @@ <h2>
</select>
</script>

<header id="menu"></header>
<header>
<div class="logo">
<img src="<%=require('../assets/moz-logo-black.png')%>" alt="Moz://a"/>
<a href="#view=browser">Code Coverage</a>
</div>
<div id="menu"></div>
</header>

<main id="main">
<div id="message" class="message loading">Loading...</div>
Expand All @@ -146,9 +157,12 @@ <h2>
</main>

<footer>
<a href="https://github.com/marco-c/code-coverage-reports/issues/new">Report an issue</a>
<a class="github-button" href="https://github.com/marco-c/code-coverage-reports/fork" data-icon="octicon-repo-forked" data-size="large"
data-show-count="true" aria-label="Fork marco-c/code-coverage-reports on GitHub">Fork</a>
<a target="_blank" href="https://github.com/mozilla/code-coverage">
<img src="<%=require('../assets/github.png')%>" alt="GitHub" />
</a>
<a target="_blank" href="https://github.com/mozilla/code-coverage/issues/new?labels=frontend,bug&title=Issue+with+the+frontend">Report an issue</a>
&bull;
<a target="_blank" href="https://github.com/mozilla/code-coverage/fork" aria-label="Fork mozilla/code-coverage on GitHub">Fork mozilla/code-coverage</a>
</footer>

</body>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export function message(cssClass, message) {
const box = document.getElementById("message");
box.className = "message " + cssClass;
box.textContent = message;
box.style.display = "block";
box.style.display = "inherit";
}

export function hide(id) {
Expand All @@ -382,7 +382,7 @@ export function show(id, node) {
}

const box = document.getElementById(id);
box.style.display = "block";
box.style.display = "inherit";
if (node) {
box.replaceWith(node);
}
Expand All @@ -400,6 +400,6 @@ export function render(template, data, target) {
// eslint-disable-next-line no-unsanitized/property
box.innerHTML = output;

box.style.display = "block";
box.style.display = "inherit";
return box;
}
11 changes: 8 additions & 3 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
zeroCoverageDisplay,
zeroCoverageMenu
} from "./zero_coverage_report.js";
import "./style.css";
import "normalize.css/normalize.css";
import "./style.scss";
import Prism from "prismjs";
import Chartist from "chartist";
import "chartist/dist/chartist.css";
Expand Down Expand Up @@ -112,6 +113,10 @@ async function showDirectory(dir, revision, files) {
file.route = buildRoute({
path: file.path
});

// Calc decimal range to make a nice coloration
file.coveragePercent = Math.floor(file.coveragePercent);
file.range = parseInt(file.coveragePercent / 10) * 10;
return file;
}),
revision: revision || REV_LATEST,
Expand All @@ -120,7 +125,7 @@ async function showDirectory(dir, revision, files) {
return dir ? this.path.substring(dir.length + 1) : this.path;
}
};
render("browser", context, "output");
render("file_browser", context, "output");
}

async function showFile(file, revision) {
Expand Down Expand Up @@ -148,7 +153,7 @@ async function showFile(file, revision) {
lines: source.split("\n").map((line, nb) => {
const coverage = file.coverage[nb];
let cssClass = "";
if (coverage !== -1) {
if (coverage && coverage !== -1) {
cssClass = coverage > 0 ? "covered" : "uncovered";
}
return {
Expand Down
200 changes: 0 additions & 200 deletions frontend/src/style.css

This file was deleted.

Loading