feat/course
Arik Chakma 1 week ago
parent acd08ac0d4
commit 758642764c
  1. 18
      src/components/Billing/BillingPage.tsx
  2. 5
      src/components/CourseLanding/CourseChapterItem.tsx
  3. 1
      src/components/CourseLanding/CourseLanding.tsx

@ -24,7 +24,7 @@ export function BillingPage() {
const [showUpgradeModal, setShowUpgradeModal] = useState(false); const [showUpgradeModal, setShowUpgradeModal] = useState(false);
const [showVerifyUpgradeModal, setShowVerifyUpgradeModal] = useState(false); const [showVerifyUpgradeModal, setShowVerifyUpgradeModal] = useState(false);
const { data: billingDetails, isPending } = useQuery( const { data: billingDetails, isPending: isLoadingBillingDetails } = useQuery(
billingDetailsOptions(), billingDetailsOptions(),
queryClient, queryClient,
); );
@ -50,7 +50,7 @@ export function BillingPage() {
); );
useEffect(() => { useEffect(() => {
if (isPending) { if (isLoadingBillingDetails) {
return; return;
} }
@ -59,9 +59,9 @@ export function BillingPage() {
if (shouldVerifyUpgrade) { if (shouldVerifyUpgrade) {
setShowVerifyUpgradeModal(true); setShowVerifyUpgradeModal(true);
} }
}, [isPending]); }, [isLoadingBillingDetails]);
if (isPending || !billingDetails) { if (isLoadingBillingDetails || !billingDetails) {
return null; return null;
} }
@ -98,7 +98,7 @@ export function BillingPage() {
{showVerifyUpgradeModal && <VerifyUpgrade />} {showVerifyUpgradeModal && <VerifyUpgrade />}
{billingDetails?.status === 'none' && !isPending && ( {billingDetails?.status === 'none' && !isLoadingBillingDetails && (
<div className="flex h-full w-full flex-col"> <div className="flex h-full w-full flex-col">
<p className="text-gray-800"> <p className="text-gray-800">
You are using free plan,&nbsp; You are using free plan,&nbsp;
@ -114,12 +114,12 @@ export function BillingPage() {
</div> </div>
)} )}
{billingDetails?.status !== 'none' && !isPending && ( {billingDetails?.status !== 'none' && !isLoadingBillingDetails && (
<> <>
{billingDetails?.status === 'past_due' && ( {billingDetails?.status === 'past_due' && (
<div className="mb-4 rounded-md border border-red-300 bg-red-50 p-2 text-red-500"> <div className="mb-4 rounded-md border border-red-300 bg-red-50 p-2 text-sm text-red-500">
Your subscription is past due. Please update your payment We were not able to charge your card. Please update your payment
information from the Stripe Portal. information.
</div> </div>
)} )}

@ -10,12 +10,13 @@ type CourseChapterItemProps = {
title: string; title: string;
}[]; }[];
className?: string; className?: string;
isOpen?: boolean;
}; };
export function CourseChapterItem(props: CourseChapterItemProps) { export function CourseChapterItem(props: CourseChapterItemProps) {
const { title, lessons, className } = props; const { title, lessons, className, isOpen: defaultIsOpen = false } = props;
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(defaultIsOpen);
const { excercises, textualLessons } = useMemo(() => { const { excercises, textualLessons } = useMemo(() => {
const excercises: CourseChapterItemProps['lessons'] = []; const excercises: CourseChapterItemProps['lessons'] = [];

@ -181,6 +181,7 @@ export function CourseLanding(props: CourseLandingProps) {
isFirst ? 'rounded-t-md' : '', isFirst ? 'rounded-t-md' : '',
isLast ? 'rounded-b-md' : 'border-b-0', isLast ? 'rounded-b-md' : 'border-b-0',
)} )}
isOpen={isFirst}
/> />
); );
})} })}

Loading…
Cancel
Save