Skip to content

feat(dashboard): create SDK workspace dashboard banner component #8770

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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,33 @@
import React from 'react';
import { Banner, Link, Stack, Text } from '@codesandbox/components';
import track from '@codesandbox/common/lib/utils/analytics';
import { BannerProps } from './types';

export const SDKWorkspaceBanner: React.FC<BannerProps> = ({ onDismiss }) => {
return (
<Banner
onDismiss={() => {
track('SDK Workspace Banner - Dismiss');
onDismiss();
}}
>
<Stack direction="vertical" gap={2}>
<Text color="#EDFFA5" size={6} weight="500">
Welcome to the CodeSandbox dashboard
</Text>
<Stack direction="vertical" gap={2}>
<Text>
We are in the process of creating a dashboard that is curated
specifically for your SDK usage. Check out the{' '}
<Link href="/t/usage">usage page</Link> for information related to
your subscription and usage. Check out the{' '}
<Link href="TODO">
CLI docs
</Link>{' '}
on how to view and inspect sandboxes created via the SDK.
</Text>
</Stack>
</Stack>
</Banner>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useAppState } from 'app/overmind';
import { FreeUpgradeBanner } from './Banners/FreeUpgradeBanner';
import { UBBWelcomeBanner } from './Banners/UBBWelcomeBanner';
import { LegacyProConvertBanner } from './Banners/LegacyProConvertBanner';
import { SDKWorkspaceBanner } from './Banners/SDKWorkspaceBanner';

export const TopBanner = () => {
const { ubbBeta } = useWorkspaceFeatureFlags();
Expand All @@ -17,6 +18,11 @@ export const TopBanner = () => {
activeTeamInfo?.insertedAt &&
new Date(activeTeamInfo.insertedAt) < new Date('2024-02-01');

const [
sdkWorkspaceBannerDismissed,
dismissSDKWorkspaceBanner,
] = useDismissible(`${activeTeam}_SDK_WORKSPACE_BANNER`);

const [welcomeBannerDismissed, dismissWelcomeBanner] = useDismissible(
`${activeTeam}_UBB_WELCOME`
);
Expand All @@ -29,6 +35,13 @@ export const TopBanner = () => {
`${activeTeam}_UPSELL_PRO_BANNER`
);

// TODO
const isSDKWorkspace = true;

if (isSDKWorkspace && !sdkWorkspaceBannerDismissed) {
return <SDKWorkspaceBanner onDismiss={dismissSDKWorkspaceBanner} />;
}

if (!ubbBeta) {
// Legacy case for seat-based Pro accounts
if (isPro && !legacyProBannerDismissed) {
Expand Down
Loading