├── .browserslistrc ├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── LICENSE ├── README.md ├── babel.config.js ├── jest.config.js ├── jsconfig.json ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ ├── css │ │ ├── app.scss │ │ └── theme-dark.scss │ └── js │ │ ├── api.js │ │ └── utils.js ├── components │ ├── Navbar.vue │ ├── Pagination.vue │ ├── PreTableRow.vue │ └── TeamTableRow.vue ├── main.js ├── mixins │ └── PaginableMixin.vue ├── router.js ├── store.js └── views │ ├── Live.vue │ ├── Search.vue │ ├── Stats.vue │ └── Teams.vue └── tests └── unit ├── .eslintrc.js └── example.spec.js /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | }, 6 | extends: ["plugin:vue/recommended", "@vue/prettier"], 7 | rules: { 8 | "no-console": process.env.NODE_ENV === "production" ? "error" : "off", 9 | "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off", 10 | }, 11 | parserOptions: { 12 | parser: "babel-eslint", 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2019 predbdotovh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # predb.ovh 2 | 3 | > Predb.ovh website 4 | 5 | ## Project setup 6 | 7 | ``` 8 | npm install 9 | ``` 10 | 11 | ### Compiles and hot-reloads for development 12 | 13 | ``` 14 | npm run serve 15 | ``` 16 | 17 | ### Compiles and minifies for production 18 | 19 | ``` 20 | npm run build 21 | ``` 22 | 23 | ### Run your tests 24 | 25 | ``` 26 | npm run test 27 | ``` 28 | 29 | ### Lints and fixes files 30 | 31 | ``` 32 | npm run lint 33 | ``` 34 | 35 | ### Run your unit tests 36 | 37 | ``` 38 | npm run test:unit 39 | ``` 40 | 41 | ### Customize configuration 42 | 43 | See [Configuration Reference](https://cli.vuejs.org/config/). 44 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/cli-plugin-babel/preset"], 3 | }; 4 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleFileExtensions: ["js", "jsx", "json", "vue"], 3 | transform: { 4 | "^.+\\.vue$": "vue-jest", 5 | ".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$": 6 | "jest-transform-stub", 7 | "^.+\\.jsx?$": "babel-jest", 8 | }, 9 | transformIgnorePatterns: ["/node_modules/"], 10 | moduleNameMapper: { 11 | "^@/(.*)$": "/src/$1", 12 | }, 13 | snapshotSerializers: ["jest-serializer-vue"], 14 | testMatch: [ 15 | "**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)", 16 | ], 17 | testURL: "http://localhost/", 18 | watchPlugins: [ 19 | "jest-watch-typeahead/filename", 20 | "jest-watch-typeahead/testname", 21 | ], 22 | }; 23 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": ["node_modules", "dist", "public"], 3 | "compilerOptions": { 4 | "baseUrl": "src", 5 | "paths": { 6 | "@/*": ["*"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "predb.ovh", 3 | "version": "1.4.0", 4 | "private": true, 5 | "description": "Predb.ovh website", 6 | "author": "predbdotovh ", 7 | "scripts": { 8 | "serve": "vue-cli-service serve", 9 | "build": "vue-cli-service build --modern", 10 | "test:unit": "vue-cli-service test:unit", 11 | "lint": "vue-cli-service lint" 12 | }, 13 | "dependencies": { 14 | "core-js": "^3.15.2", 15 | "vue": "^2.6.14", 16 | "vue-router": "^3.5.2", 17 | "vuex": "^3.6.2" 18 | }, 19 | "devDependencies": { 20 | "@vue/cli-plugin-babel": "^4.5.13", 21 | "@vue/cli-plugin-eslint": "^4.5.13", 22 | "@vue/cli-plugin-router": "^4.5.13", 23 | "@vue/cli-plugin-unit-jest": "^4.5.13", 24 | "@vue/cli-plugin-vuex": "^4.5.13", 25 | "@vue/cli-service": "^4.5.13", 26 | "@vue/eslint-config-prettier": "^6.0.0", 27 | "@vue/test-utils": "^1.2.2", 28 | "babel-eslint": "^10.1.0", 29 | "bulma": "^0.9.3", 30 | "eslint": "^7.31.0", 31 | "eslint-plugin-import": "^2.23.4", 32 | "eslint-plugin-node": "^11.1.0", 33 | "eslint-plugin-prettier": "^3.4.0", 34 | "eslint-plugin-promise": "^5.1.0", 35 | "eslint-plugin-vue": "^7.14.0", 36 | "js-cookie": "^2.2.1", 37 | "prettier": "^2.3.2", 38 | "prettier-eslint": "^12.0.0", 39 | "sass": "^1.36.0", 40 | "sass-loader": "^10.2.0", 41 | "vue-progressbar": "^0.7.5", 42 | "vue-resource": "^1.5.3", 43 | "vue-template-compiler": "^2.6.14" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/predbdotovh/website-vuejs/484b634753ba8923cc32125e5308efd647c08313/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | PREdb 10 | 11 | 12 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/assets/css/app.scss: -------------------------------------------------------------------------------- 1 | // /* Styles shared with most views */ 2 | 3 | html, body { 4 | height: 100%; 5 | } 6 | 7 | #app { 8 | min-height: 100%; 9 | } 10 | 11 | .main { 12 | padding: 0.6rem; 13 | } 14 | 15 | .state-loading { 16 | opacity: 0.6; 17 | } 18 | 19 | .stats { 20 | text-align: center; 21 | } 22 | 23 | .status-bar { 24 | text-align: center; 25 | margin-bottom: 0.8em; 26 | } 27 | 28 | @import "theme-dark"; 29 | -------------------------------------------------------------------------------- /src/assets/css/theme-dark.scss: -------------------------------------------------------------------------------- 1 | #app.theme-dark { 2 | background-color: #191c23; 3 | color: #d6d4d0; 4 | } 5 | 6 | .theme-dark { 7 | input[type="text"] { 8 | color: #d6d4d0; 9 | background-color: #14171d; 10 | } 11 | input[type="text"]::placeholder { 12 | color: #b6b4b0; 13 | } 14 | 15 | .navbar { 16 | background-color: #14171d; 17 | 18 | .checkbox:hover { 19 | color: #fafafa; 20 | } 21 | } 22 | .navbar-item { 23 | color: #d6d4d0; 24 | } 25 | .navbar-item.is-active { 26 | color: white; 27 | } 28 | .navbar-item.is-active:hover { 29 | color: #485fc7; 30 | } 31 | 32 | .table, .table th { 33 | background-color: #14171d; 34 | color: #d6d4d0; 35 | } 36 | .table.is-striped tbody tr:not(.is-selected):nth-child(even) { 37 | background-color: #252c33; 38 | } 39 | 40 | .table tbody td { 41 | border-bottom-color: #3e4b59; 42 | } 43 | .table.is-hoverable.is-striped tbody tr:not(.is-selected):hover { 44 | background-color: #3e4b59; 45 | } 46 | .table.is-hoverable.is-striped tbody tr:not(.is-selected):hover:nth-child(even) { 47 | background-color: #3e4b59; 48 | } 49 | 50 | .pagination-link,.pagination-prev,.pagination-next { 51 | color: #d6d4d0; 52 | } 53 | .pagination-link:hover,.pagination-prev:hover,.pagination-next:hover { 54 | color: #dbdbdb; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/assets/js/api.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | 3 | const apiEndpoint = "https://predb.ovh/api/v1/"; 4 | const wssEndpoint = "wss://predb.ovh/api/v1/ws"; 5 | 6 | const api = { 7 | err(msg, ctx) { 8 | const err = new Error(msg); 9 | err.ctx = ctx; 10 | throw err; 11 | }, 12 | checkHTTP(res) { 13 | if (!res || res.status !== 200) { 14 | return api.err("Unexpected response from API"); 15 | } 16 | 17 | return res; 18 | }, 19 | parseJson(res) { 20 | return res.json(); 21 | }, 22 | checkStatus(json) { 23 | if (!json) { 24 | return api.err("Unexpected response from API"); 25 | } 26 | 27 | if (json.status !== "success") { 28 | return api.err(json.message.replace("\0", ""), json); 29 | } 30 | 31 | return json; 32 | }, 33 | get(path, params) { 34 | return Vue.http 35 | .get(apiEndpoint + path, { params: params }) 36 | .then(this.checkHTTP) 37 | .then(this.parseJson) 38 | .then(this.checkStatus); 39 | }, 40 | websocket() { 41 | return new WebSocket(wssEndpoint); 42 | }, 43 | fresh() { 44 | return this.get("live", {}).then((json) => { 45 | return json.data; 46 | }); 47 | }, 48 | query(params = {}) { 49 | if ("page" in params && params.page === 1) { 50 | delete params.page; 51 | } 52 | 53 | return this.get("", params).then((json) => { 54 | return json.data; 55 | }); 56 | }, 57 | stats() { 58 | return this.get("stats", {}).then((json) => { 59 | return json.data; 60 | }); 61 | }, 62 | teams() { 63 | return this.get("teams", {}).then((json) => { 64 | return json.data; 65 | }); 66 | }, 67 | }; 68 | 69 | export default api; 70 | -------------------------------------------------------------------------------- /src/assets/js/utils.js: -------------------------------------------------------------------------------- 1 | const appName = "PREdb"; 2 | 3 | const utils = { 4 | setPageTitle(title) { 5 | if (title) { 6 | document.title = title + " - " + appName; 7 | } else { 8 | document.title = appName; 9 | } 10 | }, 11 | }; 12 | 13 | export default utils; 14 | -------------------------------------------------------------------------------- /src/components/Navbar.vue: -------------------------------------------------------------------------------- 1 | 74 | 75 | 100 | -------------------------------------------------------------------------------- /src/components/Pagination.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 52 | -------------------------------------------------------------------------------- /src/components/PreTableRow.vue: -------------------------------------------------------------------------------- 1 | 48 | 49 | 73 | 74 | 135 | -------------------------------------------------------------------------------- /src/components/TeamTableRow.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 56 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import VueProgressBar from "vue-progressbar"; 3 | import Resource from "vue-resource"; 4 | import App from "./App.vue"; 5 | import router from "./router"; 6 | import store from "./store"; 7 | 8 | Vue.config.productionTip = false; 9 | Vue.use(VueProgressBar); 10 | Vue.use(Resource); 11 | 12 | new Vue({ 13 | router, 14 | store, 15 | render: (h) => h(App), 16 | }).$mount("#app"); 17 | -------------------------------------------------------------------------------- /src/mixins/PaginableMixin.vue: -------------------------------------------------------------------------------- 1 | 72 | -------------------------------------------------------------------------------- /src/router.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import Router from "vue-router"; 3 | import Search from "./views/Search.vue"; 4 | // import Live from "@/views/Live.vue"; 5 | // import Stats from '@/views/Stats.vue'; 6 | // import Teams from "@/views/Teams.vue"; 7 | 8 | Vue.use(Router); 9 | 10 | export default new Router({ 11 | mode: "history", 12 | base: process.env.BASE_URL, 13 | linkActiveClass: "is-active", 14 | routes: [ 15 | { 16 | path: "/", 17 | name: "search", 18 | component: Search, 19 | }, 20 | { 21 | path: "/live", 22 | name: "live", 23 | component: () => 24 | import(/* webpackChunkName: "live" */ "./views/Live.vue"), 25 | }, 26 | { 27 | path: "/stats", 28 | name: "stats", 29 | component: () => 30 | import(/* webpackChunkName: "stats" */ "./views/Stats.vue"), 31 | }, 32 | { 33 | path: "/teams", 34 | name: "teams", 35 | component: () => 36 | import(/* webpackChunkName: "teams" */ "./views/Teams.vue"), 37 | }, 38 | ], 39 | }); 40 | -------------------------------------------------------------------------------- /src/store.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import Vuex from "vuex"; 3 | import Cookie from "js-cookie"; 4 | 5 | Vue.use(Vuex); 6 | 7 | function save(state) { 8 | Cookie.set("vuex-store", state); 9 | } 10 | function load() { 11 | return Cookie.getJSON("vuex-store"); 12 | } 13 | 14 | export default new Vuex.Store({ 15 | state() { 16 | return ( 17 | load() || { 18 | darkTheme: false, 19 | } 20 | ); 21 | }, 22 | getters: { 23 | appTheme(state) { 24 | return state.darkTheme ? "theme-dark" : ""; 25 | }, 26 | }, 27 | mutations: { 28 | setDarkTheme(state, darkTheme) { 29 | state.darkTheme = darkTheme; 30 | save(state); 31 | }, 32 | }, 33 | }); 34 | -------------------------------------------------------------------------------- /src/views/Live.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 137 | 138 | 149 | -------------------------------------------------------------------------------- /src/views/Search.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 147 | 148 | 153 | -------------------------------------------------------------------------------- /src/views/Stats.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 57 | -------------------------------------------------------------------------------- /src/views/Teams.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 80 | -------------------------------------------------------------------------------- /tests/unit/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | jest: true, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /tests/unit/example.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from "@vue/test-utils"; 2 | import Pagination from "@/components/Pagination.vue"; 3 | 4 | describe("Pagination.vue", () => { 5 | it("renders nothing without props", () => { 6 | const wrapper = shallowMount(Pagination, { 7 | propsData: {}, 8 | }); 9 | expect(wrapper.text()).toMatch(""); 10 | }); 11 | }); 12 | --------------------------------------------------------------------------------