mirror of
https://github.com/status-im/liquid-funding.git
synced 2025-01-20 08:28:52 +00:00
add markAsCanceled method to profiles class
remove mark state as updated method
This commit is contained in:
parent
5cc4947399
commit
4f68a15c04
@ -14,7 +14,7 @@ const formatField = field => ({
|
||||
commitTime: convertToHours(field.commitTime),
|
||||
canceled: cancelText(field.canceled)
|
||||
})
|
||||
const FunderProfilesTable = ({ cancelFundProfile, profiles }) => (
|
||||
const FunderProfilesTable = ({ profiles }) => (
|
||||
<FundingContext.Consumer>
|
||||
{({ account }) =>
|
||||
<Fragment>
|
||||
@ -39,9 +39,10 @@ const FunderProfilesTable = ({ cancelFundProfile, profiles }) => (
|
||||
onClick: (event, rowData) => {
|
||||
cancelProject(rowData.idProject || rowData.idProfile)
|
||||
.send()
|
||||
.then(res => {
|
||||
.then(async res => {
|
||||
console.log({res})
|
||||
cancelFundProfile(rowData.idProfile)
|
||||
const profile = profiles.find(p => p.idProfile == rowData.idProfile)
|
||||
await profile.markAsCanceled()
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -53,5 +54,5 @@ const FunderProfilesTable = ({ cancelFundProfile, profiles }) => (
|
||||
)
|
||||
|
||||
export default withDatabase(withObservables([], ({ database }) => ({
|
||||
profiles: database.collections.get('profiles').query().observe(),
|
||||
profiles: database.collections.get('profiles').query().observeWithColumns(['canceled']),
|
||||
}))(FunderProfilesTable))
|
||||
|
@ -12,10 +12,10 @@ const FundsManagement = ({ open }) => {
|
||||
const WebkitTransition = 'all 0.25s ease-out 0s'
|
||||
return (
|
||||
<FundingContext.Consumer>
|
||||
{({ allPledges, appendPledges, appendFundProfile, transferPledgeAmounts, fundProfiles, cancelFundProfile }) =>
|
||||
{({ allPledges, appendPledges, appendFundProfile, transferPledgeAmounts, fundProfiles }) =>
|
||||
<div style={{ maxWidth, WebkitTransition }}>
|
||||
<PledgesTable data={allPledges} transferPledgeAmounts={transferPledgeAmounts} fundProfiles={fundProfiles} />
|
||||
<FunderProfilesTable cancelFundProfile={cancelFundProfile}/>
|
||||
<FunderProfilesTable />
|
||||
<AddFunder appendFundProfile={appendFundProfile} />
|
||||
<Divider variant="middle" />
|
||||
<CreateFunding refreshTable={appendPledges} />
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { field } from '@nozbe/watermelondb/decorators'
|
||||
import { action, field } from '@nozbe/watermelondb/decorators'
|
||||
import { LiquidModel } from '../utils/models'
|
||||
|
||||
|
||||
@ -12,4 +12,10 @@ export default class Profiles extends LiquidModel {
|
||||
@field('name') name
|
||||
@field('url') url
|
||||
@field('id_profile') idProfile
|
||||
|
||||
@action async markAsCanceled() {
|
||||
await this.update(profile => {
|
||||
profile.canceled = true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user