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 Connectors Program inline enrollment callout #21315

Merged
merged 35 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
dbe90d3
genericize alert component
teallarson Jan 11, 2023
4d7e002
add className prop to alert
teallarson Jan 12, 2023
5de24d1
rename infobox "callout", swap in place for scss module
teallarson Jan 12, 2023
9a5c61d
fix imports
teallarson Jan 12, 2023
05fc5aa
use callout in place of alert
teallarson Jan 12, 2023
c76278c
add blue variant, remove icon prop
teallarson Jan 12, 2023
511fa47
remove single use prop, use a classname instead
teallarson Jan 12, 2023
abed550
WIP
teallarson Jan 12, 2023
ade40ff
WIP: i18n is mad
teallarson Jan 12, 2023
5ab16e9
add render logic
teallarson Jan 12, 2023
6197259
make i18n happy
teallarson Jan 12, 2023
7f49e92
create a hook instead
teallarson Jan 13, 2023
b8ceaf5
make structure more like other experiments
teallarson Jan 13, 2023
d353659
fix import order
teallarson Jan 13, 2023
8973b8c
cleanup from rebase
teallarson Jan 13, 2023
7424afb
cleanup
teallarson Jan 13, 2023
b8e5f47
one more cleanup bit
teallarson Jan 13, 2023
977ffc8
use new variant name
teallarson Jan 13, 2023
8056095
pointer
teallarson Jan 13, 2023
88aeb27
use experiment hook
teallarson Jan 13, 2023
d88be33
use button instead of span for enroll link
teallarson Jan 17, 2023
0ceaaeb
remove unneeded important
teallarson Jan 17, 2023
0a54d6d
remove even more css
teallarson Jan 17, 2023
b310fc9
hook up enrollment modal
teallarson Jan 17, 2023
091cea4
don't show during connector setup (yet)
teallarson Jan 17, 2023
f8ebe5e
implement api data
teallarson Jan 17, 2023
e95eae4
Merge branch 'master' into teal/inline-alert-ab-connectors
teallarson Jan 17, 2023
04378b7
Merge branch 'master' into teal/inline-alert-ab-connectors
teallarson Jan 18, 2023
550173c
Merge branch 'master' into teal/inline-alert-ab-connectors
teallarson Jan 18, 2023
d240934
bold text, remove redundant function declaration, check experiment st…
teallarson Jan 18, 2023
96c16f7
Merge branch 'master' into teal/inline-alert-ab-connectors
teallarson Jan 18, 2023
3ce0502
remove reference to experiment from hook for now
teallarson Jan 18, 2023
c5ae0be
cleanup whitespace changes
teallarson Jan 18, 2023
0690c01
Merge branch 'master' into teal/inline-alert-ab-connectors
teallarson Jan 18, 2023
1fb68e2
Merge branch 'master' into teal/inline-alert-ab-connectors
teallarson Jan 18, 2023
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,26 @@
@use "scss/variables";
@use "scss/colors";

.container {
margin-top: variables.$spacing-lg;
width: 100%;
}

.enrollLink {
text-decoration: underline;
cursor: pointer;
padding: 0;
color: colors.$dark-blue;
border: none;
background-color: transparent;
font-size: inherit;

&:hover,
&:active {
color: colors.$blue;
}
}

.freeText {
color: colors.$blue;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { PropsWithChildren } from "react";
import { FormattedMessage } from "react-intl";

import { Callout } from "components/ui/Callout";
import { Text } from "components/ui/Text";

import { useShowEnrollmentModal } from "./EnrollmentModal";
import styles from "./InlineEnrollmentCallout.module.scss";

export const EnrollLink: React.FC<PropsWithChildren<unknown>> = ({ children }) => {
const { showEnrollmentModal } = useShowEnrollmentModal();

const onEnrollClick = () => {
showEnrollmentModal();
};

return (
<button onClick={onEnrollClick} className={styles.enrollLink}>
{children}
</button>
);
};
export const InlineEnrollmentCallout: React.FC = () => {
return (
<Callout variant="info" className={styles.container}>
<Text size="sm">
<FormattedMessage
id="freeConnectorProgram.youCanEnroll"
values={{
enrollLink: (content: React.ReactNode) => <EnrollLink>{content}</EnrollLink>,
freeText: (content: React.ReactNode) => (
<Text as="span" size="sm" bold className={styles.freeText}>
{content}
</Text>
),
}}
/>
</Text>
</Callout>
);
};
4 changes: 3 additions & 1 deletion airbyte-webapp/src/packages/cloud/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,7 @@
"inviteUsersHint.message": "Need help from a teammate to set up the {connector}?",
"inviteUsersHint.cta": "Invite users",

"sidebar.credits": "Credits"
"sidebar.credits": "Credits",

"freeConnectorProgram.youCanEnroll": "You can <enrollLink>enroll</enrollLink> in the Free Connector Program to use Alpha and Beta connectors for <freeText>free</freeText>."
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import { useNavigate, useParams } from "react-router-dom";
import { ConnectionInfoCard } from "components/connection/ConnectionInfoCard";
import { ConnectionName } from "components/connection/ConnectionName";
import { Callout } from "components/ui/Callout";
import { FlexContainer } from "components/ui/Flex";
import { StepsMenu } from "components/ui/StepsMenu";
import { Text } from "components/ui/Text";

import { ConnectionStatus } from "core/request/AirbyteClient";
import { useConnectionEditService } from "hooks/services/ConnectionEdit/ConnectionEditService";
import { useExperiment } from "hooks/services/Experiment";
import { useFreeConnectorProgramInfo } from "packages/cloud/components/experiments/FreeConnectorProgram/hooks/useFreeConnectorProgram";
import { InlineEnrollmentCallout } from "packages/cloud/components/experiments/FreeConnectorProgram/InlineEnrollmentCallout";

import { ConnectionRoutePaths } from "../types";
import styles from "./ConnectionPageTitle.module.scss";
Expand All @@ -23,6 +27,11 @@ export const ConnectionPageTitle: React.FC = () => {

const { connection } = useConnectionEditService();

const freeConnectorProgramEnabled = useExperiment("workspace.freeConnectorsProgram.visible", false);
Copy link
Contributor

Choose a reason for hiding this comment

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

On reflection, I think it makes most sense to put the useExperiment check inside the useFreeConnectorProgramInfo hook: it always has the same meaning vis a vis showEnrollmentUi (if the flag is off, don't show the FCP UI), we'll always want to consider the two together while the flag is relevant, and pulling it into the hook gives us a single place to change if we end up making the experiment flag a permanent feature.

No need to update this PR, though, I'm happy to do that in my PR that implements email verification status checking.

const { data: freeConnectorProgramInfo } = useFreeConnectorProgramInfo();

const displayEnrollmentCallout = freeConnectorProgramEnabled && freeConnectorProgramInfo?.showEnrollmentUi;

const steps = useMemo(() => {
const steps = [
{
Expand Down Expand Up @@ -72,7 +81,10 @@ export const ConnectionPageTitle: React.FC = () => {
</Text>
<ConnectionName />
<div className={styles.statusContainer}>
<ConnectionInfoCard />
<FlexContainer direction="column" gap="none">
<ConnectionInfoCard />
{displayEnrollmentCallout && <InlineEnrollmentCallout />}
</FlexContainer>
</div>
<StepsMenu lightMode data={steps} onSelect={onSelectStep} activeStep={currentStep} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ export const ConnectorDefinitionTypeControl: React.FC<ConnectorDefinitionTypeCon

const workspace = useCurrentWorkspace();
const orderOverwrite = useExperiment("connector.orderOverwrite", {});

const connectorDefinitions = useAvailableConnectorDefinitions(availableConnectorDefinitions, workspace);

const sortedDropDownData = useMemo(
() => getSortedDropdownDataUsingExperiment(connectorDefinitions, orderOverwrite),
[connectorDefinitions, orderOverwrite]
Expand Down