-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
747f183
commit f8c1578
Showing
22 changed files
with
500 additions
and
353 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 0 additions & 162 deletions
162
.../PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/EditPaymentMethod/EditPaymentMethod.tsx
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/EditPaymentMethod/index.ts
This file was deleted.
Oops, something went wrong.
File renamed without changes.
93 changes: 93 additions & 0 deletions
93
...lanPage/subRoutes/CurrentOrgPlan/BillingDetails/EditPaymentMethods/EditPaymentMethods.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import React, { useState } from 'react' | ||
import { z } from 'zod' | ||
|
||
import { SubscriptionDetailSchema } from 'services/account/useAccountDetails' | ||
|
||
import AddressForm from './Address/AddressForm' | ||
import EditPaymentMethodForm from './PaymentMethod/PaymentMethodForm' | ||
|
||
interface EditPaymentMethodProps { | ||
setEditMode: (isEditMode: boolean) => void | ||
provider: string | ||
owner: string | ||
subscriptionDetail: z.infer<typeof SubscriptionDetailSchema> | ||
} | ||
|
||
const EditPaymentMethod = ({ | ||
setEditMode, | ||
provider, | ||
owner, | ||
subscriptionDetail, | ||
}: EditPaymentMethodProps) => { | ||
const [activeTab, setActiveTab] = useState<'primary' | 'secondary'>('primary') | ||
const isSecondaryPaymentMethodFeatureEnabled = false | ||
|
||
return ( | ||
<div className="flex flex-col gap-4 p-4"> | ||
<h3 className="font-semibold">Edit payment method</h3> | ||
<div> | ||
{/* Tabs for Primary and Secondary Payment Methods */} | ||
<div className="ml-2 flex border-b border-ds-gray-tertiary"> | ||
{[ | ||
'primary', | ||
...(isSecondaryPaymentMethodFeatureEnabled ? ['secondary'] : []), | ||
].map((tab) => ( | ||
<button | ||
key={tab} | ||
className={`py-2 ${tab === 'primary' ? 'mr-4' : ''} ${ | ||
activeTab === tab | ||
? 'border-b-2 border-ds-gray-octonary font-semibold text-ds-gray-octonary' | ||
: 'text-ds-gray-quinary hover:border-b-2 hover:border-ds-gray-quinary' | ||
}`} | ||
onClick={() => setActiveTab(tab as 'primary' | 'secondary')} | ||
> | ||
{tab === 'primary' ? 'Primary' : 'Secondary'} Payment Method | ||
</button> | ||
))} | ||
</div> | ||
|
||
{/* Payment Details for the selected tab */} | ||
<div className="m-4"> | ||
{activeTab === 'primary' && ( | ||
<div> | ||
<EditPaymentMethodForm | ||
closeForm={() => setEditMode(false)} | ||
provider={provider} | ||
owner={owner} | ||
/> | ||
<AddressForm | ||
address={ | ||
subscriptionDetail?.defaultPaymentMethod?.billingDetails | ||
?.address | ||
} | ||
name={ | ||
Check failure on line 63 in src/pages/PlanPage/subRoutes/CurrentOrgPlan/BillingDetails/EditPaymentMethods/EditPaymentMethods.tsx
|
||
subscriptionDetail?.defaultPaymentMethod?.billingDetails?.name | ||
} | ||
closeForm={() => setEditMode(false)} | ||
provider={provider} | ||
owner={owner} | ||
/> | ||
</div> | ||
)} | ||
{activeTab === 'secondary' && | ||
isSecondaryPaymentMethodFeatureEnabled && ( | ||
<div> | ||
<EditPaymentMethodForm | ||
closeForm={() => setEditMode(false)} | ||
provider={provider} | ||
owner={owner} | ||
/> | ||
<AddressForm | ||
closeForm={() => setEditMode(false)} | ||
provider={provider} | ||
owner={owner} | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default EditPaymentMethod |
Oops, something went wrong.