Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
5028fdc
feat: set up routes in profile
mohitb35 Aug 16, 2022
6347d88
feat: set up reusable tabbed view
mohitb35 Aug 16, 2022
5e32bd6
feat: configure tabbed view for manage payouts
mohitb35 Aug 16, 2022
abf25e9
feat: standardize form styles with StyledForm
mohitb35 Aug 16, 2022
497c3bf
feat: basic scaffolding for ManagePayouts
mohitb35 Aug 16, 2022
7627497
feat: create ui for payout schedule form
mohitb35 Aug 16, 2022
de99c36
feat: create ui for bank details form
mohitb35 Aug 17, 2022
5ecb745
feat: link up forms with react-hook-form
mohitb35 Aug 17, 2022
f6e63e8
feat: add error display to ReactHookFormSelect
mohitb35 Aug 18, 2022
cc31d46
feat: cleanup & handle errors for frequency select
mohitb35 Aug 18, 2022
1d05fd7
feat: add placeholders where needed
mohitb35 Aug 18, 2022
2cc8d18
refactor: extract translations for managePayouts
mohitb35 Aug 18, 2022
f84e3bb
fix: change support link color
mohitb35 Aug 18, 2022
47781cb
feat: update page routes and tab navigation
mohitb35 Sep 5, 2022
7bddcba
feat: minor ui updates to forms
mohitb35 Sep 7, 2022
129089d
feat: populate PayoutScheduleForm from user data
mohitb35 Sep 7, 2022
7870f4d
feat: handle APIs to save payout info
mohitb35 Sep 7, 2022
0c040be
feat: handle processing state for Save button
mohitb35 Sep 7, 2022
676e360
feat: update BankDetailsForm UI
mohitb35 Sep 9, 2022
21d7ca7
feat: populate currency selector
mohitb35 Sep 9, 2022
7104231
feat: update validations for BankDetailsForm
mohitb35 Sep 12, 2022
b475d04
feat: handle api call to create account
mohitb35 Sep 12, 2022
a19a391
Merge branch 'develop' into feature/manage-payouts
mohitb35 Sep 13, 2022
3c41043
feat: show bank account creation success
mohitb35 Sep 13, 2022
2591f2a
feat: show save success message for schedule
mohitb35 Sep 13, 2022
52a5266
feat: set up PayoutsContext
mohitb35 Sep 13, 2022
ca02267
feat: fetch accounts
mohitb35 Sep 13, 2022
1ae2a8c
refactor: remove * (reqd. fields) from translation
mohitb35 Sep 14, 2022
4032b25
feat: create bank account list ui
mohitb35 Sep 14, 2022
2e11b8b
feat: add loading effects for account list
mohitb35 Sep 15, 2022
49f78a7
feat: handle no bank account scenario
mohitb35 Sep 15, 2022
293e6f1
fix: don't send clean object while saving account
mohitb35 Sep 15, 2022
ea9ae0b
refactor: clean up Overview.tsx
mohitb35 Sep 15, 2022
f6e9d38
feat: add Edit Bank Details page
mohitb35 Sep 15, 2022
e053c1f
refactor: update component names
mohitb35 Sep 15, 2022
938d20b
chore: update eslint to allow unused vars with _
mohitb35 Sep 15, 2022
94b53c2
refactor: remove redundant null check
mohitb35 Sep 15, 2022
8786e74
feat: show Edit form with populated data
mohitb35 Sep 15, 2022
4a13150
feat: call /minPayoutAmounts if not called before
mohitb35 Sep 15, 2022
a86cc80
refactor: update structure of ManagePayouts
mohitb35 Sep 16, 2022
3f49d68
fix: prevent empty currency field in Edit Form
mohitb35 Sep 16, 2022
3467197
refactor: move submit logic out of BankDetailsForm
mohitb35 Sep 16, 2022
ba2f925
feat: set up ApiCustomError interface
mohitb35 Sep 16, 2022
fc510f1
feat: handle API to update bank account details
mohitb35 Sep 16, 2022
cc9487d
feat: stronger types while handling API responses
mohitb35 Sep 16, 2022
055b5fd
fix: resolve module not found for isApiCustomError
mohitb35 Sep 16, 2022
b6227a7
feat: show Manage Payouts in menu for tpo only
mohitb35 Sep 20, 2022
d00b4ad
feat: redirect non tpo accounts from manage a/c
mohitb35 Sep 20, 2022
dd82cec
feat: add min payout to BankAccountDetails
mohitb35 Sep 20, 2022
d4b8103
feat: add navigation from Manage Projects
mohitb35 Sep 20, 2022
64b3e62
fix: set default scheduleFrequency 'manual'
mohitb35 Sep 20, 2022
50ec425
refactor: remove magic strings
mohitb35 Sep 21, 2022
ab045bc
fix: remove holderType from Add/Edit Bank A/C req.
mohitb35 Sep 27, 2022
573e8ca
Merge branch 'develop' into feature/manage-payouts
mohitb35 Sep 27, 2022
17ac72b
fix: update tab setup to work after merge
mohitb35 Sep 27, 2022
bfbc909
fix: update styles after merge commit
mohitb35 Sep 27, 2022
47bbec9
refactor: remove unused FormSteps component
mohitb35 Sep 27, 2022
b324850
fix: prevent double render of TabSteps
mohitb35 Sep 27, 2022
2545c2d
fix: prevent reload of DashboardView on tab change
mohitb35 Sep 27, 2022
47c7b73
fix: send "" for payoutMinAmount for default a/c
mohitb35 Sep 29, 2022
10fad90
style: remove console logs
mohitb35 Oct 4, 2022
fd789f7
refactor: remove inline styles for CTA buttons
mohitb35 Oct 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ module.exports = {
},
plugins: ['react', '@typescript-eslint', '@emotion', 'cypress'],
rules: {
// note you must disable the base rule as it can report incorrect errors
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn', // or "error"
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'react/react-in-jsx-scope': 'off',
'react/jsx-props-no-spreading': 'off',
'no-use-before-define': 'off',
Expand Down
55 changes: 29 additions & 26 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { ThemeProvider as MuiThemeProvider } from '@mui/material';
import materialTheme from '../src/theme/themeStyles';
import QueryParamsProvider from '../src/features/common/Layout/QueryParamsContext';
import { PlanetCashProvider } from '../src/features/common/Layout/PlanetCashContext';
import { PayoutsProvider } from '../src/features/common/Layout/PayoutsContext';

const VideoContainer = dynamic(
() => import('../src/features/common/LandingVideo'),
Expand Down Expand Up @@ -223,32 +224,34 @@ export default function PlanetWeb({ Component, pageProps, err }: any) {
<QueryParamsProvider>
<UserPropsProvider>
<PlanetCashProvider>
<Layout>
<ProjectPropsProvider>
<BulkCodeProvider>
{isMap ? (
<>
{project ? (
<MapLayout />
) : projects ? (
<MapLayout />
) : null}
<div
style={
config.tenantName === 'planet' ||
config.tenantName === 'ttc'
? {}
: { display: 'none' }
}
>
<PlayButton setshowVideo={setshowVideo} />
</div>
</>
) : null}
<Component {...ProjectProps} />
</BulkCodeProvider>
</ProjectPropsProvider>
</Layout>
<PayoutsProvider>
<Layout>
<ProjectPropsProvider>
<BulkCodeProvider>
{isMap ? (
<>
{project ? (
<MapLayout />
) : projects ? (
<MapLayout />
) : null}
<div
style={
config.tenantName === 'planet' ||
config.tenantName === 'ttc'
? {}
: { display: 'none' }
}
>
<PlayButton setshowVideo={setshowVideo} />
</div>
</>
) : null}
<Component {...ProjectProps} />
</BulkCodeProvider>
</ProjectPropsProvider>
</Layout>
</PayoutsProvider>
</PlanetCashProvider>
</UserPropsProvider>
</QueryParamsProvider>
Expand Down
21 changes: 21 additions & 0 deletions pages/profile/payouts/add-bank-details.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { ReactElement } from 'react';
import UserLayout from '../../../src/features/common/Layout/UserLayout/UserLayout';
import Head from 'next/head';
import ManagePayouts, {
ManagePayoutTabs,
} from '../../../src/features/user/ManagePayouts';
import i18next from '../../../i18n';

const { useTranslation } = i18next;

export default function AddBankDetailsPage(): ReactElement {
const { t, ready } = useTranslation('me');
return (
<UserLayout>
<Head>
<title>{ready ? t('managePayouts.titleAddBankDetails') : ''}</title>
</Head>
<ManagePayouts step={ManagePayoutTabs.ADD_BANK_DETAILS} />
</UserLayout>
);
}
22 changes: 22 additions & 0 deletions pages/profile/payouts/edit-bank-details/[id].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { ReactElement } from 'react';
import UserLayout from '../../../../src/features/common/Layout/UserLayout/UserLayout';
import Head from 'next/head';
import ManagePayouts, {
ManagePayoutTabs,
} from '../../../../src/features/user/ManagePayouts';
import i18next from '../../../../i18n';

const { useTranslation } = i18next;

export default function EditBankDetailsPage(): ReactElement {
const { t, ready } = useTranslation('me');

return (
<UserLayout>
<Head>
<title>{ready ? t('managePayouts.titleEditBankDetails') : ''}</title>
</Head>
<ManagePayouts step={ManagePayoutTabs.OVERVIEW} isEdit={true} />
</UserLayout>
);
}
34 changes: 34 additions & 0 deletions pages/profile/payouts/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { ReactElement, useState } from 'react';
import TopProgressBar from '../../../src/features/common/ContentLoaders/TopProgressBar';
import UserLayout from '../../../src/features/common/Layout/UserLayout/UserLayout';
import Head from 'next/head';
import ManagePayouts, {
ManagePayoutTabs,
} from '../../../src/features/user/ManagePayouts';
import i18next from '../../../i18n';

const { useTranslation } = i18next;

export default function OverviewPage(): ReactElement {
const { t, ready } = useTranslation('me');
const [progress, setProgress] = useState(0);

return (
<>
{progress > 0 && (
<div className={'topLoader'}>
<TopProgressBar progress={progress} />
</div>
)}
<UserLayout>
<Head>
<title>{ready ? t('managePayouts.titleOverview') : ''}</title>
</Head>
<ManagePayouts
step={ManagePayoutTabs.OVERVIEW}
setProgress={setProgress}
/>
</UserLayout>
</>
);
}
21 changes: 21 additions & 0 deletions pages/profile/payouts/schedule.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { ReactElement } from 'react';
import UserLayout from '../../../src/features/common/Layout/UserLayout/UserLayout';
import Head from 'next/head';
import ManagePayouts, {
ManagePayoutTabs,
} from '../../../src/features/user/ManagePayouts';
import i18next from '../../../i18n';

const { useTranslation } = i18next;

export default function PayoutSchedulePage(): ReactElement {
const { t, ready } = useTranslation('me');
return (
<UserLayout>
<Head>
<title>{ready ? t('managePayouts.titlePayoutSchedule') : ''}</title>
</Head>
<ManagePayouts step={ManagePayoutTabs.PAYOUT_SCHEDULE} />
</UserLayout>
);
}
76 changes: 76 additions & 0 deletions public/assets/images/icons/BankAccountLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React, { ReactElement } from 'react';

function BankAccountListLoader(): ReactElement {
return (
<svg
role="img"
width="100%"
height="100%"
aria-labelledby="loading-aria"
viewBox="0 0 700 360"
preserveAspectRatio="none"
>
<title id="loading-aria">Loading...</title>
<rect
x="0"
y="0"
width="100%"
height="100%"
clipPath="url(#clipPath)"
style={{ fill: 'url("#fill")' }}
></rect>
<defs>
<clipPath id="clipPath">
<rect x="20" y="20" rx="3" ry="3" width="160" height="20" />
<rect x="20" y="80" rx="3" ry="3" width="100" height="20" />
<rect x="360" y="80" rx="3" ry="3" width="100" height="20" />
<rect x="20" y="110" rx="3" ry="3" width="60" height="10" />
<rect x="360" y="110" rx="3" ry="3" width="60" height="10" />
<rect x="20" y="150" rx="3" ry="3" width="100" height="20" />
<rect x="360" y="150" rx="3" ry="3" width="100" height="20" />
<rect x="20" y="180" rx="3" ry="3" width="60" height="10" />
<rect x="360" y="180" rx="3" ry="3" width="60" height="10" />
<rect x="20" y="220" rx="3" ry="3" width="100" height="20" />
<rect x="360" y="220" rx="3" ry="3" width="100" height="20" />
<rect x="20" y="250" rx="3" ry="3" width="60" height="10" />
<rect x="360" y="250" rx="3" ry="3" width="60" height="10" />
<rect x="20" y="290" rx="3" ry="3" width="100" height="20" />
<rect x="360" y="290" rx="3" ry="3" width="100" height="20" />
<rect x="20" y="320" rx="3" ry="3" width="60" height="10" />
<rect x="360" y="320" rx="3" ry="3" width="60" height="10" />
</clipPath>
<linearGradient id="fill">
<stop offset="0.599964" stopColor="#f3f3f3" stopOpacity="1">
<animate
attributeName="offset"
values="-2; -2; 1"
keyTimes="0; 0.25; 1"
dur="2s"
repeatCount="indefinite"
></animate>
</stop>
<stop offset="1.59996" stopColor="#ecebeb" stopOpacity="1">
<animate
attributeName="offset"
values="-1; -1; 2"
keyTimes="0; 0.25; 1"
dur="2s"
repeatCount="indefinite"
></animate>
</stop>
<stop offset="2.59996" stopColor="#f3f3f3" stopOpacity="1">
<animate
attributeName="offset"
values="0; 0; 3"
keyTimes="0; 0.25; 1"
dur="2s"
repeatCount="indefinite"
></animate>
</stop>
</linearGradient>
</defs>
</svg>
);
}

export default BankAccountListLoader;
73 changes: 73 additions & 0 deletions public/static/locales/en/managePayouts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"title": "Manage Payouts",
"description": "Keep your payout information updated (e.g. schedule, bank details) to facilitate smooth payouts",
"tabPayoutSchedule": "Payout Schedule",
"tabAddBankDetails": "Add Bank Details",
"tabOverview": "Overview",
"payoutInformation1": "Payouts are processed automatically every year, or when an organization collects 30,000 EUR or its equivalent in other currency.",
"payoutInformation2": "Payouts are issued by Plant-for-the-Planet Foundation and its sister organizations eg: Plant-for-the-Planet US, Plant-for-the-Planet Switzerland etc.",
"payoutInformation3": "You can adjust the payout schedule and receive frequent payouts as long as you meet the 1,500 EUR minimum amount criteria.",
"supportInformation": "If you have an exceptional case, please contact<1></1><2>support@plant-for-the-planet.org</2>.",
"scheduleFrequencies": {
"monthly": "Monthly",
"quarterly": "Quarterly",
"semiannually": "Semi-Annual",
"annually": "Annual",
"manual": "Manual"
},
"defaultCurrency": "Default",
"labels": {
"currency": "Currency",
"scheduleFrequency": "Payment Frequency",
"payoutMinAmount": "Minimum Payout Amount",
"bankName": "Bank Name",
"bankAddress": "Bank Address",
"holderName": "Name of Account Holder",
"holderAddress": "Address of Account Holder",
"remarks": "Additional Details",
"accountNumber": "IBAN / Account Number",
"routingNumber": "ABA / Routing Number (US Only)",
"bic": "BIC / SWIFT",
"branchCode": "Branch Code"
},
"errors": {
"scheduleFrequencyRequired": "Payment frequency is required",
"payoutMinAmountRequired": "Minimum payout amount is required",
"payoutMinAmountTooLow": "Minimum payout amount should be at least {{currency}} {{minAmount}}",
"bankNameRequired": "Bank name is required.",
"bankAddressRequired": "Bank address is required.",
"holderNameRequired": "Holder name is required.",
"holderAddressRequired": "Holder address is required.",
"accountNumberRequired": "Account number is required.",
"bicRequired": "BIC / SWIFT code is required.",
"noAccountFound": "No account was retrieved"
},
"placeholders": {
"payoutMinAmount": "Should be at least {{currency}} {{minAmount}}",
"bankName": "e.g. Century Bank LLC",
"bankAddress": "e.g. 1 West St, Hamington Way, MA, 10311, USA",
"holderName": "e.g. John Doe",
"holderAddress": "e.g. 21 Penn Avenue, MA 10317 USA",
"remarks": "e.g. Please include ref acct=1237 on the transfer."
},
"helperText": {
"currency": "Select “Default” if this is your standard bank account, if you need to provide special details for a currency please select it here and provide the details. We will also use the standard minimum amounts for a payout.",
"remarks": "Provide additional details, for example Intermediary Bank Details, PCs (Purpose Codes) or other References here."
},
"saveButton": "Save",
"accountError": {
"min_amount_range": "The minimum payout amount must be at least {{currency}} {{min}}.",
"min_amount_forbidden": "You may not specify a payout minimum amount for the default account.",
"account_duplicate": "There is already a {{currency}} account.",
"default": "Something went wrong while creating an account. Please try after a while."
},
"accountCreationSuccess": "Your account details were successfully saved.",
"accountUpdationSuccess": "Your account details were successfully updated.",
"scheduleSaveSuccess": "Your payout schedule was successfully saved.",
"editAccountButton": "Edit Account",
"accountTitleText": "Transfer for {{currency}}",
"addBankDetailsButton": "Add Bank Details",
"noBankAccountText": "You haven't added any bank details yet.",
"editBankAccountTitle": "Edit Account",
"minPayoutText": "Min. Payout: {{amount}}"
}
3 changes: 2 additions & 1 deletion public/static/locales/en/manageProjects.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,6 @@
"onlyEnglish": "Please create/edit projects in English only. Translations of Projects are managed automatically by Plant-for-the-Planet.",
"since": "since",
"Since": "Since",
"and": "and"
"and": "and",
"managePayoutsButton": "Manage Payouts"
}
7 changes: 7 additions & 0 deletions public/static/locales/en/me.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"managePayouts": {
"menuText": "Manage Payouts",
"titleOverview": "Manage Payouts - Overview",
"titleAddBankDetails": "Manage Payouts - Add Bank Details",
"titlePayoutSchedule": "Manage Payouts - Schedule Payouts",
"titleEditBankDetails": "Manage Payouts - Edit Bank Details"
},
"donationLinkTitle": "Build Donation Link",
"planetcash": {
"menuText": "PlanetCash",
Expand Down
Loading