Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sulthon Abdul Malik #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> 1%
last 2 versions
17 changes: 17 additions & 0 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
21 changes: 21 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
24 changes: 24 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# client

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions client/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
"presets": [
"@vue/cli-plugin-babel/preset"
]
}
12,777 changes: 12,777 additions & 0 deletions client/package-lock.json

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.19.2",
"bootstrap-vue": "^2.1.0",
"core-js": "^3.6.4",
"socket.io-client": "^2.3.0",
"sweetalert2": "^9.7.2",
"vue": "^2.6.11",
"vue-router": "^3.1.5",
"vuedraggable": "^2.23.2",
"vuex": "^3.1.2"
},
"devDependencies": {
"@babel/polyfill": "^7.7.0",
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-eslint": "^4.2.0",
"@vue/cli-plugin-router": "^4.2.0",
"@vue/cli-plugin-vuex": "^4.2.0",
"@vue/cli-service": "^4.2.0",
"babel-eslint": "^10.0.3",
"bootstrap": "^4.3.1",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.1.2",
"mutationobserver-shim": "^0.3.3",
"node-sass": "^4.12.0",
"popper.js": "^1.16.0",
"portal-vue": "^2.1.6",
"sass": "^1.19.0",
"sass-loader": "^8.0.2",
"vue-cli-plugin-bootstrap-vue": "^0.6.0",
"vue-template-compiler": "^2.6.11"
}
}
Binary file added client/public/favicon.ico
Binary file not shown.
27 changes: 27 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="google-signin-client_id"
content="577877803641-qaghehnce30lp5farn1csdv7ihtmdpp2.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- <title><%= htmlWebpackPlugin.options.title %></title> -->
<title>KamVan</title>
</head>

<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->

<script src="https://bootcamp-kamvan.herokuapp.com/socket.io/socket.io.js"></script>
</body>

</html>
136 changes: 136 additions & 0 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<template>
<div id="app">
<b-navbar id="navbar" toggleable="md" type="dark" variant="info">
<b-navbar-brand href="#"
><img alt="Vue logo" src="./assets/logo.png" style="height: 50px"
/></b-navbar-brand>

<b-navbar-toggle target="nav-collapse"></b-navbar-toggle>

<b-collapse id="nav-collapse" is-nav>
<b-navbar-nav>
<li class="nav-item">
<router-link class="nav-link" to="/">Home</router-link>
</li>
<li class="nav-item">
<router-link class="nav-link" to="/login">Login</router-link>
</li>
<li class="nav-item">
<router-link class="nav-link" to="/register">Register</router-link>
</li>
</b-navbar-nav>

<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto">
<!-- <b-nav-form>
<b-form-input
size="sm"
class="mr-sm-2"
placeholder="Search"
></b-form-input>
<b-button size="sm" class="my-2 my-sm-0" type="submit"
>Search</b-button
>
</b-nav-form> -->

<b-nav-item-dropdown right>
<!-- Using 'button-content' slot -->
<template v-slot:button-content>
<em>User</em>
</template>
<b-dropdown-item disabled>{{ loggedUsername }}</b-dropdown-item>
<b-dropdown-item href="#" v-b-modal.add-task
>Add Task</b-dropdown-item
>
<b-dropdown-item href="#" @click="logout">Sign Out</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar-nav>
</b-collapse>
</b-navbar>
<!-- <div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> |
<router-link to="/login">Login</router-link> |
<router-link to="/register">Register</router-link> |
</div> -->

<router-view />

<!-- Add Task -->
<AddTask idName="add-task" />
</div>
</template>

<script>
import AddTask from "@/components/AddTask";

export default {
components: {
AddTask
},
computed: {
loggedUsername() {
return localStorage.getItem("name");
}
},
methods: {
loginCheck() {
if (!localStorage.getItem("access_token")) {
this.$router.push("/login");
}
},
logout() {
// eslint-disable-next-line
// var auth2 = gapi.auth2.getAuthInstance();
// auth2.signOut().then(function() {
// console.log("User signed out.");
// });
// auth2.disconnect();
if (localStorage.length !== 0) {
localStorage.clear();
this.loginCheck();
}
}
}
};
</script>

<style lang="scss">
html,
body {
height: 100%;
margin: 0;
}

#app {
height: 100%;
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;
}
}
}

#navbar {
a {
font-weight: bold;

&.router-link-exact-active {
color: #0ae615;
}
}
}
</style>
Binary file added client/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions client/src/components/AddTask.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<template>
<b-modal :id="idName" title="BootstrapVue" hide-footer>
<b-form @submit="onSubmit" @reset="onReset" v-if="show">
<b-form-group
id="input-group-taskTitle"
label="Email address:"
label-for="input-taskTitle"
>
<b-form-input
id="input-taskTitle"
v-model="form.title"
type="text"
required
placeholder="Enter title"
></b-form-input>
</b-form-group>

<b-form-group id="input-group-taskDescription" label="Description" label-for="input-taskDescription">
<b-form-input
id="input-taskDescription"
v-model="form.description"
placeholder="Enter description"
></b-form-input>
</b-form-group>

<b-button type="submit" variant="primary">Submit</b-button>
<b-button type="reset" variant="danger">Reset</b-button>
</b-form>
</b-modal>
</template>

<script>
export default {
name: "AddTask",
props: ["idName"],
data() {
return {
form: {
title: "",
description: "",
},
show: true
};
},
methods: {
onSubmit(evt) {
evt.preventDefault()
// alert(JSON.stringify(this.form, null, 2));
this.$axios({
url: `${this.$SERVER_URL}/kanbans/`,
method: "post",
headers: {
access_token: localStorage.getItem("access_token")
},
data: this.form
})
.then(() => {
this.$bvModal.hide(this.idName);
this.$socket.emit("dbChange");
}).catch((err) => {
console.error(err);
});
},
onReset(evt) {
evt.preventDefault()
// Reset our form values
this.form.title = "";
this.form.description = "";
// Trick to reset/clear native browser form validation state
this.show = false
this.$nextTick(() => {
this.show = true
})
}
}
};
</script>

<style></style>
Loading