Skip to content
Draft
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
31 changes: 30 additions & 1 deletion app/courses/[course]/(pages)/setup/hooks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const useRepositorySetup = (
initialRepo?._id?.toString() ?? null,
);

// Effect for initial setup and repo data fetching
useEffect(() => {
if (initialRepo) {
setShowRepositorySetup(true);
Expand Down Expand Up @@ -82,7 +83,35 @@ cd dotcodeschool-${courseSlug}
repositorySetup,
]);

// Rest of your component...
// Effect for real-time repository updates
useEffect(() => {
if (!repoId) return;

const eventSource = new EventSource("/api/repository-updates");

eventSource.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
// Check if the update is for our repository
if (data.documentKey?._id === repoId) {
// If there's an update to test_ok field, update our state
if (data.updateDescription?.updatedFields?.test_ok !== undefined) {
setGitPushReceived(data.updateDescription.updatedFields.test_ok);
}
}
} catch (error) {
console.error("Error processing repository update:", error);
}
};

eventSource.onerror = (error) => {
console.error("EventSource failed:", error);
};

return () => {
eventSource.close();
};
}, [repoId]);

return {
showRepositorySetup,
Expand Down
18 changes: 18 additions & 0 deletions content/courses/dotpets/dotpets.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
slug: dotpets
title: "DotPets: Web3 Frontend Fundamentals"
author: Batman
author_url: https://github.com/iammasterbrucewayne
description: Learn Web3 frontend fundamentals by building a pet game with NFTs on Polkadot.
level: Beginner
language: Typescript
tags: ["typscript", "tutorial", "course", "frontend"]
prerequisites: ["Next.js", "React", "Typescript"]
what_youll_learn: ["Connecting a Polkadot wallet to a frontend app", "Querying on-chain state (e.g., checking account balance or existing NFTs) using Polkadot API (PAPI)", "Minting a unique NFT (your DotPet) on Asset Hub", "This is where we’ll introduce the concept of extrinsics — what they are, why they’re called that, and how signed transactions affect chain state", "Viewing the NFT on Subscan or another explorer"]
estimated_time: 1 # Estimated time to complete in hours
last_updated: "2025-06-11"
---

DotPets is a tamagotchi-style on-chain pet game built using Polkadot Asset Hub and Polkadot-API.

It is a fun, lightweight entry point into Web3 frontend development that teaches fundamentals like wallet connection, on-chain state, identity, and asset minting using Polkadot’s Asset Hub + Polkadot-API.
Loading