-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add writing session page - not functional yet
- Loading branch information
Showing
4 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { ColumnDef } from '@tanstack/react-table' | ||
import { formatDistanceToNow } from 'date-fns' | ||
import { DataTable } from '~/components/common/data-table' | ||
import { arls } from '~/services/arls' | ||
|
||
export const clientLoader = async () => { | ||
const sessions = await arls.writingSessions.findMany() | ||
console.log(sessions) | ||
|
||
return {} | ||
} | ||
|
||
interface WritingSession { | ||
content: string | ||
duration: number | ||
effort: string | ||
} | ||
|
||
const columns: ColumnDef<WritingSession>[] = [ | ||
{ | ||
accessorKey: 'content', | ||
cell: ({ row }) => ( | ||
<div | ||
className='w-[360px] text-left truncate' | ||
title={row.original?.content || 'Untitled'} | ||
> | ||
{row.original?.content || 'Untitled'} | ||
</div> | ||
), | ||
header: 'Content Title', | ||
}, | ||
{ | ||
accessorKey: 'effort', | ||
cell: ({ row }) => ( | ||
<div className='w-[360px] text-left truncate'> | ||
{row.original?.effort} | ||
</div> | ||
), | ||
header: 'Effort', | ||
}, | ||
{ | ||
accessorKey: 'duration', | ||
cell: ({ row }) => ( | ||
<span className='px-4 text-center'> | ||
{formatDistanceToNow(new Date(row.original.duration), { | ||
addSuffix: true, | ||
})} | ||
</span> | ||
), | ||
header: 'Duration', | ||
}, | ||
] | ||
const WritingSessionsHome = () => { | ||
return ( | ||
<> | ||
<div className='prose dark:prose-invert max-w-none flex w-full flex items-center justify-between text-white'> | ||
<h1 className='mb-4 text-center'>Writing Sessions</h1> | ||
</div> | ||
<DataTable columns={columns} data={[]} search={{ show: false }} /> | ||
</> | ||
) | ||
} | ||
|
||
export default WritingSessionsHome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Outlet } from '@remix-run/react' | ||
|
||
import ViewLayout from '~/layouts/view' | ||
|
||
const WritingSessionsRoot = () => { | ||
return ( | ||
<ViewLayout> | ||
<Outlet /> | ||
</ViewLayout> | ||
) | ||
} | ||
|
||
export default WritingSessionsRoot |