Skip to content

Commit ebb5b0e

Browse files
committed
remove course layout
1 parent 02ecdac commit ebb5b0e

3 files changed

Lines changed: 50 additions & 317 deletions

File tree

‎frontend/main/src/layout/CourseLayout.tsx‎

Lines changed: 0 additions & 288 deletions
This file was deleted.

‎frontend/main/src/layout/PostLayout.tsx‎

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,25 +201,47 @@ export default function PostLayout({
201201
key={lesson._id}
202202
passHref
203203
>
204-
<div>
204+
<div className="flex gap-2">
205205
<a className="no-underline border-none hover:text-primary-900">
206206
{lesson.title}
207207
</a>
208208
{lesson?.access_mode && (
209209
<div className="no-underline hover:text-primary-900">
210210
{lesson?.access_mode != AccessMode.free && (
211-
<svg
212-
xmlns="http://www.w3.org/2000/svg"
213-
className="w-5 h-5"
214-
viewBox="0 0 20 20"
215-
fill="currentColor"
216-
>
217-
<path
218-
fillRule="evenodd"
219-
d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"
220-
clipRule="evenodd"
221-
/>
222-
</svg>
211+
<>
212+
{user && user.uid ? (
213+
<svg
214+
xmlns="http://www.w3.org/2000/svg"
215+
className="w-5 h-5"
216+
viewBox="0 0 24 24"
217+
fill="currentColor"
218+
>
219+
<path
220+
xmlns="http://www.w3.org/2000/svg"
221+
d="M7 9h10a3 3 0 0 1 3 3v7a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3v-7a3 3 0 0 1 3-3z"
222+
className="currentColor"
223+
/>
224+
<path
225+
xmlns="http://www.w3.org/2000/svg"
226+
d="M9 7a3 3 0 0 1 5-2l1 1a1 1 0 0 0 2 0 5 5 0 0 0-1-3 5 5 0 0 0-9 4v2h2V7z"
227+
className="uim-tertiary"
228+
/>
229+
</svg>
230+
) : (
231+
<svg
232+
xmlns="http://www.w3.org/2000/svg"
233+
className="w-5 h-5"
234+
viewBox="0 0 20 20"
235+
fill="currentColor"
236+
>
237+
<path
238+
fillRule="evenodd"
239+
d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"
240+
clipRule="evenodd"
241+
/>
242+
</svg>
243+
)}
244+
</>
223245
)}
224246
</div>
225247
)}

‎frontend/main/src/pages/[...permalink].tsx‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,15 @@ export const getStaticProps: GetStaticProps<StaticPropsResult> = async ({
205205
// }
206206
// }
207207
// } else {
208-
if (lessonPath) {
209-
if (course) {
208+
if (type === PostType.course || lessonPath) {
209+
// If Lesson use the gathered lesson
210+
if (lessonPath && course) {
210211
props.course = course;
211212
}
213+
// If course use the post as course
214+
if (type === PostType.course && !lessonPath) {
215+
props.course = post;
216+
}
212217
} else {
213218
if (type != PostType.page) {
214219
const recentPosts = await getRecent({ preview });
@@ -281,20 +286,14 @@ export default function PostPage({
281286
}}
282287
></NextSeo>
283288
<Layout site={site}>
284-
<>
285-
{post._type === PostType.course ? (
286-
<CourseLayout post={post} product={product} preview={preview} />
287-
) : (
288-
<PostLayout
289-
router={router}
290-
post={post}
291-
course={course}
292-
recentPosts={recentPosts}
293-
preview={preview}
294-
secret={secret}
295-
/>
296-
)}
297-
</>
289+
<PostLayout
290+
router={router}
291+
post={post}
292+
course={course}
293+
recentPosts={recentPosts}
294+
preview={preview}
295+
secret={secret}
296+
/>
298297
</Layout>
299298
</>
300299
);

0 commit comments

Comments
 (0)