|
| 1 | +import * as React from 'react'; |
| 2 | + |
| 3 | +import { dashboard as dashboardURLs } from '@codesandbox/common/lib/utils/url-generator'; |
| 4 | +import { Banner, Button, Stack, Text, Icon } from '@codesandbox/components'; |
| 5 | + |
| 6 | +import { useDismissible } from 'app/hooks'; |
| 7 | +import { Link } from 'react-router-dom'; |
| 8 | +import { SUBSCRIPTION_DOCS_URLS } from 'app/constants'; |
| 9 | +import { useURLSearchParams } from 'app/hooks/useURLSearchParams'; |
| 10 | + |
| 11 | +export const UBBBetaWelcomeBanner: React.FC = () => { |
| 12 | + const [isBannerDismissed, dismissBanner] = useDismissible( |
| 13 | + 'DASHBOARD_UBB_BETA_WELCOME' |
| 14 | + ); |
| 15 | + |
| 16 | + if (isBannerDismissed) { |
| 17 | + return null; |
| 18 | + } |
| 19 | + |
| 20 | + return ( |
| 21 | + <Banner onDismiss={dismissBanner}> |
| 22 | + <Stack gap={2} direction="vertical"> |
| 23 | + <Text color="#EDFFA5" size={6} weight="500"> |
| 24 | + Welcome to the usage-based billing beta |
| 25 | + </Text> |
| 26 | + <Text> |
| 27 | + This workspace has been added to an early beta experience. You can |
| 28 | + now: |
| 29 | + </Text> |
| 30 | + </Stack> |
| 31 | + |
| 32 | + <StyledFeatures /> |
| 33 | + |
| 34 | + <Stack |
| 35 | + align="center" |
| 36 | + gap={2} |
| 37 | + css={{ |
| 38 | + marginTop: '24px', |
| 39 | + }} |
| 40 | + > |
| 41 | + <Button |
| 42 | + target="_blank" |
| 43 | + autoWidth |
| 44 | + onClick={() => { |
| 45 | + window.open(SUBSCRIPTION_DOCS_URLS.teams.non_trial); |
| 46 | + dismissBanner(); |
| 47 | + }} |
| 48 | + > |
| 49 | + Learn more |
| 50 | + </Button> |
| 51 | + <Button autoWidth variant="ghost" onClick={dismissBanner}> |
| 52 | + Dismiss |
| 53 | + </Button> |
| 54 | + </Stack> |
| 55 | + </Banner> |
| 56 | + ); |
| 57 | +}; |
| 58 | + |
| 59 | +const StyledFeatures: React.FC = () => { |
| 60 | + const { getQueryParam } = useURLSearchParams(); |
| 61 | + const workspaceId = getQueryParam('workspace'); |
| 62 | + |
| 63 | + return ( |
| 64 | + <Stack |
| 65 | + gap={6} |
| 66 | + as="ul" |
| 67 | + css={{ |
| 68 | + listStyle: 'none', |
| 69 | + padding: '12px 0 24px 0', |
| 70 | + maxWidth: 724, |
| 71 | + }} |
| 72 | + > |
| 73 | + <Stack gap={3} as="li"> |
| 74 | + <Icon css={{ flexShrink: 0, color: '#C2C2C2' }} name="lock" /> |
| 75 | + <Text css={{ color: '#999' }} size={3}> |
| 76 | + Create private sandboxes and devboxes for free. |
| 77 | + </Text> |
| 78 | + </Stack> |
| 79 | + |
| 80 | + <Stack gap={3} as="li"> |
| 81 | + <Icon css={{ flexShrink: 0, color: '#C2C2C2' }} name="server" /> |
| 82 | + <Text css={{ color: '#999' }} size={3}> |
| 83 | + Customize Virtual Machine specs through the new{' '} |
| 84 | + <Link to={dashboardURLs.portalRelativePath(workspaceId)}> |
| 85 | + customer portal. |
| 86 | + </Link> |
| 87 | + </Text> |
| 88 | + </Stack> |
| 89 | + |
| 90 | + <Stack gap={3} as="li"> |
| 91 | + <Icon css={{ flexShrink: 0, color: '#C2C2C2' }} name="sandbox" /> |
| 92 | + <Text css={{ color: '#999' }} size={3}> |
| 93 | + Run devboxes and repositories on credits. |
| 94 | + </Text> |
| 95 | + </Stack> |
| 96 | + </Stack> |
| 97 | + ); |
| 98 | +}; |
0 commit comments