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

ahmad zuliansyah putra #19

Open
wants to merge 5 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
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'
],
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'
]
}
13,074 changes: 13,074 additions & 0 deletions client/package-lock.json

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"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",
"core-js": "^3.6.4",
"vue": "^2.6.11",
"vue-router": "^3.1.5",
"vuex": "^3.1.2"
},
"devDependencies": {
"@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",
"@vue/eslint-config-standard": "^5.1.0",
"babel-eslint": "^10.0.3",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.1.2",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
}
}
Binary file added client/public/favicon.ico
Binary file not shown.
24 changes: 24 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!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">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<title><%= htmlWebpackPlugin.options.title %></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://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
</body>

</html>
33 changes: 33 additions & 0 deletions client/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<div id="app">
<nav class="navbar navbar-dark bg-dark">
<router-link to="/" class="navbar-brand">Home</router-link>
</nav>
<div class="container">
<router-view />
</div>
</div>
</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>
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.
33 changes: 33 additions & 0 deletions client/src/components/cardMovie.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<template>
<div class="row">
<div class="col mt-5" v-for="(movie, index) in this.$store.state.movies" :key="index">
<div class="card" style="width: 18rem;">
<img :src="movie.poster" class="card-img-top" />
<div class="card-body">
<h3 class="card-title">{{movie.title}}</h3>
<h4>{{movie.year}}</h4>
</div>
<button @click="findOne(movie.id)" class="btn btn-dark">Get Detail</button>
</div>
</div>
</div>
</template>

<script>
export default {
methods: {
findOne(id) {
this.$router.push(`/${id}`);
}
}
};
</script>

<style>
img {
max-height: 50vh;
}
.card-body {
min-height: 30vh;
}
</style>
40 changes: 40 additions & 0 deletions client/src/components/formAddRating.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div>
<div class="card-header">Add Your Rating</div>
<div class="card-body">
<form>
<div class="form-group">
<label for="reviewer">Reviewers</label>
<input v-model="review" type="text" class="form-control" id="reviewer" required />
</div>
<div class="form-group">
<label for="point">Point</label>
<input v-model="poin" type="number" class="form-control" id="point" />
</div>
<button @click.prevent="addReview" type="submit" class="btn btn-dark">Submit</button>
</form>
</div>
</div>
</template>

<script>
export default {
data() {
return {
review: "",
poin: ""
};
},
methods: {
addReview() {
this.$store.dispatch("addNewReviewer", {
reviewer: this.review,
point: this.poin
});
}
}
};
</script>

<style>
</style>
49 changes: 49 additions & 0 deletions client/src/components/formUpdateMovie.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<template>
<div>
<div class="card-header">Update Your Movie</div>
<div class="card-body">
<form>
<div class="form-group">
<label for="title">Title</label>
<input
v-model="$store.state.movie.title"
type="text"
class="form-control"
id="title"
required
/>
</div>
<div class="form-group">
<label for="year">Year</label>
<input v-model="$store.state.movie.year" type="number" class="form-control" id="year" />
</div>
<div class="form-group">
<label for="year">Year</label>
<input v-model="$store.state.movie.imdbID" type="string" class="form-control" id="year" />
</div>
<div class="form-group">
<label for="type">Type</label>
<input v-model="$store.state.movie.type" type="text" class="form-control" id="type" />
</div>
<div class="form-group">
<label for="poster">Poster</label>
<input v-model="$store.state.movie.poster" type="text" class="form-control" id="poster" />
</div>
<button @click.prevent="editMovie" type="submit" class="btn btn-dark">Edit</button>
</form>
</div>
</div>
</template>

<script>
export default {
methods: {
editMovie() {
this.$store.dispatch("editMovie");
}
}
};
</script>

<style>
</style>
27 changes: 27 additions & 0 deletions client/src/components/movieDetail.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<div class="col mt-5">
<div class="card" style="width: 18rem;">
<img :src="this.$store.state.movie.poster" class="card-img-top" />
<div class="card-body">
<h3 class="card-title">{{this.$store.state.movie.title}}</h3>
<h4>{{this.$store.state.movie.year}}</h4>
<a
:href="'https://www.imdb.com/title/' + this.$store.state.movie.imdbID"
class="card-text"
>IMDB</a>
<p class="card-text">type: {{this.$store.state.movie.type}}</p>
</div>
</div>
</div>
</template>

<script>
export default {
created() {
this.$store.dispatch("findOneMovie", this.$route.params.id);
}
};
</script>

<style>
</style>
42 changes: 42 additions & 0 deletions client/src/components/navbarDetail.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template>
<div class="col mt-5">
<nav class="navbar navbar-light bg-light">
<button @click="whatToShow('rating')" type="button" class="btn btn-light">rating</button>
<button @click="whatToShow('addRating')" type="button" class="btn btn-light">add rating</button>
<button @click="whatToShow('updateMovie')" type="button" class="btn btn-light">update movie</button>
</nav>
<div class="row">
<div class="col">
<div class="card text-dark bg-light" style="max-width: 100%;">
<rating v-if="this.$store.state.whatNowShow === 'rating'"></rating>
<formAddRating v-if="this.$store.state.whatNowShow === 'addRating'"></formAddRating>
<formUpdateMovie v-if="this.$store.state.whatNowShow === 'updateMovie'"></formUpdateMovie>
</div>
</div>
</div>
</div>
</template>

<script>
import rating from "@/components/rating.vue";
import formAddRating from "@/components/formAddRating.vue";
import formUpdateMovie from "@/components/formUpdateMovie.vue";
export default {
components: {
rating,
formAddRating,
formUpdateMovie
},
methods: {
removeRevew(id) {
this.$store.dispatch("removeReview", id);
},
whatToShow(payload) {
this.$store.state.whatNowShow = payload;
}
}
};
</script>

<style>
</style>
Loading