-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show subscription info on billing page (#14747)
- Loading branch information
Showing
7 changed files
with
90 additions
and
33 deletions.
There are no files selected for viewing
57 changes: 27 additions & 30 deletions
57
airbyte-webapp/src/components/ui/BorderedTiles/BorderedTiles.module.scss
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 |
---|---|---|
@@ -1,48 +1,45 @@ | ||
@use "scss/colors"; | ||
@use "scss/variables"; | ||
|
||
$min-width-horizontal: 900px; | ||
$min-width-small: 650px; | ||
$min-width-medium: 900px; | ||
$min-width-extra-wide: 1100px; | ||
|
||
.borderedTiles { | ||
display: grid; | ||
grid-auto-columns: 1fr; | ||
grid-template-rows: 1fr; | ||
gap: variables.$border-thin; | ||
background: colors.$grey-100; | ||
border: variables.$border-thin solid colors.$grey-100; | ||
border-radius: variables.$border-radius-md; | ||
container-type: inline-size; | ||
|
||
&__tile { | ||
grid-row: 1 / 1; | ||
background: colors.$foreground; | ||
&__grid { | ||
background: colors.$grey-100; | ||
border: variables.$border-thin solid colors.$grey-100; | ||
border-radius: variables.$border-radius-md; | ||
display: grid; | ||
grid-template-rows: 1fr; | ||
gap: variables.$border-thin; | ||
overflow: hidden; | ||
padding: variables.$spacing-xl; | ||
grid-auto-flow: column; | ||
grid-auto-columns: 1fr; | ||
|
||
@container (max-width: #{$min-width-horizontal}) { | ||
grid-row: auto; | ||
@container (max-width: #{$min-width-medium}) { | ||
grid-auto-flow: row; | ||
} | ||
|
||
&:first-child { | ||
border-top-left-radius: variables.$border-radius-md; | ||
border-bottom-left-radius: variables.$border-radius-md; | ||
&:has(> .borderedTiles__tile:nth-child(4)) { | ||
grid-auto-flow: unset; | ||
grid-template-columns: repeat(4, 1fr); | ||
|
||
@container (max-width: #{$min-width-horizontal}) { | ||
border-top-left-radius: variables.$border-radius-md; | ||
border-top-right-radius: variables.$border-radius-md; | ||
border-bottom-left-radius: 0; | ||
@container (max-width: #{$min-width-extra-wide}) { | ||
grid-template-columns: repeat(2, 1fr); | ||
} | ||
} | ||
|
||
&:last-child { | ||
border-top-right-radius: variables.$border-radius-md; | ||
border-bottom-right-radius: variables.$border-radius-md; | ||
|
||
@container (max-width: #{$min-width-horizontal}) { | ||
border-top-right-radius: 0; | ||
border-bottom-left-radius: variables.$border-radius-md; | ||
border-bottom-right-radius: variables.$border-radius-md; | ||
@container (max-width: #{$min-width-small}) { | ||
grid-template-columns: 1fr; | ||
} | ||
} | ||
} | ||
|
||
&__tile { | ||
background: colors.$foreground; | ||
overflow: hidden; | ||
padding: variables.$spacing-xl; | ||
} | ||
} |
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
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
49 changes: 49 additions & 0 deletions
49
...pp/src/packages/cloud/views/billing/OrganizationBillingPage/Subscription/Subscription.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,49 @@ | ||
import { FormattedDate, FormattedMessage } from "react-intl"; | ||
|
||
import { BorderedTile } from "components/ui/BorderedTiles"; | ||
import { Box } from "components/ui/Box"; | ||
import { DataLoadingError } from "components/ui/DataLoadingError"; | ||
import { FlexContainer, FlexItem } from "components/ui/Flex"; | ||
import { Heading } from "components/ui/Heading"; | ||
import { LoadingSkeleton } from "components/ui/LoadingSkeleton"; | ||
import { Text } from "components/ui/Text"; | ||
|
||
import { useCurrentWorkspace, useGetOrganizationSubscriptionInfo } from "core/api"; | ||
|
||
export const Subscription: React.FC = () => { | ||
const { organizationId } = useCurrentWorkspace(); | ||
const { data: subscription, isLoading, isError } = useGetOrganizationSubscriptionInfo(organizationId); | ||
return ( | ||
<BorderedTile> | ||
<Heading as="h2" size="sm"> | ||
<FormattedMessage id="settings.organization.billing.plan" /> | ||
</Heading> | ||
<Box pt="xl"> | ||
{isLoading && <LoadingSkeleton />} | ||
{subscription && ( | ||
<FlexContainer justifyContent="space-between" gap="lg" direction="column"> | ||
<Text size="lg">{subscription.name}</Text> | ||
{subscription.cancellationDate && ( | ||
<FlexItem> | ||
<FlexContainer alignItems="center" gap="xs"> | ||
<Text> | ||
<FormattedMessage id="settings.organization.billing.subscriptionCancelDate" /> | ||
</Text> | ||
</FlexContainer> | ||
|
||
<Text size="lg"> | ||
<FormattedDate value={subscription.cancellationDate} /> | ||
</Text> | ||
</FlexItem> | ||
)} | ||
</FlexContainer> | ||
)} | ||
{isError && ( | ||
<DataLoadingError> | ||
<FormattedMessage id="settings.organization.billing.planError" /> | ||
</DataLoadingError> | ||
)} | ||
</Box> | ||
</BorderedTile> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
...yte-webapp/src/packages/cloud/views/billing/OrganizationBillingPage/Subscription/index.ts
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 @@ | ||
export { Subscription } from "./Subscription"; |