Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/routes/(console)/organization-[organization]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -112,10 +119,19 @@
});
}

function dismissEducationPlanAlert() {
educationPlanAlertDismissed = true;
const notificationId = `educationPlanAlert_${data.organization.$id}`;
hideNotification(notificationId, { coolOffPeriod: 24 });
}
Comment on lines +122 to +126
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing analytics tracking on dismiss

dismissFreePlanAlert calls trackEvent(Click.OrganizationClickUpgrade, ...) when dismissed, giving the team signal on user interactions. dismissEducationPlanAlert skips this entirely. If analytics coverage is intentional, a comment explaining why would help; otherwise, consider adding the equivalent tracking call here.


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;
});

Expand Down Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Inline style instead of utility class

The style="text-decoration: underline;" inline style is inconsistent with the rest of the codebase, which relies on Pink design system utilities. Consider using the design system's link component or an existing CSS class instead of a one-off inline style.

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
Expand Down
Loading