Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions src/features/dashboard/sandboxes/table-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,5 +337,10 @@ export const COLUMNS: ColumnDef<Sandbox>[] = [
// @ts-expect-error dateRange is not a valid filterFn
filterFn: 'dateRange',
enableColumnFilter: true,
sortingFn: (rowA, rowB) => {
const dateA = new Date(rowA.original.startedAt).getTime();
const dateB = new Date(rowB.original.startedAt).getTime();
return dateA - dateB;
},
},
]
2 changes: 1 addition & 1 deletion src/features/dashboard/sandboxes/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default function SandboxesTable({
getFilteredRowModel: getFilteredRowModel(),
getSortedRowModel: getSortedRowModel(),
enableSorting: true,
enableMultiSort: true,
enableMultiSort: false,
columnResizeMode: 'onChange' as const,
enableColumnResizing: true,
keepPinnedRows: true,
Expand Down
48 changes: 37 additions & 11 deletions src/features/dashboard/templates/table-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,24 @@ export const useColumns = (deps: unknown[]) => {
header: 'Created At',
size: 250,
minSize: 140,
cell: ({ getValue }) => (
<div className="text-fg-500 truncate font-mono text-xs">
{getValue() as string}
</div>
),
cell: ({ row, getValue }) => {
const dateTimeString = getValue() as string
// Split the date and time parts
const [day, date, month, year, time, timezone] = dateTimeString.split(' ')

return (
<div className={cn('h-full truncate font-mono text-xs')}>
<span className="text-fg-500">{`${day} ${date} ${month} ${year}`}</span>{' '}
<span className="text-fg">{time}</span>{' '}
<span className="text-fg-500">{timezone}</span>
</div>
)
},
sortingFn: (rowA, rowB) => {
const dateA = new Date(rowA.original.createdAt).getTime();
const dateB = new Date(rowB.original.createdAt).getTime();
return dateA - dateB;
},
},
{
accessorFn: (row) => new Date(row.updatedAt).toUTCString(),
Expand All @@ -313,11 +326,24 @@ export const useColumns = (deps: unknown[]) => {
size: 250,
minSize: 140,
enableGlobalFilter: true,
cell: ({ getValue }) => (
<div className="text-fg-500 truncate font-mono text-xs">
{getValue() as string}
</div>
),
cell: ({ row, getValue }) => {
const dateTimeString = getValue() as string
// Split the date and time parts
const [day, date, month, year, time, timezone] = dateTimeString.split(' ')

return (
<div className={cn('h-full truncate font-mono text-xs')}>
<span className="text-fg-500">{`${day} ${date} ${month} ${year}`}</span>{' '}
<span className="text-fg">{time}</span>{' '}
<span className="text-fg-500">{timezone}</span>
</div>
)
},
sortingFn: (rowA, rowB) => {
const dateA = new Date(rowA.original.updatedAt).getTime();
const dateB = new Date(rowB.original.updatedAt).getTime();
return dateA - dateB;
},
},
{
accessorKey: 'public',
Expand Down Expand Up @@ -351,7 +377,7 @@ export const templatesTableConfig: Partial<
getFilteredRowModel: getFilteredRowModel(),
getSortedRowModel: getSortedRowModel(),
enableSorting: true,
enableMultiSort: true,
enableMultiSort: false,
columnResizeMode: 'onChange',
enableColumnResizing: true,
enableGlobalFilter: true,
Expand Down