-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23d874e
commit 0bd20b8
Showing
25 changed files
with
26,985 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# Blockchain Uygulama Geliştirme | ||
|
||
1.Bölüm Kontrat Oluşturma : | ||
[ahmetkucukoglu.com/blockchain-uygulama-gelistirme-1-kontrat-olusturma](https://www.ahmetkucukoglu.com/blockchain-uygulama-gelistirme-1-kontrat-olusturma) | ||
[ahmetkucukoglu.com/blockchain-uygulama-gelistirme-1-kontrat-olusturma](https://www.ahmetkucukoglu.com/blockchain-uygulama-gelistirme-1-kontrat-olusturma) | ||
|
||
2.Bölüm UI İle Etkileşim : | ||
[ahmetkucukoglu.com/blockchain-uygulama-gelistirme-2-ui-ile-etkilesim](https://www.ahmetkucukoglu.com/blockchain-uygulama-gelistirme-2-ui-ile-etkilesim) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frontend | ||
|
||
## 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/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/cli-plugin-babel/preset' | ||
] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "frontend", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"serve": "vue-cli-service serve", | ||
"build": "vue-cli-service build", | ||
"lint": "vue-cli-service lint" | ||
}, | ||
"dependencies": { | ||
"@metamask/detect-provider": "^1.2.0", | ||
"core-js": "^3.6.5", | ||
"vue": "^2.6.11", | ||
"vuex": "^3.6.2", | ||
"web3": "^1.3.6" | ||
}, | ||
"devDependencies": { | ||
"@vue/cli-plugin-babel": "~4.5.0", | ||
"@vue/cli-plugin-eslint": "~4.5.0", | ||
"@vue/cli-service": "~4.5.0", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^6.7.2", | ||
"eslint-plugin-vue": "^6.2.2", | ||
"vue-template-compiler": "^2.6.11" | ||
}, | ||
"eslintConfig": { | ||
"root": true, | ||
"env": { | ||
"node": true | ||
}, | ||
"extends": [ | ||
"plugin:vue/essential", | ||
"eslint:recommended" | ||
], | ||
"parserOptions": { | ||
"parser": "babel-eslint" | ||
}, | ||
"rules": {} | ||
}, | ||
"browserslist": [ | ||
"> 1%", | ||
"last 2 versions", | ||
"not dead" | ||
] | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang=""> | ||
|
||
<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"> | ||
<title> | ||
<%= htmlWebpackPlugin.options.title %> | ||
</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css"> | ||
</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 class="container"> | ||
<div id="app"></div> | ||
</div> | ||
<!-- built files will be auto injected --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" | ||
crossorigin="anonymous"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
<div id="app"> | ||
<StatusBar /> | ||
<Products /> | ||
<Cart /> | ||
<Orders /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import StatusBar from "./components/StatusBar.vue"; | ||
import Products from "./components/Products.vue"; | ||
import Cart from "./components/Cart.vue"; | ||
import Orders from "./components/Orders.vue"; | ||
export default { | ||
name: "App", | ||
components: { | ||
StatusBar, | ||
Products, | ||
Cart, | ||
Orders, | ||
}, | ||
methods: {}, | ||
}; | ||
</script> | ||
|
||
<style> | ||
</style> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<template> | ||
<div id="cart" class="card shadow-sm mt-3" v-if="this.cart.items.length > 0"> | ||
<div class="card-body"> | ||
<h5 class="card-title">Cart</h5> | ||
<hr /> | ||
<div class="row fw-bold"> | ||
<div class="col">Name</div> | ||
<div class="col">Quantity</div> | ||
<div class="col">Total Price</div> | ||
<div class="col"></div> | ||
</div> | ||
<CartItem | ||
:key="cartItem.productId" | ||
:cartItem="cartItem" | ||
v-for="cartItem in this.cart.items" | ||
@removeProductFromCart="removeProductFromCart" | ||
/> | ||
|
||
<button | ||
type="button" | ||
class="btn btn-sm btn-outline-primary" | ||
@click="createOrder" | ||
> | ||
<i class="bi bi-box-seam"></i> Create order | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import CartItem from "./CartItem.vue"; | ||
import { eventHub } from "../main"; | ||
export default { | ||
name: "Cart", | ||
components: { | ||
CartItem, | ||
}, | ||
props: {}, | ||
data() { | ||
return { | ||
cart: { | ||
items: [], | ||
}, | ||
}; | ||
}, | ||
methods: { | ||
addProductToCart(productId, productName, productPrice, deliveryDate) { | ||
var cartItems = this.cart.items.filter((x) => x.productId == productId); | ||
if (cartItems.length == 0) { | ||
this.cart.items.push({ | ||
productId: productId, | ||
productName: productName, | ||
productPrice: productPrice, | ||
deliveryDate: deliveryDate, | ||
quantity: 1, | ||
}); | ||
} else { | ||
cartItems[0].quantity++; | ||
} | ||
}, | ||
removeProductFromCart(productId) { | ||
let items = this.cart.items.filter((x) => x.productId != productId); | ||
this.cart.items = items; | ||
}, | ||
async createOrder() { | ||
let totalPrice = this.cart.items | ||
.map((x) => x.productPrice * x.quantity) | ||
.reduce((p, c) => p + c); | ||
let deliveryDate = new Date( | ||
Math.max.apply( | ||
null, | ||
this.cart.items.map((x) => new Date(x.deliveryDate)) | ||
) | ||
); | ||
eventHub.$emit("createOrder", { totalPrice, deliveryDate }); | ||
this.cart.items = []; | ||
}, | ||
}, | ||
created() { | ||
eventHub.$on("addProductToCart", (product) => { | ||
this.addProductToCart( | ||
product.id, | ||
product.name, | ||
product.price, | ||
product.deliveryDate | ||
); | ||
}); | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<div class="row mt-3"> | ||
<div class="col">{{ cartItem.productName }}</div> | ||
<div class="col"> | ||
<input | ||
type="text" | ||
class="form-control count" | ||
v-model="cartItem.quantity" | ||
/> | ||
</div> | ||
<div class="col">{{ getTotalPrice }} ETH</div> | ||
<div class="col"> | ||
<button | ||
type="button" | ||
class="btn btn-sm btn-outline-secondary" | ||
@click="removeProductFromCart" | ||
> | ||
<i class="bi bi-cart-dash"></i> Remove from cart | ||
</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "CartItem", | ||
props: { | ||
cartItem: Object, | ||
}, | ||
methods: { | ||
removeProductFromCart() { | ||
this.$emit("removeProductFromCart", this.cartItem.productId); | ||
}, | ||
}, | ||
computed: { | ||
getTotalPrice() { | ||
var totalPrice = this.cartItem.quantity * this.cartItem.productPrice; | ||
return totalPrice; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
.count { | ||
width: 45px; | ||
} | ||
</style> |
Oops, something went wrong.