Commit 9eea3958 authored by Bitcoin Please's avatar Bitcoin Please

Updated PIF campaigns.

parent d849cc0a
......@@ -35,7 +35,7 @@
</li>
<li :class="{active: tab === 'wallet'}">
<router-link :to="wallet">Bitcoin Cash Wallet</router-link>
<router-link :to="wallet">Cash Wallet</router-link>
</li>
<li :class="{active: tab === 'received'}">
......
......@@ -69,6 +69,10 @@ export default {
}
},
computed: {
...mapGetters([
'getApiProvider',
]),
...mapGetters('profile', [
'getNickname',
'getSignedMessage',
......@@ -202,7 +206,7 @@ export default {
// $('#signinForm').fadeToggle()
/* Set target. */
const target = 'https://api.causes.cash/v1/profiles'
const target = this.getApiProvider + '/profiles'
const msg = {
action: 'SIGNIN_EMAIL',
......
......@@ -136,6 +136,7 @@ export default {
},
computed: {
...mapGetters([
'getApiProvider',
'getHelp',
]),
......@@ -249,7 +250,7 @@ export default {
$('#signinForm').fadeToggle()
/* Set target. */
const target = 'https://api.causes.cash/v1/profiles'
const target = this.getApiProvider + '/profiles'
const msg = {
action: 'SIGNIN_EMAIL',
......
......@@ -5,6 +5,7 @@ import getEmail from './profile/getters/getEmail'
import getMasterSeed from './profile/getters/getMasterSeed'
import getMeta from './profile/getters/getMeta'
import getNickname from './profile/getters/getNickname'
import getRootAddress from './profile/getters/getRootAddress'
import getSignedMessage from './profile/getters/getSignedMessage'
/* Import modules (actions). */
......@@ -74,6 +75,7 @@ const getters = {
getMasterSeed,
getMeta,
getNickname,
getRootAddress,
getSignedMessage,
}
......
/* Import modules. */
import Nito from 'nitojs'
/**
* Get Address
*/
const getAddress = (state, getters, rootState, rootGetters) => {
/* Validate accounts. */
if (!rootGetters['wallet/getAccounts']) {
return null
}
/* Request accounts. */
const accounts = rootGetters['wallet/getAccounts']
/* Validate accounts. */
if (!accounts) {
return null
}
/* Set profile index. */
const profileIndex = 0
/* Set chain. */
const chain = 0 // receiving account
/* Set derivation path. */
const path = rootGetters['wallet/getDerivationPath'](chain, profileIndex)
/* Initialize HD node. */
const hdNode = rootGetters['wallet/getHDNode']
/* Initialize child node. */
const childNode = hdNode.deriveChild(path)
/* Set (profile) address. */
const address = Nito.Address.toCashAddress(childNode)
/* Return profile address. */
return address
}
/* Export module. */
export default getAddress
......@@ -9,6 +9,7 @@ import getMarkdown from './utils/getters/getMarkdown'
import getShuffledArray from './utils/getters/getShuffledArray'
/* Import modules (actions). */
import setClipboard from './utils/actions/setClipboard'
import toast from './utils/actions/toast'
/* Import modules (mutations). */
......@@ -33,6 +34,7 @@ const getters = {
/* Actions. */
const actions = {
setClipboard,
toast,
}
......
/**
* Set Clipboard
*/
const setClipboard = ({}, _params) => { // eslint-disable-line no-empty-pattern
try {
const textArea = document.createElement('textarea')
textArea.value = _params
document.body.appendChild(textArea)
if (navigator.userAgent.match(/ipad|iphone/i)) {
const range = document.createRange()
range.selectNodeContents(textArea)
const selection = window.getSelection()
selection.removeAllRanges()
selection.addRange(range)
textArea.setSelectionRange(0, 999999)
} else {
textArea.select()
}
document.execCommand('copy')
document.body.removeChild(textArea)
} catch (err) {
console.error(err) // eslint-disable-line no-console
/* Bugsnag alert. */
throw new Error(err)
}
}
/* Export module. */
export default setClipboard
......@@ -42,9 +42,9 @@
</div>
</div>
<hr />
<!-- <hr /> -->
<div class="dashboard-latest my-causes">
<!-- <div class="dashboard-latest my-causes">
<h3>My Latest Causes</h3>
<ul>
......@@ -63,7 +63,7 @@
</div>
</li>
</ul>
</div>
</div> -->
</div>
</div>
......
......@@ -21,18 +21,22 @@
<div class="author-content">
<div class="author-title">
<h3>
<a href="javascript://">
{{getNickname}}
</a>
{{getNickname}}
</h3>
</div>
<div class="author-info">
<p>
<a href="javascript://" class="">
{{getEmail}}
{{getEmail}}
</p>
<p>
<a :href="'https://explorer.bitcoin.com/bch/address/' + getRootAddress" target="_blank">
<strong>{{getRootAddress}}</strong>
</a>
<i class="fa fa-copy ml-2 copy-address" @click="copyToClipboard"></i>
</p>
<p>
Causes Cash member since August 2020
</p>
......@@ -50,7 +54,7 @@
</div>
<div class="col-8">
Satoshi N.
{{getNickname}}
</div>
<div class="col-1">
......@@ -69,7 +73,7 @@
<div class="col-8">
<p>
I feel the presence of the Almighty, who formed us in his own image, and the breath of that universal love which bears and sustains us, as it floats around us in an eternity of bliss; and then, my friend, when darkness overspreads my eyes, and heaven and earth seem to dwell in my soul and absorb its power, like the form of a beloved mistress, then I often think with longing
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
......@@ -78,25 +82,6 @@
</div>
</div>
<div class="row my-3">
<div class="col-1">
<!-- offset fix -->
</div>
<div class="col-2">
<strong>Bio</strong>
</div>
<div class="col-8">
<p>
Oh, would I could describe these conceptions, could impress upon paper all that is living so full and warm within me, that it might be the mirror of my soul, as my soul is the mirror of the infinite God!
</p>
</div>
<div class="col-1">
<!-- offset fix -->
</div>
</div>
</div>
<!-- <a href="javascript://" class="btn-primary mt-3">Save My Profile</a> -->
......@@ -144,6 +129,7 @@ export default {
'getAvatar',
'getEmail',
'getNickname',
'getRootAddress',
]),
...mapGetters('wallet', [
......@@ -151,10 +137,24 @@ export default {
]),
},
methods: {
...mapActions('campaigns', [
'addCampaign',
...mapActions('utils', [
'setClipboard',
'toast',
]),
/**
* Copy To Clipboard
*/
copyToClipboard() {
/* Set clipboard. */
this.setClipboard(this.getRootAddress)
/* Set message. */
const message = `Profile address was copied to clipboard`
/* Display notification. */
this.toast(['Done!', message, 'info'])
},
},
created: function () {
/* Set owner slug. */
......@@ -167,4 +167,14 @@ export default {
.author {
margin: 20px 40px;
}
.author-info a {
display: inline-block;
}
.author-title h3 {
font-size: 2.2em;
}
.copy-address {
cursor: pointer;
}
</style>
......@@ -11,9 +11,9 @@
<div class="col-lg-9">
<div class="account-content dashboard">
<h3 class="account-title">Bitcoin Cash Wallet</h3>
<h3 class="account-title">Cash Wallet</h3>
<div class="qr-code float-right d-none d-md-block m-3" v-html="qr" @click="setClipboard" />
<div class="qr-code float-right d-none d-md-block m-3" v-html="qr" @click="copyAddress" />
<div class="row my-3">
<div class="col-1">
......@@ -79,7 +79,7 @@
</div>
<div class="col-10">
<div class="qr-code text-center d-md-none" v-html="qr" @click="setClipboard" />
<div class="qr-code text-center d-md-none" v-html="qr" @click="copyAddress" />
</div>
<div class="col-1">
......@@ -524,41 +524,15 @@ export default {
/**
* Set Clipboard
*/
setClipboard() {
try {
const textArea = document.createElement('textarea')
textArea.value = this.getAddress('deposit')
document.body.appendChild(textArea)
if (navigator.userAgent.match(/ipad|iphone/i)) {
const range = document.createRange()
range.selectNodeContents(textArea)
const selection = window.getSelection()
selection.removeAllRanges()
selection.addRange(range)
textArea.setSelectionRange(0, 999999)
} else {
textArea.select()
}
document.execCommand('copy')
document.body.removeChild(textArea)
copyAddress() {
/* Set clipboard. */
this.setClipboard(this.getAddress('deposit'))
/* Set message. */
const message = `Deposit address copied to your clipboard.`
/* Set message. */
const message = `Deposit address copied to your clipboard.`
/* Display notification. */
this.toast(['Hey!', message, 'info'])
return true
} catch (err) {
console.error(err) // eslint-disable-line no-console
/* Bugsnag alert. */
throw new Error(err)
}
/* Display notification. */
this.toast(['Hey!', message, 'info'])
},
/**
......
......@@ -423,7 +423,7 @@
<script>
/* Initialize vuex. */
import { mapActions } from 'vuex'
import { mapActions, mapGetters } from 'vuex'
/* Import modules. */
import superagent from 'superagent'
......@@ -452,6 +452,10 @@ export default {
}
},
computed: {
...mapGetters([
'getApiProvider',
]),
/* Campaign Banner Image */
bannerImg() {
return 'https://i.imgur.com/9vNfGgt.jpg'
......@@ -516,7 +520,7 @@ export default {
}
/* Set api target. */
const target = 'https://api.causes.cash/v1/campaigns'
const target = this.getApiProvider + '/campaigns'
const result = await superagent
.post(target)
......
......@@ -199,7 +199,7 @@ function makePages() {
'background': 'url(' + $(this).find('img').attr('src') + ')',
'background-size': 'cover',
// 'padding': '5px',
'margin': '5px',
'margin': '4px',
'width': '180px',
'border': '1pt solid rgba(90, 90, 90, 0.2)',
'-moz-border-radius': '10px',
......@@ -615,7 +615,7 @@ export default {
this.showActions = true
/* Show error notif. */
return this.toast(['Oops!', 'There is NO option to support this campaign', 'error'])
return this.toast(['Oops!', 'Support for this campaign has not started', 'error'])
}
},
......
......@@ -86,7 +86,7 @@
<div class="form-group row">
<div class="col">
<button class="btn btn-primary btn-block" @click="setClipboard">Copy Details</button>
<button class="btn btn-primary btn-block" @click="copyDetails">Copy Details</button>
</div>
<div class="col">
......@@ -409,41 +409,15 @@ export default {
/**
* Set Clipboard
*/
setClipboard() {
try {
const textArea = document.createElement('textarea')
textArea.value = this.pledgeDetails
document.body.appendChild(textArea)
if (navigator.userAgent.match(/ipad|iphone/i)) {
const range = document.createRange()
range.selectNodeContents(textArea)
const selection = window.getSelection()
selection.removeAllRanges()
selection.addRange(range)
textArea.setSelectionRange(0, 999999)
} else {
textArea.select()
}
copyDetails() {
/* Set clipboard. */
this.setClipboard(this.pledgeDetails)
document.execCommand('copy')
document.body.removeChild(textArea)
/* Set message. */
const message = `Pledge details copied to your clipboard.`
/* Set message. */
const message = `Pledge details copied to your clipboard.`
/* Display notification. */
this.toast(['Done!', message, 'success'])
return true
} catch (err) {
console.error(err) // eslint-disable-line no-console
/* Bugsnag alert. */
throw new Error(err)
}
/* Display notification. */
this.toast(['Done!', message, 'success'])
},
},
......
......@@ -86,7 +86,7 @@
<div class="form-group row">
<div class="col">
<button class="btn btn-primary btn-block" @click="setClipboard">Copy Details</button>
<button class="btn btn-primary btn-block" @click="copyDetails">Copy Details</button>
</div>
<div class="col">
......@@ -272,6 +272,7 @@ export default {
]),
...mapActions('utils', [
'setClipboard',
'toast',
]),
......@@ -326,43 +327,17 @@ export default {
},
/**
* Set Clipboard
* Copy Details
*/
setClipboard() {
try {
const textArea = document.createElement('textarea')
textArea.value = this.pledgeDetails
document.body.appendChild(textArea)
if (navigator.userAgent.match(/ipad|iphone/i)) {
const range = document.createRange()
range.selectNodeContents(textArea)
const selection = window.getSelection()
selection.removeAllRanges()
selection.addRange(range)
textArea.setSelectionRange(0, 999999)
} else {
textArea.select()
}
document.execCommand('copy')
document.body.removeChild(textArea)
/* Set message. */
const message = `Pledge details copied to your clipboard.`
copyDetails() {
/* Set clipboard. */
this.setClipboard(this.pledgeDetails)
/* Display notification. */
this.toast(['Done!', message, 'success'])
/* Set message. */
const message = `Pledge details copied to your clipboard.`
return true
} catch (err) {
console.error(err) // eslint-disable-line no-console
/* Bugsnag alert. */
throw new Error(err)
}
/* Display notification. */
this.toast(['Done!', message, 'success'])
},
},
......
......@@ -186,6 +186,7 @@ export default {
return {
usd: null,
satoshis: null,
blockHeight: null,
payoutsContract: null,
receipientAddress: null,
......@@ -204,9 +205,9 @@ export default {
'getHelp',
]),
...mapGetters('campaigns', [
'getFullfillment',
]),
// ...mapGetters('campaigns', [
// 'getFullfillment',
// ]),
...mapGetters('wallet', [
'getAddress',
......@@ -266,6 +267,7 @@ export default {
]),
...mapActions('utils', [
'setClipboard',
'toast',
]),
......@@ -328,7 +330,7 @@ export default {
},
async savePledge() {
this.setClipboard()
this.copyToClipboard()
/* Set campaign id. */
const campaignid = this.campaign.id
......@@ -348,6 +350,8 @@ export default {
const pledgeUSD = numeral(this.pledgeUSD).value()
const monthlyPledgeAmt = Math.round(pledgeUSD * 100)
const minValidBlock = this.blockHeight
const scriptVer = 'v20.8.3-fixed'
const pkg = {
campaignid,
......@@ -355,6 +359,8 @@ export default {
alias,
comment,
monthlyPledgeAmt,
minValidBlock,
scriptVer,
}
/* Add payout. */
......@@ -362,43 +368,17 @@ export default {
},
/**
* Set Clipboard
* Copy To Clipboard
*/