Skip to content

Commit 17646f0

Browse files
author
Alex FusionAuth
committed
add pro to course headings
1 parent 9e09505 commit 17646f0

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎apps/codingcatdev/src/routes/(content-list)/ContentCards.svelte‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts">
22
import Image from '$lib/components/content/Image.svelte';
3-
import type { Content, ContentType } from '$lib/types';
4-
5-
export let data: { contentType: ContentType; content: Content[]; next?: any };
3+
import type { Content, Course } from '$lib/types';
4+
import { ContentType } from '$lib/types';
5+
export let data: { contentType: ContentType; content: Content[] & Course[]; next?: any };
66
77
let next = data.next;
88
const contentType = data.contentType;
@@ -48,14 +48,22 @@
4848
classes="object-cover w-full bg-cover rounded bg-black/50 aspect-video rounded-md rounded-b-none cursor-pointer"
4949
/>
5050
{/if}
51-
5251
<section class="grid h-full grid-cols-1 gap-2 p-4">
5352
<div class="space-y-2">
53+
{#if contentType === ContentType.course}
54+
{#if content?.lesson?.filter((l) => l.locked).length}
55+
<span class="chip variant-filled-primary py-1 px-4 rounded-full text-sm"
56+
>Pro</span
57+
>
58+
{:else}
59+
<span class="chip variant-ringed py-1 px-4 rounded-full text-sm">Free</span>
60+
{/if}
61+
{/if}
5462
<h3 class="font-sans text-lg tracking-wide text-bold">
5563
{content.title}
5664
</h3>
5765
{#if content?.excerpt}
58-
<p class="text-sm font-hairline ">{content.excerpt}</p>
66+
<p class="text-sm font-hairline">{content.excerpt}</p>
5967
{/if}
6068
</div>
6169
</section>

‎apps/codingcatdev/src/routes/(content-single)/course/Course.svelte‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@
4444
{/each}
4545
</section>
4646
{/if}
47+
<div class="flex">
48+
{#if data?.course?.lesson?.filter((l) => l.locked).length}
49+
<span class="chip variant-filled-primary py-1 px-4 rounded-full font-bold text-xl"
50+
>Pro</span
51+
>
52+
{:else}
53+
<span class="chip variant-ringed py-1 px-4 rounded-full font-bold text-xl">Free</span>
54+
{/if}
55+
</div>
4756
<h1>{data.course.title}</h1>
4857
<!-- Sponsors -->
4958
{#if data?.sponsors?.length}

0 commit comments

Comments
 (0)