Skip to content

Commit e9ecba2

Browse files
author
Alex Patterson
authored
Merge pull request CodingCatDev#146 from CodingCatDev/bug/membership
Bug/membership
2 parents 07fa996 + f102600 commit e9ecba2

2 files changed

Lines changed: 22 additions & 52 deletions

File tree

frontend/main/src/pages/course/[coursePath]/index.tsx

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export default function Post({
5959
combineLatest([isUserTeam$, isUserMember$, isUserCourseSub$])
6060
.pipe(take(1))
6161
.subscribe((c) => {
62+
console.log(c);
6263
setMember(c.includes(true));
6364
});
6465
}
@@ -67,33 +68,6 @@ export default function Post({
6768
const content = source ? hydrate(source) : null;
6869
return (
6970
<Layout site={site}>
70-
{/* Could not see where this was used. */}
71-
{/* <div
72-
className={`${
73-
showMustSignin ? 'block' : 'hidden'
74-
} fixed inset-0 z-50 overflow-hidden bg-primary-100 bg-opacity-80`}
75-
>
76-
<section
77-
className="absolute inset-y-0 left-0 grid w-full h-full place-items-center justify-items-center"
78-
aria-labelledby="slide-over-heading"
79-
>
80-
<OutsideClick toggle={setShowMustSignin} value={false}>
81-
<section className="flex items-center p-8 m-auto space-x-20 space-between bg-primary-900 dark:bg-primary-50 rounded-xl">
82-
<div className="grid gap-4 text-2xl text-primary-50 dark:text-primary-900">
83-
<div>Please Sign in First.</div>
84-
<Link href="/membership">
85-
<a>
86-
<button className="btn-secondary">Sign In</button>
87-
</a>
88-
</Link>
89-
<div>
90-
Then you can purchase courses directly, or become a member.
91-
</div>
92-
</div>
93-
</section>
94-
</OutsideClick>
95-
</section>
96-
</div> */}
9771
<section className="top-0 z-10 grid 2xl:sticky">
9872
<BreakBarLeft>
9973
<div className="grid w-full gap-4 ">
@@ -198,20 +172,25 @@ export default function Post({
198172
)}
199173
<div className="grid grid-cols-1 gap-2 p-4 justify-items-center">
200174
{member ? (
201-
// start course with link instead of telling user to go down on a page?
202175
<>
203-
{post.sections && (
204-
// not sure if this will get the correct slug, I think going to the first lesson here is better UX.
205-
<>
206-
{/* <Link
207-
href={`/course/${post.sections[0].lessons[0].slug}/lesson/1`}
208-
>
209-
<a>
210-
<button className="btn-primary">Start Course</button>
211-
</a>
212-
</Link> */}
213-
</>
214-
)}
176+
{post.sections &&
177+
post.sections.map((section, i) => {
178+
return (
179+
<>
180+
{section.lessons && (
181+
<Link
182+
href={`/course/${post.slug}/lesson/${section.lessons[0].slug}`}
183+
>
184+
<a>
185+
<button className="btn-primary">
186+
Start Course
187+
</button>
188+
</a>
189+
</Link>
190+
)}
191+
</>
192+
);
193+
})}
215194
</>
216195
) : (
217196
<>

frontend/main/src/pages/membership.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ export default function Membership({
7676
{user && user.uid ? (
7777
<div
7878
className={`${
79-
user.memberships ? 'w-full' : 'mx-auto'
79+
member ? 'w-full' : 'mx-auto'
8080
} "w-full relative z-0 px-8 md:px-0 md:py-16"`}
8181
>
8282
<div
8383
className={`${
84-
user.memberships
84+
member
8585
? 'rounded'
8686
: 'rounded-b md:rounded-b-none md:rounded-r'
8787
} flex flex-wrap bg-white max-w-lg shadow-lg overflow-hidden mx-auto`}
@@ -104,7 +104,7 @@ export default function Membership({
104104
</button>
105105
</div>
106106
</div>
107-
{user && !user.memberships && (
107+
{user && !member && (
108108
<div className="p-8 text-xl text-primary-800">
109109
<p className="p-2">
110110
Welcome {user.displayName}! You are now signed in.
@@ -120,15 +120,6 @@ export default function Membership({
120120
</p>
121121
</div>
122122
)}
123-
{user && user.memberships && (
124-
<p className="p-8 text-xl text-primary-800">
125-
Welcome Back{' '}
126-
<span className="font-bold">{user.displayName}</span>!
127-
You can see all of your information in the selections
128-
below, just click the button and a detailed table data
129-
will appear.
130-
</p>
131-
)}
132123
</div>
133124
</div>
134125
) : (

0 commit comments

Comments
 (0)