Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

name: PR Validation Pipeline

on:
pull_request:
branches:
- main

jobs:

client:
name: Validate Client
runs-on: ubuntu-latest

defaults:
run:
working-directory: client

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Dependencies
run: npm ci

- name: Run Build
run: npm run build

go-server:
name: Validate Go Server
runs-on: ubuntu-latest

defaults:
run:
working-directory: server

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25.0'

- name: Run Tests
run: go test -v ./...

- name: Run Build
run: go build -o cmd/server/main.go

python-service:
name: Validate Python Service
runs-on: ubuntu-latest

defaults:
run:
working-directory: python

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Dependencies
run: pip install -r requirements.txt
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__pycache__/
.vercel
*/__pycache__/*
1 change: 1 addition & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.env
120 changes: 120 additions & 0 deletions client/src/apis/pathApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type Roadmap = {
roadmapContent: string;
responsePayload: string;
dayProgress?: string;
taskProgress?: string;
createdAt: string;
authorId: number;
};
Expand Down Expand Up @@ -59,6 +60,93 @@ export type GenerateQuizResponse = {
quiz: string;
};

export type TaskProgressEntry = {
dayLabel: string;
taskIndex: number;
completed: boolean;
};

export type UpdateTaskProgressResponse = {
success: boolean;
taskProgress: TaskProgressEntry[];
};

export type ResourceItem = {
type: "video" | "article";
title: string;
url: string;
thumbnail?: string;
description?: string;
};

export type FetchResourcesResponse = {
success: boolean;
resources: Record<string, ResourceItem[]>;
};

export type PathStatItem = {
id: number;
name: string;
progress: number;
totalDays: number;
completedDays: number;
};

export type CompletedPathItem = {
id: number;
name: string;
totalDays: number;
createdAt: string;
};

export type DistributionEntry = {
name: string;
value: number;
};

export type WeeklyEntry = {
label: string;
completed: number;
created: number;
};

export type MonthlyEntry = {
month: string;
focus: number;
completion: number;
};

export type UserStats = {
totalPaths: number;
completedPaths: number;
inProgressPaths: number;
queuedPaths: number;
completionRate: number;
activePaths: PathStatItem[];
completedList: CompletedPathItem[];
distribution: DistributionEntry[];
weeklyClosures: WeeklyEntry[];
monthlyActivity: MonthlyEntry[];
currentFocus: string;
};

export type GetUserStatsResponse = {
success: boolean;
stats: UserStats;
};

export async function getUserStats(): Promise<UserStats | null> {
try {
const response = await api.get<GetUserStatsResponse>("/path/stats");
if (response.data.success) {
return response.data.stats;
}
return null;
} catch {
return null;
}
}

export function createPath(payload: FormData) {
return api.post<CreatePathResponse>("/path/create", payload, {
headers: {
Expand Down Expand Up @@ -94,6 +182,38 @@ export async function updateDayProgress(
});
}

export async function updateTaskProgress(
roadmapId: number,
dayLabel: string,
taskIndex: number,
completed: boolean,
) {
return api.patch<UpdateTaskProgressResponse>("/path/task-progress", {
roadmapId,
dayLabel,
taskIndex,
completed,
});
}

export async function fetchDayResources(
topics: string[],
userGoal: string,
): Promise<Record<string, ResourceItem[]>> {
try {
const response = await api.post<FetchResourcesResponse>("/path/resources", {
topics,
user_goal: userGoal,
});
if (response.data.success) {
return response.data.resources;
}
return {};
} catch {
return {};
}
}

export async function generateQuiz(
roadmapId: number,
difficultyTiers: number,
Expand Down
7 changes: 3 additions & 4 deletions client/src/components/AddCourseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,12 @@ const AddCourseModal: React.FC<AddCourseModalProps> = ({ onClose, refreshData })
<div className="flex flex-col gap-4">
<div className="space-y-2">
<label className="text-xs uppercase tracking-widest text-text-secondary">
Playlist URL
YouTube URL
</label>
<div className="relative">
<input
type="text"
placeholder="https://youtube.com/playlist?list=..."
placeholder="Single video: youtube.com/watch?v=... or playlist: youtube.com/playlist?list=..."
value={youtubeUrl}
onChange={(e) => {
setYoutubeUrl(e.target.value);
Expand All @@ -459,8 +459,7 @@ const AddCourseModal: React.FC<AddCourseModalProps> = ({ onClose, refreshData })
<div className="p-4 bg-white/5 rounded-lg border border-white/5 mt-4">
<p className="text-sm text-text-secondary">
<span className="text-white font-medium">Note:</span>{" "}
We'll extract transcripts and structure them into a
day-by-day plan.
Paste a single video or playlist URL — we'll extract transcripts and structure them into a day-by-day plan.
</p>
</div>
</div>
Expand Down
14 changes: 8 additions & 6 deletions client/src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AddCourseModal from "../components/AddCourseModal";
import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { Plus } from "lucide-react";
import { getAllPaths, type Roadmap } from "@/apis/pathApi";
import { getAllPaths, getUserStats, type Roadmap, type UserStats } from "@/apis/pathApi";

gsap.registerPlugin(ScrollTrigger);

Expand All @@ -16,12 +16,14 @@ const Dashboard: React.FC = () => {
const gridRef = useRef<HTMLDivElement>(null);
const [isModalOpen, setIsModalOpen] = useState(false);
const [paths, setPaths] = useState<Array<Roadmap>>([]);
const [stats, setStats] = useState<UserStats | null>(null);
const navigate = useNavigate();

const handleFetchPaths = async () => {
const response = await getAllPaths();
setPaths(response as Array<Roadmap>);
};
const [roadmaps, userStats] = await Promise.all([getAllPaths(), getUserStats()]);
setPaths(roadmaps as Array<Roadmap>);
setStats(userStats);
};

useEffect(() => {
handleFetchPaths();
Expand Down Expand Up @@ -81,14 +83,14 @@ const Dashboard: React.FC = () => {
<span>Create New</span>
</button>
<div className="flex flex-col items-end">
<span className="text-2xl font-serif text-white">12</span>
<span className="text-2xl font-serif text-white">{stats?.completedPaths ?? 0}</span>
<span className="text-xs uppercase tracking-widest text-text-secondary">
Completed
</span>
</div>
<div className="w-px h-10 bg-white/10 mx-2"></div>
<div className="flex flex-col items-end">
<span className="text-2xl font-serif text-white">4</span>
<span className="text-2xl font-serif text-white">{stats?.inProgressPaths ?? 0}</span>
<span className="text-xs uppercase tracking-widest text-text-secondary">
In Progress
</span>
Expand Down
Loading
Loading