28 lines
702 B
TypeScript
28 lines
702 B
TypeScript
import spacetime from "spacetime";
|
|
import { createClient } from '@/utils/supabase/server';
|
|
|
|
export default async function DayPage(
|
|
{ date }: { date: string }
|
|
) {
|
|
|
|
const supabase = await createClient();
|
|
|
|
const { data: { user: user } } = await supabase.auth.getUser();
|
|
const { data: day } = await supabase
|
|
.from('days')
|
|
.select('*')
|
|
.eq('date', date)
|
|
.eq('userId', user?.id)
|
|
;
|
|
|
|
return !day ? <div>Loading...</div> : (
|
|
<>
|
|
<h1>{spacetime(day.date).format('{month} {date-ordinal}, {year}')}</h1>
|
|
<ul>
|
|
<li>{day.mood}</li>
|
|
<li>{day.comment}</li>
|
|
</ul>
|
|
</>
|
|
);
|
|
}
|