Skip to content

Commit 646e81f

Browse files
Merge pull request #197 from daostack/admin/main
Approve payout screen
2 parents 368bd94 + 4a99c5a commit 646e81f

File tree

21 files changed

+482
-26
lines changed

21 files changed

+482
-26
lines changed

packages/admin/src/graphql/index.ts

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ export type Mutation = {
599599
/** Refresh the common members from the events. Returns the new common member count */
600600
refreshCommonMembers?: Maybe<Scalars['Int']>;
601601
executePayouts?: Maybe<Payout>;
602+
approvePayout?: Maybe<Scalars['Boolean']>;
602603
updatePaymentData?: Maybe<Scalars['Boolean']>;
603604
updatePaymentsCommonId?: Maybe<Scalars['Boolean']>;
604605
createIntention?: Maybe<Intention>;
@@ -620,6 +621,13 @@ export type MutationExecutePayoutsArgs = {
620621
};
621622

622623

624+
export type MutationApprovePayoutArgs = {
625+
payoutId: Scalars['ID'];
626+
index: Scalars['Int'];
627+
token: Scalars['String'];
628+
};
629+
630+
623631
export type MutationUpdatePaymentDataArgs = {
624632
id: Scalars['ID'];
625633
trackId?: Maybe<Scalars['ID']>;
@@ -857,6 +865,42 @@ export type UpdatePaymentDataMutation = (
857865
& Pick<Mutation, 'updatePaymentData'>
858866
);
859867

868+
export type GetConfirmPayoutDataQueryVariables = Exact<{
869+
payoutId: Scalars['ID'];
870+
}>;
871+
872+
873+
export type GetConfirmPayoutDataQuery = (
874+
{ __typename?: 'Query' }
875+
& { payout?: Maybe<(
876+
{ __typename?: 'Payout' }
877+
& Pick<Payout, 'amount'>
878+
& { proposals?: Maybe<Array<Maybe<(
879+
{ __typename?: 'Proposal' }
880+
& Pick<Proposal, 'id'>
881+
& { description: (
882+
{ __typename?: 'ProposalDescription' }
883+
& Pick<ProposalDescription, 'title' | 'description'>
884+
), fundingRequest?: Maybe<(
885+
{ __typename?: 'ProposalFunding' }
886+
& Pick<ProposalFunding, 'amount'>
887+
)> }
888+
)>>> }
889+
)> }
890+
);
891+
892+
export type ApprovePayoutMutationVariables = Exact<{
893+
payoutId: Scalars['ID'];
894+
token: Scalars['String'];
895+
index: Scalars['Int'];
896+
}>;
897+
898+
899+
export type ApprovePayoutMutation = (
900+
{ __typename?: 'Mutation' }
901+
& Pick<Mutation, 'approvePayout'>
902+
);
903+
860904
export type GetProposalsSelectedForBatchQueryVariables = Exact<{
861905
ids: Array<Scalars['String']> | Scalars['String'];
862906
}>;
@@ -1605,6 +1649,81 @@ export function useUpdatePaymentDataMutation(baseOptions?: Apollo.MutationHookOp
16051649
export type UpdatePaymentDataMutationHookResult = ReturnType<typeof useUpdatePaymentDataMutation>;
16061650
export type UpdatePaymentDataMutationResult = Apollo.MutationResult<UpdatePaymentDataMutation>;
16071651
export type UpdatePaymentDataMutationOptions = Apollo.BaseMutationOptions<UpdatePaymentDataMutation, UpdatePaymentDataMutationVariables>;
1652+
export const GetConfirmPayoutDataDocument = gql`
1653+
query GetConfirmPayoutData($payoutId: ID!) {
1654+
payout(id: $payoutId) {
1655+
amount
1656+
proposals {
1657+
id
1658+
description {
1659+
title
1660+
description
1661+
}
1662+
fundingRequest {
1663+
amount
1664+
}
1665+
}
1666+
}
1667+
}
1668+
`;
1669+
1670+
/**
1671+
* __useGetConfirmPayoutDataQuery__
1672+
*
1673+
* To run a query within a React component, call `useGetConfirmPayoutDataQuery` and pass it any options that fit your needs.
1674+
* When your component renders, `useGetConfirmPayoutDataQuery` returns an object from Apollo Client that contains loading, error, and data properties
1675+
* you can use to render your UI.
1676+
*
1677+
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
1678+
*
1679+
* @example
1680+
* const { data, loading, error } = useGetConfirmPayoutDataQuery({
1681+
* variables: {
1682+
* payoutId: // value for 'payoutId'
1683+
* },
1684+
* });
1685+
*/
1686+
export function useGetConfirmPayoutDataQuery(baseOptions: Apollo.QueryHookOptions<GetConfirmPayoutDataQuery, GetConfirmPayoutDataQueryVariables>) {
1687+
return Apollo.useQuery<GetConfirmPayoutDataQuery, GetConfirmPayoutDataQueryVariables>(GetConfirmPayoutDataDocument, baseOptions);
1688+
}
1689+
export function useGetConfirmPayoutDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetConfirmPayoutDataQuery, GetConfirmPayoutDataQueryVariables>) {
1690+
return Apollo.useLazyQuery<GetConfirmPayoutDataQuery, GetConfirmPayoutDataQueryVariables>(GetConfirmPayoutDataDocument, baseOptions);
1691+
}
1692+
export type GetConfirmPayoutDataQueryHookResult = ReturnType<typeof useGetConfirmPayoutDataQuery>;
1693+
export type GetConfirmPayoutDataLazyQueryHookResult = ReturnType<typeof useGetConfirmPayoutDataLazyQuery>;
1694+
export type GetConfirmPayoutDataQueryResult = Apollo.QueryResult<GetConfirmPayoutDataQuery, GetConfirmPayoutDataQueryVariables>;
1695+
export const ApprovePayoutDocument = gql`
1696+
mutation ApprovePayout($payoutId: ID!, $token: String!, $index: Int!) {
1697+
approvePayout(payoutId: $payoutId, token: $token, index: $index)
1698+
}
1699+
`;
1700+
export type ApprovePayoutMutationFn = Apollo.MutationFunction<ApprovePayoutMutation, ApprovePayoutMutationVariables>;
1701+
1702+
/**
1703+
* __useApprovePayoutMutation__
1704+
*
1705+
* To run a mutation, you first call `useApprovePayoutMutation` within a React component and pass it any options that fit your needs.
1706+
* When your component renders, `useApprovePayoutMutation` returns a tuple that includes:
1707+
* - A mutate function that you can call at any time to execute the mutation
1708+
* - An object with fields that represent the current status of the mutation's execution
1709+
*
1710+
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
1711+
*
1712+
* @example
1713+
* const [approvePayoutMutation, { data, loading, error }] = useApprovePayoutMutation({
1714+
* variables: {
1715+
* payoutId: // value for 'payoutId'
1716+
* token: // value for 'token'
1717+
* index: // value for 'index'
1718+
* },
1719+
* });
1720+
*/
1721+
export function useApprovePayoutMutation(baseOptions?: Apollo.MutationHookOptions<ApprovePayoutMutation, ApprovePayoutMutationVariables>) {
1722+
return Apollo.useMutation<ApprovePayoutMutation, ApprovePayoutMutationVariables>(ApprovePayoutDocument, baseOptions);
1723+
}
1724+
export type ApprovePayoutMutationHookResult = ReturnType<typeof useApprovePayoutMutation>;
1725+
export type ApprovePayoutMutationResult = Apollo.MutationResult<ApprovePayoutMutation>;
1726+
export type ApprovePayoutMutationOptions = Apollo.BaseMutationOptions<ApprovePayoutMutation, ApprovePayoutMutationVariables>;
16081727
export const GetProposalsSelectedForBatchDocument = gql`
16091728
query getProposalsSelectedForBatch($ids: [String!]!) {
16101729
proposals(ids: $ids) {

packages/admin/src/graphql/schema.graphql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ type Mutation {
409409
commonId: ID!
410410
): Int
411411
executePayouts(input: ExecutePayoutInput!): Payout
412-
updatePaymentData(id: ID!, trackId: ID = "5f398531-0f9b-42ec-8dd0-99896ac47e74"): Boolean
412+
approvePayout(payoutId: ID!, index: Int!, token: String!): Boolean
413+
updatePaymentData(id: ID!, trackId: ID = "7f4fe0bd-590a-455d-b3cd-fe6045d36066"): Boolean
413414
updatePaymentsCommonId: Boolean
414415
createIntention(input: CreateIntentionInput!): Intention
415416
}

packages/admin/src/graphql/schema.json

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4188,6 +4188,67 @@
41884188
"isDeprecated": false,
41894189
"deprecationReason": null
41904190
},
4191+
{
4192+
"name": "approvePayout",
4193+
"description": null,
4194+
"args": [
4195+
{
4196+
"name": "payoutId",
4197+
"description": null,
4198+
"type": {
4199+
"kind": "NON_NULL",
4200+
"name": null,
4201+
"ofType": {
4202+
"kind": "SCALAR",
4203+
"name": "ID",
4204+
"ofType": null
4205+
}
4206+
},
4207+
"defaultValue": null,
4208+
"isDeprecated": false,
4209+
"deprecationReason": null
4210+
},
4211+
{
4212+
"name": "index",
4213+
"description": null,
4214+
"type": {
4215+
"kind": "NON_NULL",
4216+
"name": null,
4217+
"ofType": {
4218+
"kind": "SCALAR",
4219+
"name": "Int",
4220+
"ofType": null
4221+
}
4222+
},
4223+
"defaultValue": null,
4224+
"isDeprecated": false,
4225+
"deprecationReason": null
4226+
},
4227+
{
4228+
"name": "token",
4229+
"description": null,
4230+
"type": {
4231+
"kind": "NON_NULL",
4232+
"name": null,
4233+
"ofType": {
4234+
"kind": "SCALAR",
4235+
"name": "String",
4236+
"ofType": null
4237+
}
4238+
},
4239+
"defaultValue": null,
4240+
"isDeprecated": false,
4241+
"deprecationReason": null
4242+
}
4243+
],
4244+
"type": {
4245+
"kind": "SCALAR",
4246+
"name": "Boolean",
4247+
"ofType": null
4248+
},
4249+
"isDeprecated": false,
4250+
"deprecationReason": null
4251+
},
41914252
{
41924253
"name": "updatePaymentData",
41934254
"description": null,
@@ -4216,7 +4277,7 @@
42164277
"name": "ID",
42174278
"ofType": null
42184279
},
4219-
"defaultValue": "\"f9ba4c76-91f6-4f8d-83d0-278cc034f77a\"",
4280+
"defaultValue": "\"8185aa06-1fe0-44e7-936e-cd262fdc22f9\"",
42204281
"isDeprecated": false,
42214282
"deprecationReason": null
42224283
}

packages/admin/src/pages/financials/payments/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const PaymentsHomepage: NextPage = () => {
113113

114114
<Spacer/>
115115

116-
<Text h3>Hanging payments ({payments?.hangingPayments})</Text>
116+
<Text h3>Hanging payments ({payments?.hangingPayments.length})</Text>
117117

118118
{(payments?.hangingPayments).map((payment) => (
119119
<React.Fragment key={payment.id}>

0 commit comments

Comments
 (0)