The store’s site uses Vite on your vite branch, it builds all four pages, and the holiday fixes from main are merged in. In the last lesson, you also tried out .env in a throwaway project and committed a fake key there on purpose, so the store’s history is still spotless. The README’s list has two unticked boxes left, and main has kept the store’s customers on the old site the whole time.
In this project, you’ll finish the move on your own, with the habits from this course. You’ll write the deals logic and the badge’s holiday wording yourself, set up the store’s key the safe way, and end with main holding the finished site. Start with the brief, so you know what’s left and how your work gets checked.
Read the Brief
Open README.md and look at the list under Next: the move to npm and Vite. The badge and both holiday fixes are ticked, and these to-dos are still open:
-
Deals that know their week: Show the deals as this week’s deals while their week is on, and with their dates once it has ended.
-
Curbside pickup: Take orders on the pickup page through Generic Curbside, with the store’s publishable key (
curb_pub_...). The secret key (curb_sec_...) never goes in the site.
There’s also one gap in the badge you added. The to-do asked for a badge that knows the holiday hours, and it does know them, but it never says which holiday it’s using. On Christmas Eve, it reads Open now, until 3 p.m., which looks like a mistake to anyone who knows the store closes at 9 p.m. You’ll fix that, too.
Work through the steps below in order, on vite until the final merge into main. Each step says what to build and how to check it, but not how to write it, because that part is yours. The order matches how your work is graded. A coding exercise after this lesson checks your deals logic, a second one checks your badge, and npm run check checks the repository at the end.
These habits from the course apply to the implementation steps:
- Run
git statusbefore you change anything, and make sure it saysOn branch vite. - Keep the dev server running with
npm run devwhile you work, and use a second terminal for Git. - Stage your changes by filename, read
git diff --staged, and only then commit. - Run
npm run checkafter each commit, and fix any line marked ✘ before you go on.
The report grows as the project does. Its lines about .env appear once you’ve created the file, and the line about the merge appears only on main. So a shorter report on vite doesn’t mean that something’s missing. The full report, which must end with All checks passed, comes after the merge, on main.
The hashes quoted below come from the course’s own run. Yours will be different, because a hash depends on your name and the time of each commit.
Show the Deals for Their Week
The deals page always says This week’s deals, even after the week in src/data/deals.js has ended. The page should keep showing the deals either way, because the next week’s deals may not be in yet, but it should call them this week’s deals only while their week is on.
Build it in three files:
-
src/lib/deals.js, a new module that exportsdealWeekIsOn(date, week). It takes aDateand a week object likedealWeekinsrc/data/deals.js, such as{ start: "2026-11-25", end: "2026-12-01" }. It returnstruewhen the date falls on any day fromstarttoend, both days included, andfalseotherwise. It never reads the current date itself, so you can test it with any date. -
deals.html, where the<h1>getsid="deals-heading"and the text Weekly deals. -
src/deals-page.js, which callsdealWeekIsOn(new Date(), dealWeek)and fills in the heading and the line below it. While the week is on, they read This week’s deals and Prices good Wednesday, November 25 through Tuesday, December 1. Otherwise, they read Weekly deals and Deals for Wednesday, November 25 through Tuesday, December 1. The existingformatDay()already writes the dates.
dateKey() in src/lib/hours.js turns a Date into the same "YYYY-MM-DD" form that start and end use. Strings in that form compare in date order with >= and <=, because every part has a fixed number of digits.
The real date decides what the page shows, so the page alone can’t show you both cases. To test the function with any date, create a scratch file named try-it.js in the project folder:
try-it.js
import { dealWeekIsOn } from "./src/lib/deals.js";
const week = { start: "2026-11-25", end: "2026-12-01" };
console.log(dealWeekIsOn(new Date("2026-11-24T20:00"), week));
console.log(dealWeekIsOn(new Date("2026-11-25T08:00"), week));
console.log(dealWeekIsOn(new Date("2026-12-01T20:00"), week));
console.log(dealWeekIsOn(new Date("2026-12-02T08:00"), week));