Skip to content

Commit

Permalink
feat: use onboarding status to conditionally show badge and message
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Sep 30, 2024
1 parent ac90c94 commit b58436b
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 16 deletions.
38 changes: 26 additions & 12 deletions frontend/src/component/personalDashboard/PersonalDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,36 @@ export const PersonalDashboard = () => {

const noProjects = projects.length === 0;

const setupIncomplete =
personalDashboardProjectDetails?.onboardingStatus.status ===
'onboarding-started' ||
personalDashboardProjectDetails?.onboardingStatus.status ===
'first-flag-created';

return (
<div>
<Typography component='h2' variant='h2'>
Welcome {name}
</Typography>
<ScreenExplanation>
<p>
Here are some tasks we think would be useful in order to get
the most out of Unleash
{personalDashboardProjectDetails?.onboardingStatus
.status === 'onboarded'
? 'We have gathered projects and flags you have favorited or owned'
: null}
{setupIncomplete
? 'Here are some tasks we think would be useful in order to get the most out of Unleash'
: null}
</p>
<IconButton
size={'small'}
title='Key concepts'
onClick={() => setWelcomeDialog('open')}
>
<HelpOutline />
</IconButton>
{setupIncomplete ? (
<IconButton
size={'small'}
title='Key concepts'
onClick={() => setWelcomeDialog('open')}
>
<HelpOutline />
</IconButton>
) : null}
</ScreenExplanation>

{noProjects ? (
Expand All @@ -235,7 +248,9 @@ export const PersonalDashboard = () => {
md={1}
sx={{ display: 'flex', justifyContent: 'flex-end' }}
>
<Badge color='warning'>Setup incomplete</Badge>
{setupIncomplete ? (
<Badge color='warning'>Setup incomplete</Badge>
) : null}
</SpacedGridItem>
<SpacedGridItem item lg={4} md={1}>
<List
Expand Down Expand Up @@ -301,8 +316,7 @@ export const PersonalDashboard = () => {
}
/>
) : null}
{stage === 'onboarding-started' ||
stage === 'first-flag-created' ? (
{setupIncomplete ? (
<ConnectSDK project={activeProject} />
) : null}
</SpacedGridItem>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/openapi/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,11 @@ export * from './patsSchema';
export * from './permissionSchema';
export * from './personalDashboardProjectDetailsSchema';
export * from './personalDashboardProjectDetailsSchemaLatestEventsItem';
export * from './personalDashboardProjectDetailsSchemaOnboardingStatus';
export * from './personalDashboardProjectDetailsSchemaOnboardingStatusOneOf';
export * from './personalDashboardProjectDetailsSchemaOnboardingStatusOneOfStatus';
export * from './personalDashboardProjectDetailsSchemaOnboardingStatusOneOfThree';
export * from './personalDashboardProjectDetailsSchemaOnboardingStatusOneOfThreeStatus';
export * from './personalDashboardProjectDetailsSchemaOwners';
export * from './personalDashboardProjectDetailsSchemaOwnersOneOfItem';
export * from './personalDashboardProjectDetailsSchemaOwnersOneOfItemAnyOf';
Expand All @@ -916,7 +921,10 @@ export * from './personalDashboardProjectDetailsSchemaOwnersOneOfSixItemOwnerTyp
export * from './personalDashboardProjectDetailsSchemaRolesItem';
export * from './personalDashboardProjectDetailsSchemaRolesItemType';
export * from './personalDashboardSchema';
export * from './personalDashboardSchemaAdminsItem';
export * from './personalDashboardSchemaFlagsItem';
export * from './personalDashboardSchemaProjectOwnersItem';
export * from './personalDashboardSchemaProjectOwnersItemOwnerType';
export * from './personalDashboardSchemaProjectsItem';
export * from './playgroundConstraintSchema';
export * from './playgroundConstraintSchemaOperator';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
* See `gen:api` script in package.json
*/
import type { PersonalDashboardProjectDetailsSchemaLatestEventsItem } from './personalDashboardProjectDetailsSchemaLatestEventsItem';
import type { PersonalDashboardProjectDetailsSchemaOnboardingStatus } from './personalDashboardProjectDetailsSchemaOnboardingStatus';
import type { PersonalDashboardProjectDetailsSchemaOwners } from './personalDashboardProjectDetailsSchemaOwners';
import type { PersonalDashboardProjectDetailsSchemaRolesItem } from './personalDashboardProjectDetailsSchemaRolesItem';
import type { ProjectOverviewSchemaOnboardingStatus } from './projectOverviewSchemaOnboardingStatus';

/**
* Project details in personal dashboard
*/
export interface PersonalDashboardProjectDetailsSchema {
/** The latest events for the project. */
latestEvents: PersonalDashboardProjectDetailsSchemaLatestEventsItem[];
/** The current onboarding status of the project. */
onboardingStatus: PersonalDashboardProjectDetailsSchemaOnboardingStatus;
/** The users and/or groups that have the "owner" role in this project. If no such users or groups exist, the list will contain the "system" owner instead. */
owners: PersonalDashboardProjectDetailsSchemaOwners;
/**
* The list of roles that the user has in this project.
* @minItems 1
*/
roles: PersonalDashboardProjectDetailsSchemaRolesItem[];
onboardingStatus: ProjectOverviewSchemaOnboardingStatus;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
export type PersonalDashboardProjectDetailsSchemaLatestEventsItem = {
/** Which user created this event */
createdBy: string;
/** URL used for the user profile image of the event author */
createdByImageUrl?: string;
/**
* The ID of the event.
* @minimum 1
*/
id?: number;
/**
* **[Experimental]** A markdown-formatted summary of the event.
* @nullable
*/
summary: string | null;
id: number;
createdByImageUrl: string;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOf } from './personalDashboardProjectDetailsSchemaOnboardingStatusOneOf';
import type { PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThree } from './personalDashboardProjectDetailsSchemaOnboardingStatusOneOfThree';

/**
* The current onboarding status of the project.
*/
export type PersonalDashboardProjectDetailsSchemaOnboardingStatus =
| PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOf
| PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThree;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfStatus } from './personalDashboardProjectDetailsSchemaOnboardingStatusOneOfStatus';

export type PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOf = {
status: PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfStatus;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/

export type PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfStatus =
(typeof PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfStatus)[keyof typeof PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfStatus =
{
'onboarding-started': 'onboarding-started',
onboarded: 'onboarded',
} as const;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThreeStatus } from './personalDashboardProjectDetailsSchemaOnboardingStatusOneOfThreeStatus';

export type PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThree = {
/** The name of the feature flag */
feature: string;
status: PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThreeStatus;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/

export type PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThreeStatus =
(typeof PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThreeStatus)[keyof typeof PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThreeStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const PersonalDashboardProjectDetailsSchemaOnboardingStatusOneOfThreeStatus =
{
'first-flag-created': 'first-flag-created',
} as const;
6 changes: 6 additions & 0 deletions frontend/src/openapi/models/personalDashboardSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { PersonalDashboardSchemaAdminsItem } from './personalDashboardSchemaAdminsItem';
import type { PersonalDashboardSchemaFlagsItem } from './personalDashboardSchemaFlagsItem';
import type { PersonalDashboardSchemaProjectOwnersItem } from './personalDashboardSchemaProjectOwnersItem';
import type { PersonalDashboardSchemaProjectsItem } from './personalDashboardSchemaProjectsItem';

/**
* Project and flags relevant to the user
*/
export interface PersonalDashboardSchema {
/** Users with the admin role in Unleash. */
admins?: PersonalDashboardSchemaAdminsItem[];
/** A list of flags a user created or favorited */
flags: PersonalDashboardSchemaFlagsItem[];
/** Users with the project owner role in Unleash. Only contains owners of projects that are visible to the user. */
projectOwners?: PersonalDashboardSchemaProjectOwnersItem[];
/** A list of projects that a user participates in with any role e.g. member or owner or any custom role */
projects: PersonalDashboardSchemaProjectsItem[];
}
18 changes: 18 additions & 0 deletions frontend/src/openapi/models/personalDashboardSchemaAdminsItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/

export type PersonalDashboardSchemaAdminsItem = {
/** @nullable */
email?: string | null;
/** The user ID. */
id: number;
/** @nullable */
imageUrl?: string | null;
/** The user's name. */
name?: string;
/** The user's username. */
username?: string;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { PersonalDashboardSchemaProjectOwnersItemOwnerType } from './personalDashboardSchemaProjectOwnersItemOwnerType';

export type PersonalDashboardSchemaProjectOwnersItem = {
/**
* The user's email address.
* @nullable
*/
email?: string | null;
/**
* The URL of the user's profile image.
* @nullable
*/
imageUrl?: string | null;
/** The name displayed for the user. Can be the user's name, username, or email, depending on what they have provided. */
name: string;
/** The type of the owner; will always be `user`. */
ownerType: PersonalDashboardSchemaProjectOwnersItemOwnerType;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/

/**
* The type of the owner; will always be `user`.
*/
export type PersonalDashboardSchemaProjectOwnersItemOwnerType =
(typeof PersonalDashboardSchemaProjectOwnersItemOwnerType)[keyof typeof PersonalDashboardSchemaProjectOwnersItemOwnerType];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const PersonalDashboardSchemaProjectOwnersItemOwnerType = {
user: 'user',
} as const;

0 comments on commit b58436b

Please sign in to comment.