page load time fixes

This commit is contained in:
Ritesh Kumar committed 2017-09-02 17:04:09 +05:30
1 parent 56fad60e5e
commit bd7faeec88
6 files changed
+264 -220

No files matched your search

+8 -11
View File
@@ -3,6 +3,7 @@ import cn from "classnames";
import Router from "next/router";
import isBrowser from "is-in-browser";
import copy from "copy-text-to-clipboard";
import { html_beautify, css_beautify, js_beautify } from "js-beautify"
const theme = "tomorrow";
@@ -21,10 +22,10 @@ if (isBrowser) {
}
const prettifyMap = {
css: "css_beautify",
json: "js_beautify",
html: "html_beautify",
typescript: "js_beautify"
css: css_beautify,
json: js_beautify,
html: html_beautify,
typescript: js_beautify
};
const modeMapping = {
@@ -144,7 +145,7 @@ export default class ConversionPanel extends PureComponent {
const { leftMode } = this.props;
const { value } = this.state;
this.setResult(window[prettifyMap[leftMode]](value, { indent_size: 2 }));
this.setResult(prettifyMap[leftMode](value, { indent_size: 2 }));
};
copyCode = () => {
@@ -152,7 +153,7 @@ export default class ConversionPanel extends PureComponent {
const { resultValue } = this.state;
copy(
rightMode !== "rust"
? window.js_beautify(resultValue, { e4x: true })
? js_beautify(resultValue, { e4x: true })
: resultValue
);
this.setState({
@@ -190,10 +191,6 @@ export default class ConversionPanel extends PureComponent {
return (
<div className="wrapper">
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.14/beautify.js" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.14/beautify-html.js" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.14/beautify-css.js" />
<style jsx>{`
.wrapper {
display: flex;
@@ -409,7 +406,7 @@ export default class ConversionPanel extends PureComponent {
<CodeMirror
value={
prettifyRightPanel ? (
window.js_beautify(resultValue, { e4x: true })
js_beautify(resultValue, { e4x: true })
) : (
resultValue
)
+1 -6
View File
@@ -122,17 +122,12 @@ export default class Layout extends PureComponent {
content="bjJSOEahdert-7mwVScrwTTUVR3nSe0bEj5YjevUNn0"
/>
<meta name="description" content={desc} />
<link rel="stylesheet" type="text/css" href="/static/nprogress.css" />
<link
rel="stylesheet"
type="text/css"
href="/static/codemirror.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/font-mfizz/2.4.1/font-mfizz.min.css"
/>
<link rel="stylesheet" href="/static/styles.css" />
</Head>
<style jsx>{`
.sidebar {
+1
View File
@@ -28,6 +28,7 @@
"generate-schema": "^2.5.1",
"graphql": "^0.10.5",
"is-in-browser": "^1.1.3",
"js-beautify": "^1.6.14",
"json2dts": "^0.0.2",
"lodash": "^4.17.4",
"next": "^3.2.1",
-200
View File
@@ -1,200 +0,0 @@
@import url('https://fonts.googleapis.com/css?family=Lato');
.rc-collapse {
background-color: #f7f7f7;
border-radius: 3px;
}
.rc-collapse-anim-active {
transition: height 0.2s ease-out;
}
.rc-collapse > .rc-collapse-item > .rc-collapse-header {
height: 38px;
line-height: 38px;
cursor: pointer;
}
.rc-collapse > .rc-collapse-item > .rc-collapse-header .arrow {
display: inline-block;
content: '\20';
width: 0;
height: 0;
font-size: 0;
line-height: 0;
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 4px solid #b3b3b3;
vertical-align: middle;
margin-right: 8px;
}
.rc-collapse > .rc-collapse-item-disabled > .rc-collapse-header {
cursor: not-allowed;
color: #999;
background-color: #f3f3f3;
}
.rc-collapse-content {
overflow: hidden;
}
.rc-collapse-content-inactive {
display: none;
}
.rc-collapse-item:last-child > .rc-collapse-content {
border-radius: 0 0 3px 3px;
}
.rc-collapse > .rc-collapse-item-active > .rc-collapse-header .arrow {
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 4px solid #666;
margin-right: 6px;
}
/* Make clicks pass-through */
#nprogress {
pointer-events: none;
}
#nprogress .bar {
background: #29d;
position: fixed;
z-index: 1031;
top: 0;
left: 0;
width: 100%;
height: 2px;
}
/* Fancy blur effect */
#nprogress .peg {
display: block;
position: absolute;
right: 0px;
width: 100px;
height: 100%;
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
opacity: 1.0;
-webkit-transform: rotate(3deg) translate(0px, -4px);
-ms-transform: rotate(3deg) translate(0px, -4px);
transform: rotate(3deg) translate(0px, -4px);
}
/* Remove these to get rid of the spinner */
#nprogress .spinner {
display: block;
position: fixed;
z-index: 1031;
top: 15px;
right: 15px;
}
#nprogress .spinner-icon {
width: 18px;
height: 18px;
box-sizing: border-box;
border: solid 2px transparent;
border-top-color: #29d;
border-left-color: #29d;
border-radius: 50%;
-webkit-animation: nprogress-spinner 400ms linear infinite;
animation: nprogress-spinner 400ms linear infinite;
}
.nprogress-custom-parent {
overflow: hidden;
position: relative;
}
.nprogress-custom-parent #nprogress .spinner,
.nprogress-custom-parent #nprogress .bar {
position: absolute;
}
@-webkit-keyframes nprogress-spinner {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes nprogress-spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.fuzzy-picker-background {
background: rgba(0, 0, 0, 0.1);
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
align-items: flex-start;
justify-content: center;
padding-top: 300px;
padding-top: 25vh;
z-index: 100;
font-family: 'Lato';
}
.fuzzy-picker-background .fuzzy-picker {
width: 600px;
background: #fff;
border-radius: 2px;
box-shadow: 0px 0px 16px #333;
font-size: 1rem;
display: flex;
flex-direction: column;
}
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text {
color: #aaa;
margin-top: 0.5em;
margin-left: 0.5rem;
margin-right: 0.5rem;
font-size: 16px;
user-select: none;
}
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-label {
float: left;
}
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-instructions {
float: right;
}
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-instructions span {
margin: 0.35em;
}
.fuzzy-picker-background .fuzzy-picker input[type=text] {
border: 1px solid #dedede;
border-radius: 2px;
outline: none;
flex: 1;
font-size: 18px;
padding: 4px;
margin: 0.5rem;
margin-bottom: 0;
}
.fuzzy-picker-background .fuzzy-picker ul {
list-style-type: none;
padding-left: 0px;
margin-top: 0.2em;
margin-bottom: 0.5em;
}
.fuzzy-picker-background .fuzzy-picker ul li {
margin: 0.1em 0.5rem;
padding: 0.6em 0.5em;
border-radius: 2px;
cursor: pointer;
}
.fuzzy-picker-background .fuzzy-picker ul li.selected {
background-color: #444444;
color: #fff;
}
+201
View File
@@ -1,3 +1,204 @@
@import url('https://fonts.googleapis.com/css?family=Lato');
.rc-collapse {
background-color: #f7f7f7;
border-radius: 3px;
}
.rc-collapse-anim-active {
transition: height 0.2s ease-out;
}
.rc-collapse > .rc-collapse-item > .rc-collapse-header {
height: 38px;
line-height: 38px;
cursor: pointer;
}
.rc-collapse > .rc-collapse-item > .rc-collapse-header .arrow {
display: inline-block;
content: '\20';
width: 0;
height: 0;
font-size: 0;
line-height: 0;
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 4px solid #b3b3b3;
vertical-align: middle;
margin-right: 8px;
}
.rc-collapse > .rc-collapse-item-disabled > .rc-collapse-header {
cursor: not-allowed;
color: #999;
background-color: #f3f3f3;
}
.rc-collapse-content {
overflow: hidden;
}
.rc-collapse-content-inactive {
display: none;
}
.rc-collapse-item:last-child > .rc-collapse-content {
border-radius: 0 0 3px 3px;
}
.rc-collapse > .rc-collapse-item-active > .rc-collapse-header .arrow {
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 4px solid #666;
margin-right: 6px;
}
/* Make clicks pass-through */
#nprogress {
pointer-events: none;
}
#nprogress .bar {
background: #29d;
position: fixed;
z-index: 1031;
top: 0;
left: 0;
width: 100%;
height: 2px;
}
/* Fancy blur effect */
#nprogress .peg {
display: block;
position: absolute;
right: 0px;
width: 100px;
height: 100%;
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
opacity: 1.0;
-webkit-transform: rotate(3deg) translate(0px, -4px);
-ms-transform: rotate(3deg) translate(0px, -4px);
transform: rotate(3deg) translate(0px, -4px);
}
/* Remove these to get rid of the spinner */
#nprogress .spinner {
display: block;
position: fixed;
z-index: 1031;
top: 15px;
right: 15px;
}
#nprogress .spinner-icon {
width: 18px;
height: 18px;
box-sizing: border-box;
border: solid 2px transparent;
border-top-color: #29d;
border-left-color: #29d;
border-radius: 50%;
-webkit-animation: nprogress-spinner 400ms linear infinite;
animation: nprogress-spinner 400ms linear infinite;
}
.nprogress-custom-parent {
overflow: hidden;
position: relative;
}
.nprogress-custom-parent #nprogress .spinner,
.nprogress-custom-parent #nprogress .bar {
position: absolute;
}
@-webkit-keyframes nprogress-spinner {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes nprogress-spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.fuzzy-picker-background {
background: rgba(0, 0, 0, 0.1);
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
align-items: flex-start;
justify-content: center;
padding-top: 300px;
padding-top: 25vh;
z-index: 100;
font-family: 'Lato';
}
.fuzzy-picker-background .fuzzy-picker {
width: 600px;
background: #fff;
border-radius: 2px;
box-shadow: 0px 0px 16px #333;
font-size: 1rem;
display: flex;
flex-direction: column;
}
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text {
color: #aaa;
margin-top: 0.5em;
margin-left: 0.5rem;
margin-right: 0.5rem;
font-size: 16px;
user-select: none;
}
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-label {
float: left;
}
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-instructions {
float: right;
}
.fuzzy-picker-background .fuzzy-picker .fuzzy-picker-top-text .fuzzy-picker-instructions span {
margin: 0.35em;
}
.fuzzy-picker-background .fuzzy-picker input[type=text] {
border: 1px solid #dedede;
border-radius: 2px;
outline: none;
flex: 1;
font-size: 18px;
padding: 4px;
margin: 0.5rem;
margin-bottom: 0;
}
.fuzzy-picker-background .fuzzy-picker ul {
list-style-type: none;
padding-left: 0px;
margin-top: 0.2em;
margin-bottom: 0.5em;
}
.fuzzy-picker-background .fuzzy-picker ul li {
margin: 0.1em 0.5rem;
padding: 0.6em 0.5em;
border-radius: 2px;
cursor: pointer;
}
.fuzzy-picker-background .fuzzy-picker ul li.selected {
background-color: #444444;
color: #fff;
}
/* BASICS */
.CodeMirror {
+53 -3
View File
@@ -1087,6 +1087,10 @@ block-stream@*:
dependencies:
inherits "~2.0.0"
bluebird@^3.0.5:
version "3.5.0"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c"
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
version "4.11.7"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.7.tgz#ddb048e50d9482790094c13eb3fcfc833ce7ab46"
@@ -1454,6 +1458,13 @@ concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
config-chain@~1.1.5:
version "1.1.11"
resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.11.tgz#aba09747dfbe4c3e70e766a6e41586e1859fc6f2"
dependencies:
ini "^1.3.4"
proto-list "~1.2.1"
console-browserify@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10"
@@ -1856,6 +1867,16 @@ ecc-jsbn@~0.1.1:
dependencies:
jsbn "~0.1.0"
editorconfig@^0.13.2:
version "0.13.3"
resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.13.3.tgz#e5219e587951d60958fd94ea9a9a008cdeff1b34"
dependencies:
bluebird "^3.0.5"
commander "^2.9.0"
lru-cache "^3.2.0"
semver "^5.1.0"
sigmund "^1.0.1"
ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
@@ -2662,7 +2683,7 @@ inherits@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1"
ini@~1.3.0:
ini@^1.3.4, ini@~1.3.0:
version "1.3.4"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e"
@@ -2890,6 +2911,15 @@ js-base64@^2.1.9:
version "2.1.9"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce"
js-beautify@^1.6.14:
version "1.6.14"
resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.6.14.tgz#d3b8f7322d02b9277d58bd238264c327e58044cd"
dependencies:
config-chain "~1.1.5"
editorconfig "^0.13.2"
mkdirp "~0.5.0"
nopt "~3.0.1"
js-tokens@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
@@ -3092,6 +3122,12 @@ lower-case@^1.1.0, lower-case@^1.1.1, lower-case@^1.1.2:
version "1.1.4"
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
lru-cache@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-3.2.0.tgz#71789b3b7f5399bec8565dda38aa30d2a097efee"
dependencies:
pseudomap "^1.0.1"
lru-cache@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55"
@@ -3410,6 +3446,12 @@ nopt@~1.0.10:
dependencies:
abbrev "1"
nopt@~3.0.1:
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
dependencies:
abbrev "1"
normalize-package-data@^2.3.2:
version "2.4.0"
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f"
@@ -4024,6 +4066,10 @@ prop-types@15.5.10, prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.4, pr
fbjs "^0.8.9"
loose-envify "^1.3.1"
proto-list@~1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
proxy-addr@~1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-1.1.5.tgz#71c0ee3b102de3f202f3b64f608d173fcba1a918"
@@ -4035,7 +4081,7 @@ prr@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a"
pseudomap@^1.0.2:
pseudomap@^1.0.1, pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
@@ -4467,7 +4513,7 @@ schema-utils@^0.3.0:
dependencies:
ajv "^5.0.0"
"semver@2 || 3 || 4 || 5", semver@^5.3.0:
"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0:
version "5.4.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
@@ -4537,6 +4583,10 @@ shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
sigmund@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"
signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"