diff --git a/package.json b/package.json index d794267..e03919d 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "build:docker": "docker build -t toogether/webapp .", "start": "next start -p 4000", "start:prod": "docker compose up --force-recreate -d", - "lint": "next lint" + "lint": "next lint", + "format": "prettier --write ." }, "dependencies": { "@internationalized/date": "^3.6.0", @@ -35,7 +36,8 @@ "eslint": "^8", "eslint-config-next": "15.0.3", "postcss": "^8", + "prettier": "^3.4.2", "tailwindcss": "^3.4.1", "typescript": "^5" } -} \ No newline at end of file +} diff --git a/src/app/components/Room/List.tsx b/src/app/components/Room/List.tsx index 5c3966d..80e98e4 100644 --- a/src/app/components/Room/List.tsx +++ b/src/app/components/Room/List.tsx @@ -8,10 +8,17 @@ export const RoomList = ({ rooms }: { rooms: Room[] }) => { const handleWheel = (event: WheelEvent) => { if (event.deltaY === 0) return; - event.preventDefault(); + if (event.ctrlKey || event.shiftKey || event.altKey) return; + const scrollContainer = scrollContainerRef.current; if (!scrollContainer) return; + const goLeft = event.deltaY < 0; + const isEnd = goLeft ? scrollContainer.scrollLeft === 0 : scrollContainer.scrollLeft + scrollContainer.clientWidth >= scrollContainer.scrollWidth; + if (isEnd) return; + + event.preventDefault(); + const scrollAmount = 10; const direction = event.deltaY > 0 ? 1 : -1; let scrollCount = 0; @@ -23,7 +30,6 @@ export const RoomList = ({ rooms }: { rooms: Room[] }) => { clearInterval(interval); } }, 10); - }; useEffect(() => { @@ -38,10 +44,13 @@ export const RoomList = ({ rooms }: { rooms: Room[] }) => { }, []); return ( -
-