Skip to content

Commit

Permalink
Apply Gab's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
PopDaph committed Nov 16, 2023
1 parent 436b32a commit 13ad5ea
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions front/pages/w/[wId]/builder/data-sources/managed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ContentMessage,
ContextItem,
DropdownMenu,
InformationCircleIcon,
Page,
Popup,
} from "@dust-tt/sparkle";
Expand Down Expand Up @@ -249,6 +250,8 @@ export default function DataSourcesView({
>({} as Record<ConnectorProvider, boolean | undefined>);
const [showUpgradePopupForProvider, setShowUpgradePopupForProvider] =
useState<ConnectorProvider | null>(null);
const [showPreviewPopupForProvider, setShowPreviewPopupForProvider] =
useState<ConnectorProvider | null>(null);
const handleEnableManagedDataSource = async (
provider: ConnectorProvider,
suffix: string | null
Expand Down Expand Up @@ -383,11 +386,9 @@ export default function DataSourcesView({
<Button.List>
{(() => {
const disabled =
!ds.isBuilt ||
isLoadingByProvider[
ds.connectorProvider as ConnectorProvider
] ||
!isAdmin;
] || !isAdmin;
const onClick = async () => {
let isDataSourceAllowedInPlan: boolean;

Expand Down Expand Up @@ -425,6 +426,10 @@ export default function DataSourcesView({
ds.connectorProvider as ConnectorProvider,
ds.setupWithSuffix
);
} else if (!ds.isBuilt) {
setShowPreviewPopupForProvider(
ds.connectorProvider
);
} else {
setShowUpgradePopupForProvider(
ds.connectorProvider as ConnectorProvider
Expand All @@ -433,7 +438,7 @@ export default function DataSourcesView({
return;
};
const label = !ds.isBuilt
? "Coming soon"
? "Preview"
: !isLoadingByProvider[
ds.connectorProvider as ConnectorProvider
] && !ds.fetchConnectorError
Expand All @@ -445,7 +450,11 @@ export default function DataSourcesView({
{ds.connectorProvider !== "google_drive" && (
<Button
variant="primary"
icon={CloudArrowLeftRightIcon}
icon={
ds.isBuilt
? CloudArrowLeftRightIcon
: InformationCircleIcon
}
disabled={disabled}
onClick={onClick}
label={label}
Expand All @@ -458,7 +467,11 @@ export default function DataSourcesView({
variant="primary"
label={label}
disabled={disabled}
icon={CloudArrowLeftRightIcon}
icon={
ds.isBuilt
? CloudArrowLeftRightIcon
: InformationCircleIcon
}
/>
</DropdownMenu.Button>
<DropdownMenu.Items
Expand Down Expand Up @@ -561,6 +574,23 @@ export default function DataSourcesView({
setShowUpgradePopupForProvider(null);
}}
/>
<Popup
show={
showPreviewPopupForProvider === ds.connectorProvider
}
className="absolute bottom-8 right-0"
chipLabel="Coming Soon!"
description="Please email us at [email protected] for early access."
buttonLabel="Contact us"
buttonClick={() => {
window.open(
"mailto:[email protected]?subject=Intersted in the Intercom connection"
);
}}
onClose={() => {
setShowPreviewPopupForProvider(null);
}}
/>
</div>
}
>
Expand Down

0 comments on commit 13ad5ea

Please sign in to comment.