Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟 ☁️ Free alpha/beta connectors pills #21564

Merged
merged 7 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@use "scss/colors";
@use "scss/variables";

.pill {
display: inline-flex;
align-items: center;
padding: 2px 6px;
background-color: colors.$grey-100;
border-radius: variables.$border-radius-pill;
text-transform: uppercase;
font-size: 10px;
line-height: initial;
color: colors.$dark-blue-500;
font-weight: 600;

&--small {
font-size: 8px;
}

&--contains-tag {
padding-right: 2px;
}
}

.freeTag {
background-color: colors.$green-300;
color: colors.$white;
border-radius: variables.$border-radius-pill;
padding: 2px 5px;
margin-left: 2px;
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import { FormattedMessage } from "react-intl";
import styled from "styled-components";
import classNames from "classnames";
import { FormattedMessage, useIntl } from "react-intl";

import { GAIcon } from "components/icons/GAIcon";
import { Tooltip } from "components/ui/Tooltip";

import { ReleaseStage } from "core/request/AirbyteClient";

const Stage = styled.div<{ $small: boolean }>`
display: inline-block;
padding: 2px 6px;
background: ${({ theme }) => theme.greyColor20};
border-radius: 25px;
text-transform: uppercase;
font-size: ${({ $small }) => ($small ? "8px" : "10px")};
line-height: initial;
color: ${({ theme }) => theme.textColor};
`;
import styles from "./ReleaseStageBadge.module.scss";

interface ReleaseStageBadgeProps {
small?: boolean;
Expand All @@ -24,9 +15,17 @@ interface ReleaseStageBadgeProps {
* Whether to show a detailed message via a tooltip. If not specified, will be {@code true}.
*/
tooltip?: boolean;
showFreeTag?: boolean;
}

export const ReleaseStageBadge: React.FC<ReleaseStageBadgeProps> = ({ stage, small, tooltip = true }) => {
export const ReleaseStageBadge: React.FC<ReleaseStageBadgeProps> = ({
stage,
small,
tooltip = true,
showFreeTag = false,
}) => {
const { formatMessage } = useIntl();

if (!stage || stage === ReleaseStage.custom) {
return null;
}
Expand All @@ -35,9 +34,17 @@ export const ReleaseStageBadge: React.FC<ReleaseStageBadgeProps> = ({ stage, sma
stage === ReleaseStage.generally_available ? (
<GAIcon />
) : (
<Stage $small={!!small}>
<div
className={classNames(styles.pill, {
[styles["pill--small"]]: small,
[styles["pill--contains-tag"]]: showFreeTag,
})}
>
<FormattedMessage id={`connector.releaseStage.${stage}`} />
</Stage>
{showFreeTag && (
<span className={styles.freeTag}>{formatMessage({ id: "freeConnectorProgram.releaseStageBadge.free" })}</span>
)}
</div>
);

return tooltip ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

.pill {
z-index: 2;

// HACK: the hardcoded top margin is to vertically center the image, which was exported
// from Figma with an off-center vertical alignment
margin-top: 2em;
}

.contentWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { StripeCheckoutSessionCreate, StripeCheckoutSessionRead } from "packages
import { ReactComponent as CardSVG } from "./cards.svg";
import { ReactComponent as ConnectorGridSvg } from "./connectorGrid.svg";
import styles from "./EnrollmentModal.module.scss";
import { ReactComponent as FreeAlphaBetaPillsSVG } from "./free-alpha-beta-pills.svg";
import { ReactComponent as FreeSVG } from "./free.svg";
import { ReactComponent as MailSVG } from "./mail.svg";

Expand Down Expand Up @@ -95,8 +96,7 @@ export const EnrollmentModalContent: React.FC<EnrollmentModalContentProps> = ({
<div className={styles.headerBackgroundImageContainer}>
<ConnectorGridSvg />
</div>
<div className={styles.pill}>Pill #1</div>
<div className={styles.pill}>Pill #2</div>
<FreeAlphaBetaPillsSVG className={styles.pill} />
</FlexContainer>
<div className={styles.contentWrapper}>
<Heading size="lg" as="h2" className={styles.contentHeader}>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export const useFreeConnectorProgram = () => {
({ hasEligibleConnector, hasPaymentAccountSaved }) => {
const userIsEligibleToEnroll = !hasPaymentAccountSaved && hasEligibleConnector;

return freeConnectorProgramEnabled && userIsEligibleToEnroll;
return {
showEnrollmentUi: freeConnectorProgramEnabled && userIsEligibleToEnroll,
isEnrolled: freeConnectorProgramEnabled && hasPaymentAccountSaved,
};
}
)
);
Expand Down
1 change: 1 addition & 0 deletions airbyte-webapp/src/packages/cloud/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,6 @@
"freeConnectorProgram.enrollmentModal.cancelButtonText": "Cancel",
"freeConnectorProgram.enrollmentModal.enrollButtonText": "Enroll now!",
"freeConnectorProgram.enrollmentModal.unvalidatedEmailButtonText": "Resend email validation",
"freeConnectorProgram.releaseStageBadge.free": "Free",
"freeConnectorProgram.youCanEnroll": "You can <enrollLink>enroll</enrollLink> in the <b>Free Connector Program</b> to use Alpha and Beta connectors for <freeText>free</freeText>."
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import styles from "./CreditsPage.module.scss";
const CreditsPage: React.FC = () => {
const { emailVerified } = useAuthService();
useTrackPage(PageTrackingCodes.CREDITS);
const { data: showEnrollmentUi } = useFreeConnectorProgram();
const { data: freeConnectorProgramInfo } = useFreeConnectorProgram();
const { showEnrollmentUi } = freeConnectorProgramInfo || {};

return (
<MainPageWithScroll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const ConnectionPageTitle: React.FC = () => {

const { connection } = useConnectionEditService();

const { data: displayEnrollmentCallout } = useFreeConnectorProgram();
const { data: freeConnectorProgramInfo } = useFreeConnectorProgram();
const displayEnrollmentCallout = freeConnectorProgramInfo?.showEnrollmentUi;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be the same in both CreditsPage and ConnectionTitlePage if we just rename the variable showEnrollmentUi... No real strong feeling in how we do it.


const steps = useMemo(() => {
const steps = [
Expand Down