Skip to content

Commit 1caee75

Browse files
authored
Merge pull request #981 from topcoder-platform/dev
Redirect payment settings to wallet app, and Lint cleanup
2 parents a596365 + c6c1c2e commit 1caee75

File tree

4 files changed

+117
-122
lines changed

4 files changed

+117
-122
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"shortid": "^2.2.16",
119119
"styled-components": "^5.3.6",
120120
"swr": "^1.3.0",
121-
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.26",
121+
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.27",
122122
"turndown": "^4.0.2",
123123
"typescript": "^4.8.4",
124124
"universal-navigation": "https://github.com/topcoder-platform/universal-navigation#9fc50d938be7182",

Diff for: src/apps/accounts/src/settings/tabs/AccountSettingsTabs.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { Dispatch, FC, SetStateAction, useMemo, useState } from 'react'
22
import { useLocation } from 'react-router-dom'
33
import { KeyedMutator } from 'swr'
44

5+
import { EnvironmentConfig } from '~/config'
56
import { useMemberTraits, UserProfile, UserTraits } from '~/libs/core'
67
import { PageTitle, TabsNavbar, TabsNavItem } from '~/libs/ui'
78

89
import { AccountSettingsTabsConfig, AccountSettingsTabViews, getHashFromTabId, getTabIdFromHash } from './config'
910
import { AccountTab } from './account'
1011
import { PreferencesTab } from './preferences'
11-
import { PaymentsTab } from './payments'
1212
import { ToolsTab } from './tools'
1313
import { TCandYouTab } from './tcandyou'
1414
import styles from './AccountSettingsTabs.module.scss'
@@ -31,9 +31,13 @@ const AccountSettingsTabs: FC<AccountSettingsTabsProps> = (props: AccountSetting
3131
} = useMemberTraits(props.profile.handle)
3232

3333
function handleTabChange(tabId: string): void {
34-
setActiveTab(tabId)
35-
window.location.hash = getHashFromTabId(tabId)
36-
mutateTraits() // mutate member traits to refresh the data
34+
if (tabId === AccountSettingsTabViews.payment) {
35+
window.location.href = `https://wallet.${EnvironmentConfig.TC_DOMAIN}`
36+
} else {
37+
setActiveTab(tabId)
38+
window.location.hash = getHashFromTabId(tabId)
39+
mutateTraits() // mutate member traits to refresh the data
40+
}
3741
}
3842

3943
return (
@@ -66,10 +70,6 @@ const AccountSettingsTabs: FC<AccountSettingsTabsProps> = (props: AccountSetting
6670
{activeTab === AccountSettingsTabViews.preferences && (
6771
<PreferencesTab profile={props.profile} />
6872
)}
69-
70-
{activeTab === AccountSettingsTabViews.payment && (
71-
<PaymentsTab profile={props.profile} />
72-
)}
7373
</div>
7474
)
7575
}

Diff for: src/apps/wallet-admin/src/lib/components/payment-view/PaymentView.tsx

+106-111
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ const PaymentView: React.FC<PaymentViewProps> = (props: PaymentViewProps) => {
110110

111111
<div className={styles.infoItem}>
112112
<span className={styles.label}>Net Payment</span>
113-
<p className={styles.value}>{props.payment.netPaymentNumber.toLocaleString(undefined, { currency: 'USD', style: 'currency' })}</p>
113+
<p className={styles.value}>
114+
{props.payment.netPaymentNumber.toLocaleString(undefined, {
115+
currency: 'USD',
116+
style: 'currency',
117+
})}
118+
</p>
114119
</div>
115120

116121
<div className={styles.infoItem}>
@@ -124,18 +129,14 @@ const PaymentView: React.FC<PaymentViewProps> = (props: PaymentViewProps) => {
124129
</div>
125130

126131
{props.payment.datePaid !== '-' && (
127-
(
128-
<div className={styles.infoItem}>
129-
<span className={styles.label}>Date Paid</span>
130-
<p className={styles.value}>{props.payment.datePaid}</p>
131-
</div>
132-
))}
132+
<div className={styles.infoItem}>
133+
<span className={styles.label}>Date Paid</span>
134+
<p className={styles.value}>{props.payment.datePaid}</p>
135+
</div>
136+
)}
133137

134138
<div className={styles.infoItem}>
135-
<Button
136-
onClick={() => handleToggleView('audit')}
137-
label='View Audit'
138-
/>
139+
<Button onClick={() => handleToggleView('audit')} label='View Audit' />
139140
{props.payment.status.toUpperCase() === 'PAID' && (
140141
<Button
141142
onClick={() => handleToggleView('external_transaction')}
@@ -149,127 +150,121 @@ const PaymentView: React.FC<PaymentViewProps> = (props: PaymentViewProps) => {
149150
{view === 'audit' && (
150151
<>
151152
<div className={styles.auditSection}>
152-
{auditLines && auditLines.length > 0 && auditLines.map(line => (
153-
<Collapsible
154-
key={line.id}
155-
header={(
156-
<h3>
157-
{
158-
new Date(line.createdAt)
159-
.toLocaleString()
160-
}
161-
</h3>
162-
)}
163-
containerClass={styles.container}
164-
contentClass={styles.content}
165-
>
166-
<div className={styles.auditItem}>
167-
<div>
168-
<p>
169-
<strong>User:</strong>
170-
{' '}
171-
{line.userId}
172-
</p>
173-
<p>
174-
<strong>Action:</strong>
175-
{' '}
176-
{formatAction(line.action)}
177-
</p>
178-
<p>
179-
<strong>Note:</strong>
180-
{' '}
181-
{line.note}
182-
</p>
183-
</div>
184-
</div>
185-
</Collapsible>
186-
))}
187-
{(auditLines === undefined || auditLines.length === 0)
188-
&& (
189-
<div className={styles.auditItem}>
190-
<p>No audit data available</p>
191-
</div>
192-
)}
193-
</div>
194-
<div className={styles.infoItem}>
195-
<Button
196-
onClick={() => handleToggleView('details')}
197-
label='Back to Details'
198-
/>
199-
</div>
200-
</>
201-
)}
202-
203-
{view === 'external_transaction' && (
204-
<>
205-
<div className={styles.auditSection}>
206-
{externalTransactionAudit && externalTransactionAudit.length > 0 && externalTransactionAudit.map((externalTransaction: PayoutAudit, index: number) => (
207-
<>
153+
{auditLines
154+
&& auditLines.length > 0
155+
&& auditLines.map(line => (
208156
<Collapsible
209-
key={`internal-record${index}`}
210-
header={(
211-
<h3>Internal Record</h3>
212-
)}
157+
key={line.id}
158+
header={
159+
(
160+
<h3>
161+
{
162+
new Date(line.createdAt)
163+
.toLocaleString()
164+
}
165+
</h3>
166+
)
167+
}
213168
containerClass={styles.container}
214169
contentClass={styles.content}
215170
>
216171
<div className={styles.auditItem}>
217172
<div>
218173
<p>
219-
<strong>Provider Used:</strong>
220-
{' '}
221-
{externalTransaction.paymentMethodUsed}
174+
<strong>User:</strong>
175+
{line.userId}
222176
</p>
223177
<p>
224-
<strong>Status:</strong>
225-
{' '}
226-
{externalTransaction.status}
178+
<strong>Action:</strong>
179+
{formatAction(line.action)}
227180
</p>
228181
<p>
229-
<strong>Processed At:</strong>
230-
{' '}
231-
{externalTransaction.createdAt}
182+
<strong>Note:</strong>
183+
{line.note}
232184
</p>
233-
<p>
234-
<strong>Totl Amount Processed:</strong>
235-
{' '}
236-
{externalTransaction.totalNetAmount}
237-
</p>
238-
</div>
239-
</div>
240-
</Collapsible>
241-
<Collapsible
242-
key={`external-record${index}`}
243-
header={(
244-
<h3>External Record</h3>
245-
)}
246-
containerClass={styles.container}
247-
contentClass={styles.content}
248-
>
249-
<div className={styles.auditItem}>
250-
<div>
251-
<pre>{JSON.stringify(externalTransaction.externalTransactionDetails, undefined, 2)}</pre>
252185
</div>
253186
</div>
254187
</Collapsible>
255-
</>
256-
))}
257-
{(externalTransactionAudit === undefined)
258-
&& (
259-
<div className={styles.auditItem}>
260-
<p>No external transaction data is available</p>
261-
</div>
262-
)}
188+
))}
189+
{(auditLines === undefined || auditLines.length === 0) && (
190+
<div className={styles.auditItem}>
191+
<p>No audit data available</p>
192+
</div>
193+
)}
263194
</div>
264195
<div className={styles.infoItem}>
265-
<Button
266-
onClick={() => handleToggleView('details')}
267-
label='Back to Details'
268-
/>
196+
<Button onClick={() => handleToggleView('details')} label='Back to Details' />
269197
</div>
270198
</>
271199
)}
272200

201+
{view === 'external_transaction' && (
202+
<>
203+
<div className={styles.auditSection}>
204+
{externalTransactionAudit
205+
&& externalTransactionAudit.length > 0
206+
&& externalTransactionAudit.map((externalTransaction: PayoutAudit, index: number) => (
207+
<>
208+
<Collapsible
209+
key={`internal-record${index}`}
210+
header={<h3>Internal Record</h3>}
211+
containerClass={styles.container}
212+
contentClass={styles.content}
213+
>
214+
<div className={styles.auditItem}>
215+
<div>
216+
<p>
217+
<strong>Provider Used:</strong>
218+
{' '}
219+
{externalTransaction.paymentMethodUsed}
220+
</p>
221+
<p>
222+
<strong>Status:</strong>
223+
{externalTransaction.status}
224+
</p>
225+
<p>
226+
<strong>Processed At:</strong>
227+
{externalTransaction.createdAt}
228+
</p>
229+
<p>
230+
<strong>Total Amount Processed:</strong>
231+
{' '}
232+
{externalTransaction.totalNetAmount}
233+
</p>
234+
</div>
235+
</div>
236+
</Collapsible>
237+
<Collapsible
238+
key={`external-record${index}`}
239+
header={<h3>External Record</h3>}
240+
containerClass={styles.container}
241+
contentClass={styles.content}
242+
>
243+
<div className={styles.auditItem}>
244+
<div>
245+
<pre>
246+
{JSON.stringify(
247+
externalTransaction.externalTransactionDetails,
248+
undefined,
249+
2,
250+
)}
251+
</pre>
252+
</div>
253+
</div>
254+
</Collapsible>
255+
</>
256+
))}
257+
{externalTransactionAudit === undefined && (
258+
<div className={styles.auditItem}>
259+
<p>No external transaction data is available</p>
260+
</div>
261+
)}
262+
</div>
263+
<div className={styles.infoItem}>
264+
<Button onClick={() => handleToggleView('details')} label='Back to Details' />
265+
</div>
266+
</>
267+
)}
273268
</div>
274269
</div>
275270
)

Diff for: yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -18449,9 +18449,9 @@ tar@^6.1.13:
1844918449
mkdirp "^1.0.3"
1845018450
yallist "^4.0.0"
1845118451

18452-
tc-auth-lib@topcoder-platform/tc-auth-lib#1.0.26:
18452+
tc-auth-lib@topcoder-platform/tc-auth-lib#1.0.27:
1845318453
version "1.0.2"
18454-
resolved "https://codeload.github.com/topcoder-platform/tc-auth-lib/tar.gz/3e1b78473b421327c492a814df3f6c72f17e860f"
18454+
resolved "https://codeload.github.com/topcoder-platform/tc-auth-lib/tar.gz/dc5b3a29ac3b8e2a0f386fce411c6533c2f33f05"
1845518455
dependencies:
1845618456
lodash "^4.17.19"
1845718457

0 commit comments

Comments
 (0)