feat: add Prettier for code formatting and enhance RoomList component scroll behavior
This commit is contained in:
parent
f9aef69cfa
commit
85deb66a54
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 (
|
||||
<div ref={scrollContainerRef} className='overflow-x-auto scrollbar-hide rounded-xl'>
|
||||
<ul className='flex gap-2'>
|
||||
<div
|
||||
ref={scrollContainerRef}
|
||||
className='overflow-x-auto scrollbar-hide rounded-xl bg-default-100'
|
||||
>
|
||||
<ul className='flex'>
|
||||
{rooms.map(room => (
|
||||
<li key={room.id}>
|
||||
<li key={room.id} className='p-2'>
|
||||
<RoomCard
|
||||
id={room.id}
|
||||
name={room.name}
|
||||
|
@ -4450,6 +4450,11 @@ prelude-ls@^1.2.1:
|
||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
|
||||
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
|
||||
|
||||
prettier@^3.4.2:
|
||||
version "3.4.2"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f"
|
||||
integrity sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==
|
||||
|
||||
pretty-format@^3.8.0:
|
||||
version "3.8.0"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-3.8.0.tgz#bfbed56d5e9a776645f4b1ff7aa1a3ac4fa3c385"
|
||||
|
Loading…
Reference in New Issue
Block a user