From dd1a6b49403d233519e54dafe0fafc507717f033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eline=20J=C3=A5sund?= Date: Fri, 13 Nov 2026 12:37:24 +0100 Subject: [PATCH 01/16] docs: add forth deliverable --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0886ed7..2dece98 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ To see the project as it was for the second handin look at the `Second-Deliverab To see the project as it was for the third handin look at the `Third-Deliverable` release of the codebase on git. +To see the project as it was for the fourth handin look at the `Fourth-Deliverable` release of the codebase on git. + ## Versions Local development runtime: From 086dfefac29fbf381360b75a8c220f87f7eb7296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eline=20J=C3=A5sund?= Date: Fri, 13 Nov 2026 12:47:02 +0100 Subject: [PATCH 02/16] docs: update functional requirements and application functions --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2dece98..eded738 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ src ## Functional requirements -The third delivery for the course requires a functional prototype. Our prototype includes all the functionality we wanted for our website, with user/profile, wishlist, friends, pagination, and searching and filtering. +The fourth delivery for the course requires a finished product. The website implements all our intended features, such as searching for games, filters, sorting, wishlist, adding friends and updating you profile. We have also finished component testing, as well as end-to-end testing. View the database information: [Database](#database) View the backend information: [Backend](#backend) @@ -203,7 +203,7 @@ When selecting a game anywhere on the application, the user will be sent to the Users can also enter the friends page to add friends by their secret FriendID. When selecting a friend, they will be able to see their profile and wishlistpage. Friendship is mutual. If you want to test the add friend function, you can use the friend id ```cabbages``` to add our mock user. -Lastly, the application will have a wishlist page where the user can place, and view, the games they want. Our goal is to implement a friends function that allows users to view their friends' wishlist. +Lastly, the application will have a wishlist page where the user can place, and view, the games they want. ## Styling From 80b47dd22bc52a027f019652446fd2f3a59c5481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eline=20J=C3=A5sund?= Date: Fri, 13 Nov 2026 12:49:08 +0100 Subject: [PATCH 03/16] style: run prettier --- Frontend/src/FrontendLogic/LogicConnection.ts | 3 +- .../FrontendLogic/MainPageLogicFrontend.ts | 11 ++++--- .../FrontendLogic/SearchPageLogicFrontend.ts | 2 +- Frontend/src/FrontendLogic/Storage.ts | 7 ++-- .../src/FrontendLogic/UserLogicFrontend.ts | 4 ++- Frontend/src/components/ReviewCard.tsx | 6 +--- Frontend/src/components/WishlistGameCard.tsx | 5 ++- Frontend/src/css/FriendsPage.css | 1 - Frontend/src/css/Global.css | 33 +++++++++++-------- Frontend/src/hooks/useSearchPageResults.ts | 4 ++- Frontend/src/tests/GameLogicFrontend.test.ts | 5 +-- Frontend/src/types/User.ts | 2 +- 12 files changed, 44 insertions(+), 39 deletions(-) diff --git a/Frontend/src/FrontendLogic/LogicConnection.ts b/Frontend/src/FrontendLogic/LogicConnection.ts index c7e6654..1e08489 100644 --- a/Frontend/src/FrontendLogic/LogicConnection.ts +++ b/Frontend/src/FrontendLogic/LogicConnection.ts @@ -1,7 +1,6 @@ export const BACKEND_URL = import.meta.env.VITE_BACKEND_URL ?? 'http://it2810-10.idi.ntnu.no:3001/' -export const NETWORK_ERROR_MESSAGE = - 'Could not reach the server.' +export const NETWORK_ERROR_MESSAGE = 'Could not reach the server.' export async function Gql(query: string, variables: Record): Promise { const token = GetStoredToken() diff --git a/Frontend/src/FrontendLogic/MainPageLogicFrontend.ts b/Frontend/src/FrontendLogic/MainPageLogicFrontend.ts index ed3c68e..ffea266 100644 --- a/Frontend/src/FrontendLogic/MainPageLogicFrontend.ts +++ b/Frontend/src/FrontendLogic/MainPageLogicFrontend.ts @@ -14,7 +14,6 @@ const mainPageGenreStorageKeys: Record = { discounts: 'GameStart:genreMainpage:discounts' } - function ReportStorageError(action: string, error: unknown) { const message = error instanceof Error ? error.message : String(error) console.error(`MainPage: Could not ${action} in session storage: ${message}`) @@ -31,8 +30,9 @@ export function SaveMainPageGenre(section: MainPageGenreSection, genre: string) } export function GetDiscountedOnlySearchpage(): boolean { - return ReadStored(DISCOUNT_ONLY_KEY, false, IsBoolean, 'session', (error) => - ReportStorageError('Could not read discounted only games:', error)) + return ReadStored(DISCOUNT_ONLY_KEY, false, IsBoolean, 'session', (error) => + ReportStorageError('Could not read discounted only games:', error) + ) } export function SaveDiscountedOnlySearchpage(discountedOnly: boolean) { @@ -40,8 +40,9 @@ export function SaveDiscountedOnlySearchpage(discountedOnly: boolean) { } export function GetSavedRecentReviewCount(): number { - return ReadStored(RECENT_REVIEW_KEY, DEFAULT_REVIEW_COUNT, IsInteger, 'session', (error) => - ReportStorageError('Could not read recent review count: ', error)) + return ReadStored(RECENT_REVIEW_KEY, DEFAULT_REVIEW_COUNT, IsInteger, 'session', (error) => + ReportStorageError('Could not read recent review count: ', error) + ) } export function SaveRecentReviewCount(count: number) { diff --git a/Frontend/src/FrontendLogic/SearchPageLogicFrontend.ts b/Frontend/src/FrontendLogic/SearchPageLogicFrontend.ts index 4159648..10087c9 100644 --- a/Frontend/src/FrontendLogic/SearchPageLogicFrontend.ts +++ b/Frontend/src/FrontendLogic/SearchPageLogicFrontend.ts @@ -50,4 +50,4 @@ export function SaveFilterMenuOpenSearchpage(isOpen: boolean) { export function GetFilterMenuOpenSearchpage(): boolean { return ReadStored(menuStorageKey, false, IsBoolean) -} \ No newline at end of file +} diff --git a/Frontend/src/FrontendLogic/Storage.ts b/Frontend/src/FrontendLogic/Storage.ts index 8eb58ca..8d5c6d8 100644 --- a/Frontend/src/FrontendLogic/Storage.ts +++ b/Frontend/src/FrontendLogic/Storage.ts @@ -1,4 +1,4 @@ -import type { User } from "../types/User" +import type { User } from '../types/User' type StorageKind = 'session' | 'local' @@ -6,7 +6,8 @@ export const IsString = (value: unknown): value is string => typeof value === 's export const IsBoolean = (value: unknown): value is boolean => typeof value === 'boolean' // export const IsNumber = (value: unknown): value is number => // typeof value === 'number' && Number.isFinite(value) && value > 0 -export const IsInteger = (value: unknown): value is number => typeof value === 'number' && Number.isInteger(value) && value > 0 +export const IsInteger = (value: unknown): value is number => + typeof value === 'number' && Number.isInteger(value) && value > 0 export const IsStringArray = (value: unknown): value is string[] => Array.isArray(value) export const IsNull = (value: unknown): value is null => value === 'null' export const IsUser = (value: unknown): value is User => { @@ -62,4 +63,4 @@ export function RemoveStored(key: string, kind: StorageKind = 'session') { } catch { console.log(`Could not remove "${key}" from ${kind} storage`) } -} \ No newline at end of file +} diff --git a/Frontend/src/FrontendLogic/UserLogicFrontend.ts b/Frontend/src/FrontendLogic/UserLogicFrontend.ts index 269def9..5ddac2d 100644 --- a/Frontend/src/FrontendLogic/UserLogicFrontend.ts +++ b/Frontend/src/FrontendLogic/UserLogicFrontend.ts @@ -42,7 +42,9 @@ export function SaveUser(user: User, remember = true) { // Returns the saved user or null if no user is found. export function GetSavedUser(): User | null { - const user = ReadStored(USER_KEY, null, OrNull(IsUser), 'local') ?? ReadStored(USER_KEY, null, OrNull(IsUser)) + const user = + ReadStored(USER_KEY, null, OrNull(IsUser), 'local') ?? + ReadStored(USER_KEY, null, OrNull(IsUser)) if (!user) ClearUser() return user } diff --git a/Frontend/src/components/ReviewCard.tsx b/Frontend/src/components/ReviewCard.tsx index 966d7bf..c71a56a 100644 --- a/Frontend/src/components/ReviewCard.tsx +++ b/Frontend/src/components/ReviewCard.tsx @@ -114,11 +114,7 @@ export default function ReviewCard({ {isOwner && onEdit && onDelete && (
-