From c38cd58bbce61f10884a55115001532c8f8bed36 Mon Sep 17 00:00:00 2001 From: Vijay Prasanna Date: Mon, 16 Sep 2024 11:07:46 +0530 Subject: [PATCH] Add Hasura DDN Banners PR-URL: https://github.com/hasura/graphql-engine-mono/pull/11024 GitOrigin-RevId: c9370430559e827f233851d540e71abd04f2dd06 --- frontend/libs/console/legacy-ce/src/index.ts | 2 +- .../src/lib/components/Main/DDNBanner.tsx | 78 +++++++++++++++++++ .../legacy-ce/src/lib/components/Main/Main.js | 2 + .../EETrial/components/NavbarButton.tsx | 36 +++++++++ .../legacy-ee/src/lib/components/Main/Main.js | 2 + 5 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 frontend/libs/console/legacy-ce/src/lib/components/Main/DDNBanner.tsx diff --git a/frontend/libs/console/legacy-ce/src/index.ts b/frontend/libs/console/legacy-ce/src/index.ts index 818681f1a72..3228e636127 100644 --- a/frontend/libs/console/legacy-ce/src/index.ts +++ b/frontend/libs/console/legacy-ce/src/index.ts @@ -21,7 +21,7 @@ export * from './lib/utils/console-dev-tools'; export { ControlPlane }; export { App as ConsoleCeApp } from './lib/client'; - +export { DDNBanner } from './lib/components/Main/DDNBanner'; export type { Metadata, SetOpenTelemetryQuery, diff --git a/frontend/libs/console/legacy-ce/src/lib/components/Main/DDNBanner.tsx b/frontend/libs/console/legacy-ce/src/lib/components/Main/DDNBanner.tsx new file mode 100644 index 00000000000..530e7b07365 --- /dev/null +++ b/frontend/libs/console/legacy-ce/src/lib/components/Main/DDNBanner.tsx @@ -0,0 +1,78 @@ +/* eslint-disable jsx-a11y/anchor-is-valid */ +import { CloseCircleFilled } from '@ant-design/icons'; +import { useLocalStorage } from '../../hooks'; +import ToolTip from '../Common/Tooltip/Tooltip'; +import { + sendTelemetryEvent, + telemetryUserEventsTracker, +} from '../../telemetry'; +import { InitializeTelemetry } from '../../features/Analytics'; +import { FiExternalLink } from 'react-icons/fi'; + +export const DDNBanner = () => { + const [isDismissed, setIsDimissed] = useLocalStorage( + 'console:dismiss-ddn-banner', + false + ); + + if (isDismissed) return null; + + return ( + <> + +
+
+ + 🎉 + + + Hasura DDN, our next-gen platform, is now live with new powerful + features such as federation, lambda connectors, and faster CI/CD! + + + + +
+
+ + { + setIsDimissed(true); + }} + /> + +
+
+ + ); +}; diff --git a/frontend/libs/console/legacy-ce/src/lib/components/Main/Main.js b/frontend/libs/console/legacy-ce/src/lib/components/Main/Main.js index 597fac1d9f2..d14a5b82c27 100644 --- a/frontend/libs/console/legacy-ce/src/lib/components/Main/Main.js +++ b/frontend/libs/console/legacy-ce/src/lib/components/Main/Main.js @@ -61,6 +61,7 @@ import { Badge } from './../../new-components/Badge'; import { ConsoleDevTools } from '../../utils/console-dev-tools/ConsoleDevTools'; import { isFeatureFlagEnabled } from '../../features/FeatureFlags/hooks/useFeatureFlags'; import { availableFeatureFlagIds } from '../../features/FeatureFlags'; +import { DDNBanner } from './DDNBanner'; export const updateRequestHeaders = props => { const { requestHeaders, dispatch } = props; @@ -488,6 +489,7 @@ class Main extends React.Component { + {globals.consoleMode === 'pro-lite' && }
{getMainContent()}
diff --git a/frontend/libs/console/legacy-ce/src/lib/features/EETrial/components/NavbarButton.tsx b/frontend/libs/console/legacy-ce/src/lib/features/EETrial/components/NavbarButton.tsx index e6dbe6ce0bc..7618c064b7f 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/EETrial/components/NavbarButton.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/EETrial/components/NavbarButton.tsx @@ -8,6 +8,34 @@ import { WithEEBenefits } from './BenefitsView/WithEEBenefits'; import { getDaysFromNow } from '../utils'; import { EnableEEButtonWrapper } from './EnableEnterpriseButton'; import { Analytics } from '../../Analytics'; +import { Badge } from '../../../new-components/Badge'; +import { sendTelemetryEvent } from '../../../telemetry'; + +const TryDDNButton = () => { + return ( + + ); +}; export const NavbarButton: React.VFC<{ className?: string; @@ -20,6 +48,14 @@ export const NavbarButton: React.VFC<{ return null; } + if (access !== 'active') { + return ( +
+ +
+ ); + } + return (
diff --git a/frontend/libs/console/legacy-ee/src/lib/components/Main/Main.js b/frontend/libs/console/legacy-ee/src/lib/components/Main/Main.js index 9fdffb92f0f..99d5149e53c 100644 --- a/frontend/libs/console/legacy-ee/src/lib/components/Main/Main.js +++ b/frontend/libs/console/legacy-ee/src/lib/components/Main/Main.js @@ -95,6 +95,7 @@ import { ConsoleDevTools, isFeatureFlagEnabled, availableFeatureFlagIds, + DDNBanner, } from '@hasura/console-legacy-ce'; import { getAdminSecret } from '../AppState'; @@ -729,6 +730,7 @@ class Main extends React.Component {
+ {globals.consoleType === 'pro-lite' && }
{getMainContent()}