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

Zoe Zachary #7

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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# hackoverflow
# hackoverflow

link deploy: http://hackoverflow-zoezachary.s3-website-ap-southeast-1.amazonaws.com/
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
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?
19 changes: 19 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# client

## Project setup
```
yarn install
```

### Compiles and hot-reloads for development
```
yarn serve
```

### Compiles and minifies for production
```
yarn build
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
8 changes: 8 additions & 0 deletions client/apis/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axios from 'axios'

const instance = axios.create({
// baseURL: 'http://localhost:3000'
baseURL: `http://18.219.119.178:55553`
});

export default instance
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'
]
}
27 changes: 27 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"tailwind-build": "npx tailwind build ./src/assets/css/prebuild-tailwind.css -o ./src/assets/css/tailwind.css"
},
"dependencies": {
"axios": "^0.19.0",
"core-js": "^3.4.3",
"tailwindcss": "^1.1.4",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vue-sweetalert2": "^2.1.5",
"vuex": "^3.1.2"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^1.3.0",
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"vue-template-compiler": "^2.6.10"
}
}
26 changes: 26 additions & 0 deletions client/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// postcss.config.js
const purgecss = require('@fullhuman/postcss-purgecss')({

// Specify the paths to all of the template files in your project
content: [
'./src/**/*.html',
'./src/**/*.vue',
'./src/**/*.jsx',
// etc.
],

whitelistPatterns: [/swal2/gm],

// Include any special characters you're using in this regular expression
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || []
})

module.exports = {
plugins: [
require('tailwindcss'),
require('autoprefixer'),
...process.env.NODE_ENV === 'production'
? [purgecss]
: []
]
}
Binary file added client/public/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!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">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<script src="https://kit.fontawesome.com/5f4f5c7a85.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://unpkg.com/sweetalert2@8.19.0/dist/sweetalert2.min.css">
<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>
55 changes: 55 additions & 0 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<template>
<div id="app">
<div id="nav" class="flex justify-between items-center px-16 py-4 bg-green-100 shadow">
<router-link to="/" class="font-bold text-gray-600 hover:text-gray-800">Hackoverflow</router-link>
<div v-if="!isLoggedIn">
<router-link class="px-4 font-bold text-gray-600 hover:text-gray-800" to="/login">Log in</router-link>
<router-link class="px-4 font-bold text-gray-600 hover:text-gray-800" to="/register">Register</router-link>
</div>
<div v-if="isLoggedIn">
<router-link class="px-4 font-bold text-gray-600 cursor-pointer hover:text-gray-800" to="/ask">Ask question</router-link>
<a class="px-4 font-bold text-gray-600 cursor-pointer hover:text-gray-800" @click.prevent="logout">Log out</a>
</div>
</div>
<router-view/>
</div>
</template>

<script>
import {mapState, mapActions} from 'vuex'

export default {
computed: {
...mapState('user', ['isLoggedIn'])
},

methods: {
...mapActions('user', ['checkLoggedIn']),

logout() {
localStorage.removeItem('token')
localStorage.removeItem('userId')
this.checkLoggedIn()
}
},

watch: {
isLoggedIn: function() {
this.checkLoggedIn()
}
},

created() {
this.checkLoggedIn()
}
}
</script>

<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
}
</style>
6 changes: 6 additions & 0 deletions client/src/assets/css/prebuild-tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */

@tailwind utilities;
Loading