Seed tasks at startup and add dark-themed task list page - #7
Merged
Conversation
Add a seed() method to TaskStore and seed four tasks in server.ts so GET /tasks returns a populated list on startup. The injectable default store in createApp stays empty so existing tests still pass. Also add a modern dark-themed HTML page at GET / that renders the task list (status dot, title, created time, Open/Done badge, done counter); /tasks continues to serve raw JSON. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
GET /tasksstarted empty, so the sample app's list view looked blank on a fresh boot during demos. This pre-loads a few tasks at startup and gives them a readable, modern home page.What changed
seed(titles: string[])method toTaskStorethat creates a task per title.server.tsnow constructs the store explicitly and seeds it with four tasks ("comb my hair", "brush my teeth", "pet the octocat", "plan world domination"), then injects it intocreateApp.GET /rendering a dependency-free, GitHub-style dark page (src/tasks/view.ts): each task shows a status dot, title, created time, and an Open/Done badge, plus a done counter. Titles are HTML-escaped.Notes for reviewers
createAppis intentionally left empty so the existing tests (which expect an empty store) keep passing. Seeding only happens inserver.ts.GET /tasksstill returns raw JSON; the styled view lives at/.npm test(8/8 passing) andnpm run typecheckboth clean.