Skip to content

Commit 862edc7

Browse files
Scala projects course page (#339)
* scala projects course page * Update scala-projects image file with new version and reduced size * Add LFS support to checkout step in PR workflow * Add error message for missing pricing plan in CourseLayout * Update package.json dependencies for improved performance and security * Add .nvmrc file and remove packageManager field from package.json * Add isPreview property to course data and update related components * Update pnpm version to 10.14.0 in workflows and package.json * Update newsletter subscription title for course availability notification * Refactor newsletter subscription form for improved design and user experience * Hide Curriculum component when in preview mode --------- Co-authored-by: Andrei Liviu Georgescu <[email protected]>
1 parent 960dcae commit 862edc7

File tree

15 files changed

+250
-78
lines changed

15 files changed

+250
-78
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"autoPull": false
66
},
77
"ghcr.io/devcontainers/features/node:1": {
8-
"version": "22"
8+
"version": "22",
9+
"pnpmVersion": "10.14.0"
910
}
1011
},
1112
"customizations": {

.github/workflows/cache.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup pnpm
2020
uses: pnpm/action-setup@v4
2121
with:
22-
version: latest
22+
version: 10.14.0
2323
run_install: false
2424
- name: Setup Node.js
2525
uses: actions/setup-node@v4

.github/workflows/pr.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
17+
with:
18+
lfs: true
1719
- name: Setup pnpm
1820
uses: pnpm/action-setup@v4
1921
with:
20-
version: latest
22+
version: 10.14.0
2123
run_install: false
2224
- name: Setup Node.js
2325
uses: actions/setup-node@v4
@@ -37,7 +39,7 @@ jobs:
3739
- name: Setup pnpm
3840
uses: pnpm/action-setup@v4
3941
with:
40-
version: latest
42+
version: 10.14.0
4143
- name: Setup Node.js
4244
uses: actions/setup-node@v4
4345
with:

.github/workflows/weekly.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup pnpm
2121
uses: pnpm/action-setup@v4
2222
with:
23-
version: latest
23+
version: 10.14.0
2424
run_install: false
2525
- name: Setup Node.js
2626
uses: actions/setup-node@v4
@@ -43,7 +43,7 @@ jobs:
4343
- name: Setup pnpm
4444
uses: pnpm/action-setup@v4
4545
with:
46-
version: latest
46+
version: 10.14.0
4747
- name: Setup Node.js
4848
uses: actions/setup-node@v4
4949
with:
@@ -58,11 +58,11 @@ jobs:
5858
arguments: --github-annotate-new-only=false
5959
check_broken_links:
6060
name: Check Broken Links
61-
runs-on: ubuntu-latest
61+
runs-on: ubuntu-24.04
6262
steps:
6363
- name: Setup Node.js
6464
uses: actions/setup-node@v4
6565
with:
66-
node-version: latest
66+
node-version: 22
6767
- name: Check Broken Links
6868
run: npx linkinator https://rockthejvm.com --recurse

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,6 @@
8080
"tailwindcss-animate": "^1.0.7",
8181
"typescript": "^5.8.2",
8282
"typescript-eslint": "^8.28.0"
83-
}
83+
},
84+
"packageManager": "[email protected]"
8485
}

src/collections/courses.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export default defineCollection({
9595
.min(1, "At least 1 instructor is required")
9696
.default(["daniel-ciocirlan"]),
9797
isFree: z.boolean().default(false),
98+
isPreview: z.boolean().default(false),
9899
pricingPlanId: z.number().int().nonnegative(),
99100
publishedDate: z.date().optional(),
100101
question: z

src/components/NewsletterSection.astro

Lines changed: 113 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,127 @@
22
interface Props {
33
stacked?: boolean;
44
title?: string;
5+
isPreview?: boolean;
56
}
67
7-
const { stacked = false, title } = Astro.props;
8+
const { stacked = false, title, isPreview = false } = Astro.props;
89
---
910

1011
{
1112
stacked ? (
12-
<div class="bg-bkg py-8 md:py-0">
13-
<div class="mx-auto max-w-7xl px-6">
14-
{title && (
15-
<h2 class="max-w-xl text-balance text-xl font-semibold tracking-tight text-content-1 sm:text-2xl">
16-
{title}
17-
</h2>
18-
)}
19-
<form id="newsletter-form" class="w-full max-w-md pt-2 lg:col-span-5">
20-
<div class="flex gap-x-4">
21-
<label for="email" class="sr-only">
22-
{" "}
23-
Email address{" "}
24-
</label>
25-
<input
26-
id="email"
27-
name="email"
28-
type="email"
29-
autocomplete="email"
30-
required
31-
class="min-w-0 flex-auto rounded-md bg-white px-3.5 py-2 text-base text-black placeholder-black outline outline-1 -outline-offset-1 outline-gray-300 placeholder:text-black focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6"
32-
placeholder="Enter your email"
33-
/>
34-
<button
35-
type="submit"
36-
class="flex-none rounded-md bg-cta px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-accent-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
37-
>
38-
Subscribe
39-
</button>
40-
</div>
41-
<p class="mt-4 text-sm/6 text-content-1">
42-
This site is built on trust, and your data is safe. Check out the{" "}
43-
<a href="/policies/privacy" class="font-semibold">
44-
privacy&nbsp;policy
45-
</a>
46-
.
13+
isPreview ? (
14+
<div class="mb-4 mt-10 bg-transparent py-8 md:py-0">
15+
<div class="mx-auto max-w-2xl px-6 text-center underline decoration-white">
16+
{title && (
17+
<h2 class="text-lg font-medium text-gray-200 sm:text-xl">
18+
{title}
19+
</h2>
20+
)}
21+
22+
<form id="newsletter-form" class="mt-6">
23+
<div class="mx-auto max-w-xl overflow-hidden rounded-2xl bg-white/10 p-2 shadow-xl ring-1 ring-black/10 backdrop-blur-md dark:ring-white/15">
24+
<div class="flex flex-col gap-2 sm:flex-row">
25+
<div class="relative flex-1">
26+
<svg
27+
aria-hidden="true"
28+
viewBox="0 0 24 24"
29+
class="pointer-events-none absolute left-3 top-1/2 size-5 -translate-y-1/2 opacity-70"
30+
>
31+
<path
32+
fill="white"
33+
d="M20 6H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2Zm0 2v.01L12 13 4 8.01V8h16ZM4 16V9.7l7.4 4.63a1 1 0 0 0 1.2 0L20 9.7V16H4Z"
34+
/>
35+
</svg>
36+
<label for="email" class="sr-only">
37+
Email address
38+
</label>
39+
<input
40+
id="email"
41+
name="email"
42+
type="email"
43+
autocomplete="email"
44+
required
45+
placeholder="Enter your email"
46+
class="w-full rounded-xl border-0 bg-transparent py-3 pl-11 pr-4 text-base text-gray-100 placeholder-gray-300 outline-none focus:ring-2 focus:ring-cta/70"
47+
/>
48+
</div>
49+
50+
<button
51+
type="submit"
52+
class="rounded-xl bg-cta px-5 py-3 text-base font-semibold text-ctatext shadow-lg transition-all hover:-translate-y-0.5 hover:bg-accent-1 hover:shadow-xl focus:ring-2 focus:ring-cta/80 focus:ring-offset-2 focus:ring-offset-black focus-visible:outline-none active:translate-y-0"
53+
>
54+
Subscribe
55+
</button>
56+
</div>
57+
58+
<p class="mt-2 text-center text-xs text-gray-200/85">
59+
We'll only email about this course. Read our{" "}
60+
<a
61+
href="/policies/privacy"
62+
class="font-semibold text-gray-100 underline-offset-2 hover:underline"
63+
>
64+
privacy policy
65+
</a>
66+
.
67+
</p>
68+
</div>
69+
</form>
70+
71+
<p
72+
id="confirmation-message"
73+
class="mt-4 hidden text-sm/6 text-green-200"
74+
>
75+
Thank you for subscribing! Check your email for confirmation.
4776
</p>
48-
</form>
49-
<p
50-
id="confirmation-message"
51-
class="mt-4 hidden text-sm/6 text-green-200"
52-
>
53-
Thank you for subscribing! Check your email for confirmation.
54-
</p>
77+
</div>
5578
</div>
56-
</div>
79+
) : (
80+
<div class="bg-transparent py-8 md:py-0">
81+
<div class="mx-auto max-w-7xl px-6">
82+
{title && (
83+
<h2 class="max-w-xl text-balance text-xl font-semibold tracking-tight text-content-1 sm:text-2xl">
84+
{title}
85+
</h2>
86+
)}
87+
<form id="newsletter-form" class="w-full max-w-md pt-2 lg:col-span-5">
88+
<div class="flex gap-x-4">
89+
<label for="email" class="sr-only">
90+
{" "}
91+
Email address{" "}
92+
</label>
93+
<input
94+
id="email"
95+
name="email"
96+
type="email"
97+
autocomplete="email"
98+
required
99+
class="min-w-0 flex-auto rounded-xl bg-white px-3.5 py-2 text-base text-black placeholder-black outline outline-1 -outline-offset-1 outline-gray-300 placeholder:text-black focus:outline focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6"
100+
placeholder="Enter your email"
101+
/>
102+
<button
103+
type="submit"
104+
class="flex-none rounded-md bg-cta px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-accent-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
105+
>
106+
Subscribe
107+
</button>
108+
</div>
109+
<p class="mt-4 text-sm/6 text-content-1">
110+
This site is built on trust, and your data is safe. Check out the{" "}
111+
<a href="/policies/privacy" class="font-semibold">
112+
privacy&nbsp;policy
113+
</a>
114+
.
115+
</p>
116+
</form>
117+
<p
118+
id="confirmation-message"
119+
class="mt-4 hidden text-sm/6 text-green-200"
120+
>
121+
Thank you for subscribing! Check your email for confirmation.
122+
</p>
123+
</div>
124+
</div>
125+
)
57126
) : (
58127
<div class="bg-bkg py-8 sm:py-12 lg:py-16">
59128
<div class="mx-auto grid max-w-7xl grid-cols-1 gap-10 px-6 lg:grid-cols-12 lg:gap-8 lg:px-8">

src/data/courseCategories.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
members:
2020
- scala-at-light-speed
2121
- scala-essentials
22+
- scala-projects
2223
- advanced-scala
2324
- scala-macros-and-metaprogramming
2425
- scala-and-functional-programming-interview-practice
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)