diff --git a/src/components/AITutor/AITutorSidebar.tsx b/src/components/AITutor/AITutorSidebar.tsx
index 54b70996a..c9fa61130 100644
--- a/src/components/AITutor/AITutorSidebar.tsx
+++ b/src/components/AITutor/AITutorSidebar.tsx
@@ -7,7 +7,6 @@ import {
Star,
Swords,
X,
- Zap,
} from 'lucide-react';
import { useEffect, useState } from 'react';
import { isLoggedIn } from '../../lib/jwt';
@@ -21,6 +20,7 @@ import { getPercentage } from '../../lib/number';
import { AILimitsPopup } from '../GenerateCourse/AILimitsPopup';
import { cn } from '../../lib/classname';
import { UserDropdown } from './UserDropdown';
+import { UpgradeSidebarCard } from './UpgradeSidebarCard';
type AITutorSidebarProps = {
isFloating: boolean;
@@ -162,34 +162,9 @@ export function AITutorSidebar(props: AITutorSidebarProps) {
{!isInitialLoad && isLoggedIn() && !isPaidUser && !isLoading && (
-
+ setIsUpgradeModalOpen(true)}
+ />
)}
diff --git a/src/components/AITutor/UpgradeSidebarCard.tsx b/src/components/AITutor/UpgradeSidebarCard.tsx
new file mode 100644
index 000000000..2e2774161
--- /dev/null
+++ b/src/components/AITutor/UpgradeSidebarCard.tsx
@@ -0,0 +1,77 @@
+import { useQuery } from '@tanstack/react-query';
+import { Zap } from 'lucide-react';
+import { queryClient } from '../../stores/query-client';
+import { getAiCourseLimitOptions } from '../../queries/ai-course';
+import { getPercentage } from '../../lib/number';
+import { cn } from '../../lib/classname';
+
+type UpgradeSidebarCardProps = {
+ onUpgrade: () => void;
+ className?: string;
+ descriptionClassName?: string;
+ titleClassName?: string;
+ title?: string;
+ description?: string;
+ showLimit?: boolean;
+};
+
+export function UpgradeSidebarCard(props: UpgradeSidebarCardProps) {
+ const {
+ onUpgrade,
+ title = 'Upgrade',
+ description = 'Get access to all features and benefits of the AI Tutor.',
+ descriptionClassName,
+ titleClassName,
+ className,
+ showLimit = true,
+ } = props;
+
+ const { data: limits, isLoading: isLimitsLoading } = useQuery(
+ getAiCourseLimitOptions(),
+ queryClient,
+ );
+
+ const { used, limit } = limits ?? { used: 0, limit: 0 };
+ const totalPercentage = getPercentage(used, limit);
+
+ return (
+
+ );
+}
diff --git a/src/components/AccounSidebar/AccountSidebarUpgrade.tsx b/src/components/AccounSidebar/AccountSidebarUpgrade.tsx
new file mode 100644
index 000000000..dca9bfcbe
--- /dev/null
+++ b/src/components/AccounSidebar/AccountSidebarUpgrade.tsx
@@ -0,0 +1,33 @@
+import { useIsMounted } from '../../hooks/use-is-mounted';
+import { isLoggedIn } from '../../lib/jwt';
+import { useIsPaidUser } from '../../queries/billing';
+import { UpgradeSidebarCard } from '../AITutor/UpgradeSidebarCard';
+import { useState } from 'react';
+import { UpgradeAccountModal } from '../Billing/UpgradeAccountModal';
+
+export function AccountSidebarUpgrade() {
+ const isMounted = useIsMounted();
+ const { isPaidUser, isLoading: isPaidUserLoading } = useIsPaidUser();
+ const [isUpgradeModalOpen, setIsUpgradeModalOpen] = useState(false);
+
+ if (!isMounted || isPaidUserLoading || !isLoggedIn() || isPaidUser) {
+ return null;
+ }
+
+ return (
+ <>
+ {isUpgradeModalOpen && (
+ setIsUpgradeModalOpen(false)} />
+ )}
+
+ setIsUpgradeModalOpen(true)}
+ className="mt-4 -mr-px rounded-r-none ml-0"
+ descriptionClassName="leading-normal"
+ title="Upgrade"
+ description="Unlock premium features including AI tutor and more."
+ showLimit={false}
+ />
+ >
+ );
+}
diff --git a/src/components/AccountSidebar.astro b/src/components/AccountSidebar.astro
index dc7a699db..2ade4e569 100644
--- a/src/components/AccountSidebar.astro
+++ b/src/components/AccountSidebar.astro
@@ -3,6 +3,7 @@ import AstroIcon from './AstroIcon.astro';
import { TeamDropdown } from './TeamDropdown/TeamDropdown';
import { SidebarFriendsCounter } from './Friends/SidebarFriendsCounter';
import { Map } from 'lucide-react';
+import { AccountSidebarUpgrade } from './AccounSidebar/AccountSidebarUpgrade';
export interface Props {
activePageId: string;
@@ -97,7 +98,7 @@ const sidebarLinks = [