Skip to content

Commit

Permalink
feat: improve onboarding flow
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Oct 2, 2024
1 parent a874ac0 commit 5357c26
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
7 changes: 4 additions & 3 deletions frontend/src/component/onboarding/dialog/SdkConnected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ export const SdkConnected: FC<ISdkConnectedProps> = ({ sdk }) => {
<Box sx={{ mt: 2 }}>
<SectionHeader>Production settings</SectionHeader>
<Typography variant='body2'>
In order to validate the connection, we changed some
settings that you might want to revert. We recommend the
following default settings.
You have successfully connected your SDK. In the
previous code example, the settings were optimized for
development. We recommend the following setup for
production.
</Typography>
<Markdown components={{ code: CodeRenderer }}>
{productionSnippet}
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/component/onboarding/dialog/snippets/nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ setInterval(() => {
```

---
### Production settings

In order to validate the connection, we changed some settings that you might want to revert. We recommend the following default settings.

```js
const { initialize } = require('unleash-client');

Expand All @@ -35,10 +31,6 @@ const unleash = initialize({
```

---
### Additional resources

Now that we’ve validated the connection, you might want to look into more advanced use cases and examples:

- [SDK repository with documentation](https://github.com/Unleash/unleash-client-node)
- [Node.js SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/NodeJS)
- [Node.js SDK tutorial](https://dev.to/reeshee/how-to-implement-feature-flags-in-nodejs-using-unleash-3907)
16 changes: 13 additions & 3 deletions frontend/src/component/onboarding/flow/ProjectOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ interface IProjectOnboardingProps {
projectId: string;
setConnectSdkOpen: (open: boolean) => void;
setOnboardingFlow: (status: 'visible' | 'closed') => void;
refetchFeatures: () => void;
}

interface ICreateFlagProps {
projectId: string;
refetchFeatures: () => void;
}

const Container = styled('div')(({ theme }) => ({
Expand Down Expand Up @@ -101,6 +103,7 @@ export const ProjectOnboarding = ({
projectId,
setConnectSdkOpen,
setOnboardingFlow,
refetchFeatures,
}: IProjectOnboardingProps) => {
const { project } = useProjectOverview(projectId);
const isFirstFlagCreated =
Expand Down Expand Up @@ -133,7 +136,10 @@ export const ProjectOnboarding = ({
'first-flag-created' ? (
<ExistingFlag />
) : (
<CreateFlag projectId={projectId} />
<CreateFlag
projectId={projectId}
refetchFeatures={refetchFeatures}
/>
)}
</ActionBox>
<ActionBox>
Expand Down Expand Up @@ -166,7 +172,7 @@ export const ProjectOnboarding = ({
);
};

const CreateFlag = ({ projectId }: ICreateFlagProps) => {
const CreateFlag = ({ projectId, refetchFeatures }: ICreateFlagProps) => {
const { refetch } = useProjectOverview(projectId);
return (
<>
Expand All @@ -181,7 +187,11 @@ const CreateFlag = ({ projectId }: ICreateFlagProps) => {
<FlagCreationButton
text='Create flag'
skipNavigationOnComplete={true}
onSuccess={refetch}
onSuccess={() => {
console.log('refetching features');
refetch();
refetchFeatures();
}}
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ export const ProjectFeatureToggles = ({
projectId={projectId}
setConnectSdkOpen={setConnectSdkOpen}
setOnboardingFlow={setOnboardingFlow}
refetchFeatures={refetch}
/>
}
/>
Expand Down

0 comments on commit 5357c26

Please sign in to comment.