Skip to content

Commit

Permalink
Feature/profile
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-latinier committed Dec 20, 2019
1 parent 19cc960 commit fce502b
Show file tree
Hide file tree
Showing 30 changed files with 3,984 additions and 460 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ ACCOUNT_API_URL='"https://opqeierg9e.execute-api.us-east-1.amazonaws.com/dev/v1/
ACCOUNT_API_KEY='"BQoDqqyTpG1zriwiwwBZ62nZnVcCI9KQ1j1qUSJc"'

BLOCKCHAIN_EXPLORER='"https://telos-test.bloks.io"'

PPP_ENV='"prod"'
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"dependencies": {
"@quasar/extras": "1.3.1",
"@smontero/ppp-client-api": "^0.0.34",
"@smontero/ual-keycat": "^1.0.21",
"@smontero/ual-lynx": "^0.2.3",
"@smontero/ual-sqrl": "^0.1.8",
Expand All @@ -26,14 +27,16 @@
"husky": "3.0.5",
"pug": "2.0.4",
"pug-plain-loader": "1.0.0",
"quasar": "1.1.0",
"quasar": "1.5.9",
"ual-scatter": "^0.1.6",
"universal-authenticator-library": "^0.1.4",
"validator": "11.1.0",
"vue-croppa": "^1.3.8",
"vuex": "^3.1.2"
},
"devDependencies": {
"@quasar/app": "1.0.6",
"@quasar/app": "1.4.2",
"@quasar/quasar-app-extension-qmarkdown": "^1.0.10",
"@vue/eslint-config-standard": "4.0.0",
"babel-eslint": "10.0.3",
"eslint": "5.16.0",
Expand Down
24 changes: 21 additions & 3 deletions quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ module.exports = function (ctx) {
boot: [
'axios',
{ path: 'ual', server: false },
{ path: 'api', server: false }
{ path: 'api', server: false },
{ path: 'ppp', server: false },
{ path: 'croppa', server: false },
{ path: 'qmarkdown', server: false }
],

css: [
Expand Down Expand Up @@ -55,6 +58,7 @@ module.exports = function (ctx) {
'QDialog',
'QDrawer',
'QExpansionItem',
'QField',
'QFooter',
'QForm',
'QHeader',
Expand All @@ -64,6 +68,7 @@ module.exports = function (ctx) {
'QItemSection',
'QItemLabel',
'QInfiniteScroll',
'QInnerLoading',
'QKnob',
'QLayout',
'QList',
Expand All @@ -76,10 +81,14 @@ module.exports = function (ctx) {
'QSeparator',
'QSpinner',
'QSpinnerDots',
'QSplitter',
'QStep',
'QStepper',
'QStepperNavigation',
'QTable',
'QTab',
'QTabPanel',
'QTabPanels',
'QTabs',
'QTimeline',
'QTimelineEntry',
Expand All @@ -97,7 +106,10 @@ module.exports = function (ctx) {
plugins: [
'Notify',
'LocalStorage'
]
],
config: {
notify: { /* Notify defaults */ }
}
},

supportIE: false,
Expand All @@ -114,7 +126,8 @@ module.exports = function (ctx) {
NETWORK_PORT: process.env.NETWORK_PORT,
SMARTCONTRACT: process.env.SMARTCONTRACT,
TRAILCONTRACT: process.env.TRAILCONTRACT,
BLOCKCHAIN_EXPLORER: process.env.BLOCKCHAIN_EXPLORER
BLOCKCHAIN_EXPLORER: process.env.BLOCKCHAIN_EXPLORER,
PPP_ENV: process.env.PPP_ENV
},
scopeHoisting: true,
// vueRouterMode: 'history',
Expand All @@ -123,6 +136,11 @@ module.exports = function (ctx) {
// analyze: true,
// extractCSS: false,
extendWebpack (cfg) {
cfg.module.rules.push({
test: /\.mjs$/,
type: 'javascript/auto'
})

cfg.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
Expand Down
6 changes: 6 additions & 0 deletions quasar.extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@quasar/qmarkdown": {
"import_md": false,
"import_vmd": false
}
}
7 changes: 7 additions & 0 deletions src/boot/croppa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Croppa from 'vue-croppa'
// for more info:
// https://zhanziyang.github.io/vue-croppa/#/quick-start

export default ({ Vue }) => {
Vue.use(Croppa)
}
6 changes: 6 additions & 0 deletions src/boot/ppp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import PPP from '@smontero/ppp-client-api'

export default async ({ store }) => {
PPP.configure(process.env.PPP_ENV)
store['$ppp'] = PPP
}
6 changes: 6 additions & 0 deletions src/boot/qmarkdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Plugin from '@quasar/quasar-ui-qmarkdown'
import '@quasar/quasar-ui-qmarkdown/dist/index.css'

export default ({ Vue }) => {
Vue.use(Plugin)
}
157 changes: 157 additions & 0 deletions src/components/form/image-processor.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<script>
import 'vue-croppa/dist/vue-croppa.css'
export default {
name: 'form-image-processor',
props: {
width: { type: Number, required: true },
height: { type: Number, required: true },
round: { type: Boolean, required: false, default: () => false }
},
data () {
return {
edited: false,
image: {}
}
},
updated () {
const canvas = this.image.getCanvas()
if (this._getHeight() > this._getWidth()) {
canvas.style.maxHeight = `${Math.min(this.height || 200, 250)}px`
canvas.style.width = 'auto'
} else {
canvas.style.width = '100%'
}
},
methods: {
_getHeight () {
return this.height || 200
},
_getWidth () {
return this.width || 200
},
onInit () {
if (this.round) {
this.image.addClipPlugin(function (ctx, x, y, w, h) {
ctx.beginPath()
ctx.arc(x + w / 2, y + h / 2, w / 2, 0, 2 * Math.PI, true)
ctx.closePath()
})
}
},
getBlob () {
const self = this
return new Promise(function (resolve, reject) {
try {
if (self.image.hasImage()) {
self.image.generateBlob((blob) => {
resolve(blob)
}, 'image/jpg', 0.8)
} else {
resolve(null)
}
} catch (e) {
reject(new Error(e))
}
})
}
}
}
</script>

<template lang="pug">
.image-processor
.row.flex.image-container
.col-10.flex.items-center.text-center.justify-center
.row
croppa(
v-model="image"
:accept="'image/*'"
:file-size-limit="4e6"
:width="width || 200"
:height="height || 200"
:show-remove-button="false"
:quality="1"
:replace-drop="true"
@file-choose="edited = true"
placeholder=""
prevent-white-space
@init="onInit"
:class="{ rounded: round }"
)
.col-2.column.justify-between.items-end
q-btn(
icon="fas fa-redo-alt"
@click="image.rotate(1)"
color="accent"
round
size="sm"
)
q-tooltip Rotate +90
q-btn(
icon="fas fa-undo-alt"
@click="image.rotate(-1)"
color="accent"
round
size="sm"
)
q-tooltip Rotate -90
q-btn(
icon="fas fa-search-plus"
@click="image.zoomIn()"
color="accent"
round
size="sm"
)
q-tooltip Zoom in
q-btn(
icon="fas fa-search-minus"
@click="image.zoomOut()"
color="accent"
round
size="sm"
)
q-tooltip Zoom out
q-btn(
icon="fas fa-arrows-alt-h"
@click="image.flipX()"
color="accent"
round
size="sm"
)
q-tooltip Vertical mirror
q-btn(
icon="fas fa-arrows-alt-v"
@click="image.flipY()"
color="accent"
round
size="sm"
)
q-tooltip Horizontal mirror
q-separator.q-mt-md
.row.flex.justify-end.q-mt-md
q-btn.q-mr-sm(
label="Cancel"
color="primary"
@click="$emit('cancel')"
flat
)
q-btn(
label="Reset"
color="primary"
@click="image.refresh()"
)
</template>

<style lang="stylus" scoped>
.image-processor
.image-container
min-height 210px
.rounded
border-radius 50%
.croppa-container
max-width 100%
height auto
canvas
height auto !important
</style>
Loading

0 comments on commit fce502b

Please sign in to comment.