diff --git a/.gitignore b/.gitignore
index a547bf3..21f6c6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
+coverage/
diff --git a/README.md b/README.md
index 7fc2ab3..8c8e446 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ The webpage can be accessed through a virtual machine at:
## Overview
-This project collects and displays data from an external REST API for the popular TV show _Rick and Morty_. Users can search for and filter characters using the search bar or filter menu. More detailed information about each character can be viewed by clicking the `Details` button. Each character card also has a star button that allows users to add characters to their favorites.
+This project collects and displays data from an external REST API for the popular TV show _Rick and Morty_. To demonstrate the application's functionality and navigation without using an unnecessarily large dataset, only the first page of characters is fetched from the API. Users can search for and filter characters using the search bar or filter menu. More detailed information about each character can be viewed by clicking the `Details` button. Each character card also has a star button that allows users to add characters to their favorites.
The API documentation can be found here:
@@ -16,7 +16,7 @@ The API documentation can be found here:
## Get started
-Before running the project, make sure you have `Node.js` installed on your machine. Install the project dependencies with:
+Before running the project, make sure you have `Node.js v24.6.X+` and `npm v11.+` installed on your machine. Install the project dependencies with:
```bash
npm install
@@ -32,7 +32,7 @@ The webpage will then be available at the local URL provided in the terminal (lo
## Tests
-The project has a test coverage of 88,73%. To measure and review the current test coverage, run the following command in the terminal:
+The project has a test line coverage of 90%. To measure and review the current test coverage, run the following command in the terminal:
```bash
npm test -- --coverage
@@ -44,6 +44,15 @@ Each component has its own test file covering its most important functionality.
npm test
```
+We performed manual testing for responiveness and user experience. This was done in both landscape and portrait orientations on the following devices:
+
+- iPhone 16
+- iPhone 17
+- iPhone 13
+- iPad Air
+- Macbook Air
+- Macbook Pro
+
## Developed by
- Emma Fredriksen
@@ -74,5 +83,5 @@ The user interface is built with our own React components and plain CSS, without
## Use of AI
During development, our use of AI has been limited. Any code written with the assistance of AI is marked with a comment above the relevant code snippet. We chose this approach based on our understanding of AI and our previous experience. AI can be a great accelerator when programming, but using it effectively requires a good understanding of the fundamental principles behind the technology being used. Without this understanding it is hard to evaluate the code produced by AI and make informed decisions. Since we are still developing our understanding of React, TypeScript and the other technologies used in this project, we decided it was better to use AI as a coach rather than a developer. This approach affected our development speed, and we spent more time exploring documentation and other learning resources. However, it also gave us a better understanding of the project as a whole and helped us avoid introducing unnecessary code that we did not fully understand or know how to maintain.
-
+
We also found that establishing a shared standard for documenting AI-assisted code made it easier to be transparent about the use of AI and to review each other's work. Knowing which parts were developed with AI assistance made it easier to discuss the reasoning behind the code and evaluate whether we understood and agreed with the proposed solutions. At the same time, we recognize that we could probably have achieved a higher development speed by using AI more actively, and AI might also have helped us identify more efficient solutions in some areas. However, for this project, we felt that the benefits of prioritizing learning, transparency, and understanding outweighed the potential increase in productivity. We therefore intend to continue using this approach while gradually increasing our use of AI as our own knowledge and ability to evaluate its output improve.
diff --git a/index.html b/index.html
index 5cea164..9d7488d 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
-
project-1
+ Rick and Morty Character Explorer
diff --git a/src/App.tsx b/src/App.tsx
index b20edee..9510877 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,11 +1,13 @@
import HeroPage from "./pages/HeroPage";
import CharactersPage from "./pages/CharactersPage";
+import Footer from "./components/Footer";
function App() {
return (
+
);
}
diff --git a/src/components/CharacterDetailCard.test.tsx b/src/components/CharacterDetailCard.test.tsx
index 9e609ef..c43155d 100644
--- a/src/components/CharacterDetailCard.test.tsx
+++ b/src/components/CharacterDetailCard.test.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import { cleanup, render, screen } from "@testing-library/react";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import "@testing-library/jest-dom/vitest";
import { afterEach, describe, expect, it, vi } from "vitest";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -209,4 +209,21 @@ describe("CharacterDetailCard", () => {
expect(onPrevious).toHaveBeenCalledOnce();
});
+
+ it("closes the detail card when 'esc' is pressed", () => {
+ const onClose = vi.fn();
+ renderWithQueryClient(
+ ,
+ );
+ fireEvent.keyDown(window, { key: "Escape" });
+
+ expect(onClose).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/src/components/CharacterDetailCard.tsx b/src/components/CharacterDetailCard.tsx
index 46781a5..8b60415 100644
--- a/src/components/CharacterDetailCard.tsx
+++ b/src/components/CharacterDetailCard.tsx
@@ -12,6 +12,7 @@ import UserRound from "../assets/user-round.svg";
import X from "../assets/X.svg";
import Star from "../assets/star.svg";
import StarFilled from "../assets/star-filled.svg";
+import { useEffect } from "react";
type CharacterDetailCardProps = {
character: Character;
@@ -60,6 +61,20 @@ export default function CharacterDetailCard({
queryFn: () => fetchEpisodes(character),
});
+ // Closes detailcard when "esc" is pressed
+ useEffect(() => {
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (event.key === "Escape") {
+ onClose();
+ }
+ };
+
+ window.addEventListener("keydown", handleKeyDown);
+ return () => {
+ window.removeEventListener("keydown", handleKeyDown);
+ };
+ }, [onClose]);
+
return (