Skip to content

Commit

Permalink
Merge branch 'master' into feature/git-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
DrSensor authored Sep 21, 2018
2 parents 48ff952 + 73b1592 commit 0c71cc8
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 92 deletions.
4 changes: 2 additions & 2 deletions src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
q-layout.no-shadow(view="lHh Lpr lFf")
q-layout-footer.no-shadow
q-toolbar.row(color="primary")
q-item
// q-item
img(src="statics/guc-logo-64x64.png")
q-toolbar-title.col
span Github-Utopian-Contributor
div(slot="subtitle") Quasar v{{ $q.version }}
// div(slot="subtitle") Quasar v{{ $q.version }}
q-btn-dropdown(ref="selectLanguages", v-if="hasMultipleLanguages", icon="translate", :label="currentLanguage.code", flat, dense)
q-list(link)
Expand Down
267 changes: 178 additions & 89 deletions src/pages/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,100 @@
position="top"
)
q-tab(default slot="title" name="Config" icon="fas fa-cogs" label="Config")
q-tab(slot="title" name="Editor" icon="fas fa-pen-nib" label="Editor")
q-tab(slot="title" name="Preview" icon="far fa-eye" label="Preview")
q-tab(slot="title" name="Info" icon="far fa-question-circle" label="Info")
q-tab-pane.q-pa-sm(name="Config")
.col-6.full-width
q-item
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.steemAccount"
:style="`background-image: url('https://steemitimages.com/u/${config.steemAccount}/avatar')!important; background-size: 42px!important; background-position: center center;`"
)
q-item-main
q-input(
v-model="config.steemAccount"
float-label="Steem account"
placeholder="Which Steem account will you use to post?"
)
q-item
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.steemPostingKey"
icon="fas fa-key"
)
q-item-main
q-input(
type="password"
v-model="config.steemPostingKey"
float-label="Steem posting key"
placeholder="Don't use your master key!"
)
q-item
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.gitUser"
:style="`background-image: url('https://github.com/${config.gitUser}.png')!important; background-size: 42px 42px!important;`"
)
q-item-main
q-input(
v-model="config.gitUser"
float-label="Github username"
placeholder="Enter your username, not an orgname!"
)
q-item
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
q-tab(slot="title" name="Edit" icon="fas fa-pen-nib" label="Edit")
q-tab(slot="title" name="Review" icon="far fa-eye" label="Review")
q-tab(slot="title" name="Inform" icon="far fa-question-circle" label="Inform")
q-tab-pane.q-pa-sm.row(name="Config")
q-item.col-md-6
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.gitRepo"
icon="fab fa-git-square"
v-if="config.steemAccount"
:style="`background-image: url('https://steemitimages.com/u/${config.steemAccount}/avatar')!important; background-size: 42px!important; background-position: center center;`"
)
q-item-main
q-input(
v-model="config.steemAccount"
float-label="Steem account"
placeholder="Which Steem account will you use to post?"
)
q-item-main
q-input(
v-model="config.gitRepo"
float-label="GIT repository"
placeholder="Use a complete repo like https://github.com/g-u-c/guc-desktop"
)
q-item.col-md-6
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.gitUser"
:style="`background-image: url('https://github.com/${config.gitUser}.png')!important; background-size: 42px 42px!important;`"
)
q-item-main
q-input(
v-model="config.gitUser"
float-label="Github username"
placeholder="Enter your username, not an orgname!"
)
q-item.col-md-6
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.steemPostingKey"
icon="fas fa-key"
)
q-item-main
q-input(
type="password"
v-model="config.steemPostingKey"
float-label="Steem posting key"
placeholder="Don't use your master key!"
)

q-tab-pane.q-pa-sm.row(name="Editor")
q-item.col-md-6
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.gitRepo"
icon="fab fa-git-square"
)
q-item-main
q-input(
v-model="config.gitRepo"
float-label="GIT repository"
placeholder="Use a complete repo like https://github.com/g-u-c/guc-desktop"
)
q-item.col-md-6
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.gitRepo"
icon="fas fa-folder"
)
q-item-main
q-input(
v-model="config.workingDirectory"
float-label="Working Directory"
placeholder="Where is the project located on your development machine?"
)
q-item.col-md-6
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="config.gitRepo"
icon="fas fa-hashtag"
)
q-item-main
q-input(
v-model="config.commitId"
float-label="Commit ID"
placeholder="c0ffee"
)
q-tab-pane.q-pa-sm.row(name="Edit")
q-item.col-md-12
q-item-side(color='secondary' style="margin-left:-1px")
q-btn(
round
v-if="tags"
icon="fas fa-tag"
icon="fas fa-feather"
)
q-item-main
q-field(:count="5", :max-count="5" :max="6")
q-field(:count="5", :max-count="5" :max="5")
q-chips-input(
color="secondary"
float-label="Tags"
Expand All @@ -86,43 +111,50 @@
q-btn(
round
v-if="postTitle"
icon="rate_review"
icon="fas fa-dove"
)
q-item-main
q-input(
v-model="postTitle"
float-label="Post Title"
placeholder="Keep it short and simple"
)
// q-btn(icon="visibility" v-bind="$attrs" @click="show")
// create-button()
// remove-button()
q-editor.col-md-12(
v-model="model"
height="60vh"
:toolbar="[['bold', 'italic', 'underline', 'strike'],['link'],[{label: 'Sizes', icon: 'format_sizes', list: 'no-icons', options: ['p', 'code', 'h5', 'h4', 'h3', 'h2', 'h1']}]]"
)
q-tab-pane.q-pa-sm(name="Preview")
q-tab-pane.q-pa-sm(name="Review")
.row
.col-12.full-width
div STEEM ACOUNT: {{ config.steemAccount }}
div TAGS: {{ tags }}
div STEEM ACOUNT: 
strong {{ config.steemAccount }}
div TITLE: 
strong {{ postTitle }}
div TAGS: 
strong {{ tags }}
.markdownDisplay
pre(
v-model="model_ce"
:contenteditable="contentEditable"
@blur="mdModel = model_ce"
) {{ mdModel }}
) {{ content.header }}{{ mdModel }}{{ content.footer }}
q-checkbox(v-model="toHTML" @input="makeMarkdown(mdModel, toHTML)") HTML
span     
q-checkbox(v-model="contentEditable" @input="!contentEditable" disabled) EDIT (danger!!!)
steem-post-button(
:username="config.steemAccount"
:title="postTitle"
:body="mdModel"
:tags="tags"
:postingKey="config.steemPostingKey"
@success="result => console.log(result)"
@fail="error => console.log(error)"
q-btn.dropLet(
round
size="24px"
color="positive"
class="fixed"
style="right: 200px; bottom: 20px"
icon="cloud_upload"
@click="publish()"
)
q-tab-pane.q-pa-sm(name="Info")
q-tab-pane.q-pa-sm(name="Inform")
.row
.col-12.full-width
div This is where we explain how it works.
Expand All @@ -138,11 +170,21 @@
}
.markdownDisplay {
border: 1px solid #333389;
min-height: 50%;
max-height: 50%;
height: 50vh;
height: 350px;
padding: 10px;
overflow: auto;
resize: vertical
}
pre {
white-space: pre-wrap;
}
.dropLet {
border: 5px solid #fff;
z-index: 10000000;
box-shadow: none!important;
}
pre {
white-space: pre-wrap;
}
</style>

Expand All @@ -163,18 +205,27 @@ export default {
},
data () {
return {
model: 'Start here',
mdModel: 'Start here',
model: 'Hola!',
mdModel: 'Hola!',
model_ce: '',
toHTML: false,
contentEditable: false,
tags: ['utopian-io', 'development'],
postTitle: '',
tags: ['utopian-io', 'development', 'hackathon', 'quasarframework'],
postTitle: 'Hello World',
config: {
steemAccount: '',
steemAccount: 'nothingismagick',
steemPostingKey: '',
gitUser: '',
gitRepo: ''
gitRepo: 'https://github.com/g-u-c/guc-desktop',
workingDirectory: '/home/user/git/guc-desktop',
commitId: 'f004881'
},
steemProps: {
maximum_block_size: this.main().catch()
},
content: {
header: '',
footer: ''
}
// props: {
// maximum_block_size: this.main().catch()
Expand All @@ -195,14 +246,30 @@ export default {
}
},
mounted () {
this.header()
this.footer()
},
methods: {
// main: async function () {
// await this.$steem.testnet.client.database.getChainProperties().then((props) => {
// console.log(`Maximum blocksize consensus: ${props.maximum_block_size} bytes`)
// this.props = props
// })
// },
header () {
this.content.header = `#### Repository
${this.config.gitRepo}
`
},
footer () {
this.content.footer = `
#### GitHub Account
https://github.com/${this.config.gitUser}
`
},
main: async function () {
await this.$steemClient.database.getChainProperties().then((props) => {
console.log(`Maximum blocksize consensus: ${props.maximum_block_size} bytes`)
this.steemProps = props
})
},
makeMarkdown (data, html) {
// let turndownService = new TurndownService()
// this.converter = new showdown.Converter()
Expand All @@ -219,7 +286,29 @@ export default {
// this.$q.notify(`Tab: ${tab}`)
},
publish () {
// this.$q.notify(this.mdModel)
const parentAuthor = ''
const mainTag = 'utopian-io'
const wif = this.$dsteem.PrivateKey.fromLogin('nothingismagick', this.config.steemPostingKey, 'posting')
// const wif = this.$dsteem.PrivateKey.fromString(this.config.steemPostingKey))
this.$q.notify('Publishing')
this.steemClient = new this.$dsteem.Client('https://api.steemit.com')
this.steemClient.broadcast.comment({
author: this.config.steemName,
body: this.mdModel,
title: this.postTitle,
json_metadata: JSON.stringify({
tags: this.tags
}),
parent_author: parentAuthor,
parent_permlink: mainTag,
permlink: new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase()
// }, this.$dsteem.PrivateKey.fromString(this.config.steemPostingKey)).then((result) => {
}, wif).then((result) => {
console.log(result)
this.$q.notify(`Published ${this.postTitle}`)
}, function (error) {
console.error(error)
})
},
/** A function to lowercase, hyphenate and truncate the tags
*
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dsteem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client } from 'dsteem'
import * as dsteem from 'dsteem'

export default ({ app, router, Vue, store }) => {
// TODO: switch to .env file 💪
Expand Down

0 comments on commit 0c71cc8

Please sign in to comment.