T01 html css js - #55
Conversation
|
Thank you for your pull request. Note that all new pull requests to the Vue3-WebDev-Kit are opened as draft pull requests. Submitting Your WorkWhen you believe your work on the assignment is complete mark your pull request as ready for review to turn it in. Getting HelpIf you have questions as you work you can get in touch via:
|
bfc2aa8 to
7176a47
Compare
|
@copilot review this pull request. |
|
@copilot review this pull request. |
Project Structure
Workflow
Basic HTML Structure
CSS Styling
JavaScript Functionality
CI Status
|
|
Used for testing. |
There was a problem hiding this comment.
🟡 Changes recommended
The current HTML/JS combination can break at runtime due to async script loading order, and the JavaScript function name does not match the tutorial requirement (setUsername).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds the “Tutorial 01 - HTML/CSS/JS” first-website project content (HTML/CSS/JS + images) under web-projects/first-website/, matching the tutorial’s required structure and basic functionality.
Changes:
- Adds
index.htmlwith page content, Google Font loading, stylesheet link, and script tag. - Adds
styles/style.csswith basic type-selector styling for the page. - Adds
scripts/main.jsfor image toggling and a localStorage-backed personalized greeting.
Project Structure
| Requirement | Status | Notes |
|---|---|---|
web-projects/first-website directory exists |
✅ | Present |
web-projects/first-website/index.html exists |
✅ | Present |
web-projects/first-website/styles/style.css exists |
✅ | Present |
web-projects/first-website/images contains ≥1 image file |
✅ | fd2-logo.png, fd2-logo-orange.png |
web-projects/first-website/scripts/main.js exists |
✅ | Present |
index.html links styles/style.css in <head> |
✅ | Present |
index.html loads scripts/main.js via <script> in <head> |
✅ | Present; avoid async here (see inline review comment) |
Workflow
| Requirement | Status | Notes |
|---|---|---|
| PR contains at least three commits | ✅ | Confirmed via PR commit list |
| Commit messages briefly describe changes | ✅ | Messages are generally descriptive |
Basic HTML Structure
| Requirement | Status | Notes |
|---|---|---|
Descriptive <title> in <head> |
✅ | “The FarmData2 Project” |
<h1> matches or is very similar to title |
✅ | Matches title |
styles/style.css linked in <head> |
✅ | Present |
| Head links to a Google Font | ✅ | Roboto |
<img> displays an image with descriptive alt text |
✅ | Present |
One or more <p> elements below the image |
✅ | Present |
<ul> or <ol> with ≥3 <li> items |
✅ | 5 items |
| At least one link element | ✅ | Link to FarmData2 GitHub repo |
CSS Styling
| Requirement | Status | Notes |
|---|---|---|
Type selectors for h1, p, li, body, img, html |
✅ | Present (including grouped p, li) |
JavaScript Functionality
| Requirement | Status | Notes |
|---|---|---|
| Image click toggles displayed image between two images | ✅ | Toggles fd2-logo.png / fd2-logo-orange.png |
Button click calls setUsername function |
❌ | Implemented as setUserName (see inline review comment) |
On page load, uses localStorage name to update <h1> if present |
✅ | Present |
File summaries
| File | Description |
|---|---|
| web-projects/first-website/index.html | Adds the tutorial page structure/content, styling link, Google Font, and script inclusion. |
| web-projects/first-website/styles/style.css | Adds basic CSS type-selector styling for the tutorial page. |
| web-projects/first-website/scripts/main.js | Adds image toggling and localStorage-backed greeting behavior for the tutorial. |
Review details
- Files reviewed: 3/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" | ||
| rel="stylesheet" | ||
| /> | ||
| <script async src="scripts/main.js"></script> |
| function setUserName() { | ||
| const myName = prompt('Please enter your name.') | ||
| if (!myName) { | ||
| setUserName() | ||
| } else { | ||
| localStorage.setItem('name', myName) | ||
| myHeading.textContent = `FarmData2 is cool, ${myName}` | ||
| } | ||
| } | ||
|
|
||
| if (!localStorage.getItem('name')) { | ||
| setUserName() | ||
| } else { | ||
| const storedName = localStorage.getItem('name') | ||
| myHeading.textContent = `FarmData2 is cool, ${storedName}` | ||
| } | ||
|
|
||
| myButton.addEventListener('click', () => { | ||
| setUserName() | ||
| }) |
| html { | ||
| /* px means "pixels". The base font size is now 10 pixels high */ | ||
| font-size: 10px; | ||
| /* Replace PLACEHOLDER with the font-family property value you got from Google Fonts */ |
There was a problem hiding this comment.
🔵 Needs a closer look
The async script load can break DOM-dependent JS initialization and the required setUsername function name does not match the rubric.
Review details
Suppressed comments (2)
web-projects/first-website/index.html:13
- Using
asyncfor the<script>in the<head>can runmain.jsbefore the<img>,<h1>, and<button>elements exist, which will makedocument.querySelector(...)returnnulland cause runtime errors when adding event listeners. Usedefer(or move the script tag to the end of<body>) so the DOM is parsed before the script executes.
<script async src="scripts/main.js"></script>
web-projects/first-website/scripts/main.js:18
- The tutorial criteria expects the button click listener to call a
setUsernamefunction, but this file defines and callssetUserNameinstead. Rename the function and update call sites so the implementation matches the required API/name.
function setUserName() {
const myName = prompt('Please enter your name.')
if (!myName) {
setUserName()
- Files reviewed: 3/5 changed files
- Comments generated: 0 new
- Review effort level: Lite
Type of Work
Topic
Time Estimate
Additional Information