Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion apps/web/app/feed/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ const repository = createRepository()
export default async function FeedPage({
searchParams,
}: {
searchParams: Promise<{ q?: string }>
searchParams: Promise<{ q?: string; since?: string }>
}) {
const params = await searchParams
const viewerHandle = await getViewerHandleFromCookies()
const [feed, trending, conferences, opportunities, groups] = await Promise.all([
repository.getFeed({
viewerHandle,
query: params.q,
since: params.since,
}),
repository.listTrendingPapers({
viewerHandle,
Expand Down
127 changes: 1 addition & 126 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@papers/config": "0.1.0",
"@papers/db": "0.1.0",
"better-auth": "^1.5.6",
"drizzle-orm": "^0.44.5",
"drizzle-orm": "^0.45.1",
"pg": "^8.16.3"
}
}
12 changes: 11 additions & 1 deletion packages/db/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ export interface PapersRepository {
}): Promise<User>
updateViewerProfile(input: UpdateViewerProfileInput, viewerHandle?: string | null): Promise<User>
getRoadmap(): Promise<RoadmapBucket>
getFeed(input?: { viewerHandle?: string | null; query?: string | null }): Promise<FeedEntry[]>
getFeed(input?: {
viewerHandle?: string | null
query?: string | null
since?: string | null
}): Promise<FeedEntry[]>
listTrendingPapers(input?: { viewerHandle?: string | null; limit?: number }): Promise<FeedEntry[]>
getPaperBySlug(slug: string, viewerHandle?: string | null): Promise<PaperDetail | null>
getProfileByHandle(handle: string, viewerHandle?: string | null): Promise<ProfileDetail | null>
Expand Down Expand Up @@ -431,13 +435,19 @@ class DemoRepository implements PapersRepository {
async getFeed(input?: {
viewerHandle?: string | null
query?: string | null
since?: string | null
}): Promise<FeedEntry[]> {
const state = await readDemoState()
const viewer = await this.getViewer(input?.viewerHandle)
const normalizedQuery = input?.query?.trim().toLowerCase()
const sinceMs = input?.since ? new Date(input.since).getTime() : null

return state.papers
.filter((paper) => {
if (sinceMs && new Date(paper.createdAt).getTime() < sinceMs) {
return false
}

if (!normalizedQuery) {
return true
}
Expand Down