-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1838 from cardstack/cs-7044-cs-7555-cs-7556-subsc…
…ription-section-in-account-settings Add subscription data section in account settings
- Loading branch information
Showing
11 changed files
with
615 additions
and
189 deletions.
There are no files selected for viewing
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
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
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: 162 additions & 0 deletions
162
packages/host/app/components/operator-mode/profile/profile-subscription.gts
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,162 @@ | ||
import { service } from '@ember/service'; | ||
import Component from '@glimmer/component'; | ||
|
||
import { | ||
BoxelButton, | ||
FieldContainer, | ||
LoadingIndicator, | ||
} from '@cardstack/boxel-ui/components'; | ||
import { IconHexagon } from '@cardstack/boxel-ui/icons'; | ||
|
||
import WithSubscriptionData from '@cardstack/host/components/with-subscription-data'; | ||
import BillingService from '@cardstack/host/services/billing-service'; | ||
|
||
interface Signature { | ||
Args: {}; | ||
Element: HTMLElement; | ||
} | ||
|
||
export default class ProfileSubscription extends Component<Signature> { | ||
<template> | ||
<WithSubscriptionData as |subscriptionData|> | ||
<FieldContainer | ||
@label='Membership Tier' | ||
@tag='label' | ||
class='profile-field' | ||
> | ||
<div class='profile-subscription'> | ||
<div class='monthly-credit'> | ||
<div class='plan-name'>{{subscriptionData.plan}}</div> | ||
<div class='credit-info'> | ||
<span class='credit-info__label'>Monthly Credit</span> | ||
{{subscriptionData.monthlyCredit}} | ||
</div> | ||
</div> | ||
<BoxelButton | ||
@as='anchor' | ||
@kind='secondary-light' | ||
@size='extra-small' | ||
@disabled={{this.billingService.fetchingStripePaymentLinks}} | ||
@href={{this.billingService.customerPortalLink.url}} | ||
target='_blank' | ||
data-test-manage-plan-button | ||
>Manage Plan</BoxelButton> | ||
</div> | ||
</FieldContainer> | ||
<FieldContainer | ||
@label='Additional Credit' | ||
@tag='label' | ||
class='profile-field' | ||
> | ||
<div class='additional-credit'> | ||
<div class='profile-subscription'> | ||
<div class='credit-info'> | ||
{{subscriptionData.additionalCredit}} | ||
</div> | ||
</div> | ||
<div class='buy-more-credits'> | ||
<span class='buy-more-credits__title'>Buy more credits</span> | ||
<div class='payment-links'> | ||
{{#if this.billingService.fetchingStripePaymentLinks}} | ||
<LoadingIndicator /> | ||
{{else}} | ||
{{#each | ||
this.billingService.extraCreditsPaymentLinks | ||
as |paymentLink index| | ||
}} | ||
<div class='payment-link' data-test-payment-link={{index}}> | ||
<span><IconHexagon width='16px' height='16px' /> | ||
{{paymentLink.creditReloadAmount}}</span> | ||
<BoxelButton | ||
@as='anchor' | ||
@kind='secondary-light' | ||
@size='extra-small' | ||
@href={{paymentLink.url}} | ||
target='_blank' | ||
data-test-pay-button={{index}} | ||
>Pay</BoxelButton> | ||
</div> | ||
{{/each}} | ||
{{/if}} | ||
</div> | ||
</div> | ||
</div> | ||
</FieldContainer> | ||
</WithSubscriptionData> | ||
<style scoped> | ||
.profile-field :deep(.invalid) { | ||
box-shadow: none; | ||
} | ||
.profile-field + .profile-field { | ||
margin-top: var(--boxel-sp-xl); | ||
} | ||
.profile-subscription { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.monthly-credit { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--boxel-sp); | ||
} | ||
.credit-info { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--boxel-sp-xs); | ||
padding-left: var(--boxel-sp-sm); | ||
border-left: 5px solid #c6c6c6; | ||
min-height: 40px; | ||
} | ||
.credit-info__label { | ||
font: var(--boxel-font-xs); | ||
letter-spacing: var(--boxel-lsp-xs); | ||
text-wrap: nowrap; | ||
line-height: 18px; | ||
} | ||
.additional-credit { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--boxel-sp); | ||
} | ||
.buy-more-credits { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--boxel-sp-sm); | ||
border-top: 1px solid var(--boxel-300); | ||
padding-top: var(--boxel-sp-sm); | ||
} | ||
.buy-more-credits__title { | ||
font: 600 var(--boxel-font-sm); | ||
} | ||
.payment-links { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--boxel-sp-sm); | ||
padding-left: var(--boxel-sp-xs); | ||
} | ||
.payment-link { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
border-bottom: 1px solid var(--boxel-300); | ||
padding: var(--boxel-sp-xxs); | ||
} | ||
.payment-link > span { | ||
color: var(--boxel-dark); | ||
font: 600 var(--boxel-font-sm); | ||
display: flex; | ||
align-items: center; | ||
gap: var(--boxel-sp-4xs); | ||
--icon-color: var(--boxel-teal); | ||
--boxel-loading-indicator-size: var(--boxel-icon-xs); | ||
} | ||
:deep(.buy-more-credits .boxel-loading-indicator) { | ||
width: 100%; | ||
text-align: center; | ||
} | ||
</style> | ||
</template> | ||
|
||
@service private declare billingService: BillingService; | ||
} |
Oops, something went wrong.