From 8e340c95df821dfbea256fa32cfc9f0486dfea12 Mon Sep 17 00:00:00 2001 From: Bot Date: Fri, 25 Dec 2020 21:01:04 +0100 Subject: [PATCH 1/4] clean up config --- package.json | 2 +- vue.config.js | 37 ------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/package.json b/package.json index eae2bca17..e21ea4e37 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "private": true, "scripts": { - "serve": "vue-cli-service serve --port 80", + "serve": "vue-cli-service serve", "dev": "concurrently -r \"npm:serve\" \"npm:server\"", "vue-ui": "vue ui", "build": "vue-cli-service build", diff --git a/vue.config.js b/vue.config.js index 5b3746a3c..450de0e0d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,8 +1,6 @@ const path = require('path'); const PrerenderSPAPlugin = require('prerender-spa-plugin'); -// const zopfli = require('@gfx/zopfli'); - // const fs = require('fs'); // const StatsPlugin = require('stats-webpack-plugin'); @@ -19,31 +17,8 @@ module.exports = { }, }, sourceMap: false, - // extract: { - // filename: 'css/[name].css', - // chunkFilename: 'css/[name].css', - // }, - }, - pluginOptions: { - // compression: { - // zopfli: { - // filename: '[path]', - // include: /\.js$|\.css$/, - // exclude: /cm\/|code\//, - // compressionOptions: { - // numiterations: 15, - // }, - // algorithm(input, compressionOptions, callback) { - // return zopfli.gzip(input, compressionOptions, callback); - // }, - // }, - // }, }, configureWebpack: { - // output: { - // filename: 'js/[name].js', - // chunkFilename: 'js/[name].js', - // }, resolve: { alias: { // bundle size optimatization @@ -54,9 +29,7 @@ module.exports = { plugins: [ // new StatsPlugin('stats.json'), process.env.NODE_ENV ? new PrerenderSPAPlugin({ - // Required - The path to the webpack-outputted app to prerender. staticDir: path.join(__dirname, 'dist'), - // Required - Routes to render. routes: ['/', '/about', '/contribute'], }) : null, ], @@ -82,16 +55,6 @@ module.exports = { headers: { 'Access-Control-Allow-Origin': '*', }, - // before(app) { - // app.use((req, res, next) => { - // if (req.path.slice(0, 4) === '/cm/') { - // res.header('content-encoding', 'gzip'); - // } - // next(); - // }); - // }, - - // compress: false, // https: { // key: fs.readFileSync(`${process.env.HOME}/localhost.key`), // cert: fs.readFileSync(`${process.env.HOME}/localhost.crt`), From 07dfe5c0fde43b9ab47a8c23e39466ce375e8ea6 Mon Sep 17 00:00:00 2001 From: Bot Date: Fri, 25 Dec 2020 21:22:08 +0100 Subject: [PATCH 2/4] fix layout bug after send on contribute page --- src/views/Contribute.vue | 8 ++++---- vue.config.js | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/views/Contribute.vue b/src/views/Contribute.vue index b892f5dab..1308e43b0 100644 --- a/src/views/Contribute.vue +++ b/src/views/Contribute.vue @@ -3,7 +3,7 @@

Contribute

-
+

Our mission is to ensure the diversity and quality of the code on which our users practice and test their skills. We do our best to ensure that there are no errors in the code but with that many languages and technologies available on CodeRush, it is not possible without your help.

@@ -49,6 +49,7 @@ class="editor-wrapper" @expand="(value) => expand = value" /> +

Thank you for your contribution. Your submission will soon be listed here.

@@ -166,7 +167,6 @@ export default { .middle display: flex - justify-content: space-between flex-basis: 0 flex-direction: column flex-grow: 2 @@ -250,7 +250,7 @@ article p display: flex align-items: flex-end justify-content: space-between - margin-top: 1em + margin-top: auto margin-bottom: $thin-gap .button @@ -270,7 +270,7 @@ article p &:first-child margin-right: $gap - &:hover + &:hover:not(:disabled) background-color: $purple &:active diff --git a/vue.config.js b/vue.config.js index 450de0e0d..c7b82b17f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -3,7 +3,15 @@ const PrerenderSPAPlugin = require('prerender-spa-plugin'); // const fs = require('fs'); // const StatsPlugin = require('stats-webpack-plugin'); - +const plugins = [ + // new StatsPlugin('stats.json') +]; +if (process.env.VUE_APP_API_URL === 'https://api.coderush.xyz') { + plugins.push(new PrerenderSPAPlugin({ + staticDir: path.join(__dirname, 'dist'), + routes: ['/', '/about', '/contribute'], + })); +} module.exports = { productionSourceMap: false, @@ -26,13 +34,7 @@ module.exports = { 'chart.js$': 'chart.js/dist/Chart.min.js', }, }, - plugins: [ - // new StatsPlugin('stats.json'), - process.env.NODE_ENV ? new PrerenderSPAPlugin({ - staticDir: path.join(__dirname, 'dist'), - routes: ['/', '/about', '/contribute'], - }) : null, - ], + plugins, }, chainWebpack(config) { config.optimization.minimizer('terser').tap((args) => { From fce5dac1508ec9c5e9aae5090cd1ba200005b289 Mon Sep 17 00:00:00 2001 From: Bot Date: Fri, 25 Dec 2020 21:31:34 +0100 Subject: [PATCH 3/4] fix wpm overflow barchart --- public/exampleResults.json | 2 +- src/components/charts/BarChart.vue | 2 +- src/views/Results.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/exampleResults.json b/public/exampleResults.json index a7c0982e7..4f0980e5d 100644 --- a/public/exampleResults.json +++ b/public/exampleResults.json @@ -1912,7 +1912,7 @@ "oneThirdTime": 34888, "lastThirdCharsCount": 53, "lastThirdStartTime": 61622, - "timeFromFirstInput": 76782, + "timeFromFirstInput": 61782, "codeLength": 216, "correctLines": 12, "mode": 0, diff --git a/src/components/charts/BarChart.vue b/src/components/charts/BarChart.vue index c687dbaf4..c21f6c353 100644 --- a/src/components/charts/BarChart.vue +++ b/src/components/charts/BarChart.vue @@ -74,7 +74,7 @@ export default { plugins: { datalabels: { color: '#fff', - align: 'end', + align: 'start', anchor: 'end', formatter(value) { return `${value} wpm`; diff --git a/src/views/Results.vue b/src/views/Results.vue index 65a64406d..525cda687 100644 --- a/src/views/Results.vue +++ b/src/views/Results.vue @@ -26,7 +26,7 @@ Time

- {{ minutes ? `${minutes}:${seconds}` : `${seconds}s` }} + {{ minutes ? `${minutes}:${('0' + seconds).slice(-2)}` : `${seconds}s` }}

From 74426dc603a822febf3661a062737d0729b01905 Mon Sep 17 00:00:00 2001 From: Bot Date: Fri, 25 Dec 2020 21:34:07 +0100 Subject: [PATCH 4/4] remove dynamic bar width --- src/components/charts/BarChart.vue | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/charts/BarChart.vue b/src/components/charts/BarChart.vue index c21f6c353..c79eab726 100644 --- a/src/components/charts/BarChart.vue +++ b/src/components/charts/BarChart.vue @@ -39,10 +39,6 @@ export default { data[score.name].value = score.value; }); - if (Math.round(data.player.value) === data.avg.value || Math.round(data.player.value) === data.best.value) { - data.barWidth = true; - } - return data; }, options() { @@ -65,7 +61,6 @@ export default { }, }], yAxes: [{ - barPercentage: 0.7, gridLines: { display: false, }, @@ -88,7 +83,7 @@ export default { return { datasets: [ { - barPercentage: this.chartData.barWidth ? 0.75 : 0.9, + barPercentage: 0.75, label: 'You', backgroundColor: this.backgroundColors[this.chartData.player.order], data: [this.chartData.player.value], @@ -99,12 +94,14 @@ export default { backgroundColor: this.backgroundColors[this.chartData.avg.order], data: [this.chartData.avg.value], order: this.chartData.avg.order, + barPercentage: 0.7, }, { label: 'Best', backgroundColor: this.backgroundColors[this.chartData.best.order], data: [this.chartData.best.value], order: this.chartData.best.order, + barPercentage: 0.7, }, ], };