( thread: ThreadSortInput, sortOrder: SidebarThreadSortOrder | Exclude<SidebarProjectSortOrder, "manual">, )
| 55 | } |
| 56 | |
| 57 | export function getThreadSortTimestamp( |
| 58 | thread: ThreadSortInput, |
| 59 | sortOrder: SidebarThreadSortOrder | Exclude<SidebarProjectSortOrder, "manual">, |
| 60 | ): number { |
| 61 | if (sortOrder === "created_at") { |
| 62 | return ( |
| 63 | getFirstSortableTimestamp(thread.createdAt, thread.updatedAt) ?? Number.NEGATIVE_INFINITY |
| 64 | ); |
| 65 | } |
| 66 | return getLatestUserMessageTimestamp(thread); |
| 67 | } |
| 68 | |
| 69 | export function sortThreads<T extends { readonly id: string } & ThreadSortInput>( |
| 70 | threads: readonly T[], |
no test coverage detected