Skip to content

Commit

Permalink
HF29 - UI for payment subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Aug 18, 2023
1 parent 98785e1 commit cc3352d
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
44 changes: 44 additions & 0 deletions app/components/cards/TransferHistoryRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import {connect} from 'react-redux'
import { Link } from 'react-router';
import { PrivateKey } from 'golos-lib-js/lib/auth/ecc'
import { Asset } from 'golos-lib-js/lib/utils'
import tt from 'counterpart'

import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper';
Expand Down Expand Up @@ -269,6 +270,49 @@ class TransferHistoryRow extends React.Component {
description_end += tt('transferhistoryrow_jsx.with_unlimit')
}
}
else if (type === 'subscription_payment') {
const iAmSponsor = data.subscriber === this.props.context
const total = Asset(data.amount).plus(data.rest).floatString
if (data.payment_type === 'first') {
if (iAmSponsor) {
description_start += tt('transferhistoryrow_jsx.i_become_sponsor')
link = data.author
description_end += tt('transferhistoryrow_jsx.for')
description_end += total
} else {
link = data.subscriber
description_end += tt('transferhistoryrow_jsx.their_become_sponsor')
description_end += tt('transferhistoryrow_jsx.for')
description_end += total
}
} else if (data.payment_type === 'prolong') {
if (iAmSponsor) {
description_start += tt('transferhistoryrow_jsx.i_prolong_sponsor')
link = data.author
description_end += tt('transferhistoryrow_jsx.for')
description_end += total
} else {
link = data.subscriber
description_end += tt('transferhistoryrow_jsx.their_prolong_sponsor')
description_end += tt('transferhistoryrow_jsx.for')
description_end += total
}
} else if (data.payment_type === 'regular') {
if (iAmSponsor) {
description_start += tt('transferhistoryrow_jsx.payment_for_sponsorship')
link = data.author
description_end += ' - ' + total
description_end += tt('transferhistoryrow_jsx.per_month')
} else {
description_start += tt('transferhistoryrow_jsx.payment_from_sponsor')
link = data.subscriber
description_end += ' - ' + total
description_end += tt('transferhistoryrow_jsx.per_month')
}
} else {
code_key = JSON.stringify({type, ...data}, null, 2);
}
}

else {
code_key = JSON.stringify({type, ...data}, null, 2);
Expand Down
4 changes: 2 additions & 2 deletions app/components/modules/TopRightMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function TopRightMenu({account, savings_withdraws, price_per_golos, globalprops,
{link: uiaLink, icon: 'editor/coin', value: tt('g.assets')},
{link: ordersLink, icon: 'trade', value: tt('navigation.market2'), addon: <NotifiCounter fields="fill_order" />},
{link: inviteLink, icon: 'hf/hf19', value: tt('g.invites')},
{link: blogLink, target: blogsTarget(), icon: 'new/blogging', value: tt('g.blog'), addon: <NotifiCounter fields="comment_reply,mention" />},
{link: blogLink, target: blogsTarget(), icon: 'new/blogging', value: tt('g.blog'), addon: <NotifiCounter fields="comment_reply,mention,new_sponsor,sponsor_inactive" />},
{link: donatesLink, icon: 'hf/hf8', value: tt('g.rewards'), addon: <NotifiCounter fields="donate,donate_msgs" />},
(messagesLink ?
{link: messagesLink, icon: 'new/envelope', value: tt('g.messages'), target: '_blank', addon: <NotifiCounter fields="message" />} :
Expand Down Expand Up @@ -196,7 +196,7 @@ function TopRightMenu({account, savings_withdraws, price_per_golos, globalprops,
</div>
</div>
</a>
<div className="TopRightMenu__notificounter"><NotifiCounter fields="send,receive,delegate_vs,donate,donate_msgs,message,fill_order,comment_reply,mention" /></div>
<div className="TopRightMenu__notificounter"><NotifiCounter fields="send,receive,delegate_vs,donate,donate_msgs,message,fill_order,comment_reply,mention,new_sponsor,sponsor_inactive" /></div>
</li>}
</LinkWithDropdown>
{navAdditional}
Expand Down
6 changes: 6 additions & 0 deletions app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,12 @@
"transferred": "Transfer ",
"percen_referral": " - you get a percentage of the referral fee ",
"funded_workers": "Funded by the community ",
"i_become_sponsor": "Became a sponsor of ",
"their_become_sponsor": " became a sponsor of ",
"i_prolong_sponsor": "Prolonged sponsorship of ",
"their_prolong_sponsor": " prolonged sponsorship of ",
"payment_for_sponsorship": "Payment for sponsorship of ",
"payment_from_sponsor": "Payment from sponsor ",
"to_golos_power": " for Golos Power",
"to_tip": " to TIP balance ",
"from_tip": " with TIP balance ",
Expand Down
7 changes: 7 additions & 0 deletions app/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,13 @@
"transferred": "Передано ",
"percen_referral": " - процент от награды в адрес вашего реферала ",
"funded_workers": "Профинансировано ",
"i_become_sponsor": "Стал спонсором ",
"their_become_sponsor": " стал спонсором",
"i_prolong_sponsor": "Продлил спонсорство ",
"their_prolong_sponsor": " продлил спонсорство ",
"payment_for_sponsorship": "Платеж за спонсорство ",
"payment_from_sponsor": "Платеж от спонсора ",
"per_month": " в месяц",
"to_golos_power": " в Силу Голоса",
"to_golos_liquid": " на основной баланс",
"to_tip": " на TIP-баланс ",
Expand Down
4 changes: 3 additions & 1 deletion app/redux/FetchDataSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function* fetchState(location_change_action) {
break
case 'transfers':
default:
const history = yield call([api, api.getAccountHistoryAsync], uname, -1, 1000, {select_ops: ['donate', 'transfer', 'author_reward', 'curation_reward', 'transfer_to_tip', 'transfer_from_tip', 'transfer_to_vesting', 'withdraw_vesting', 'asset_issue', 'invite', 'transfer_to_savings', 'transfer_from_savings', 'convert_sbd_debt', 'convert', 'fill_convert_request', 'interest', 'worker_reward', 'account_freeze', 'unwanted_cost', 'unlimit_cost']})
const history = yield call([api, api.getAccountHistoryAsync], uname, -1, 1000, {select_ops: ['donate', 'transfer', 'author_reward', 'curation_reward', 'transfer_to_tip', 'transfer_from_tip', 'transfer_to_vesting', 'withdraw_vesting', 'asset_issue', 'invite', 'transfer_to_savings', 'transfer_from_savings', 'convert_sbd_debt', 'convert', 'fill_convert_request', 'interest', 'worker_reward', 'account_freeze', 'unwanted_cost', 'unlimit_cost', 'subscription_payment'/*, 'subscription_prepaid_return'*/]})
account.transfer_history = []
account.other_history = []

Expand All @@ -170,6 +170,8 @@ export function* fetchState(location_change_action) {
case 'account_freeze':
case 'unwanted_cost':
case 'unlimit_cost':
case 'subscription_payment':
//case 'subscription_prepaid_return':
state.accounts[uname].transfer_history.push(operation)
break

Expand Down

0 comments on commit cc3352d

Please sign in to comment.