-
Notifications
You must be signed in to change notification settings - Fork 229
feat:Add education plan project limit alert on org page #2963
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,9 +47,16 @@ | |
| let showCreate = $state(false); | ||
| let addOrganization = $state(false); | ||
| let showCreateProjectCloud = $state(false); | ||
| let educationPlanAlertDismissed = $state(false); | ||
| let freePlanAlertDismissed = $state(false); | ||
|
|
||
| let searchQuery: SearchQuery | null = $state(null); | ||
| const educationProgramId = 'github-student-developer'; | ||
|
|
||
| const isEducationProgram = $derived(data.program?.$id === educationProgramId); | ||
| const shouldShowEducationPlanAlert = $derived( | ||
| isCloud && isEducationProgram && data.projects.total >= 2 | ||
| ); | ||
|
|
||
| const projectCreationDisabled = $derived.by(() => { | ||
| return ( | ||
|
|
@@ -112,10 +119,19 @@ | |
| }); | ||
| } | ||
|
|
||
| function dismissEducationPlanAlert() { | ||
| educationPlanAlertDismissed = true; | ||
| const notificationId = `educationPlanAlert_${data.organization.$id}`; | ||
| hideNotification(notificationId, { coolOffPeriod: 24 }); | ||
| } | ||
|
Comment on lines
+122
to
+126
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| onMount(async () => { | ||
| checkPricingRefAndRedirect(page.url.searchParams); | ||
| const educationNotificationId = `educationPlanAlert_${data.organization.$id}`; | ||
| const notificationId = `freePlanAlert_${data.organization.$id}`; | ||
| const shouldShowEducation = shouldShowNotification(educationNotificationId); | ||
| const shouldShow = shouldShowNotification(notificationId); | ||
| educationPlanAlertDismissed = !shouldShowEducation; | ||
| freePlanAlertDismissed = !shouldShow; | ||
| }); | ||
|
|
||
|
|
@@ -174,6 +190,20 @@ | |
| {/if} | ||
| </Layout.Stack> | ||
|
|
||
| {#if shouldShowEducationPlanAlert && !educationPlanAlertDismissed} | ||
| <Alert.Inline status="info" dismissible on:dismiss={dismissEducationPlanAlert}> | ||
| <Typography.Text> | ||
| Education plan organizations can have up to 2 projects. To create a new project, | ||
| please delete an existing one or | ||
| <a | ||
| href={getChangePlanUrl(data.organization.$id)} | ||
| style="text-decoration: underline;"> | ||
| upgrade your plan | ||
| </a>. | ||
|
Comment on lines
+199
to
+202
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| </Typography.Text> | ||
| </Alert.Inline> | ||
| {/if} | ||
|
|
||
| {#if isCloud && !data.program && data.currentPlan?.projects && activeProjectsTotal <= data.currentPlan.projects && !freePlanAlertDismissed} | ||
| <Alert.Inline dismissible on:dismiss={dismissFreePlanAlert}> | ||
| <Typography.Text | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.