Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
6a11fbe
Add recipes and countries for week1
Idesta1 Oct 23, 2025
538b39a
Update recipes and countries in git/week1
Idesta1 Oct 23, 2025
6c11acd
Remove duplicate root git/ folder; keep courses/foundation/git/week1
Idesta1 Oct 23, 2025
14283c5
Merge pull request #1 from Idesta1/git-week1/iglesia
Idesta1 Oct 23, 2025
65d86f7
added a new folder portfolio
Idesta1 Oct 27, 2025
aac3bf3
Create index.html
Idesta1 Oct 27, 2025
2d64a70
Update index.html
Idesta1 Oct 27, 2025
3a4fe44
created CSS file
Idesta1 Oct 27, 2025
1b6b8ee
moved folder
Idesta1 Oct 29, 2025
6ff9d5f
update html/CSS
Idesta1 Oct 29, 2025
bd9d8d6
added js file
Idesta1 Oct 29, 2025
85bfd33
added images
Idesta1 Oct 29, 2025
960107b
Update styles.css
Idesta1 Oct 29, 2025
eb44aac
Update reflection.md
Idesta1 Oct 29, 2025
460b862
Merge pull request #2 from Idesta1/usingai-week2-iglesia
Idesta1 Oct 29, 2025
f21a135
update
Idesta1 Oct 31, 2025
8365182
Delete settings.json
Idesta1 Oct 31, 2025
af74a3f
Create script.js
Idesta1 Oct 31, 2025
05c3042
update
Idesta1 Nov 3, 2025
5685bdc
Update
Idesta1 Nov 3, 2025
ff0f8ed
added Js function
Idesta1 Nov 3, 2025
e82a90b
Create index1.html
Idesta1 Nov 3, 2025
63affdf
moved folder
Idesta1 Nov 3, 2025
25a5424
Update index.html
Idesta1 Nov 4, 2025
1093c72
Update index.html
Idesta1 Nov 4, 2025
ae97d88
Create index2.html
Idesta1 Nov 4, 2025
ceec765
Create index.html
Idesta1 Nov 4, 2025
00522fb
Delete settings.json
Idesta1 Nov 4, 2025
b95e30b
remove folders
Idesta1 Nov 5, 2025
70c41d3
change file
Idesta1 Nov 5, 2025
bbf0710
Added readme
Idesta1 Nov 5, 2025
ef1bd62
update JS
Idesta1 Nov 5, 2025
5cc45e1
Create pizza.js
Idesta1 Nov 6, 2025
25c6267
update
Idesta1 Nov 6, 2025
8f11dd9
update
Idesta1 Nov 6, 2025
626e0ee
Create flight.js
Idesta1 Nov 11, 2025
f86ff94
Update flight.js
Idesta1 Nov 11, 2025
be95a9f
Update pizza.js
Idesta1 Nov 11, 2025
490ab7d
update
Idesta1 Nov 11, 2025
77061f0
Merge pull request #3 from Idesta1/javascript/week3/iglesia
Idesta1 Nov 11, 2025
e7db7d0
Create event.js
Idesta1 Nov 11, 2025
0eeffa6
Create weatherwear.js
Idesta1 Nov 11, 2025
b4a990c
Create student.js
Idesta1 Nov 12, 2025
0702e39
update
Idesta1 Nov 12, 2025
7f72eac
Create freecodecamp.txt
Idesta1 Nov 13, 2025
08799de
update
Idesta1 Nov 13, 2025
5f66696
Merge pull request #4 from Idesta1/javascript/week3/iglesia
Idesta1 Nov 13, 2025
a43a9a3
update
Idesta1 Nov 17, 2025
50902f3
Create array.js
Idesta1 Nov 18, 2025
313bd30
Create note.js
Idesta1 Nov 18, 2025
25edace
created cactus.js
Idesta1 Nov 20, 2025
0ccea43
Update note.js
Idesta1 Nov 20, 2025
af2d445
Update note.js
Idesta1 Nov 20, 2025
ff0779d
update
Idesta1 Nov 22, 2025
3faa6d7
Merge pull request #5 from Idesta1/javascript/week3/iglesia
Idesta1 Nov 22, 2025
a52a467
Create voiceasst.js
Idesta1 Nov 24, 2025
51c285b
Update voiceasst.js
Idesta1 Nov 25, 2025
47c26e1
Update voiceasst.js
Idesta1 Nov 26, 2025
c325a98
Update voiceasst.js
Idesta1 Nov 26, 2025
36e0f88
Create sandbox.txt
Idesta1 Nov 26, 2025
36cfa90
Update voiceasst.js
Idesta1 Nov 28, 2025
284e9db
Update voiceasst.js
Idesta1 Nov 28, 2025
e39f9f4
Update voiceasst.js
Idesta1 Nov 29, 2025
bb028bd
Merge pull request #6 from Idesta1/javascript/week3/iglesia
Idesta1 Nov 29, 2025
e7837e1
Added sequence diagram
Idesta1 Dec 3, 2025
3a226eb
Update README.md
Idesta1 Dec 3, 2025
e052b4a
Update README.md
Idesta1 Dec 3, 2025
ff47daa
Update README.md
Idesta1 Dec 3, 2025
0e404fd
update
Idesta1 Dec 4, 2025
c4c62bd
Merge pull request #7 from Idesta1/Web-arct/iglesia
Idesta1 Dec 4, 2025
0813734
Added Dbeaver sql
Idesta1 Dec 9, 2025
50ee277
Update db.sql
Idesta1 Dec 10, 2025
cd2ba8e
Merge pull request #8 from Idesta1/database/hyf
Idesta1 Dec 11, 2025
a2ee823
Create hogwarts.js
Idesta1 Jan 11, 2026
da9383e
Created html file hogwarts.js
Idesta1 Jan 11, 2026
ffb0032
Create Trello.txt
Idesta1 Jan 13, 2026
4de1e86
updated
Idesta1 Jan 15, 2026
79cfd73
Empty db file
Idesta1 Jan 25, 2026
aad9041
Copied over safely without excessive other files
Idesta1 Jan 25, 2026
c0eb74b
update
Idesta1 Jan 26, 2026
3eaaf39
Update styles.css
Idesta1 Jan 26, 2026
f1bb5fa
Update styles.css
Idesta1 Jan 26, 2026
212babc
Updated HyfBay
Idesta1 Jan 26, 2026
5a2e67c
added image
Idesta1 Jan 26, 2026
2a13b21
Delete db.sql
Idesta1 Jan 26, 2026
7a007b7
Merge pull request #12 from Idesta1/intro-to-agile/iglesia
Idesta1 Jan 26, 2026
ec056fe
update hogwarts house
Idesta1 Jan 27, 2026
a3f6dce
update
Idesta1 Jan 27, 2026
572994f
update hyfbay
Idesta1 Jan 27, 2026
2aa3b03
Merge pull request #14 from Idesta1/Front-end/iglesia-2
Idesta1 Feb 18, 2026
d33cae4
Resolve merge conflicts from upstream/main
Idesta1 Feb 18, 2026
9a43c61
added new folder session material on using AI
Idesta1 Mar 1, 2026
b267c32
modify excercise 8 on using AI session in class
Idesta1 Mar 1, 2026
ab21993
init commit: set up all the files moved from previous portfolio folder
Idesta1 Mar 2, 2026
a02f173
Implemented enhancement to HTML, CSS and JS using copilot
Idesta1 Mar 3, 2026
7fd7f5f
Enhance: Add responsive navigation bar with hamburger menu and smooth…
Idesta1 Mar 3, 2026
c10decf
Enhance: Improve layout, theme functionality, and responsiveness
Idesta1 Mar 3, 2026
7bf90b3
Enhance Portfolio: Add Flag, Project Thumbnails
Idesta1 Mar 3, 2026
d5e89be
feat: Enhance About Skills & Interests section with gradient font and…
Idesta1 Mar 4, 2026
5bbff44
feat: Update project description in the Projects section
Idesta1 Mar 4, 2026
62bd47b
feat: Enhance contact section and footer design
Idesta1 Mar 4, 2026
74d018c
refactor: Optimize and clean up codebase
Idesta1 Mar 4, 2026
ec8a637
reflection
Idesta1 Mar 4, 2026
21ee214
Delete foundation.PNG
Idesta1 Mar 4, 2026
c448e9f
removed resize
Idesta1 Mar 8, 2026
79099aa
Create doubling.js
Idesta1 Mar 9, 2026
327b27a
Update doubling.js
Idesta1 Mar 9, 2026
9fe15b2
init commit
Idesta1 Mar 9, 2026
98ed46d
add CSS file and image
Idesta1 Mar 9, 2026
72d142d
Update
Idesta1 Mar 9, 2026
aeb031b
Enhance movie display with dynamic tags and responsive design
Idesta1 Mar 11, 2026
202098b
display keyword
Idesta1 Mar 11, 2026
914a0b1
implemented: total count of movies by category and duplicate title
Idesta1 Mar 11, 2026
54c9ad6
Improve responsiveness and clean CSS/HTML code for better alignment a…
Idesta1 Mar 11, 2026
f539ecc
Added codewars
Idesta1 Mar 11, 2026
913b37d
set up html js file for task2
Idesta1 Mar 16, 2026
7420f24
Merge pull request #18 from Idesta1/advancedjs-assignment
Idesta1 Mar 16, 2026
095b01f
init commit
Idesta1 Mar 16, 2026
aac2077
init commit for assignment 2
Idesta1 Mar 17, 2026
0872859
Update functions.js
Idesta1 Mar 17, 2026
801fa4e
Implement game logic and DOM handling
Idesta1 Mar 18, 2026
8bf2dbe
Improved Html,CSS and Js
Idesta1 Mar 18, 2026
d4f77b5
update
Idesta1 Mar 18, 2026
5824f80
update
Idesta1 Mar 18, 2026
7d1f089
Update functions.js
Idesta1 Mar 18, 2026
bb87228
Update functions.js
Idesta1 Mar 19, 2026
4cf8b04
Added confetti for winning
Idesta1 Mar 19, 2026
cdb7554
Update script.js
Idesta1 Mar 23, 2026
3153223
Update functions.js
Idesta1 Mar 23, 2026
8585be0
init commit
Idesta1 Mar 23, 2026
7a38b51
update
Idesta1 Mar 24, 2026
3329a11
feat: dynamic currency options and conversion logic via fetch API
Idesta1 Mar 25, 2026
d494932
Improved responsiveness and style
Idesta1 Mar 25, 2026
3359a40
Merge pull request #19 from Idesta1/advancedjs-assignment
Idesta1 Mar 25, 2026
86b97a9
update
Idesta1 Mar 24, 2026
c289d88
update week-3
Idesta1 Mar 24, 2026
0b8e1a1
resolved
Idesta1 Mar 30, 2026
cef093b
Screen-shot PNG
Idesta1 Mar 30, 2026
adfe589
Merge pull request #17 from Idesta1/frontend/using-ai
Idesta1 Mar 30, 2026
8036723
init commit
Idesta1 Apr 9, 2026
0783d39
update on ourValues
Idesta1 Apr 9, 2026
bf5fbe9
feat: render crew component using mapped data
Idesta1 Apr 15, 2026
c83e3f0
Update AboutUsPage.module.css
Idesta1 Apr 15, 2026
3f37c32
Add Our Partners section and styles
Idesta1 Apr 15, 2026
406789a
Refactor AboutUsPage values section and styles
Idesta1 Apr 15, 2026
eae7b74
Split AboutUs components into separate files
Idesta1 Apr 15, 2026
10155be
Update AboutUsPage.module.css
Idesta1 Apr 15, 2026
4631517
Update .gitignore
Idesta1 Apr 15, 2026
3341069
clean code based on mentor's review
Idesta1 Apr 18, 2026
9b84f34
Merge pull request #23 from Idesta1/react/week1
Idesta1 Apr 18, 2026
5ee7e60
Merge pull request #21 from Idesta1/advanced-week3-clean
Idesta1 Apr 18, 2026
7100416
feat: render destination data and wishlist behavior
Idesta1 Apr 20, 2026
45f4e16
feat: create PlanetCard component and style button
Idesta1 Apr 20, 2026
7348766
feat: wishlist count, responsive layout, and CSS variables
Idesta1 Apr 21, 2026
4278482
refactor(navbar): create NavItem component and improve responsiveness
Idesta1 Apr 21, 2026
2997a7d
feat(footer): add pages navigation with React Router links
Idesta1 Apr 21, 2026
6c5eb10
feat(footer): add reusable SocialMediaItem with local social icons
Idesta1 Apr 21, 2026
c5dd5cd
Merge pull request #24 from Idesta1/react/week2
Idesta1 Apr 25, 2026
6aa8e2f
feat(destination): add custom wishlist item state and form handling
Idesta1 Apr 27, 2026
b66cf62
feat(nasa): integrate NASA API with rover photos and astronomy pictur…
Idesta1 Apr 27, 2026
3eaa671
feat: move NASA API key to .env for security
Idesta1 Apr 29, 2026
cc3a3a9
feat: use yesterday rover date and limit rover photo to one image
Idesta1 Apr 29, 2026
5224424
feat: add RoverPhoto component, NASA styling, and APOD media handling
Idesta1 Apr 29, 2026
fd6b01b
Merge pull request #25 from Idesta1/react/week3
Idesta1 May 2, 2026
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules/
.env
.env.local
.vercel/
.DS_Store
.vscode/
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"sqltools.connections": [
{
"previewLimit": 50,
"driver": "SQLite",
"name": "db sql",
"database": "db.sql"
}
],
"cSpell.words": ["apod", "Desta", "Galactica"]
}
File renamed without changes.
2 changes: 2 additions & 0 deletions assets/courses/foundation/Intro-to-agile/Trello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

https://trello.com/b/opBYR6Ge/bake-birthday-cake
30 changes: 30 additions & 0 deletions assets/courses/foundation/databases/db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--1 How many tasks are in the task table?
SELECT COUNT(*) FROM task;

--2 How many tasks in the task table do not have a valid due date?
SELECT COUNT(*) AS invalid_due_dates FROM task WHERE due_date IS NULL;

--3 Find all the tasks that are marked as done.
SELECT * FROM task WHERE status_id = 3;

--4 Find all the tasks that are not marked as done.
SELECT * FROM task WHERE status_id != 3;

--5 Get all the tasks, sorted with the most recently created first.
SELECT * FROM task ORDER BY created DESC;

--6 Get the single most recently created task.
SELECT * FROM task ORDER BY created DESC LIMIT 1;

--7 Get the title and due date of all tasks where the title or description contains database.
SELECT title, due_date FROM task WHERE title LIKE '%database%' OR description LIKE '%database%';

--8 Get the title and status (as text) of all tasks.
SELECT t.title, s.name FROM task t LEFT JOIN status s ON t.status_id = s.id;

--9 Get the name of each status, along with a count of how many tasks have that status.
SELECT s.name AS status, COUNT(t.id) AS status_count FROM status s LEFT JOIN task t ON t.status_id = s.id GROUP BY s.id, s.name;

--10 Get the names of all statuses, sorted by the status with most tasks first.
SELECT s.name, COUNT(*) AS status_count FROM task t JOIN status s ON t.status_id = s.id
GROUP BY s.name ORDER BY status_count DESC;
3 changes: 3 additions & 0 deletions assets/courses/foundation/git/week1/countries.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ethiopia
USA
Sweden
26 changes: 26 additions & 0 deletions assets/courses/foundation/git/week1/my-favourite-food.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Fish Balls (Simple Home Recipe)

Ingredients:
- 500 g white fish fillets (cod, pollock or haddock), skin removed
- 1 egg, lightly beaten
- 2 spring onions, finely chopped
- 2 cloves garlic, minced
- 1 teaspoon soy sauce
- 1 teaspoon sesame oil
- 1/2 teaspoon salt (adjust to taste)
- 1/4 teaspoon white or black pepper
- 3 tablespoons cornstarch (plus extra for dusting)
- Vegetable oil, for frying or cooking

Instructions:
1. Chop the fish into small pieces and place into a large bowl or food processor.
2. Add the egg, spring onions, garlic, soy sauce, sesame oil, salt and pepper.
3. Pulse or mix until you get a smooth, sticky paste. If too loose, add 1 tablespoon cornstarch at a time until the mixture holds together.
4. Wet your hands and shape the mixture into small balls (about 1" / 2–3 cm diameter).
5. Option A — Boil: Bring a pot of water to a gentle boil and drop the fish balls in. Cook until they float (3–5 minutes). Remove with a slotted spoon.
Option B — Pan-fry: Heat 2–3 tablespoons vegetable oil in a skillet and shallow-fry the fish balls, turning occasionally, until golden and cooked through (about 6–8 minutes).
6. Serve hot with dipping sauce, in noodle soup, or as a snack.

Tips:
- For a springier texture, chill the fish paste for 30 minutes before shaping.
- You can substitute a mixture of fish and shrimp for a different flavor.
27 changes: 27 additions & 0 deletions assets/courses/foundation/git/week1/my-second-favorite-food.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Vegetable Stir-Fry with Garlic Sauce

Ingredients:
- 3 cups mixed vegetables (broccoli florets, bell peppers, carrots, snap peas)
- 200 g firm tofu or sliced mushrooms (optional)
- 3 cloves garlic, minced
- 1 tbsp fresh ginger, minced
- 2 tbsp soy sauce
- 1 tbsp oyster sauce (or vegetarian alternative)
- 1 tsp sugar
- 1 tbsp sesame oil
- 2 tbsp vegetable oil for frying
- 1 tbsp cornstarch mixed with 3 tbsp water (slurry)

Instructions:
1. Prepare all vegetables and proteins, cutting into bite-sized pieces.
2. Heat vegetable oil in a wok or large skillet over high heat.
3. Add garlic and ginger, stir-fry briefly until fragrant (20–30 seconds).
4. Add tofu or mushrooms, fry until lightly browned.
5. Add vegetables and stir-fry for 3–5 minutes until crisp-tender.
6. Mix soy sauce, oyster sauce, sugar and sesame oil; pour over the vegetables.
7. Add cornstarch slurry and stir until the sauce thickens and coats the vegetables.
8. Serve immediately over steamed rice or noodles.

Variations:
- Add chili flakes or fresh chilies for heat.
- Swap tofu for chicken or shrimp for a non-vegetarian version.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ window.getAvailableProducts = function () {
const numberOfAvailableProducts = getRandomInt(0, 30);
const availableProducts = Array.apply(
null,
Array(numberOfAvailableProducts),
Array(numberOfAvailableProducts)
).map(() => {
const name = getRandomProductName();
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@
/>
</head>
<body>
<main></main>
<main>
<header>
<h1>HYF-Bay🤑</h1>
<p>Your Favorite Marketplace</p>
</header>
<section class="products-section">
<h2>Products</h2>
<ul id="product-list" class="product-item"></ul>
</section>
</main>
<script src="hyfBayHelpers.js"></script>
<script src="main.js"></script>
</body>
31 changes: 31 additions & 0 deletions assets/courses/foundation/intro-to-frontend/HYFBay/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
body {
font-family: "Open Sans", sans-serif;
background-color: #f9fbfd;
padding: 20px;
}

* {
box-sizing: border-box;
}

body,
h1,
h2 {
margin: 0;
text-align: center;
}
.products-section {
max-width: 1200px;
margin: 0 auto;
}
.product-item {
display: flex;
flex-direction: column;
margin: 20px 0 10px 30px;
list-style-type: none;
background-color: lightyellow;
padding: 15px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0,
0, 0.1);
}
22 changes: 22 additions & 0 deletions assets/courses/foundation/intro-to-frontend/HYFBay/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
console.log("Script loaded");

const products = getAvailableProducts();
console.log(products);

// This should create the ul and the li's with the individual products details

function renderProducts(products) {
const productList = document.getElementById("product-list");

products.forEach((product) => {
const listItem = document.createElement("li");
listItem.classList.add("product-item");
listItem.innerHTML = `${product.name}
Price: $${product.price.toFixed(2)}
Rating: ${product.rating} / 10
`;
productList.appendChild(listItem);
});
}

renderProducts(products);
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const houses = [
{
name: "Gryffindor",
description:
"Gryffindor values courage, bravery, nerve and chivalry. Its mascot is the lion, and its colours are scarlet and gold. The Gryffindor motto is Their daring, nerve and chivalry set Gryffindors apart. The Head of this house is the Transfiguration teacher and Deputy Headmistress, Minerva McGonagall, and the house ghost is Sir Nicholas de Mimsy-Porpington, more commonly known as Nearly Headless Nick. According to Rowling, Gryffindor corresponds roughly to the element of fire. The founder of the house is Godric Gryffindhighest towers, the entrance to which is located on the seventh floor in the east wing of the castle and is guarded by a painting of The Fat Lady, who is garbed in a pink dress. She permits entry only after being given the correct password, as was distinguished in the third book, when Sirius Black tried forcing entry into the tower, only to be blocked by The Fat Lady after he could not give the correct password. In the first book, Neville Longbottom tends to forget the password and must wait near the painting until other Gryffindors arrive to open the way.",
image:
"https://harrypottercrazies.weebly.com/uploads/1/8/4/4/18445957/4778832.jpg",
},
{
name: "Hufflepuff",
description:
"Hufflepuff house values hard work, patience, justice, and loyalty. The house mascot is the badger, and the house colours are yellow and black. The Hufflepuff motto is Those patient Hufflepuffs are true and unafraid of toil. The head of this house is the Herbology professor, Pomona Sprout, and the house ghost is the Fat Friar. According to Rowling, Hufflepuff corresponds roughly to the element of earth. The founder of this house is Helga Hufflepuff. The Hufflepuff dormitories and common room are located near the castle kitchens, in a cozy nook that can be reached through a stack of large barrels in a nook near the kitchens. The entrance is concealed by a large barrel; to gain entry, one must tap the barrel in a certain rhythm (which changes from time to time) to open it up. The common room is a vast underground cavern with earthy tones, low ceilings, and numerous plants and fungi growing from the walls. There are many cozy chairs and sofas around small fireplaces, as well as low tables for studying and socializing.",
image:
"https://harrypottercrazies.weebly.com/uploads/1/8/4/4/18445957/3077859.jpg?303",
},
{
name: "Ravenclaw",
description:
'Ravenclaw values intelligence, creativity, learning, and wit. The house mascot is an eagle and the house colours are blue and bronze blue and grey in the films. The Ravenclaw motto is "Wit beyond measure is man\'s greatest treasure." The head of this house is the Charms professor, Filius Flitwick, and the house ghost is The Grey Lady. According to Rowling, Ravenclaw corresponds roughly to the element of air. The founder of this house is Rowena Ravenclaw. The dormitories are located in Ravenclaw Tower, on the west side of Hogwarts. The common room, which went undescribed in the series until the climax of Deathly Hallows, is round and filled with blue hangings and armchairs, has a domed ceiling painted with stars and features a replica statue of Rowena wearing her diadem. Harry also notes that Ravenclaws "have a spectacular view of the surrounding mountains"',
image:
"https://harrypottercrazies.weebly.com/uploads/1/8/4/4/18445957/1177755.jpg?264",
},
{
name: "Slytherin",
description:
"Slytherin house values ambition, cunning, leadership, and resourcefulness; the Sorting Hat said in Harry Potter and the Philosopher's Stone that Slytherins will do anything to get their way. The house mascot of Slytherin is the serpent, and the house colours are green and silver. The Slytherin motto is Slytherin will help you on your way to greatness. Salazar Slytherin founded the house. The Head of House is Severus Snape until near the end of the sixth book. Then, Horace Slughorn, the previous Head of House, comes out of retirement re-assuming authority. The ghost of Slytherin house is The Bloody Baron. According to Rowling, Slytherin corresponds roughly to the element of water. The Slytherin dormitories and common room are reached through a bare stone wall in the dungeons. The Slytherin common room is a long, low, dungeon-style room, located under the Hogwarts Lake, furnished with green lamps and carved armchairs. The room is described in the second book as having a greenish glow.",
image:
"https://harrypottercrazies.weebly.com/uploads/1/8/4/4/18445957/987119.jpg?250",
},
];

const usernameInput = document.getElementById("username");
const getHouseBtn = document.getElementById("getHouseBtn");
const retryBtn = document.getElementById("retryBtn");
const houseResult = document.getElementById("houseResult");
const houseName = document.getElementById("houseName");
const houseDescription = document.getElementById("houseDescription");
const houseImage = document.getElementById("houseImage");

let lastHouseIndex = -1; // Track the last selected house index

function getRandomHouse() {
const username = usernameInput.value.trim();
if (username === "") {
houseResult.textContent = "Please enter your name to get sorted!";
houseResult.classList.remove("hidden");
return;
}

// Generate a new random index that is not the same as the last one
let randomIndex;
do {
randomIndex = Math.floor(Math.random() * houses.length);
} while (randomIndex === lastHouseIndex);
lastHouseIndex = randomIndex; // Update last index

const house = houses[randomIndex];

houseName.textContent = `You belong in ${house.name}!`;
houseDescription.textContent = house.description;
houseImage.src = house.image;

houseResult.textContent = `${username} belongs in ${house.name}!`;
houseResult.classList.remove("error", "hidden");

// Change button text after first click
if (getHouseBtn.textContent === "Get a House") {
getHouseBtn.textContent = "Assign New House";
}
retryBtn.classList.remove("hidden");
}

getHouseBtn.addEventListener("click", getRandomHouse);
retryBtn.addEventListener("click", getRandomHouse);
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="styles.css" />
<title>Hogwarts House generator</title>
</head>
<body>
<div class="container">
<h1>Hogwarts House generator</h1>

<label for="username">Username:</label>
<input
id="username"
class="input-text"
type="text"
placeholder="Enter your name.."
/>
<button id="getHouseBtn">Get a House</button>
<button id="retryBtn" class="hidden">Try Again</button>

<p id="houseResult" class="error hidden"></p>

<h2 id="houseName"></h2>
<div class="house-info">
<img
src="https://harrypottercrazies.weebly.com/uploads/1/8/4/4/18445957/3554216.jpg?320"
id="houseImage"
class="house-img"
alt="house-image"
/>
<p id="houseDescription"></p>
</div>
</div>
<script src="hogwarts.js"></script>
</body>
</html>
Loading