Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Causes Cash
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bitcoin Please
Causes Cash
Commits
92757405
Commit
92757405
authored
Aug 17, 2020
by
Bitcoin Please
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added display of payout supporters.
parent
c4afb513
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
21 deletions
+139
-21
src/views/Campaign/Details/History/Supporters.vue
src/views/Campaign/Details/History/Supporters.vue
+139
-21
No files found.
src/views/Campaign/Details/History/Supporters.vue
View file @
92757405
...
...
@@ -2,7 +2,27 @@
<div
id=
"supporters"
class=
"tabs"
>
<h1>
Featured Supporters
</h1>
<table
class=
"mt-3"
>
<table
class=
"mt-3"
v-if=
"funders"
>
<tbody>
<tr>
<th>
Nickname / Alias
</th>
<th
class=
"text-center"
>
Comment
</th>
<th
class=
"text-center"
>
Amount (USD)
</th>
<th
class=
"text-right"
>
Time
</th>
</tr>
<tr
v-for=
"funder of funders"
:key=
"funder.publicKeyHash + ':' + funder.monthlyPledgeAmt"
>
<td>
{{
funder
.
alias
}}
</td>
<td
class=
"text-center"
>
{{
funder
.
comment
}}
</td>
<td
class=
"text-center"
>
{{
formatUSD
(
funder
.
monthlyPledgeAmt
)
}}
<small>
[
<span
class=
"text-danger"
>
{{
funder
.
payouts
.
length
}}
x
</span>
]
</small>
</td>
<td
class=
"text-right"
>
{{
formatDate
(
funder
.
createdAt
)
}}
</td>
</tr>
</tbody>
</table>
<table
class=
"mt-3"
v-if=
"pledges"
>
<tbody>
<tr>
<th>
Nickname / Alias
</th>
...
...
@@ -13,11 +33,12 @@
<tr
v-for=
"pledge of pledges"
:key=
"pledge.previousTransactionHash + ':' + pledge.previousOutputIndex"
>
<td>
{{
pledge
.
alias
}}
</td>
<td
class=
"text-center"
>
{{
pledge
.
comment
}}
</td>
<td
class=
"text-center"
>
{{
format
Amount
(
pledge
.
satoshis
)
}}
</td>
<td
class=
"text-center"
>
{{
format
Satoshis
(
pledge
.
satoshis
)
}}
</td>
<td
class=
"text-right"
>
{{
formatDate
(
pledge
.
createdAt
)
}}
</td>
</tr>
</tbody>
</table>
</div>
</
template
>
...
...
@@ -34,41 +55,76 @@ export default {
data
:
()
=>
{
return
{
usd
:
null
,
funders
:
null
,
pledges
:
null
,
}
},
watch
:
{
campaign
:
function
(
_campaign
)
{
/* Handle campaign supporters. */
if
(
_campaign
&&
_campaign
.
assurances
)
{
if
(
_campaign
&&
(
_campaign
.
assurances
||
_campaign
.
payouts
)
)
{
console
.
log
(
'
CAMPAIGN HAS CHANGED, UPDATE SUPPORTERS!!
'
,
_campaign
)
const
assuranceid
=
0
/* Validate assurances. */
if
(
_campaign
.
assurances
)
{
/* Set assurance id. */
const
assuranceid
=
0
// FIXME: Hard-coded to a single assurance campaign
/* Set pledges. */
const
pledges
=
_campaign
.
assurances
[
assuranceid
].
pledges
/* Validate pledges. */
if
(
!
pledges
)
{
return
}
/* Initialize pledges. */
this
.
pledges
=
[]
/* Set pledges. */
const
pledges
=
_campaign
.
assurances
[
assuranceid
].
pledges
/* Handle all pledges. */
Object
.
keys
(
pledges
).
filter
(
pledgeid
=>
{
if
(
pledges
[
pledgeid
].
isFilled
===
true
||
pledges
[
pledgeid
].
isSpent
===
false
)
{
this
.
pledges
.
push
(
pledges
[
pledgeid
])
}
})
/* Validate pledges. */
if
(
!
pledges
)
{
return
/* Sort pledges (decending). */
this
.
pledges
.
sort
((
a
,
b
)
=>
{
return
b
.
satoshis
-
a
.
satoshis
})
}
/* Handle all pledges. */
Object
.
keys
(
pledges
).
filter
(
pledgeId
=>
{
if
(
pledges
[
pledgeId
].
isFilled
===
true
||
pledges
[
pledgeId
].
isSpent
===
false
)
{
this
.
pledges
.
push
(
pledges
[
pledgeId
])
/* Validate payouts. */
if
(
_campaign
.
payouts
&&
_campaign
.
payouts
.
funders
)
{
/* Set funders. */
const
funders
=
_campaign
.
payouts
.
funders
/* Validate funders. */
if
(
!
funders
)
{
return
}
})
/* Sort pledges (decending). */
this
.
pledges
.
sort
((
a
,
b
)
=>
{
return
b
.
satoshis
-
a
.
satoshis
})
/* Initialize funders. */
this
.
funders
=
[]
/* Handle all funders. */
Object
.
keys
(
funders
).
filter
(
funderid
=>
{
if
(
funders
[
funderid
].
nextPayoutAt
)
{
this
.
funders
.
push
(
funders
[
funderid
])
}
})
/* Sort funders (decending). */
this
.
funders
.
sort
((
a
,
b
)
=>
{
return
b
.
monthlyPledgeAmt
-
a
.
monthlyPledgeAmt
})
}
}
},
},
methods
:
{
format
Amount
(
_amount
)
{
format
Satoshis
(
_amount
)
{
const
value
=
(
_amount
/
100000000
)
*
this
.
usd
if
(
value
)
{
...
...
@@ -78,6 +134,16 @@ export default {
}
},
formatUSD
(
_amount
)
{
const
value
=
(
_amount
/
100
)
if
(
value
)
{
return
numeral
(
value
).
format
(
'
$0,0.00
'
)
}
else
{
return
'
$0.00
'
}
},
formatDate
(
_date
)
{
if
(
_date
)
{
return
moment
.
unix
(
_date
).
fromNow
()
...
...
@@ -90,8 +156,60 @@ export default {
this
.
usd
=
await
Nito
.
Markets
.
getTicker
(
'
BCH
'
,
'
USD
'
)
// console.info(`Market price (USD)`, this.usd)
/* Initialize pledges. */
this
.
pledges
=
[]
/* Validate assurances. */
if
(
this
.
campaign
.
assurances
)
{
/* Set assurance id. */
const
assuranceid
=
0
// FIXME: Hard-coded to a single assurance campaign
/* Set pledges. */
const
pledges
=
this
.
campaign
.
assurances
[
assuranceid
].
pledges
/* Validate pledges. */
if
(
!
pledges
)
{
return
}
/* Initialize pledges. */
this
.
pledges
=
[]
/* Handle all pledges. */
Object
.
keys
(
pledges
).
filter
(
pledgeid
=>
{
if
(
pledges
[
pledgeid
].
isFilled
===
true
||
pledges
[
pledgeid
].
isSpent
===
false
)
{
this
.
pledges
.
push
(
pledges
[
pledgeid
])
}
})
/* Sort pledges (decending). */
this
.
pledges
.
sort
((
a
,
b
)
=>
{
return
b
.
satoshis
-
a
.
satoshis
})
}
/* Validate payouts. */
if
(
this
.
campaign
.
payouts
&&
this
.
campaign
.
payouts
.
funders
)
{
/* Set funders. */
const
funders
=
this
.
campaign
.
payouts
.
funders
/* Validate funders. */
if
(
!
funders
)
{
return
}
/* Initialize funders. */
this
.
funders
=
[]
/* Handle all funders. */
Object
.
keys
(
funders
).
filter
(
funderid
=>
{
if
(
funders
[
funderid
].
nextPayoutAt
)
{
this
.
funders
.
push
(
funders
[
funderid
])
}
})
/* Sort funders (decending). */
this
.
funders
.
sort
((
a
,
b
)
=>
{
return
b
.
monthlyPledgeAmt
-
a
.
monthlyPledgeAmt
})
}
},
}
</
script
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment