From 03ee589a6799947eb040e92e6eac24885c7d0547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 12:11:27 +0100 Subject: [PATCH 01/12] Removed unused code --- backend/src/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/src/app.js b/backend/src/app.js index 4f063cb..236f084 100644 --- a/backend/src/app.js +++ b/backend/src/app.js @@ -9,7 +9,6 @@ import v1Routes from "./routes/v1/index.js"; const app = express(); const frontendRoute = urls[1]; -const backendRoute = urls[0]; const authRoute = urls[2]; app.use(express.json()); From b02102f6174db9f3d80917a5099f7ffc4f456ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 12:18:52 +0100 Subject: [PATCH 02/12] Linting and removal os unused code --- backend/src/db/chargningStation.js | 2 +- backend/src/db/customer.js | 14 +++++++------- backend/src/db/parkingSation.js | 2 +- backend/src/db/payment.js | 8 ++++---- backend/src/db/scooter.js | 12 ++++++------ backend/src/db/trip.js | 2 +- backend/src/db/zone.js | 2 +- backend/src/events/bus.js | 2 +- backend/src/modules/auth/loginAttempt.js | 3 ++- backend/src/modules/user/checkBalance.js | 1 - backend/src/routes/v1/authRoute.js | 2 -- backend/src/simulation/simulation.js | 13 +++++++++++++ backend/test/app.test.js | 4 ++-- frontend/src/components/Admin/AdminMenu.jsx | 3 +++ 14 files changed, 42 insertions(+), 28 deletions(-) diff --git a/backend/src/db/chargningStation.js b/backend/src/db/chargningStation.js index da8e64d..50db9f9 100644 --- a/backend/src/db/chargningStation.js +++ b/backend/src/db/chargningStation.js @@ -27,7 +27,7 @@ export async function cityCharging(cityId) { * @async * @param {number} cityId Id of the city. * @param {string} chargingId Id of the charging station. - * @returns {Object} Charging station object. + * @returns {object} Charging station object. */ export async function cityChargingId(cityId, chargingId) { let conn; diff --git a/backend/src/db/customer.js b/backend/src/db/customer.js index f0ad11a..7151114 100644 --- a/backend/src/db/customer.js +++ b/backend/src/db/customer.js @@ -25,7 +25,7 @@ export async function showCustomers() { * Retrieves a customer by ID. * @async * @param {number} customerId Id of the customer. - * @returns {Object} Customer object. + * @returns {object} Customer object. */ export async function showCustomersId(customerId) { let conn; @@ -42,7 +42,7 @@ export async function showCustomersId(customerId) { * Retrieves a customer by email. * @async * @param {string} email Email of the customer. - * @returns {Object} Customer object. + * @returns {object} Customer object. */ export async function showCustomerEmail(email) { let conn; @@ -77,13 +77,13 @@ export async function customerTripsId(customerId) { /** * Adds a new customer. * @async - * @param {Object} data Customer data. + * @param {object} data Customer data. * @param {string} data.name Name of the customer. * @param {string} data.email Email of the customer. * @param {string} data.password Password of the customer. * @param {number} data.balance Starting balance. * @param {string} data.type Type of customer. - * @returns {Object} Result from the database. + * @returns {object} Result from the database. */ export async function addCustomer(data) { let conn; @@ -106,7 +106,7 @@ export async function addCustomer(data) { * Deletes a customer by ID. * @async * @param {number} id Id of the customer. - * @returns {Object} Result from the database. + * @returns {object} Result from the database. */ export async function deleteCustomer(id) { let conn; @@ -123,14 +123,14 @@ export async function deleteCustomer(id) { * Updates a customer by ID. * @async * @param {number} id Id of the customer. - * @param {Object} data Customer data. + * @param {object} data Customer data. * @param {string} data.name Name of the customer. * @param {string} data.email Email of the customer. * @param {number} data.balance Balance of the customer. * @param {string} data.type Type of the customer. * @param {string} data.subscription Subscription status. * @param {number} data.subscription_amount Subscription amount. - * @returns {Object} Result from the database. + * @returns {object} Result from the database. */ export async function updateCustomer(id, data) { let conn; diff --git a/backend/src/db/parkingSation.js b/backend/src/db/parkingSation.js index 824d868..5a43bab 100644 --- a/backend/src/db/parkingSation.js +++ b/backend/src/db/parkingSation.js @@ -27,7 +27,7 @@ export async function cityParking(cityId) { * @async * @param {number} cityId Id of the city. * @param {string} parkingId Id of the parking station. - * @returns {Object} Parking station object. + * @returns {object} Parking station object. */ export async function cityParkingId(cityId, parkingId) { let conn; diff --git a/backend/src/db/payment.js b/backend/src/db/payment.js index 4199c9a..3d27e06 100644 --- a/backend/src/db/payment.js +++ b/backend/src/db/payment.js @@ -9,9 +9,9 @@ import pool from "./pool.js"; * Adds or updates a user's subscription. * @async * @param {number} id Id of the user. - * @param {Object} data Subscription data. + * @param {object} data Subscription data. * @param {number} data.amount Amount of subscription. - * @returns {Object} Updated subscription object. + * @returns {object} Updated subscription object. */ export async function userSub(id, data) { let conn; @@ -33,7 +33,7 @@ export async function userSub(id, data) { * Cancels a user's subscription by ID. * @async * @param {number} id Id of the user. - * @returns {Object} Result from the database. + * @returns {object} Result from the database. */ export async function cancelSub(id) { let conn; @@ -51,7 +51,7 @@ export async function cancelSub(id) { * @async * @param {number} id Id of the user. * @param {number} amount Amount to add. - * @returns {Object} Updated user object with new balance. + * @returns {object} Updated user object with new balance. */ export async function addBalance(id, amount) { let conn; diff --git a/backend/src/db/scooter.js b/backend/src/db/scooter.js index 134b620..4be4e91 100644 --- a/backend/src/db/scooter.js +++ b/backend/src/db/scooter.js @@ -8,12 +8,12 @@ import pool from "./pool.js"; /** * Adds a new scooter. * @async - * @param {Object} data Scooter data. + * @param {object} data Scooter data. * @param {number} data.city_id Id of the city. * @param {string} data.name Name of the scooter. * @param {number} data.latitude Latitude coordinate. * @param {number} data.longitude Longitude coordinate. - * @returns {Object} Result from the database. + * @returns {object} Result from the database. */ export async function addScooter(data) { let conn; @@ -35,12 +35,12 @@ export async function addScooter(data) { * Updates a scooter by ID. * @async * @param {string} id Id of the scooter. - * @param {Object} data Scooter data. + * @param {object} data Scooter data. * @param {number} data.battery Battery percentage. * @param {number} data.latitude Latitude coordinate. * @param {number} data.longitude Longitude coordinate. * @param {string} data.status Status of the scooter. - * @returns {Object} Result from the database. + * @returns {object} Result from the database. */ export async function updateScooter(id, data) { let conn; @@ -63,7 +63,7 @@ export async function updateScooter(id, data) { * Deletes a scooter by ID. * @async * @param {string} id Id of the scooter. - * @returns {Object} Result from the database. + * @returns {object} Result from the database. */ export async function deleteScooter(id) { let conn; @@ -98,7 +98,7 @@ export async function cityScooters(cityId) { * @async * @param {number} cityId Id of the city. * @param {string} scooterId Id of the scooter. - * @returns {Object} Scooter object. + * @returns {object} Scooter object. */ export async function cityScootersId(cityId, scooterId) { let conn; diff --git a/backend/src/db/trip.js b/backend/src/db/trip.js index 5ebced8..56aa2e1 100644 --- a/backend/src/db/trip.js +++ b/backend/src/db/trip.js @@ -25,7 +25,7 @@ export async function showTrips() { * Retrieves a specific trip by ID. * @async * @param {number} tripId Id of the trip. - * @returns {Object} Trip object. + * @returns {object} Trip object. */ export async function showTripsId(tripId) { let conn; diff --git a/backend/src/db/zone.js b/backend/src/db/zone.js index dfd6302..90a5ce1 100644 --- a/backend/src/db/zone.js +++ b/backend/src/db/zone.js @@ -27,7 +27,7 @@ export async function cityZone(cityId) { * @async * @param {number} cityId Id of the city. * @param {string} zoneId Id of the zone. - * @returns {Object} Zone object. + * @returns {object} Zone object. */ export async function cityZoneId(cityId, zoneId) { let conn; diff --git a/backend/src/events/bus.js b/backend/src/events/bus.js index 7635120..89ef084 100644 --- a/backend/src/events/bus.js +++ b/backend/src/events/bus.js @@ -12,7 +12,7 @@ export default bus; /** * A listener for Scooter-rent that triggers an emit to start rent process. * @param {string} event The scooter-rent event. - * @param {Function} listener Arrow function triggering events. + * @param {bus} listener Arrow function triggering events. */ bus.on("scooter-rent", async (data) => { try { diff --git a/backend/src/modules/auth/loginAttempt.js b/backend/src/modules/auth/loginAttempt.js index a2907f3..7aefe15 100644 --- a/backend/src/modules/auth/loginAttempt.js +++ b/backend/src/modules/auth/loginAttempt.js @@ -1,9 +1,10 @@ /** * Attempts to log in a user with a given token. - * @param {Object} user The user object. + * @param {object} user The user object. * @param {string} token The authentication token. * @returns {string} A placeholder string. */ +// eslint-disable-next-line no-unused-vars export async function loginAttempt(user, token) { return "placeholder"; } diff --git a/backend/src/modules/user/checkBalance.js b/backend/src/modules/user/checkBalance.js index c777c42..3b56c24 100644 --- a/backend/src/modules/user/checkBalance.js +++ b/backend/src/modules/user/checkBalance.js @@ -3,7 +3,6 @@ import { userModel } from "../../models/user"; /** * Check if user has balance that exceeds minimum sum to start a trip. - * * @async * @param {number} userId A userId used to check that users balance. * @throws {Error} If users balance if below minimum constant, throw error. diff --git a/backend/src/routes/v1/authRoute.js b/backend/src/routes/v1/authRoute.js index ddb3278..62e15d9 100644 --- a/backend/src/routes/v1/authRoute.js +++ b/backend/src/routes/v1/authRoute.js @@ -1,9 +1,7 @@ import express from "express"; import axios from "axios"; -import urls from "../../utils/baseUrl.js"; const router = express.Router(); -const frontendRoute = urls[1]; /** * Post data used in auth route. diff --git a/backend/src/simulation/simulation.js b/backend/src/simulation/simulation.js index a3cd617..cc0c1f7 100644 --- a/backend/src/simulation/simulation.js +++ b/backend/src/simulation/simulation.js @@ -84,6 +84,10 @@ export function beginTrip(scooter, user) { }, speedInterval); } +/** + * + * @param cityId + */ function chooseRoute(cityId) { let navigationRoutes = ""; switch (cityId) { @@ -102,11 +106,17 @@ function chooseRoute(cityId) { return route.routes[0].geometry.coordinates; } +/** + * + */ function chooseUserId() { let userId = Math.floor(Math.random() * 1001); return userId + 1; // Num can never be more than 1001 but can be 0, +1 normalize } +/** + * + */ function chooseCity() { // const cities = Object.keys(scootersSorted); const cities = { @@ -128,6 +138,9 @@ export async function simulationRunning(numberSimulations = 500) { /* Release one scooter with status 'available' from random city to random user for demo Sets a interval to 0.8 seconds for every scooter release */ + /** + * + */ function releaseScooter() { const status = "available"; if (simulatedTrips > numberSimulations) { diff --git a/backend/test/app.test.js b/backend/test/app.test.js index de6c3c9..86d7d66 100644 --- a/backend/test/app.test.js +++ b/backend/test/app.test.js @@ -7,8 +7,8 @@ import { fakedata } from './../src/mockData/fakeData.js'; describe('Faker Functions', function() { /** - * Tests for generated user data. - */ + * Tests for generated user data. + */ describe('users', function() { it('should return an array', function() { assert.isArray(fakedata.user()); diff --git a/frontend/src/components/Admin/AdminMenu.jsx b/frontend/src/components/Admin/AdminMenu.jsx index d04297a..ebdfc98 100644 --- a/frontend/src/components/Admin/AdminMenu.jsx +++ b/frontend/src/components/Admin/AdminMenu.jsx @@ -77,6 +77,9 @@ export default function AdminMenu() { onClick={(e) => { if (e.target === e.currentTarget) closeDrawer(); }} + onKeyDown={(e) => { + if (e.key === "Escape") closeDrawer(); + }} >
From 253b3da657e24e6a99a2782b68bf80dc820e8367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 12:20:20 +0100 Subject: [PATCH 03/12] Unused code celaning --- backend/src/routes/v1/sessionRoute.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/backend/src/routes/v1/sessionRoute.js b/backend/src/routes/v1/sessionRoute.js index 9c7baf9..2e08064 100644 --- a/backend/src/routes/v1/sessionRoute.js +++ b/backend/src/routes/v1/sessionRoute.js @@ -4,16 +4,6 @@ import urls from "../../utils/baseUrl.js"; const router = express.Router(); const frontendRoute = urls[1]; -/** - * Post data used in auth route. - */ -const postData = { - client_id: process.env.GOOGLE_CLIENT_ID, - client_secret: process.env.GOOGLE_CLIENT_SECRET, - refresh_token: process.env.GOOGLE_REFRESH_TOKEN, - grant_type: "refresh_token", -}; - /** * Route to check if there is a user logged into session. */ From 510fbb654783def2c9fe08deb529701811a2ab3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 12:27:36 +0100 Subject: [PATCH 04/12] Updated jsDoc for simulation --- backend/src/simulation/simulation.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/backend/src/simulation/simulation.js b/backend/src/simulation/simulation.js index cc0c1f7..b64ed48 100644 --- a/backend/src/simulation/simulation.js +++ b/backend/src/simulation/simulation.js @@ -85,8 +85,9 @@ export function beginTrip(scooter, user) { } /** - * - * @param cityId + * A function that returns correct scooter routes from its citys dataset. + * @param {number} cityId Takes a number and chooses a dataset to get a route from. + * @returns {JSON} A random route as a variable containing JSON format route information */ function chooseRoute(cityId) { let navigationRoutes = ""; @@ -107,7 +108,9 @@ function chooseRoute(cityId) { } /** - * + * Choose a random user + * @returns {number} Returns a random number between 1 and 1001 which + * is starting database customer safe */ function chooseUserId() { let userId = Math.floor(Math.random() * 1001); @@ -115,7 +118,8 @@ function chooseUserId() { } /** - * + * Chooses a city by random and returns it by index in cities + * @returns {string} Return string of its name */ function chooseCity() { // const cities = Object.keys(scootersSorted); @@ -136,10 +140,10 @@ function chooseCity() { export async function simulationRunning(numberSimulations = 500) { let simulatedTrips = 0; - /* Release one scooter with status 'available' from random city to random user for demo - Sets a interval to 0.8 seconds for every scooter release */ /** - * + * + * Sets a interval to 1 seconds for every scooter release + * Release one scooter with status 'available' from random city to random user for demo */ function releaseScooter() { const status = "available"; From 7a0099bd1b482008624621593668eea048b99aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 12:31:55 +0100 Subject: [PATCH 05/12] JsDoc update --- frontend/src/Verification/verifyGoogleToken.js | 2 ++ frontend/src/components/User/OngoingRent.jsx | 4 ++++ frontend/src/components/User/RentList.jsx | 1 - 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/Verification/verifyGoogleToken.js b/frontend/src/Verification/verifyGoogleToken.js index 896a183..79f8ebd 100644 --- a/frontend/src/Verification/verifyGoogleToken.js +++ b/frontend/src/Verification/verifyGoogleToken.js @@ -49,6 +49,7 @@ export async function verifyGoogleToken(accessToken, expectedClientId) { /** * Checks if a valid user session exists. + * @returns {boolean} Returns True if user has token */ export async function verifyToken() { const sessionData = await fetch(`${baseUrl}/auth/session`); @@ -60,6 +61,7 @@ export async function verifyToken() { /** * Fetch session data from the backend. + * @returns {JSON} Sessiondata */ export async function getData() { const sessionData = await fetch(`${baseUrl}/auth/session`); diff --git a/frontend/src/components/User/OngoingRent.jsx b/frontend/src/components/User/OngoingRent.jsx index 3174601..504f84f 100644 --- a/frontend/src/components/User/OngoingRent.jsx +++ b/frontend/src/components/User/OngoingRent.jsx @@ -4,6 +4,10 @@ * @returns {HTMLElement} renders the individual scooter. */ +/** + * + * @param {{scooter: object, onReturn: () => void}} + */ export default function OngoingRent({ scooter, onReturn }) { return ( <> diff --git a/frontend/src/components/User/RentList.jsx b/frontend/src/components/User/RentList.jsx index 574a638..5a555b8 100644 --- a/frontend/src/components/User/RentList.jsx +++ b/frontend/src/components/User/RentList.jsx @@ -4,7 +4,6 @@ import RentOne from "./RentOne.jsx"; /** * Takes argument from RentScooters. Here all scooters are sent to be rendered individually. - * * @param {{scooters: object, onRent: () => void}} scooters All scooters filtered by city,and status. * @returns {HTMLElement} Renders tablehead */ From a91f021e43085ae6d8128b23fe9f966daca15a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 12:35:12 +0100 Subject: [PATCH 06/12] Unused code removed --- frontend/src/components/User/RentScooter.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/User/RentScooter.jsx b/frontend/src/components/User/RentScooter.jsx index 87a21f3..a5231b9 100644 --- a/frontend/src/components/User/RentScooter.jsx +++ b/frontend/src/components/User/RentScooter.jsx @@ -93,7 +93,6 @@ export default function RentScooter() { scooterId: scooterItem.id, userId: userId.userId, }; - const scooterEvent = scooterItem.status === "available" ? "in_use" : "available"; socket.emit("scooter-rent", scooterObj); From 63fab74375b6a41408d54abcea33e62176613a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 13:22:46 +0100 Subject: [PATCH 07/12] New upload for sonar fixed issue --- frontend/src/components/Admin/AdminMenu.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/components/Admin/AdminMenu.jsx b/frontend/src/components/Admin/AdminMenu.jsx index ebdfc98..b86d3f9 100644 --- a/frontend/src/components/Admin/AdminMenu.jsx +++ b/frontend/src/components/Admin/AdminMenu.jsx @@ -144,3 +144,4 @@ export default function AdminMenu() { ); } + From 349c19456d89648274187b087f79818af6625aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 13:25:29 +0100 Subject: [PATCH 08/12] Retesting with user on map --- frontend/src/components/Map/Map.jsx | 63 ++++++++++++++--------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/frontend/src/components/Map/Map.jsx b/frontend/src/components/Map/Map.jsx index bfbd2e1..2322396 100644 --- a/frontend/src/components/Map/Map.jsx +++ b/frontend/src/components/Map/Map.jsx @@ -1,23 +1,22 @@ import "leaflet/dist/leaflet.css"; import L from "leaflet"; import { MapContainer } from "react-leaflet/MapContainer"; -// import { useGeolocated } from 'react-geolocated'; import { TileLayer } from "react-leaflet/TileLayer"; import { Marker } from "react-leaflet/Marker"; import { Popup } from "react-leaflet/Popup"; import { citycenters } from "./cityCenters"; -import { useMap } from "react-leaflet/hooks"; import { useEffect, useState } from "react"; +import { useMap } from "react-leaflet/hooks"; import { ScooterRendering } from "./ScooterRendering"; import PropTypes from "prop-types"; import { ChargingStations } from "./ChargingStation"; import { ParkingStations } from "./ParkingStations"; -//Icon for user -// const userIcon = L.icon({ -// iconUrl: `/person.svg`, -// iconSize: [30, 30] -// }); +// Icon for user +const userIcon = L.icon({ + iconUrl: `/person.svg`, + iconSize: [30, 30] +}); //Icon for cities const cityIcon = L.icon({ @@ -35,20 +34,20 @@ export default function WorldMap({ city }) { const [citycenter, setCitycenter] = useState(citycenters[0]); const [usersPosition, setUsersPosition] = useState(null); - // /** - // * - // * @param {{ usersPosition: Array }} usersPosition Users position in array as longitude, latitude - // * @returns {null} Centers on User if user accept tracking - // */ - // function CenterOnUser({ usersPosition }) { - // const map = useMap(); // Like a ref to the map object to reach it - // useEffect(() => { - // if (usersPosition) { - // map.setView(usersPosition, map.getZoom()); - // } - // }, [usersPosition, map]); - // return null; - // } + /** + * + * @param {{ usersPosition: Array }} usersPosition Users position in array as longitude, latitude + * @returns {null} Centers on User if user accept tracking + */ + function CenterOnUser({ usersPosition }) { + const map = useMap(); // Like a ref to the map object to reach it + useEffect(() => { + if (usersPosition) { + map.setView(usersPosition, map.getZoom()); + } + }, [usersPosition, map]); + return null; + } useEffect(() => { if (!city) return; @@ -59,14 +58,14 @@ export default function WorldMap({ city }) { setCitycenter(selectedCity); }, [city]); - // useEffect(() => { - // if (navigator.geolocation) { - // navigator.geolocation.getCurrentPosition((pos) => { - // const coordinates = [pos.coords.latitude, pos.coords.longitude]; - // setUsersPosition(coordinates); - // }); - // } - // }, []); + useEffect(() => { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition((pos) => { + const coordinates = [pos.coords.latitude, pos.coords.longitude]; + setUsersPosition(coordinates); + }); + } + }, []); return (
@@ -99,14 +98,14 @@ export default function WorldMap({ city }) { ))} - {/* {usersPosition && ( + {usersPosition && ( You are here fellow scooterer - )} */} + )} - {/* */} + From 92ccfc102d23b6843a3dd2c7d0399c096b18885f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 13:28:17 +0100 Subject: [PATCH 09/12] Corrected Doc --- frontend/src/components/User/OngoingRent.jsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/frontend/src/components/User/OngoingRent.jsx b/frontend/src/components/User/OngoingRent.jsx index 504f84f..11ceb8c 100644 --- a/frontend/src/components/User/OngoingRent.jsx +++ b/frontend/src/components/User/OngoingRent.jsx @@ -3,11 +3,6 @@ * @param {{scooter: object, onReturn: () => void }} individual scooterthat has been rented. * @returns {HTMLElement} renders the individual scooter. */ - -/** - * - * @param {{scooter: object, onReturn: () => void}} - */ export default function OngoingRent({ scooter, onReturn }) { return ( <> From 046a590f5cb79182445ab1b524f02a087a584a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 13:29:10 +0100 Subject: [PATCH 10/12] Removed unused code --- frontend/src/components/User/RentOne.jsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/src/components/User/RentOne.jsx b/frontend/src/components/User/RentOne.jsx index be41ec2..56fe147 100644 --- a/frontend/src/components/User/RentOne.jsx +++ b/frontend/src/components/User/RentOne.jsx @@ -1,6 +1,3 @@ -import PropTypes from "prop-types"; -import { useMemo, useState } from "react"; - /** * This will render each scooter individually. * @param {{scooter: object, onRent: () => void,}} scooter individual scooter rendered. From 147816282370f17bf82cd8fbdb8aa4b5f2e0b87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 13:33:00 +0100 Subject: [PATCH 11/12] Function did note use user, no dependancy --- frontend/src/components/User/RentScooter.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/User/RentScooter.jsx b/frontend/src/components/User/RentScooter.jsx index a5231b9..a1c2d05 100644 --- a/frontend/src/components/User/RentScooter.jsx +++ b/frontend/src/components/User/RentScooter.jsx @@ -125,7 +125,7 @@ export default function RentScooter() { activeRental, }); setActiveRental(null); - }, [activeRental, userId]); + }, [activeRental]); return ( <> From 89639f44a20d4dbb7eaec4ebcfd08ae04421b528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenny=20=C3=85kerup?= Date: Mon, 19 Jan 2026 13:41:21 +0100 Subject: [PATCH 12/12] Removed unused code --- frontend/src/components/User/RentScooter.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/User/RentScooter.jsx b/frontend/src/components/User/RentScooter.jsx index a1c2d05..4352bee 100644 --- a/frontend/src/components/User/RentScooter.jsx +++ b/frontend/src/components/User/RentScooter.jsx @@ -93,7 +93,6 @@ export default function RentScooter() { scooterId: scooterItem.id, userId: userId.userId, }; - scooterItem.status === "available" ? "in_use" : "available"; socket.emit("scooter-rent", scooterObj); setActiveRental({