add sort and hub filter dropdowns#385
add sort and hub filter dropdowns#385chillenberger wants to merge 13 commits intoResearchHub:mainfrom
Conversation
|
@chillenberger is attempting to deploy a commit to the ResearchHub Team on Vercel. A member of the Team first needs to authorize it. |
hooks/useFeed.ts
Outdated
| } | ||
| }, [status, activeTab]); | ||
|
|
||
| const arraysEqual = (a?: (string | number)[], b?: (string | number)[]) => { |
There was a problem hiding this comment.
We use lodash, can use _.isEqual
hooks/useFeed.ts
Outdated
| }; | ||
|
|
||
| // Check if options have changed | ||
| useEffect(() => { |
There was a problem hiding this comment.
Could we refactor this useEffect into a hook? I realize that this was here before you started but it's getting a bit too long right now
There was a problem hiding this comment.
I agree, this whole thing is getting a bit long. I’m happy to move this effect into its own hook, but since it’s only used here, I first tried using omit and isEqual to simplify and compress it. Let me know what you think. I also combined loadFeed and loadMore into one function, since they were basically copy-pastes of each other. I think these two changes make the useFeed hook much easier to understand.
It looks like we could simplify it even further, since the currentTab state and initial activeTab parameter seem to be dead code. That would require touching more files, though, so I held back for now.
| private static readonly GRANT_PATH = '/api/grant_feed'; | ||
|
|
||
| // Determine which endpoint to use | ||
| private static getEndpointPath(endpoint: Endpoints) { |
services/feed.service.ts
Outdated
|
|
||
| try { | ||
| const response = await ApiClient.get<any[]>(path); | ||
| // Use transformTopic to normalize |
There was a problem hiding this comment.
Can we use transformTopic in topic.ts ?
There was a problem hiding this comment.
🙏 Thank you, and again I think we can go further here since after finishing this I found another component that was a copy and paste of the one I refactored. I haven't tracked down exactly what is going on here but I believe they should probably be refactored to be one component. https://github.com/ResearchHub/web/blob/main/app/paper/create/components/HubsSelector.tsx
|



Add frontend to filter and sort Funding pages (RFP, Proposal, Previously Funded):
RFP:
Proposals:
Previously Funded:
Other: