Skip to content

Commit 16fc3de

Browse files
authored
Merge branch 'develop' into feat/migrate-to-pnpn
2 parents 7c45fe5 + 94401a6 commit 16fc3de

File tree

28 files changed

+656
-317
lines changed

28 files changed

+656
-317
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ jobs:
5050
GITHUB_ID: ${{ secrets.E2E_GITHUB_ID }}
5151
GITHUB_SECRET: ${{ secrets.E2E_GITHUB_SECRET }}
5252
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
53-
E2E_USER_ONE_EMAIL: [email protected]
54-
E2E_USER_ONE_ID: 8e3179ce-f32b-4d0a-ba3b-234d66b836ad
55-
E2E_USER_ONE_SESSION_ID: df8a11f2-f20a-43d6-80a0-a213f1efedc1
56-
E2E_USER_TWO_EMAIL: [email protected]
57-
E2E_USER_TWO_ID: a15a104a-0e34-4101-8800-ed25c9231345
58-
E2E_USER_TWO_SESSION_ID: 10134766-bc6c-4b52-83d7-46ec0a4cb95d
5953

6054
steps:
6155
- name: Checkout repository

E2E Overview.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
To run the end-to-end tests using Playwright, you need to configure your environment and follow these steps:
44

5-
### Environment Variables
6-
7-
Ensure you have the following variables set in your `.env` file:
8-
9-
- `E2E_USER_ID`: The ID of the E2E user for testing.
10-
- `E2E_USER_EMAIL`: The email of the E2E user for testing.
11-
- `E2E_USER_ONE_SESSION_ID`: The session ID that the user will use to authenticate.
12-
13-
Note: The sample `.env` file is fine to use.
14-
155
### Session and User Setup
166

177
First, you need to add your E2E test user to your locally running database. Do this by running the following script if you haven't already:
@@ -38,11 +28,9 @@ For UI mode:
3828
npx playwright test --ui
3929
```
4030

41-
### Additional E2E Environment Variables
31+
### Additional E2E constants
4232

4333
- **E2E_USER_ONE_SESSION_ID**: This is the session token UUID for one E2E user.
4434
- **E2E_USER_TWO_SESSION_ID**: This is the session token UUID for another E2E user.
4535
- **E2E_USER_ONE_ID**: The user ID of one of the E2E users.
4636
- **E2E_USER_TWO_ID**: The user ID of another E2E user.
47-
48-
These values are currently hardcoded and should be unique for each user.

ISSUE_TEMPLATE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
## Context
22

3-
Please provide any relevant information about your setup
3+
<!-- Please provide any relevant information about your setup. -->
44

55
## Expected Behavior
66

7-
Please describe the behavior you are expecting
7+
<!-- Please describe the behavior you are expecting. -->
88

99
## Current Behavior
1010

11-
What is the current behavior?
11+
<!-- What is the current behavior? -->
1212

1313
## Screenshots
1414

15-
Drag and drop screenshots here to better describe your issue
15+
<!-- Drag and drop screenshots here to better describe your issue. -->
1616

1717
## Steps to reproduce
1818

19-
Please provide detailed steps for reproducing the issue
20-
19+
<!-- Please provide detailed steps for reproducing the issue:
2120
1. Step 1
2221
2. Step 2
23-
3. etc
22+
3. etc.
23+
-->
2424

2525
## Additional info
2626

27-
Provide any additional information here
27+
<!-- Provide any additional information here. -->
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
"use client";
2+
import { FEATURE_FLAGS, isFlagEnabled } from "@/utils/flags";
3+
import { CircleCheck, SquarePlay } from "lucide-react";
4+
import { type Session } from "next-auth";
5+
import { notFound } from "next/navigation";
6+
import { mockContentList } from "../../mock";
7+
8+
interface ContentProps {
9+
session: Session | null;
10+
}
11+
12+
const Content = ({ session }: ContentProps) => {
13+
const flagEnabled = isFlagEnabled(FEATURE_FLAGS.COURSE_VIDEO);
14+
15+
if (!flagEnabled) {
16+
notFound();
17+
}
18+
19+
return (
20+
<div className="overflow-auto">
21+
<div className="w-full divide-x divide-gray-700 lg:grid lg:grid-cols-12">
22+
<VideoPlayer />
23+
<Sidebar contentList={mockContentList} />
24+
</div>
25+
<div className="mx-auto max-w-5xl">
26+
<ContentList contentList={mockContentList} />
27+
</div>
28+
</div>
29+
);
30+
};
31+
32+
const VideoPlayer = () => (
33+
<div className="col-span-9">
34+
<div className="mx-auto w-full max-w-7xl bg-black">
35+
<iframe
36+
className="aspect-video w-full"
37+
src="https://www.youtube.com/embed/oKKG-CpDjrI"
38+
title="YouTube video"
39+
></iframe>
40+
</div>
41+
</div>
42+
);
43+
44+
interface SidebarProps {
45+
contentList: typeof mockContentList;
46+
}
47+
48+
const Sidebar = ({ contentList }: SidebarProps) => (
49+
<div className="col-span-3 flex w-full flex-col overflow-auto">
50+
<ul className="divide-y divide-gray-700">
51+
{contentList && contentList.length > 0 ? (
52+
contentList.map((item, index) => (
53+
<SidebarItem key={index} item={item} />
54+
))
55+
) : (
56+
<li className="text-center text-gray-500">No content available</li>
57+
)}
58+
</ul>
59+
</div>
60+
);
61+
62+
interface SidebarItemProps {
63+
item: (typeof mockContentList)[0];
64+
}
65+
66+
const SidebarItem = ({ item }: SidebarItemProps) => (
67+
<li className="flex flex-row items-center justify-between px-2 py-2">
68+
<div className="flex flex-row items-center">
69+
<SquarePlay
70+
className="mr-4 h-5 w-5 text-white group-hover:text-white"
71+
aria-hidden="true"
72+
/>
73+
<p>{item.title}</p>
74+
</div>
75+
<CircleCheck
76+
className={`h-6 w-6 ${
77+
item.watched ? "mr-2 h-5 w-5 text-pink-600" : "mr-2 h-5 w-5 text-white"
78+
}`}
79+
aria-hidden="true"
80+
/>
81+
</li>
82+
);
83+
84+
interface ContentListProps {
85+
contentList: typeof mockContentList;
86+
}
87+
88+
const ContentList = ({ contentList }: ContentListProps) => {
89+
return (
90+
<>
91+
{contentList.map(
92+
({
93+
id,
94+
title,
95+
longDescription,
96+
description,
97+
publishedDate,
98+
author,
99+
imageLink,
100+
}) => (
101+
<div key={id} className="mx-auto w-full max-w-7xl py-8">
102+
<h2 className="text-3xl font-extrabold tracking-tight text-neutral-800 dark:text-white">
103+
{title}
104+
</h2>
105+
<li key={author} className="flex justify-between gap-x-6 py-5">
106+
<div className="flex min-w-0 gap-x-4">
107+
<img
108+
alt=""
109+
src={imageLink}
110+
className="h-12 w-12 flex-none rounded-full bg-gray-50"
111+
/>
112+
<div className="min-w-0 flex-auto">
113+
<p className="text-sm font-semibold leading-6 text-neutral-800 dark:text-white">
114+
{author}
115+
</p>
116+
<p className="mt-1 truncate text-xs leading-5 text-gray-500">
117+
{publishedDate}
118+
</p>
119+
</div>
120+
</div>
121+
</li>
122+
<div>{description}</div>
123+
<div>{longDescription}</div>
124+
</div>
125+
),
126+
)}
127+
</>
128+
);
129+
};
130+
131+
export default Content;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { getServerAuthSession } from "@/server/auth";
2+
import Content from "./_client";
3+
4+
export const metadata = {
5+
title: "Video Course",
6+
};
7+
8+
export default async function Page() {
9+
// Example of grabbing session in case it is needed
10+
const session = await getServerAuthSession();
11+
12+
return <Content session={session} />;
13+
}

app/(app)/courses/mock.ts

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// Mock video source (this would typically be a path to a video file)
2+
const mockVideoSrc = "https://youtu.be/Ln4KSN0rchI?t=12";
3+
4+
// Mock content list
5+
const mockContentList = [
6+
{
7+
id: 1,
8+
title: "Introduction to React",
9+
longDescription:
10+
"In this video, we will explore the fundamentals of React, including its component-based architecture, virtual DOM, and how to get started with your first React application. This tutorial guides you through the installation and configuration of essential tools like Node.js, npm, and create-react-app to set up your React development environment.",
11+
description: "Learn the basics of React and its core concepts",
12+
watched: false,
13+
publishedDate: "2023-01-15",
14+
author: "John Doe",
15+
imageLink: "https://example.com/images/react-introduction.jpg",
16+
},
17+
{
18+
id: 2,
19+
title: "Setting Up Your Development Environment",
20+
longDescription:
21+
"This tutorial guides you through the installation and configuration of essential tools like Node.js, npm, and create-react-app to set up your React development environment.",
22+
description:
23+
"Install and configure the necessary tools for React development",
24+
watched: true,
25+
publishedDate: "2023-01-22",
26+
author: "Jane Smith",
27+
},
28+
{
29+
id: 3,
30+
title: "Components and Props",
31+
longDescription:
32+
"Dive deep into React's core concepts of components and props. Learn how to create reusable components and pass data between them using props.",
33+
description: "Understand the building blocks of React applications",
34+
watched: true,
35+
publishedDate: "2023-01-29",
36+
author: "John Doe",
37+
},
38+
{
39+
id: 4,
40+
title: "State and Lifecycle",
41+
longDescription:
42+
"Explore how to manage component state and lifecycle methods to build dynamic and interactive applications with React.",
43+
description: "Manage component state and lifecycle methods",
44+
watched: true,
45+
publishedDate: "2023-02-05",
46+
author: "Jane Smith",
47+
},
48+
{
49+
id: 5,
50+
title: "Handling Events",
51+
longDescription:
52+
"Learn how to handle user interactions in React, including events like clicks, form submissions, and more.",
53+
description: "Learn how to handle user interactions in React",
54+
watched: true,
55+
publishedDate: "2023-02-12",
56+
author: "John Doe",
57+
},
58+
{
59+
id: 6,
60+
title: "Conditional Rendering",
61+
longDescription:
62+
"Discover how to display different UI elements based on specific conditions in your React applications.",
63+
description: "Display different UI based on conditions",
64+
watched: false,
65+
publishedDate: "2023-02-19",
66+
author: "Jane Smith",
67+
},
68+
{
69+
id: 7,
70+
title: "Lists and Keys",
71+
longDescription:
72+
"Learn the best practices for rendering lists of components in React and how to efficiently manage them with unique keys.",
73+
description: "Render multiple components efficiently",
74+
watched: false,
75+
publishedDate: "2023-02-26",
76+
author: "John Doe",
77+
},
78+
{
79+
id: 8,
80+
title: "Forms in React",
81+
longDescription:
82+
"This video covers how to create and manage forms in React applications, including controlled and uncontrolled components.",
83+
description: "Create and handle form inputs in React applications",
84+
watched: false,
85+
publishedDate: "2023-03-05",
86+
author: "Jane Smith",
87+
},
88+
{
89+
id: 9,
90+
title: "Hooks: useState and useEffect",
91+
longDescription:
92+
"An introduction to React Hooks, focusing on useState and useEffect to manage state and side effects in functional components.",
93+
description: "Understand and use basic React Hooks",
94+
watched: false,
95+
publishedDate: "2023-03-12",
96+
author: "John Doe",
97+
},
98+
{
99+
id: 10,
100+
title: "Custom Hooks",
101+
longDescription:
102+
"Learn how to create custom hooks in React to encapsulate and reuse logic across components.",
103+
description: "Create reusable logic with custom Hooks",
104+
watched: false,
105+
publishedDate: "2023-03-19",
106+
author: "Jane Smith",
107+
},
108+
{
109+
id: 11,
110+
title: "Context API",
111+
longDescription:
112+
"Explore the Context API to manage global state in your React applications without the need for prop drilling.",
113+
description: "Manage global state in your React application",
114+
watched: false,
115+
publishedDate: "2023-03-26",
116+
author: "John Doe",
117+
},
118+
{
119+
id: 12,
120+
title: "React Router",
121+
longDescription:
122+
"Learn how to implement navigation in your single-page applications using React Router, including dynamic routing and nested routes.",
123+
description: "Implement navigation in your single-page application",
124+
watched: false,
125+
publishedDate: "2023-04-02",
126+
author: "Jane Smith",
127+
},
128+
];
129+
130+
export { mockVideoSrc, mockContentList };

0 commit comments

Comments
 (0)