|
47 | 47 | let showCreate = $state(false); |
48 | 48 | let addOrganization = $state(false); |
49 | 49 | let showCreateProjectCloud = $state(false); |
| 50 | + let educationPlanAlertDismissed = $state(false); |
50 | 51 | let freePlanAlertDismissed = $state(false); |
51 | 52 |
|
52 | 53 | let searchQuery: SearchQuery | null = $state(null); |
| 54 | + const educationProgramId = 'github-student-developer'; |
| 55 | +
|
| 56 | + const isEducationProgram = $derived(data.program?.$id === educationProgramId); |
| 57 | + const shouldShowEducationPlanAlert = $derived( |
| 58 | + isCloud && isEducationProgram && data.projects.total >= 2 |
| 59 | + ); |
53 | 60 |
|
54 | 61 | const projectCreationDisabled = $derived.by(() => { |
55 | 62 | return ( |
|
112 | 119 | }); |
113 | 120 | } |
114 | 121 |
|
| 122 | + function dismissEducationPlanAlert() { |
| 123 | + educationPlanAlertDismissed = true; |
| 124 | + const notificationId = `educationPlanAlert_${data.organization.$id}`; |
| 125 | + hideNotification(notificationId, { coolOffPeriod: 24 }); |
| 126 | + } |
| 127 | +
|
115 | 128 | onMount(async () => { |
116 | 129 | checkPricingRefAndRedirect(page.url.searchParams); |
| 130 | + const educationNotificationId = `educationPlanAlert_${data.organization.$id}`; |
117 | 131 | const notificationId = `freePlanAlert_${data.organization.$id}`; |
| 132 | + const shouldShowEducation = shouldShowNotification(educationNotificationId); |
118 | 133 | const shouldShow = shouldShowNotification(notificationId); |
| 134 | + educationPlanAlertDismissed = !shouldShowEducation; |
119 | 135 | freePlanAlertDismissed = !shouldShow; |
120 | 136 | }); |
121 | 137 |
|
|
174 | 190 | {/if} |
175 | 191 | </Layout.Stack> |
176 | 192 |
|
| 193 | + {#if shouldShowEducationPlanAlert && !educationPlanAlertDismissed} |
| 194 | + <Alert.Inline status="info" dismissible on:dismiss={dismissEducationPlanAlert}> |
| 195 | + <Typography.Text> |
| 196 | + Education plan organizations can have up to 2 projects. To create a new project, |
| 197 | + please delete an existing one or |
| 198 | + <a |
| 199 | + href={getChangePlanUrl(data.organization.$id)} |
| 200 | + style="text-decoration: underline;"> |
| 201 | + upgrade your plan |
| 202 | + </a>. |
| 203 | + </Typography.Text> |
| 204 | + </Alert.Inline> |
| 205 | + {/if} |
| 206 | + |
177 | 207 | {#if isCloud && !data.program && data.currentPlan?.projects && activeProjectsTotal <= data.currentPlan.projects && !freePlanAlertDismissed} |
178 | 208 | <Alert.Inline dismissible on:dismiss={dismissFreePlanAlert}> |
179 | 209 | <Typography.Text |
|
0 commit comments