Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
mosinve committed Jul 4, 2019
1 parent 046a022 commit 7bc13de
Show file tree
Hide file tree
Showing 20 changed files with 593 additions and 211 deletions.
10 changes: 7 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
module.exports = {
root: true,

env: {
node: true
},
extends: ["plugin:vue/essential", "@vue/prettier"],

extends: ["plugin:vue/recommended", "@vue/prettier"],

rules: {
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
"no-console": "off",
"no-debugger": "off"
},

parserOptions: {
parser: "babel-eslint"
}
Expand Down
14 changes: 11 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "get-bored",
"name": "bored-app",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -9,10 +9,14 @@
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"axios": "^0.19.0",
"core-js": "^2.6.5",
"vue": "^2.6.10",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
"vue-toasted": "^1.1.27",
"vuetify": "^1.5.5",
"vuex": "^3.0.1",
"vuex-persistedstate": "^2.5.4"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.8.0",
Expand All @@ -29,7 +33,11 @@
"lint-staged": "^8.1.5",
"node-sass": "^4.9.0",
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.6.10"
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"vue-cli-plugin-vuetify": "^0.5.0",
"vue-template-compiler": "^2.6.10",
"vuetify-loader": "^1.2.2"
},
"gitHooks": {
"pre-commit": "lint-staged"
Expand Down
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>get-bored</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
</head>
<body>
<noscript>
Expand Down
51 changes: 25 additions & 26 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view />
</div>
<v-app>
<v-toolbar app tabs dense>
<v-toolbar-title class="headline text-uppercase">
<span>Bored?</span>
<span class="font-weight-thin">No more!</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items>
<v-btn :to="{ name: 'Activity' }" append exact flat>
Activity
</v-btn>
<v-btn :to="{ name: 'Activities' }" append flat>
My List
</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-content>
<router-view />
</v-content>
</v-app>
</template>

<style lang="scss">
#app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style>
<script>
export default {
name: "App"
};
</script>
17 changes: 17 additions & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import axios from "axios";
import qs from "qs";

const instance = axios.create({
baseURL: "http://www.boredapi.com/api",
paramsSerializer: function(params) {
return qs.stringify(params, { strictNullHandling: true });
}
});

export default {
getActivity(params) {
return instance.get("activity", {
params: { ...params }
});
}
};
122 changes: 0 additions & 122 deletions src/components/HelloWorld.vue

This file was deleted.

5 changes: 5 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import Vue from "vue";
import "./plugins/vuetify";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Toasted from "vue-toasted";

Vue.use(Toasted, {
duration: 500
});
Vue.config.productionTip = false;

new Vue({
Expand Down
7 changes: 7 additions & 0 deletions src/models/Activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class Activity {
constructor({ type, participants, price } = {}) {
this.type = type;
this.participants = participants;
this.price = price;
}
}
7 changes: 7 additions & 0 deletions src/plugins/vuetify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Vue from "vue";
import Vuetify from "vuetify/lib";
import "vuetify/src/stylus/app.styl";

Vue.use(Vuetify, {
iconfont: "fa"
});
17 changes: 8 additions & 9 deletions src/router.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Vue from "vue";
import Router from "vue-router";
import Home from "./views/Home.vue";

Vue.use(Router);

Expand All @@ -10,17 +9,17 @@ export default new Router({
routes: [
{
path: "/",
name: "home",
component: Home
name: "Activity",
component: () =>
import(/* webpackChunkName: "Activity" */ "@/views/PageActivity")
},
{
path: "/about",
name: "about",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
path: "/list",
name: "Activities",
component: () =>
import(/* webpackChunkName: "about" */ "./views/About.vue")
import(
/* webpackChunkName: "Activities" */ "@/views/PageActivitiesList"
)
}
]
});
42 changes: 39 additions & 3 deletions src/store.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";
import api from "@/api";

Vue.use(Vuex);

export default new Vuex.Store({
state: {},
mutations: {},
actions: {}
plugins: [createPersistedState({ paths: ["activitiesList"] })],
state: {
activity: {},
activitiesList: []
},
mutations: {
setActivity(state, activity) {
state.activity = activity;
},
addToList(state) {
state.activitiesList.push(state.activity);
},
removeFromList(state, activity) {
state.activitiesList = state.activitiesList.filter(
({ key }) => key !== activity.key
);
},
clearAll(state) {
state.activitiesList = [];
}
},
actions: {
async loadActivity({ commit }, params = {}) {
const { data: activity } = await api.getActivity(params);
commit("setActivity", activity);
},
async saveActivityToList({ state, commit }) {
if (
state.activitiesList.some(
({ key }) => state.activity.key && key === state.activity.key
)
) {
return Promise.reject("You already saved this activity");
}
commit("addToList");
}
}
});
5 changes: 0 additions & 5 deletions src/views/About.vue

This file was deleted.

18 changes: 0 additions & 18 deletions src/views/Home.vue

This file was deleted.

Loading

0 comments on commit 7bc13de

Please sign in to comment.