Skip to content

Commit 49ee78b

Browse files
authored
🪟 🐛 Fix out of credits banner (#15216)
* fix out of credits banner * change intl string id * show trial expiration over credit issues
1 parent 7b4f59b commit 49ee78b

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

airbyte-webapp/src/packages/cloud/locales/en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@
110110
"credits.connection": "Connection",
111111
"credits.usage": "Usage",
112112
"credits.noData": "Data is empty",
113+
"credits.creditProblems.lnkText": "add credits",
113114
"credits.creditsProblem.negative_within_grace_period": "Your workspace is out of credits! Please add more credits to make sure your syncs keep running!",
114-
"credits.creditsProblem.negative_beyond_grace_period": "You’re out of credits! To set up connections and run syncs, <lnk>add credits</lnk>.",
115-
"credits.creditsProblem.negative_max_threshold": "You’re out of credits! To set up connections and run syncs, <lnk>add credits</lnk>.",
115+
"credits.creditsProblem.negative_beyond_grace_period": "You’re out of credits! To set up connections and run syncs, {lnk}.",
116+
"credits.creditsProblem.negative_max_threshold": "You’re out of credits! To set up connections and run syncs, {lnk}.",
116117
"credits.emailVerificationRequired": "You need to verify your email address before you can buy credits.",
117118
"credits.emailVerification.resendConfirmation": "We send you a new verification link.",
118119
"credits.emailVerification.resend": "Send verification link again",

airbyte-webapp/src/packages/cloud/views/layout/MainView/MainView.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useMemo } from "react";
2-
import { useIntl } from "react-intl";
2+
import { FormattedMessage, useIntl } from "react-intl";
33
import { Link, Outlet } from "react-router-dom";
44
import styled from "styled-components";
55

@@ -41,6 +41,8 @@ const MainView: React.FC = (props) => {
4141
const { formatMessage } = useIntl();
4242
const workspace = useCurrentWorkspace();
4343
const cloudWorkspace = useGetCloudWorkspace(workspace.workspaceId);
44+
cloudWorkspace.creditStatus = CreditStatus.NEGATIVE_BEYOND_GRACE_PERIOD;
45+
4446
const showCreditsBanner =
4547
cloudWorkspace.creditStatus &&
4648
[
@@ -54,13 +56,17 @@ const MainView: React.FC = (props) => {
5456

5557
const alertMessage = useMemo(() => {
5658
if (alertToShow === "credits") {
57-
return formatMessage(
58-
{ id: `credits.creditsProblem.${cloudWorkspace.creditStatus}` },
59-
{
60-
values: {
61-
lnk: (content: React.ReactNode) => <Link to={CloudRoutes.Credits}>{content}</Link>,
62-
},
63-
}
59+
return (
60+
<FormattedMessage
61+
id={`credits.creditsProblem.${cloudWorkspace.creditStatus}`}
62+
values={{
63+
lnk: (
64+
<Link to={CloudRoutes.Credits}>
65+
<FormattedMessage id="credits.creditProblems.lnkText" />
66+
</Link>
67+
),
68+
}}
69+
/>
6470
);
6571
} else if (alertToShow === "trial") {
6672
const { trialExpiryTimestamp } = cloudWorkspace;

0 commit comments

Comments
 (0)