Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions frontend/src/routes/$roomId/$editId.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,22 @@ function RouteComponent() {
}, [room, calendarItems, selectedDay]);

const handleDayClick = (day: number) => {
// 他人の作成したアイテムがある場合はクリックを無効化
if (room && calendarItems && user) {
const startDate = new Date(room.startAt);
const existingItem = calendarItems.find((item) => {
const openDate = new Date(item.openDate);
const diffTime = openDate.getTime() - startDate.getTime();
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24)) + 1;
return diffDays === day;
});

if (existingItem && existingItem.userId !== user.id) {
console.log("他人のアイテムは編集できません");
return;
}
}

const drawerIndex = day - 1;
setSelectedDay(day);
setIsDialogOpen(true);
Expand Down