Compare commits
2
Commits
89eadbd477
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fe2d76973 | ||
|
|
abe584b1c1 |
@@ -26,7 +26,10 @@ export default function RealtimeDayPage({ initialDay }) {
|
|||||||
const prevHours = day.hours;
|
const prevHours = day.hours;
|
||||||
const newHours = prevHours.map((hour) => {
|
const newHours = prevHours.map((hour) => {
|
||||||
if (hour.id === updatedHour.id) {
|
if (hour.id === updatedHour.id) {
|
||||||
return updatedHour;
|
return {
|
||||||
|
...updatedHour,
|
||||||
|
category: hour.category,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return hour;
|
return hour;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default function RootLayout({
|
|||||||
{!hasEnvVars ? <EnvVarWarning /> : <HeaderAuth />}
|
{!hasEnvVars ? <EnvVarWarning /> : <HeaderAuth />}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<div className="flex flex-col gap-20 max-w-5xl p-5">
|
<div className="flex flex-col gap-20 w-[40%] p-5">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
export default function
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const daysChannel = supabase.channel('days')
|
||||||
|
.on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'days' }, (payload) => {
|
||||||
|
setDay(payload.new);
|
||||||
|
}).subscribe();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
daysChannel.unsubscribe();
|
||||||
|
}
|
||||||
|
}, [supabase])
|
||||||
Reference in New Issue
Block a user