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

Immanuel Pandiangan #27

Open
wants to merge 9 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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# hacktivoverflow
# hacktivoverflow

API DOCUMENTATION LINK
https://documenter.getpostman.com/view/7161106/SWTBedSG
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
5 changes: 5 additions & 0 deletions client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
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',
'@vue/standard'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}
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'
]
}
11,933 changes: 11,933 additions & 0 deletions client/package-lock.json

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"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": "^4.4.1",
"bootstrap-vue": "^2.3.0",
"core-js": "^3.4.4",
"moment": "^2.24.0",
"sweetalert2": "^9.7.1",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vue-wysiwyg": "^1.7.2",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.6.10"
}
}
Binary file added client/public/favicon.ico
Binary file not shown.
18 changes: 18 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!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">
<script src="https://kit.fontawesome.com/4c7f2424bc.js" crossorigin="anonymous"></script>
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>client</title>
</head>
<body>
<noscript>
<strong>We're sorry but client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
41 changes: 41 additions & 0 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<div id="app">
<NavBar class="mb-5"/>
<router-view/>
</div>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
export default {
components: {
NavBar
},
created () {
this.$store.commit('CHECK_LOGIN')
}
}
</script>
<style>
a {
color: #fff !important;
}
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
}

#nav {
padding: 30px;
}

#nav a {
font-weight: bold;
color: #2c3e50;
}

#nav a.router-link-exact-active {
color: #42b983;
}
</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.
74 changes: 74 additions & 0 deletions client/src/components/AnswerList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<template>
<div class="question-list-wrapper">
<VoteButton :modeURL="'answer'" :data="answer"/>
<div class="answer-content">
<p class="content"><span v-html="answer.content"></span></p>
<span style="font-size:12px">Author: {{ answer.author.name }}</span> &nbsp;&nbsp;
<span style="font-size:12px">Created at: {{ createdAt }}</span>
</div>
</div>
</template>

<script>
import moment from 'moment'
import VoteButton from './VoteButton'

export default {
props: ['answer'],
components: {
VoteButton
},
created () {
},
methods: {
},
computed: {
createdAt () {
return moment(this.answer.createdAt).fromNow()
}
}
}
</script>

<style scoped>
.vote-wrapper {
margin: 0 0 0 2rem !important;
}
.answer-card {
width: 80px;
height: 80px;
display: flex;
flex-shrink: 0;
justify-content: center;
align-items: center;
margin-right: 1rem;
}
.answer-score {
font-size: 2rem;
color: #9c9c9c;
}
.label-score {
margin-top: auto;
color: #9c9c9c;
}
.question-list-wrapper {
border-bottom: 1px solid #cacaca;
display: flex;
padding: 1rem;
margin: 0 auto;
cursor: pointer;
}
.answer-content {
margin-left: 2rem;
width: calc(100% - 4.4rem);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
p.content {
/* max-width: 100% !important; */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
60 changes: 60 additions & 0 deletions client/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>

<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
49 changes: 49 additions & 0 deletions client/src/components/NavBar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<template>
<b-container>
<b-row>
<b-col>
<div class="navigation">
<div class="left">
<router-link to="/question">
<b-icon icon="plus"></b-icon>
ASK QUESTIONS
</router-link>
</div>
<div class="right">
<router-link class="mr-2" to="/">HOME</router-link>
<router-link class="mr-2" v-if="!isLogin" to="/login">LOGIN</router-link>
<router-link v-if="!isLogin" to="/register">REGISTER</router-link>
<a href="#" v-if="isLogin" @click.prevent="logout">LOGOUT</a>
</div>
</div>
</b-col>
</b-row>
</b-container>
</template>

<script>
export default {
methods: {
logout () {
localStorage.clear()
this.$store.commit('CHECK_LOGIN')
}
},
computed: {
isLogin () {
return this.$store.state.isLogin
}
}
}
</script>

<style>
.navigation {
height: 4rem;
display: flex;
padding: 2rem;
justify-content: space-between;
align-items: center;
background-color: #45454d;
}
</style>
Loading