[Expert Finder] Services, hooks, layout and pages#644
[Expert Finder] Services, hooks, layout and pages#644nicktytarenko wants to merge 16 commits intomainfrom
Conversation
- Introduced `ExpertFinderLayout` for managing user access and loading states. - Created main `ExpertFinderPage` that redirects to the find page. - Added `ExpertFinderLibraryPage`, `ExpertFinderOutreachPage`, and `ExpertFinderTemplatesPage` for library, outreach, and templates sections. - Implemented `LayoutWithRightSidebar` for consistent layout structure. - Developed hooks for managing expert search details and progress tracking. - Added `ExpertFinderService` for API interactions related to expert searches. - Defined types for expert search configurations and results.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
The sidebarnav (I think referred to right sidebar) is a pattern we only use in the admin area of the site and will likely change up a bit soon.
To organize things a bit more clearly, can you place in components/ui/moderator/ModeratorSidebarNav.tsx
There was a problem hiding this comment.
You are correct! this is realted to the admin area.
I created this components/SidebarNav.tsx to reuse it in the Moderator Dashboard and ExpertFinder
And the ModeratorSidebarNav looks like this (we specify nav items and render this SidebarNav)
const navigationItems: SidebarNavItem[];
export const ModerationMenu: FC = () => (
<SidebarNavMenu
items={navigationItems}
menuTitle="Choose moderation area"
triggerFallbackLabel="Moderation"
/>
);
we have the same layout for the Moderator dashboard and ExpertFinder pages
| const abortController = new AbortController(); | ||
| abortControllerRef.current = abortController; | ||
|
|
||
| const connect = async () => { |
There was a problem hiding this comment.
- Are we streaming results here as they arrive?
- I think method does too much. Opens stream, read stream, parse stream via transformer. It is challenging to read since it is verbose. Could we split it up?
Some pseudocode, obviously simplistic:
const connect = async () => {
const { streamReader, cancelStream } = openStream()
while (true) {
const { rawRecord } = streamReader.nextRecord()
const record = transformRecord(rawRecord);
if (!rawRecord) {
cancelStream()
}
}
}
There was a problem hiding this comment.
This isn't working as I expected. I'll probably need to update the backend, because currently no messages are received in the web app. I only get them all at once when the search is completed. 😕🔧
For now we don't show a progress bar like 1% >>> 100% - we just redirect the user to the search details page when it's completed.
| const isModerator = !!user?.isModerator; | ||
|
|
||
| useEffect(() => { | ||
| if (!isLoading && !isModerator) { |
There was a problem hiding this comment.
If not too difficult, let's use server side verification. If complex to determine moderator then we can just continue
There was a problem hiding this comment.
| /** | ||
| * Create a new expert search. | ||
| */ | ||
| export function useCreateExpertSearch(): UseCreateExpertSearchReturn { |
There was a problem hiding this comment.
yes, in my next PR i use it
| const [isConnected, setIsConnected] = useState(false); | ||
| const abortControllerRef = useRef<AbortController | null>(null); | ||
|
|
||
| const cleanup = useCallback(() => { |
There was a problem hiding this comment.
I think we should call releaseLock in here https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/releaseLock
…ity-to-pages [Expert finder] - Add content to pages
|
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 17. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |



What?
ExpertFinderServicefor API interactions related to expert searches.LayoutWithRightSidebarfor consistent layout structure. copied from the current Moderator dashboardExpertFinderLayoutfor managing user access and loading states.ExpertFinderPagethat redirects to the find page.ExpertFinderLibraryPage,ExpertFinderOutreachPage, andExpertFinderTemplatesPagefor library, outreach, and templates sections. (no functionality)