Skip to content

Commit 14613f6

Browse files
authored
Merge pull request #2963 from appwrite/fix-education-plan-project-limit-alert
feat:Add education plan project limit alert on org page
2 parents 3e29e58 + 7cd6367 commit 14613f6

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

  • src/routes/(console)/organization-[organization]

src/routes/(console)/organization-[organization]/+page.svelte

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,16 @@
4747
let showCreate = $state(false);
4848
let addOrganization = $state(false);
4949
let showCreateProjectCloud = $state(false);
50+
let educationPlanAlertDismissed = $state(false);
5051
let freePlanAlertDismissed = $state(false);
5152
5253
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+
);
5360
5461
const projectCreationDisabled = $derived.by(() => {
5562
return (
@@ -112,10 +119,19 @@
112119
});
113120
}
114121
122+
function dismissEducationPlanAlert() {
123+
educationPlanAlertDismissed = true;
124+
const notificationId = `educationPlanAlert_${data.organization.$id}`;
125+
hideNotification(notificationId, { coolOffPeriod: 24 });
126+
}
127+
115128
onMount(async () => {
116129
checkPricingRefAndRedirect(page.url.searchParams);
130+
const educationNotificationId = `educationPlanAlert_${data.organization.$id}`;
117131
const notificationId = `freePlanAlert_${data.organization.$id}`;
132+
const shouldShowEducation = shouldShowNotification(educationNotificationId);
118133
const shouldShow = shouldShowNotification(notificationId);
134+
educationPlanAlertDismissed = !shouldShowEducation;
119135
freePlanAlertDismissed = !shouldShow;
120136
});
121137
@@ -174,6 +190,20 @@
174190
{/if}
175191
</Layout.Stack>
176192

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+
177207
{#if isCloud && !data.program && data.currentPlan?.projects && activeProjectsTotal <= data.currentPlan.projects && !freePlanAlertDismissed}
178208
<Alert.Inline dismissible on:dismiss={dismissFreePlanAlert}>
179209
<Typography.Text

0 commit comments

Comments
 (0)