Skip to content

Feat/bookmark search filter#656

Open
OmanshiRaj wants to merge 6 commits into
knoxiboy:mainfrom
OmanshiRaj:feat/bookmark-search-filter
Open

Feat/bookmark search filter#656
OmanshiRaj wants to merge 6 commits into
knoxiboy:mainfrom
OmanshiRaj:feat/bookmark-search-filter

Conversation

@OmanshiRaj

@OmanshiRaj OmanshiRaj commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

User description

CLOSES #639
Added a client-side search bar to the Bookmarks page (src/app/bookmarks/page.tsx) that filters bookmarked doubts in real-time by subject or content as the user types. The search input only renders when bookmarks exist, includes a clear (×) button to reset the query, and shows a friendly "No Results Found" empty state with a Clear Search button when no bookmarks match — keeping it distinct from the existing "No Bookmarks Yet" empty state. No API changes were needed since filtering happens entirely on the already-fetched data, making it instant with zero extra network requests.


CodeAnt-AI Description

Add bookmark search and improve sharing, image labels, and question length feedback

What Changed

  • Added a search box on the Bookmarks page to filter saved doubts by subject or content, with a clear button and a “No Results Found” state when nothing matches
  • Sharing a doubt now works in more browsers and on non-secure pages by falling back to a copy method if the standard clipboard action is unavailable
  • Doubt images now use clearer alt text, including the subject and author name, which improves screen reader output
  • The ask-doubt form now shows a live character counter when the field is empty, with warning colors as the limit approaches

Impact

✅ Faster bookmark lookup
✅ Fewer copy-link failures
✅ Clearer screen reader labels

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

@OmanshiRaj is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@OmanshiRaj, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 8 minutes and 51 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3da66658-fb99-4a6d-9187-9e7bf6b3abff

📥 Commits

Reviewing files that changed from the base of the PR and between 30c282f and b1b675c.

📒 Files selected for processing (3)
  • src/app/bookmarks/page.tsx
  • src/components/AskDoubt.tsx
  • src/components/DoubtCard.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added gssoc'26 GSSoC program issue level:intermediate Intermediate level task type:feature New feature size/m labels Jun 14, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐ Star Required

Hi @OmanshiRaj! Thank you for your contribution to DoubtDesk.

Before we can complete the review and merge this pull request, please star the DoubtDesk repository.

Once you have starred the repository, please drop a comment here saying "done" and we will proceed with reviewing your PR. Thank you!

@github-actions github-actions Bot requested a review from knoxiboy June 14, 2026 15:58
@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jun 14, 2026
@github-actions github-actions Bot removed the size:M This PR changes 30-99 lines, ignoring generated files label Jun 14, 2026
Comment on lines 507 to 517
{charCount === 0 && (
<span className="text-slate-500">Min {minLength} · Max {maxLength} characters</span>
<span className={`font-medium tabular-nums ${
charCount > maxLength
? "text-red-500 dark:text-red-400"
: charCount >= maxLength * 0.9
? "text-amber-500 dark:text-amber-400"
: "text-slate-500 dark:text-slate-400"
}`}>
{charCount}/{maxLength}
</span>
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This conditional block adds a second character counter when the input is empty, so the UI shows duplicate 0/500 counters at the same time. It also contains unreachable style branches because charCount === 0 makes the charCount > maxLength and charCount >= maxLength * 0.9 checks impossible. Remove the duplicate counter or merge it with the existing right-side counter logic. [incorrect condition logic]

Severity Level: Major ⚠️
- ⚠️ Duplicate counters in AskDoubt compose textarea header.
- ⚠️ Unreachable branches complicate character limit color logic.
Steps of Reproduction ✅
1. Open a page that renders the AskDoubt modal, for example
`src/app/rooms/[id]/page.tsx:997-999`, which conditionally renders `<AskDoubt
isOpen={isAskModalOpen} ... />` when the local `isAskModalOpen` state is true.

2. In the running app, trigger the AskDoubt modal from that rooms page (e.g., via the "Ask
Doubt" control wired to `isAskModalOpen`), so that the component at
`src/components/AskDoubt.tsx` mounts with an empty `content` string.

3. With `content` still empty, `charCount` is `0`, so in `src/components/AskDoubt.tsx` at
lines 507–517 the `{charCount === 0 && (...)}` block renders the new inline counter while
the right-side counter at lines 519–521 (`{charCount} / {maxLength}`) also renders,
producing two visible `0 / maxLength` counters simultaneously.

4. Inspect the conditional styling inside the new empty-state counter at lines 509–513
(`charCount > maxLength ? ... : charCount >= maxLength * 0.9 ? ... : ...`): because
`charCount === 0` on this path, both `charCount > maxLength` and `charCount >= maxLength *
0.9` are always false, so the red and amber branches are never reachable, confirming the
unreachable-condition issue and the redundant counter.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/components/AskDoubt.tsx
**Line:** 507:517
**Comment:**
	*Incorrect Condition Logic: This conditional block adds a second character counter when the input is empty, so the UI shows duplicate `0/500` counters at the same time. It also contains unreachable style branches because `charCount === 0` makes the `charCount > maxLength` and `charCount >= maxLength * 0.9` checks impossible. Remove the duplicate counter or merge it with the existing right-side counter logic.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +215 to +216
document.execCommand("copy");
document.body.removeChild(textArea);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The fallback copy path treats document.execCommand("copy") as always successful, but this API can return false without throwing. In that case, users will still see a success toast even though nothing was copied. Check the boolean return value and show an error when the copy command fails. [logic error]

Severity Level: Major ⚠️
- ❌ Copy-link menu can report success on clipboard failure.
- ⚠️ Users may think doubts were share-copied when not.
Steps of Reproduction ✅
1. Use any page that renders DoubtCard, such as
`src/components/InfiniteDoubtFeed.tsx:149-151` or `src/app/public-rooms/page.tsx:379-380`,
where `<DoubtCard ... />` is created for each doubt.

2. Run the app in an environment where the modern clipboard path is unavailable (so
`navigator.clipboard` is undefined or `window.isSecureContext` is false), causing
`handleShare` in `src/components/DoubtCard.tsx:23-44` to take the fallback branch that
creates a temporary textarea and calls `document.execCommand("copy")` at PR hunk line 215.

3. In a browser or Jest test, stub `document.execCommand("copy")` to return `false`
without throwing (matching the DOM API contract that it returns a boolean), then click the
"Share doubt" button and choose the "Copy link" menu item wired to `onClick={handleShare}`
at `src/components/DoubtCard.tsx:215-218`.

4. Observe that even though `document.execCommand("copy")` returned `false` and no text
was actually copied to the clipboard, execution continues to the success path and
`toast.success(SHARE_MESSAGES.COPY_SUCCESS)` at `src/components/DoubtCard.tsx:39` still
fires, so users are told the link was copied when it was not.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/components/DoubtCard.tsx
**Line:** 215:216
**Comment:**
	*Logic Error: The fallback copy path treats `document.execCommand("copy")` as always successful, but this API can return `false` without throwing. In that case, users will still see a success toast even though nothing was copied. Check the boolean return value and show an error when the copy command fails.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@knoxiboy knoxiboy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OmanshiRaj look into the problem mentioned by coderabbit & codeant and resolve the problem also look into the failing CI tests and fix them as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc'26 GSSoC program issue level:intermediate Intermediate level task size/m type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add search/filter input to Bookmarks page

2 participants