Skip to content

feat: New getting started section #2184

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

Merged
Merged
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
44 changes: 33 additions & 11 deletions assets/src/components/cd/clusters/Clusters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
TabPanel,
Table,
useSetBreadcrumbs,
WrapWithIf,
} from '@pluralsh/design-system'
import { useDebounce } from '@react-hooks-library/core'
import { Row } from '@tanstack/react-table'
Expand Down Expand Up @@ -60,6 +61,8 @@ import { useProjectId } from '../../contexts/ProjectsContext'
import { cdClustersColumns } from './ClustersColumns'
import { DemoTable } from './ClustersDemoTable'
import CreateCluster from './create/CreateCluster'
import { GettingStartedBlock } from '../../home/GettingStarted.tsx'
import { useOnboarded } from '../../contexts/DeploymentSettingsContext.tsx'

export const CD_CLUSTERS_BASE_CRUMBS: Breadcrumb[] = [
{ label: 'cd', url: '/cd' },
Expand Down Expand Up @@ -106,6 +109,7 @@ export default function Clusters() {
const navigate = useNavigate()
const projectId = useProjectId()
const cdIsEnabled = useCDEnabled()
const onboarded = useOnboarded()
const tabStateRef = useRef<any>(null)
const [statusFilter, setStatusFilter] = useState<ClusterStatusTabKey>('ALL')
const [selectedTagKeys, setSelectedTagKeys] = useState(new Set<Key>())
Expand Down Expand Up @@ -239,17 +243,35 @@ export default function Clusters() {
stateRef={tabStateRef}
css={{ height: '100%', overflow: 'hidden' }}
>
<ClustersTable
fullHeightWrap
data={tableData || []}
refetch={refetch}
virtualizeRows
hasNextPage={pageInfo?.hasNextPage}
fetchNextPage={fetchNextPage}
isFetchingNextPage={loading}
reactVirtualOptions={DEFAULT_REACT_VIRTUAL_OPTIONS}
onVirtualSliceChange={setVirtualSlice}
/>
<WrapWithIf
condition={!onboarded}
wrapper={
<div
css={{
display: 'flex',
border: theme.borders['fill-two'],
borderRadius: theme.borderRadiuses.medium,
flexDirection: 'column',
overflow: 'hidden',
height: '100%',
}}
/>
}
>
<ClustersTable
flush={!onboarded}
fullHeightWrap={!!onboarded}
data={tableData || []}
refetch={refetch}
virtualizeRows
hasNextPage={pageInfo?.hasNextPage}
fetchNextPage={fetchNextPage}
isFetchingNextPage={loading}
reactVirtualOptions={DEFAULT_REACT_VIRTUAL_OPTIONS}
onVirtualSliceChange={setVirtualSlice}
/>
{!onboarded && <GettingStartedBlock />}
</WrapWithIf>
</TabPanel>
</div>
) : (
Expand Down
6 changes: 6 additions & 0 deletions assets/src/components/contexts/DeploymentSettingsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export function useAIEnabled() {
return ctx.ai?.enabled
}

export function useOnboarded() {
const ctx = useDeploymentSettings()

return ctx.onboarded === true
}

export function DeploymentSettingsProvider({
children,
}: {
Expand Down
114 changes: 114 additions & 0 deletions assets/src/components/home/GettingStarted.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import { Button, Card, ConfettiIcon, Flex } from '@pluralsh/design-system'
import { Body1BoldP, Body2P } from '../utils/typography/Text.tsx'
import { useTheme } from 'styled-components'
import { useDissmissOnboardingMutation } from '../../generated/graphql.ts'
import { GqlError } from '../utils/Alert.tsx'

export function GettingStartedPopup() {
const theme = useTheme()

return (
<div
css={{
backdropFilter: 'blur(4px)',
inset: 0,
position: 'absolute',
zIndex: theme.zIndexes.modal,
}}
>
<Card
css={{
backgroundColor: theme.colors['fill-one'],
border: theme.borders.input,
boxShadow: theme.boxShadows.modal,
left: '50%',
padding: theme.spacing.xxlarge,
position: 'absolute',
top: 88,
transform: 'translateX(-50%)',
}}
>
<GettingStartedContent />
</Card>
</div>
)
}

export function GettingStartedBlock() {
const theme = useTheme()

return (
<Card
css={{
backgroundColor: theme.colors['fill-one'],
border: 'none',
borderTop: theme.borders['fill-two'],
borderRadius: 0,
display: 'flex',
flexGrow: 1,
justifyContent: 'center',
padding: theme.spacing.xxxlarge,
}}
>
<GettingStartedContent />
</Card>
)
}

export function GettingStartedContent() {
const theme = useTheme()
const [dismiss, { loading, error }] = useDissmissOnboardingMutation()

return (
<div
css={{
alignItems: 'center',
display: 'flex',
flexDirection: 'column',
gap: theme.spacing.medium,
width: 576,
}}
>
<ConfettiIcon
size={64}
color={'icon-primary'}
/>
<Body1BoldP>Congrats on deploying your Plural Console!</Body1BoldP>
<Body2P css={{ color: theme.colors['text-light'], textAlign: 'center' }}>
To get the most out of the Continuous Deployment (CD) experience, you
can begin to add more clusters. Check out the docs or contact us to
learn more.
</Body2P>
{error && <GqlError error={error} />}
<Flex
gap="xsmall"
marginTop={theme.spacing.xsmall}
>
<Button
secondary
loading={loading}
onClick={() => dismiss()}
>
Dismiss
</Button>
<Button
floating
as="a"
href="https://www.plural.sh/contact"
target="_blank"
rel="noopener noreferrer"
>
Contact the team
</Button>
<Button
as="a"
href="https://docs.plural.sh/"
target="_blank"
rel="noopener noreferrer"
>
Read docs
</Button>
</Flex>
</div>
)
}
48 changes: 27 additions & 21 deletions assets/src/components/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,50 @@ import { DeploymentsCard } from './deployments/DeploymentsCard'
import { PrCard } from './pullrequests/PrCard'
import { ServiceCatalogs } from './ServiceCatalog.tsx'
import { ConstraintViolationsCard } from './violations/ConstraintViolationsCard'
import { GettingStartedPopup } from './GettingStarted.tsx'
import { useOnboarded } from '../contexts/DeploymentSettingsContext.tsx'

const breadcrumbs: Breadcrumb[] = [{ label: 'home', url: '/' }]

export default function Home() {
const theme = useTheme()
const isManager = useIsManager()
const onboarded = useOnboarded()

useSetBreadcrumbs(breadcrumbs)

return (
<ResponsivePageFullWidth maxContentWidth={1440}>
<div
css={{
display: 'flex',
flexDirection: 'column',
gap: theme.spacing.large,
paddingBottom: theme.spacing.large,
}}
>
<ClusterOverviewCard />
<ServiceCatalogs />
<AiThreads />
{isManager && <ConstraintViolationsCard />}
<>
{!onboarded && <GettingStartedPopup />}
<ResponsivePageFullWidth maxContentWidth={1440}>
<div
css={{
display: 'flex',
flexDirection: 'column',
gap: theme.spacing.large,

'@media (min-width: 1168px)': {
flexDirection: 'row',
},
paddingBottom: theme.spacing.large,
}}
>
<PrCard />
<DeploymentsCard />
<ClusterOverviewCard />
<ServiceCatalogs />
<AiThreads />
{isManager && <ConstraintViolationsCard />}
<div
css={{
display: 'flex',
flexDirection: 'column',
gap: theme.spacing.large,

'@media (min-width: 1168px)': {
flexDirection: 'row',
},
}}
>
<PrCard />
<DeploymentsCard />
</div>
</div>
</div>
</ResponsivePageFullWidth>
</ResponsivePageFullWidth>
</>
)
}
Loading
Loading