diff --git a/frontend/.eslintignore b/frontend/.eslintignore new file mode 100644 index 000000000..5033deba2 --- /dev/null +++ b/frontend/.eslintignore @@ -0,0 +1,2 @@ +node_modules +**/*.min.js diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 638b2d891..412341955 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -1,15 +1,30 @@ module.exports = { root: true, env: { - node: true - }, - extends: ['plugin:vue/essential'], - rules: { - // TODO no console! - 'no-console': 'off', - 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' + browser: true, + node: true, + jest: true }, parserOptions: { parser: 'babel-eslint' + }, + extends: [ + 'plugin:vue/essential', + 'plugin:prettier/recommended' + ], + // required to lint *.vue files + plugins: [ + 'vue', + 'prettier', + 'jest' + ], + // add your custom rules here + rules: { + 'no-console': ['error'], + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', + 'vue/component-name-in-template-casing': ['error', 'kebab-case'], + 'prettier/prettier': ['error', { + htmlWhitespaceSensitivity: 'ignore' + }], } -}; +} diff --git a/frontend/babel.config.js b/frontend/babel.config.js index add0e9944..5daca001a 100644 --- a/frontend/babel.config.js +++ b/frontend/babel.config.js @@ -1,14 +1,12 @@ module.exports = { - "presets": [ - "@vue/app" - ], - "plugins": [ + presets: ["@vue/app"], + plugins: [ [ "component", { - "libraryName": "element-ui", - "styleLibraryName": "theme-chalk" + libraryName: "element-ui", + styleLibraryName: "theme-chalk" } ] ] -} +}; diff --git a/frontend/intelij.webpack.js b/frontend/intelij.webpack.js index 2f49f3814..2e604e3c2 100644 --- a/frontend/intelij.webpack.js +++ b/frontend/intelij.webpack.js @@ -1,12 +1,12 @@ // This configuration file is not used anywhere in the code, it's a hack to handle InteliJ relative path imports // Keep in sync with actual webpack aliases -const path = require('path'); +const path = require("path"); module.exports = { resolve: { alias: { - '@': path.resolve(__dirname, 'src') + "@": path.resolve(__dirname, "src") } } }; diff --git a/frontend/jest.config.js b/frontend/jest.config.js index 6f45984ab..a66bab3ff 100644 --- a/frontend/jest.config.js +++ b/frontend/jest.config.js @@ -1,34 +1,29 @@ module.exports = { - verbose: true, - collectCoverageFrom: [ - "**/*.{js,vue}", - "!**/node_modules/**", - "!**/?(*.)+(spec|test).js?(x)" - ], - moduleFileExtensions: [ - 'js', - //'jsx', - 'json', - 'vue', - ], - coverageReporters: [ - "lcov" - ], - moduleNameMapper: { - '^@/(.*)$': '/src/$1' - }, - transform: { - '^.+\\.vue$': 'vue-jest', - // '.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', - "^.+\\.(js|jsx)?$": "babel-jest" - }, - //setupFiles: [ - // "/test/registerContext.js" - //], - testMatch: [ - "**/?(*.)+(spec|test).js?(x)" - ], - // snapshotSerializers: ['jest-serializer-vue'], - transformIgnorePatterns: ['/node_modules/'] - }; - \ No newline at end of file + verbose: true, + collectCoverageFrom: [ + "**/*.{js,vue}", + "!**/node_modules/**", + "!**/?(*.)+(spec|test).js?(x)" + ], + moduleFileExtensions: [ + "js", + //'jsx', + "json", + "vue" + ], + coverageReporters: ["lcov"], + moduleNameMapper: { + "^@/(.*)$": "/src/$1" + }, + transform: { + "^.+\\.vue$": "vue-jest", + // '.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', + "^.+\\.(js|jsx)?$": "babel-jest" + }, + //setupFiles: [ + // "/test/registerContext.js" + //], + testMatch: ["**/?(*.)+(spec|test).js?(x)"], + // snapshotSerializers: ['jest-serializer-vue'], + transformIgnorePatterns: ["/node_modules/"] +}; diff --git a/frontend/package.json b/frontend/package.json index 2ebf5c1a2..fa0c9bcde 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,7 +6,7 @@ "start": "node server.js", "serve": "vue-cli-service serve --open", "build": "vue-cli-service build", - "lint": "vue-cli-service lint", + "lint": "eslint --ext .js,.vue .", "dev": "yarn run serve", "i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'", "test": "jest" @@ -27,7 +27,16 @@ "element-ui": "2.4.11", "es6-promise": "^4.1.1", "eslint": "^5.16.0", - "eslint-plugin-vue": "^7.5.0", + "eslint-config-prettier": "^8.1.0", + "eslint-config-standard": "^16.0.2", + "eslint-loader": "^4.0.2", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-jest": "^24.3.2", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-promise": "^4.3.1", + "eslint-plugin-standard": "^5.0.0", + "eslint-plugin-vue": "^7.8.0", "express": "^4.17.1", "flatpickr": "^4.5.7", "fuse.js": "^3.2.0", diff --git a/frontend/server.js b/frontend/server.js index 7f91163e5..ac73bba13 100644 --- a/frontend/server.js +++ b/frontend/server.js @@ -1,7 +1,7 @@ -var express = require('express'); -var serveStatic = require('serve-static'); +var express = require("express"); +var serveStatic = require("serve-static"); var app = express(); app.use(serveStatic(__dirname + "/dist")); var port = process.env.PORT || 5000; app.listen(port); -// console.log('http://localhost:5000 server started.'); \ No newline at end of file +// console.log('http://localhost:5000 server started.'); diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 86d8a020b..d0aa0307e 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,46 +1,64 @@ diff --git a/frontend/src/apis/communityAPI.js b/frontend/src/apis/communityAPI.js index a1da31707..91ab65504 100644 --- a/frontend/src/apis/communityAPI.js +++ b/frontend/src/apis/communityAPI.js @@ -1,54 +1,63 @@ -import axios from 'axios'; -import CONFIG from '../config' +import axios from "axios"; +import CONFIG from "../config"; -const apiGet = async (url) => { +const apiGet = async url => { try { const result = await axios.get(url); - if(result.status !== 200){ - throw new Error('HTTP Status Error '+result.status) + if (result.status !== 200) { + throw new Error("HTTP Status Error " + result.status); } - if(result.data.state !== 'success'){ - throw new Error(result.data.msg) + if (result.data.state !== "success") { + throw new Error(result.data.msg); } - return { success: true, result } - } catch(error){ - return { success: false, result: error} + return { success: true, result }; + } catch (error) { + return { success: false, result: error }; } -} +}; const apiPost = async (url, payload) => { try { const result = await axios.post(url, payload); - if(result.status !== 200){ - throw new Error('HTTP Status Error '+result.status) + if (result.status !== 200) { + throw new Error("HTTP Status Error " + result.status); } - if(result.data.state !== 'success'){ - throw new Error(result.data.msg) + if (result.data.state !== "success") { + throw new Error(result.data.msg); } - return { success: true, result } - } catch(error){ - return { success: false, result: error} + return { success: true, result }; + } catch (error) { + return { success: false, result: error }; } -} +}; const communityAPI = { - balance: async (session_id) => { - return apiGet(CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'ajaxGetBalance/' + session_id) + balance: async session_id => { + return apiGet( + CONFIG.COMMUNITY_API_STATE_BALANCE_URL + "ajaxGetBalance/" + session_id + ); }, - transactions: async (session_id) => { - return apiGet(CONFIG.COMMUNITY_API_STATE_BALANCE_URL + 'ajaxListTransactions/' + session_id) + transactions: async session_id => { + return apiGet( + CONFIG.COMMUNITY_API_STATE_BALANCE_URL + + "ajaxListTransactions/" + + session_id + ); }, - create: async (session_id, email, amount, memo, target_date = new Date() ) => { + create: async (session_id, email, amount, memo, target_date = new Date()) => { const payload = { session_id, email, amount, - target_date, + target_date, memo, auto_sign: true - } - return apiPost(CONFIG.COMMUNITY_API_TRANSACTION_CREATION_URL + 'ajaxCreate/', payload) + }; + return apiPost( + CONFIG.COMMUNITY_API_TRANSACTION_CREATION_URL + "ajaxCreate/", + payload + ); } -} +}; -export default communityAPI \ No newline at end of file +export default communityAPI; diff --git a/frontend/src/apis/loginAPI.js b/frontend/src/apis/loginAPI.js index 8756a6840..3883fd230 100644 --- a/frontend/src/apis/loginAPI.js +++ b/frontend/src/apis/loginAPI.js @@ -1,40 +1,40 @@ -import axios from 'axios'; -import CONFIG from '../config' +import axios from "axios"; +import CONFIG from "../config"; // control email-text sended with email verification code const EMAIL_TYPE = { DEFAULT: 2, // if user has registered directly - ADMIN: 5, // if user was registered by an admin -} + ADMIN: 5 // if user was registered by an admin +}; const apiPost = async (url, payload) => { try { const result = await axios.post(url, payload); - if(result.status !== 200){ - throw new Error('HTTP Status Error '+result.status) + if (result.status !== 200) { + throw new Error("HTTP Status Error " + result.status); } - if(result.data.state !== 'success'){ - throw new Error(result.data.msg) + if (result.data.state !== "success") { + throw new Error(result.data.msg); } - return { success: true, result } - } catch(error){ - return { success: false, result: error} + return { success: true, result }; + } catch (error) { + return { success: false, result: error }; } -} +}; const loginAPI = { login: async (email, password) => { const payload = { email, - password, - } - return apiPost(CONFIG.LOGIN_API_URL + 'unsecureLogin', payload) + password + }; + return apiPost(CONFIG.LOGIN_API_URL + "unsecureLogin", payload); }, - logout: async (session_id) => { - const payload= { session_id } - return apiPost(CONFIG.LOGIN_API_URL + 'logout', payload) + logout: async session_id => { + const payload = { session_id }; + return apiPost(CONFIG.LOGIN_API_URL + "logout", payload); }, - create : async (email, first_name, last_name, password) => { + create: async (email, first_name, last_name, password) => { const payload = { email, first_name, @@ -42,9 +42,9 @@ const loginAPI = { password, emailType: EMAIL_TYPE.DEFAULT, login_after_register: true - } - return apiPost(CONFIG.LOGIN_API_URL + 'createUser', payload) - }, -} + }; + return apiPost(CONFIG.LOGIN_API_URL + "createUser", payload); + } +}; -export default loginAPI \ No newline at end of file +export default loginAPI; diff --git a/frontend/src/components/Badge.vue b/frontend/src/components/Badge.vue index 4dcaca41d..07a6d5ea8 100644 --- a/frontend/src/components/Badge.vue +++ b/frontend/src/components/Badge.vue @@ -3,48 +3,48 @@ :variant="type" :pill="rounded" :size="size" - :class="{'badge-circle': circle }"> + :class="{ 'badge-circle': circle }" + > - + diff --git a/frontend/src/components/BaseAlert.vue b/frontend/src/components/BaseAlert.vue index 33567682d..daeab0289 100644 --- a/frontend/src/components/BaseAlert.vue +++ b/frontend/src/components/BaseAlert.vue @@ -8,7 +8,6 @@ > diff --git a/frontend/src/components/BaseButton.vue b/frontend/src/components/BaseButton.vue index d2f6ed3df..880662ec2 100644 --- a/frontend/src/components/BaseButton.vue +++ b/frontend/src/components/BaseButton.vue @@ -23,7 +23,7 @@ diff --git a/frontend/src/components/BaseDropdown.vue b/frontend/src/components/BaseDropdown.vue index 9c50f40da..ecbaca250 100644 --- a/frontend/src/components/BaseDropdown.vue +++ b/frontend/src/components/BaseDropdown.vue @@ -9,12 +9,13 @@ - {{ title }} + + {{ title }} @@ -32,46 +33,46 @@ - + diff --git a/frontend/src/components/BasePagination.vue b/frontend/src/components/BasePagination.vue index 84d4c7207..b7055d247 100755 --- a/frontend/src/components/BasePagination.vue +++ b/frontend/src/components/BasePagination.vue @@ -1,14 +1,27 @@ - + diff --git a/frontend/src/components/BaseSlider.vue b/frontend/src/components/BaseSlider.vue index 00d9e67b3..3d4e40369 100644 --- a/frontend/src/components/BaseSlider.vue +++ b/frontend/src/components/BaseSlider.vue @@ -2,31 +2,31 @@
diff --git a/frontend/src/components/ButtonCheckbox.vue b/frontend/src/components/ButtonCheckbox.vue index 1028aa899..42c3ebf13 100644 --- a/frontend/src/components/ButtonCheckbox.vue +++ b/frontend/src/components/ButtonCheckbox.vue @@ -1,39 +1,38 @@ - + diff --git a/frontend/src/components/ButtonRadioGroup.vue b/frontend/src/components/ButtonRadioGroup.vue index 5b8fc6742..eb8e92ca5 100644 --- a/frontend/src/components/ButtonRadioGroup.vue +++ b/frontend/src/components/ButtonRadioGroup.vue @@ -1,47 +1,56 @@ - + diff --git a/frontend/src/components/Cards/Card.vue b/frontend/src/components/Cards/Card.vue index d82e6cc35..d5b3a0038 100644 --- a/frontend/src/components/Cards/Card.vue +++ b/frontend/src/components/Cards/Card.vue @@ -1,18 +1,17 @@ - + diff --git a/frontend/src/components/Cards/StatsCard.vue b/frontend/src/components/Cards/StatsCard.vue index 919384882..929463d04 100644 --- a/frontend/src/components/Cards/StatsCard.vue +++ b/frontend/src/components/Cards/StatsCard.vue @@ -1,57 +1,58 @@ diff --git a/frontend/src/components/Charts/BarChart.js b/frontend/src/components/Charts/BarChart.js index c45092cbc..11068f750 100644 --- a/frontend/src/components/Charts/BarChart.js +++ b/frontend/src/components/Charts/BarChart.js @@ -1,8 +1,8 @@ -import { Bar, mixins } from 'vue-chartjs'; +import { Bar, mixins } from "vue-chartjs"; import globalOptionsMixin from "@/components/Charts/globalOptionsMixin"; export default { - name: 'bar-chart', + name: "bar-chart", extends: Bar, mixins: [mixins.reactiveProp, globalOptionsMixin], props: { @@ -18,7 +18,7 @@ export default { }, mounted() { this.$watch( - 'chartData', + "chartData", (newVal, oldVal) => { if (!oldVal) { this.renderChart(this.chartData, this.extraOptions); diff --git a/frontend/src/components/Charts/LineChart.js b/frontend/src/components/Charts/LineChart.js index fffb85571..fa8f561ff 100644 --- a/frontend/src/components/Charts/LineChart.js +++ b/frontend/src/components/Charts/LineChart.js @@ -1,7 +1,7 @@ -import { Line, mixins } from 'vue-chartjs'; +import { Line, mixins } from "vue-chartjs"; import globalOptionsMixin from "@/components/Charts/globalOptionsMixin"; export default { - name: 'line-chart', + name: "line-chart", extends: Line, mixins: [mixins.reactiveProp, globalOptionsMixin], props: { @@ -17,7 +17,7 @@ export default { }, mounted() { this.$watch( - 'chartData', + "chartData", (newVal, oldVal) => { if (!oldVal) { this.renderChart(this.chartData, this.extraOptions); diff --git a/frontend/src/components/Charts/config.js b/frontend/src/components/Charts/config.js index c3add6981..12365d4f3 100644 --- a/frontend/src/components/Charts/config.js +++ b/frontend/src/components/Charts/config.js @@ -1,35 +1,35 @@ import { parseOptions } from "@/components/Charts/optionHelpers"; -import Chart from 'chart.js' +import Chart from "chart.js"; export const Charts = { - mode: 'light',//(themeMode) ? themeMode : 'light'; + mode: "light", //(themeMode) ? themeMode : 'light'; fonts: { - base: 'Open Sans' + base: "Open Sans" }, colors: { gray: { - 100: '#f6f9fc', - 200: '#e9ecef', - 300: '#dee2e6', - 400: '#ced4da', - 500: '#adb5bd', - 600: '#8898aa', - 700: '#525f7f', - 800: '#32325d', - 900: '#212529' + 100: "#f6f9fc", + 200: "#e9ecef", + 300: "#dee2e6", + 400: "#ced4da", + 500: "#adb5bd", + 600: "#8898aa", + 700: "#525f7f", + 800: "#32325d", + 900: "#212529" }, theme: { - 'default': '#172b4d', - 'primary': '#5e72e4', - 'secondary': '#f4f5f7', - 'info': '#11cdef', - 'success': '#2dce89', - 'danger': '#f5365c', - 'warning': '#fb6340' + default: "#172b4d", + primary: "#5e72e4", + secondary: "#f4f5f7", + info: "#11cdef", + success: "#2dce89", + danger: "#f5365c", + warning: "#fb6340" }, - black: '#12263F', - white: '#FFFFFF', - transparent: 'transparent', + black: "#12263F", + white: "#FFFFFF", + transparent: "transparent" } }; @@ -41,8 +41,8 @@ function chartOptions() { global: { responsive: true, maintainAspectRatio: false, - defaultColor: (mode === 'dark') ? colors.gray[700] : colors.gray[600], - defaultFontColor: (mode === 'dark') ? colors.gray[700] : colors.gray[600], + defaultColor: mode === "dark" ? colors.gray[700] : colors.gray[600], + defaultFontColor: mode === "dark" ? colors.gray[700] : colors.gray[600], defaultFontFamily: fonts.base, defaultFontSize: 13, layout: { @@ -50,7 +50,7 @@ function chartOptions() { }, legend: { display: false, - position: 'bottom', + position: "bottom", labels: { usePointStyle: true, padding: 16 @@ -59,51 +59,54 @@ function chartOptions() { elements: { point: { radius: 0, - backgroundColor: colors.theme['primary'] + backgroundColor: colors.theme["primary"] }, line: { - tension: .4, + tension: 0.4, borderWidth: 4, - borderColor: colors.theme['primary'], + borderColor: colors.theme["primary"], backgroundColor: colors.transparent, - borderCapStyle: 'rounded' + borderCapStyle: "rounded" }, rectangle: { - backgroundColor: colors.theme['warning'] + backgroundColor: colors.theme["warning"] }, arc: { - backgroundColor: colors.theme['primary'], - borderColor: (mode == 'dark') ? colors.gray[800] : colors.white, + backgroundColor: colors.theme["primary"], + borderColor: mode == "dark" ? colors.gray[800] : colors.white, borderWidth: 4 } }, tooltips: { enabled: true, - mode: 'index', - intersect: false, + mode: "index", + intersect: false } }, pie: { tooltips: { - mode: 'point' + mode: "point" } }, doughnut: { tooltips: { - mode: 'point' + mode: "point" }, cutoutPercentage: 83, - legendCallback: function (chart) { + legendCallback: function(chart) { let data = chart.data; - let content = ''; + let content = ""; - data.labels.forEach(function (label, index) { + data.labels.forEach(function(label, index) { let bgColor = data.datasets[0].backgroundColor[index]; content += ''; - content += ''; + content += + ''; content += label; - content += ''; + content += ""; }); return content; @@ -113,37 +116,37 @@ function chartOptions() { }; // yAxes - Chart.scaleService.updateScaleDefaults('linear', { + Chart.scaleService.updateScaleDefaults("linear", { gridLines: { borderDash: [2], borderDashOffset: [2], - color: (mode === 'dark') ? colors.gray[900] : colors.gray[200], + color: mode === "dark" ? colors.gray[900] : colors.gray[200], drawBorder: false, drawTicks: true, zeroLineWidth: 1, - zeroLineColor: (mode === 'dark') ? colors.gray[900] : colors.gray[200], + zeroLineColor: mode === "dark" ? colors.gray[900] : colors.gray[200], zeroLineBorderDash: [2], zeroLineBorderDashOffset: [2] }, ticks: { beginAtZero: true, padding: 10, - callback: function (value) { + callback: function(value) { if (!(value % 10)) { - return value + return value; } } } }); // xAxes - Chart.scaleService.updateScaleDefaults('category', { + Chart.scaleService.updateScaleDefaults("category", { gridLines: { drawBorder: false, drawOnChartArea: false, drawTicks: false, lineWidth: 1, - zeroLineWidth: 1, + zeroLineWidth: 1 }, ticks: { padding: 20 @@ -152,16 +155,16 @@ function chartOptions() { }); return options; -}; +} -let initialized = false +let initialized = false; export function initGlobalOptions() { if (initialized) { - return + return; } parseOptions(Chart, chartOptions()); - initialized = true + initialized = true; } export const basicOptions = { @@ -173,26 +176,28 @@ export const basicOptions = { }; export let blueChartOptions = { scales: { - yAxes: [{ - gridLines: { - color: Charts.colors.gray[700], - zeroLineColor: Charts.colors.gray[700] + yAxes: [ + { + gridLines: { + color: Charts.colors.gray[700], + zeroLineColor: Charts.colors.gray[700] + } } - }] + ] } }; export let lineChartOptionsBlue = { ...basicOptions, tooltips: { - backgroundColor: '#f5f5f5', - titleFontColor: '#333', - bodyFontColor: '#666', + backgroundColor: "#f5f5f5", + titleFontColor: "#333", + bodyFontColor: "#666", bodySpacing: 4, xPadding: 12, - mode: 'nearest', + mode: "nearest", intersect: 0, - position: 'nearest' + position: "nearest" }, responsive: true, scales: { @@ -201,14 +206,14 @@ export let lineChartOptionsBlue = { barPercentage: 1.6, gridLines: { drawBorder: false, - color: 'rgba(29,140,248,0.0)', - zeroLineColor: 'transparent' + color: "rgba(29,140,248,0.0)", + zeroLineColor: "transparent" }, ticks: { suggestedMin: 60, suggestedMax: 125, padding: 20, - fontColor: '#9e9e9e' + fontColor: "#9e9e9e" } } ], @@ -218,12 +223,12 @@ export let lineChartOptionsBlue = { barPercentage: 1.6, gridLines: { drawBorder: false, - color: 'rgba(29,140,248,0.1)', - zeroLineColor: 'transparent' + color: "rgba(29,140,248,0.1)", + zeroLineColor: "transparent" }, ticks: { padding: 20, - fontColor: '#9e9e9e' + fontColor: "#9e9e9e" } } ] diff --git a/frontend/src/components/Charts/globalOptionsMixin.js b/frontend/src/components/Charts/globalOptionsMixin.js index eebaaca55..1ab0fd6d5 100644 --- a/frontend/src/components/Charts/globalOptionsMixin.js +++ b/frontend/src/components/Charts/globalOptionsMixin.js @@ -1,7 +1,7 @@ import { initGlobalOptions } from "@/components/Charts/config"; -import './roundedCornersExtension' +import "./roundedCornersExtension"; export default { mounted() { initGlobalOptions(); } -} +}; diff --git a/frontend/src/components/Charts/optionHelpers.js b/frontend/src/components/Charts/optionHelpers.js index 227b229e1..fb8f7c712 100644 --- a/frontend/src/components/Charts/optionHelpers.js +++ b/frontend/src/components/Charts/optionHelpers.js @@ -1,7 +1,7 @@ // Parse global options export function parseOptions(parent, options) { for (let item in options) { - if (typeof options[item] !== 'object') { + if (typeof options[item] !== "object") { parent[item] = options[item]; } else { parseOptions(parent[item], options[item]); diff --git a/frontend/src/components/Charts/roundedCornersExtension.js b/frontend/src/components/Charts/roundedCornersExtension.js index b1a91643f..d0325e54e 100644 --- a/frontend/src/components/Charts/roundedCornersExtension.js +++ b/frontend/src/components/Charts/roundedCornersExtension.js @@ -2,9 +2,8 @@ // Chart extension for making the bars rounded // Code from: https://codepen.io/jedtrow/full/ygRYgo // -import Chart from 'chart.js' +import Chart from "chart.js"; Chart.elements.Rectangle.prototype.draw = function() { - let ctx = this._chart.ctx; let vm = this._view; let left, right, top, bottom, signX, signY, borderSkipped, radius; @@ -21,7 +20,7 @@ Chart.elements.Rectangle.prototype.draw = function() { bottom = vm.base; signX = 1; signY = bottom > top ? 1 : -1; - borderSkipped = vm.borderSkipped || 'bottom'; + borderSkipped = vm.borderSkipped || "bottom"; } else { // horizontal bar left = vm.base; @@ -30,7 +29,7 @@ Chart.elements.Rectangle.prototype.draw = function() { bottom = vm.y + vm.height / 2; signX = right > left ? 1 : -1; signY = 1; - borderSkipped = vm.borderSkipped || 'left'; + borderSkipped = vm.borderSkipped || "left"; } // Canvas doesn't allow us to stroke inside the width so we can @@ -41,10 +40,12 @@ Chart.elements.Rectangle.prototype.draw = function() { borderWidth = borderWidth > barSize ? barSize : borderWidth; let halfStroke = borderWidth / 2; // Adjust borderWidth when bar top position is near vm.base(zero). - let borderLeft = left + (borderSkipped !== 'left' ? halfStroke * signX : 0); - let borderRight = right + (borderSkipped !== 'right' ? -halfStroke * signX : 0); - let borderTop = top + (borderSkipped !== 'top' ? halfStroke * signY : 0); - let borderBottom = bottom + (borderSkipped !== 'bottom' ? -halfStroke * signY : 0); + let borderLeft = left + (borderSkipped !== "left" ? halfStroke * signX : 0); + let borderRight = + right + (borderSkipped !== "right" ? -halfStroke * signX : 0); + let borderTop = top + (borderSkipped !== "top" ? halfStroke * signY : 0); + let borderBottom = + bottom + (borderSkipped !== "bottom" ? -halfStroke * signY : 0); // not become a vertical line? if (borderLeft !== borderRight) { top = borderTop; @@ -73,7 +74,7 @@ Chart.elements.Rectangle.prototype.draw = function() { ]; // Find first (starting) corner with fallback to 'bottom' - let borders = ['bottom', 'left', 'top', 'right']; + let borders = ["bottom", "left", "top", "right"]; let startCorner = borders.indexOf(borderSkipped, 0); if (startCorner === -1) { startCorner = 0; @@ -91,7 +92,7 @@ Chart.elements.Rectangle.prototype.draw = function() { corner = cornerAt(i); let nextCornerId = i + 1; if (nextCornerId == 4) { - nextCornerId = 0 + nextCornerId = 0; } let nextCorner = cornerAt(nextCornerId); @@ -120,7 +121,6 @@ Chart.elements.Rectangle.prototype.draw = function() { ctx.quadraticCurveTo(x, y + height, x, y + height - radius); ctx.lineTo(x, y + radius); ctx.quadraticCurveTo(x, y, x + radius, y); - } ctx.fill(); diff --git a/frontend/src/components/CloseButton.spec.js b/frontend/src/components/CloseButton.spec.js index 3bf307c28..96a670ad8 100644 --- a/frontend/src/components/CloseButton.spec.js +++ b/frontend/src/components/CloseButton.spec.js @@ -1,32 +1,28 @@ -import { mount } from '@vue/test-utils' +import { mount } from "@vue/test-utils"; -import CloseButton from './CloseButton' +import CloseButton from "./CloseButton"; -const localVue = global.localVue +const localVue = global.localVue; -describe('CloseButton', () => { - - let wrapper +describe("CloseButton", () => { + let wrapper; let propsData = { target: "Target", - expanded: false, - } + expanded: false + }; const Wrapper = () => { - return mount(CloseButton, { localVue, propsData }) - } - - describe('mount', () => { + return mount(CloseButton, { localVue, propsData }); + }; + describe("mount", () => { beforeEach(() => { - wrapper = Wrapper() - }) + wrapper = Wrapper(); + }); - it('emmits click event', () => { - wrapper.find('.navbar-toggler').trigger('click') - expect(wrapper.emitted('click')).toBeTruthy() - }) - - }) - -}) + it("emmits click event", () => { + wrapper.find(".navbar-toggler").trigger("click"); + expect(wrapper.emitted("click")).toBeTruthy(); + }); + }); +}); diff --git a/frontend/src/components/CloseButton.vue b/frontend/src/components/CloseButton.vue index 756c8b6a5..0ee8d25a8 100755 --- a/frontend/src/components/CloseButton.vue +++ b/frontend/src/components/CloseButton.vue @@ -9,25 +9,26 @@ :aria-expanded="expanded" aria-label="Toggle navigation" > - + + diff --git a/frontend/src/components/Inputs/BaseInput.vue b/frontend/src/components/Inputs/BaseInput.vue index 31c075c6f..777b124bf 100644 --- a/frontend/src/components/Inputs/BaseInput.vue +++ b/frontend/src/components/Inputs/BaseInput.vue @@ -1,24 +1,31 @@ - + diff --git a/frontend/src/components/Inputs/BaseRadio.vue b/frontend/src/components/Inputs/BaseRadio.vue index d0d7fd50b..b28e2e595 100755 --- a/frontend/src/components/Inputs/BaseRadio.vue +++ b/frontend/src/components/Inputs/BaseRadio.vue @@ -1,7 +1,8 @@ diff --git a/frontend/src/components/LoadingPanel.vue b/frontend/src/components/LoadingPanel.vue index 41fe2cf72..f3cd275c2 100644 --- a/frontend/src/components/LoadingPanel.vue +++ b/frontend/src/components/LoadingPanel.vue @@ -2,8 +2,8 @@ diff --git a/frontend/src/components/Modal.vue b/frontend/src/components/Modal.vue index cc01518d1..1689fe665 100644 --- a/frontend/src/components/Modal.vue +++ b/frontend/src/components/Modal.vue @@ -1,85 +1,89 @@ diff --git a/frontend/src/components/Navbar/BaseNav.vue b/frontend/src/components/Navbar/BaseNav.vue index 81400f61b..9de33aebe 100644 --- a/frontend/src/components/Navbar/BaseNav.vue +++ b/frontend/src/components/Navbar/BaseNav.vue @@ -20,8 +20,8 @@ - + @click.stop="toggleMenu" + > + v-click-outside="closeMenu" + > @@ -37,65 +38,65 @@ diff --git a/frontend/src/components/NavbarToggleButton.vue b/frontend/src/components/NavbarToggleButton.vue index 78b0396ba..266328a3a 100755 --- a/frontend/src/components/NavbarToggleButton.vue +++ b/frontend/src/components/NavbarToggleButton.vue @@ -10,7 +10,7 @@ > - + @@ -19,12 +19,12 @@ export default { props: { target: { type: [String, Number], - description: 'Button target element' + description: "Button target element" }, toggled: { type: Boolean, default: false, - description: 'Whether button is toggled' + description: "Whether button is toggled" } } }; diff --git a/frontend/src/components/NotificationPlugin/Notification.vue b/frontend/src/components/NotificationPlugin/Notification.vue index 6338fa9ea..294d2f388 100644 --- a/frontend/src/components/NotificationPlugin/Notification.vue +++ b/frontend/src/components/NotificationPlugin/Notification.vue @@ -15,16 +15,18 @@ > - - {{ title }}
+ + {{ title }} +
+
- - diff --git a/frontend/src/components/NotificationPlugin/Notifications.vue b/frontend/src/components/NotificationPlugin/Notifications.vue index 2689cc923..6020ea1ff 100644 --- a/frontend/src/components/NotificationPlugin/Notifications.vue +++ b/frontend/src/components/NotificationPlugin/Notifications.vue @@ -1,55 +1,52 @@ diff --git a/frontend/src/components/NotificationPlugin/index.js b/frontend/src/components/NotificationPlugin/index.js index e871fb6ac..93e9f0038 100644 --- a/frontend/src/components/NotificationPlugin/index.js +++ b/frontend/src/components/NotificationPlugin/index.js @@ -1,12 +1,12 @@ -import Notifications from './Notifications.vue'; +import Notifications from "./Notifications.vue"; const NotificationStore = { state: [], // here the notifications will be added settings: { overlap: false, - verticalAlign: 'top', - horizontalAlign: 'right', - type: 'info', + verticalAlign: "top", + horizontalAlign: "right", + type: "info", timeout: 5000, closeOnClick: true, showClose: true @@ -21,7 +21,7 @@ const NotificationStore = { } }, addNotification(notification) { - if (typeof notification === 'string' || notification instanceof String) { + if (typeof notification === "string" || notification instanceof String) { notification = { message: notification }; } notification.timestamp = new Date(); @@ -56,7 +56,7 @@ const NotificationsPlugin = { }); Vue.prototype.$notify = app.notify; Vue.prototype.$notifications = app.notificationStore; - Vue.component('Notifications', Notifications); + Vue.component("Notifications", Notifications); if (options) { NotificationStore.setOptions(options); } diff --git a/frontend/src/components/SearchUser.vue b/frontend/src/components/SearchUser.vue index 143fcfeac..08fb14f40 100644 --- a/frontend/src/components/SearchUser.vue +++ b/frontend/src/components/SearchUser.vue @@ -1,12 +1,8 @@ \ No newline at end of file + } +}; + diff --git a/frontend/src/components/SidebarPlugin/SideBar.vue b/frontend/src/components/SidebarPlugin/SideBar.vue index 7f2f1e5eb..410c5e673 100755 --- a/frontend/src/components/SidebarPlugin/SideBar.vue +++ b/frontend/src/components/SidebarPlugin/SideBar.vue @@ -1,130 +1,151 @@ diff --git a/frontend/src/components/SidebarPlugin/SidebarItem.vue b/frontend/src/components/SidebarPlugin/SidebarItem.vue index 2699bef25..9ce45193a 100755 --- a/frontend/src/components/SidebarPlugin/SidebarItem.vue +++ b/frontend/src/components/SidebarPlugin/SidebarItem.vue @@ -15,12 +15,16 @@ > @@ -61,10 +65,10 @@ + diff --git a/frontend/src/views/Dashboard/SocialTrafficTable.vue b/frontend/src/views/Dashboard/SocialTrafficTable.vue index bd3eace62..3ce5760dd 100644 --- a/frontend/src/views/Dashboard/SocialTrafficTable.vue +++ b/frontend/src/views/Dashboard/SocialTrafficTable.vue @@ -11,24 +11,27 @@ - + header-row-class-name="thead-light" + > - diff --git a/frontend/src/views/Pages/Password.vue b/frontend/src/views/Pages/Password.vue index a5a257c27..adb85066e 100644 --- a/frontend/src/views/Pages/Password.vue +++ b/frontend/src/views/Pages/Password.vue @@ -5,32 +5,47 @@
-

{{ $t('site.password.title')}}

-

{{ $t('site.password.subtitle')}}

+

{{ $t("site.password.title") }}

+

{{ $t("site.password.subtitle") }}

- - - - - + + + + - - - {{form}} + :rules="{ required: true, email: true }" + v-model="model.email" + > + {{ form }}
- {{ $t('site.password.reset_now')}} + + {{ $t("site.password.reset_now") }} +
@@ -38,30 +53,30 @@
-
- {{ $t('back')}} -
+
+ {{ $t("back") }} +
diff --git a/frontend/src/views/Pages/Register.vue b/frontend/src/views/Pages/Register.vue index 3d622066f..29fd6a6f8 100755 --- a/frontend/src/views/Pages/Register.vue +++ b/frontend/src/views/Pages/Register.vue @@ -6,75 +6,103 @@
-

{{ $t('site.signup.title')}}

-

{{ $t('site.signup.subtitle')}}

+

{{ $t("site.signup.title") }}

+

{{ $t("site.signup.subtitle") }}

- - - - + +
- {{ $t('signup')}} + {{ $t("signup") }}
- + - - - - + + - - + - - -
{{ $t('site.signup.strength')}} {{ $t('site.signup.strong')}}
+ +
+ + {{ $t("site.signup.strength") }} + + {{ $t("site.signup.strong") }} + + +
- + - {{ $t('privacy_policy')}} - {{ $t('site.signup.agree')}} + + + {{ $t("privacy_policy") }} + + - {{ $t("site.signup.agree") }} +
- {{ $t('signup')}} + + {{ $t("signup") }} +
@@ -82,39 +110,44 @@
-
- {{ $t('back')}} -
+
+ {{ $t("back") }} +
diff --git a/frontend/src/views/Pages/UserProfile.vue b/frontend/src/views/Pages/UserProfile.vue index c380abc75..4ce873b9c 100755 --- a/frontend/src/views/Pages/UserProfile.vue +++ b/frontend/src/views/Pages/UserProfile.vue @@ -1,14 +1,20 @@ - + diff --git a/frontend/src/views/Pages/UserProfile/EditProfileForm.vue b/frontend/src/views/Pages/UserProfile/EditProfileForm.vue index 7ad1800fa..b27386f55 100755 --- a/frontend/src/views/Pages/UserProfile/EditProfileForm.vue +++ b/frontend/src/views/Pages/UserProfile/EditProfileForm.vue @@ -1,12 +1,8 @@ @@ -119,22 +116,22 @@ export default { data() { return { user: { - company: 'Creative Code Inc.', - username: 'michael23', - email: '', - firstName: 'Mike', - lastName: 'Andrew', - address: 'Bld Mihail Kogalniceanu, nr. 8 Bl 1, Sc 1, Ap 09', - city: 'New York', - country: 'USA', - postalCode: '', + company: "Creative Code Inc.", + username: "michael23", + email: "", + firstName: "Mike", + lastName: "Andrew", + address: "Bld Mihail Kogalniceanu, nr. 8 Bl 1, Sc 1, Ap 09", + city: "New York", + country: "USA", + postalCode: "", aboutMe: `Lamborghini Mercy, Your chick she so thirsty, I'm in that two seat Lambo.` } }; }, methods: { updateProfile() { - alert('Your data: ' + JSON.stringify(this.user)); + alert("Your data: " + JSON.stringify(this.user)); } } }; diff --git a/frontend/src/views/Pages/UserProfile/ImageUploaderAvatar.vue b/frontend/src/views/Pages/UserProfile/ImageUploaderAvatar.vue index 1e6fa8620..ad5e99c85 100644 --- a/frontend/src/views/Pages/UserProfile/ImageUploaderAvatar.vue +++ b/frontend/src/views/Pages/UserProfile/ImageUploaderAvatar.vue @@ -5,16 +5,17 @@ - + - {{errorText}} + {{ errorText }} Got it! @@ -24,48 +25,49 @@ diff --git a/frontend/src/views/Pages/UserProfile/UserCard.vue b/frontend/src/views/Pages/UserProfile/UserCard.vue index 3f6e5e273..787d551bd 100755 --- a/frontend/src/views/Pages/UserProfile/UserCard.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard.vue @@ -4,7 +4,10 @@ @@ -12,13 +15,13 @@
-
+
- +
-- @@ -29,7 +32,9 @@ Community
- {{ $n(this.$store.state.user.balance) }} + + {{ $n(this.$store.state.user.balance) }} + GDD
@@ -37,21 +42,20 @@
- {{this.$store.state.email}} + {{ this.$store.state.email }} +
- -
diff --git a/frontend/src/views/Pages/UserProfileActivity.vue b/frontend/src/views/Pages/UserProfileActivity.vue index 4346df68a..e7d37d8dd 100644 --- a/frontend/src/views/Pages/UserProfileActivity.vue +++ b/frontend/src/views/Pages/UserProfileActivity.vue @@ -1,99 +1,91 @@ - + diff --git a/frontend/src/views/Pages/UserProfileCard.vue b/frontend/src/views/Pages/UserProfileCard.vue index b435c2beb..d65a74019 100644 --- a/frontend/src/views/Pages/UserProfileCard.vue +++ b/frontend/src/views/Pages/UserProfileCard.vue @@ -1,9 +1,9 @@ - + diff --git a/frontend/src/views/Pages/UserProfileEdit.vue b/frontend/src/views/Pages/UserProfileEdit.vue index 5f838475d..debc39bfa 100644 --- a/frontend/src/views/Pages/UserProfileEdit.vue +++ b/frontend/src/views/Pages/UserProfileEdit.vue @@ -1,11 +1,11 @@ - + diff --git a/frontend/src/views/Pages/UserProfileTransactionList.vue b/frontend/src/views/Pages/UserProfileTransactionList.vue index 525ea2525..29eb5f65a 100644 --- a/frontend/src/views/Pages/UserProfileTransactionList.vue +++ b/frontend/src/views/Pages/UserProfileTransactionList.vue @@ -1,24 +1,25 @@ - + diff --git a/frontend/src/views/Pages/thx.vue b/frontend/src/views/Pages/thx.vue index f11e0c8df..f6f64b9b2 100644 --- a/frontend/src/views/Pages/thx.vue +++ b/frontend/src/views/Pages/thx.vue @@ -3,21 +3,29 @@
-
-

{{$t('site.thx.title')}}

-

{{$t('site.thx.subtitle')}}

-
- {{$t('login')}} - +
+

{{ $t("site.thx.title") }}

+

{{ $t("site.thx.subtitle") }}

+
+ {{ $t("login") }}
- - + +
-
diff --git a/frontend/src/views/RegularTables.vue b/frontend/src/views/RegularTables.vue index 72d8fbbb5..3777f0c2c 100755 --- a/frontend/src/views/RegularTables.vue +++ b/frontend/src/views/RegularTables.vue @@ -4,12 +4,13 @@ - - +