Allow project search by type, Improve search visuals#1473
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds "Project Type (e.g. SAB)" to three locale files, infers ApplicationType from search text server-side to include a TypeId filter in project queries, surfaces PackageName in project projections, and passes a new Changes
Sequence Diagram(s)sequenceDiagram
participant User as "User"
participant Client as "Client (Browser)"
participant Server as "App Server"
participant DB as "Database (Prisma)"
User->>Client: Enter search text (e.g. "SAB someName")
Client->>Server: Request projects with search query
Server->>Server: typeFilter(search) -> ApplicationType? (SAB/RAB/DAB/KAB)
alt Type detected
Server->>DB: Prisma query (OR filters) + TypeId == inferred
else Type not detected
Server->>DB: Prisma query (OR filters only)
end
DB-->>Server: Projects (include PackageName)
Server-->>Client: Projects JSON
Client->>Client: Render ProjectCard per project with `search` prop
Client-->>User: Display highlighted matches in UI
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/projects/components/ProjectCard.svelte`:
- Around line 33-52: The component currently wraps the highlighted content in a
block-level <pre>, which breaks inline layouts and preserves unwanted newlines;
in ProjectCard.svelte (the {`#snippet` highlight(content: string)} block) replace
the <pre class="font-sans"> wrapper with an inline element (e.g., a <span> with
class "font-sans") and render {prefix}<span
class="highlight">{match}</span>{suffix} without the extra line breaks so the
variables prefix, match and suffix stay inline and spacing isn’t altered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 13caf7bc-f07b-4e05-9898-dbd60d667f88
📒 Files selected for processing (1)
src/lib/projects/components/ProjectCard.svelte
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/projects/components/ProjectCard.svelte (1)
135-139: Consider extracting duplicated package-name highlight markup into a snippet.The same package-name block appears in both mobile and desktop tables. A small snippet would reduce duplication and future drift.
♻️ Suggested refactor
+{`#snippet` packageName(value: string | null | undefined)} + {`#if` value} + <div class="wrap-anywhere ml-8 opacity-70 font-bold italic"> + {`@render` highlight(value)} + </div> + {/if} +{/snippet} @@ - {`#if` product.PackageName} - <div class="wrap-anywhere ml-8 opacity-70 font-bold italic"> - {`@render` highlight(product.PackageName)} - </div> - {/if} + {`@render` packageName(product.PackageName)} @@ - {`#if` product.PackageName} - <div class="wrap-anywhere ml-8 opacity-70 font-bold italic"> - {`@render` highlight(product.PackageName)} - </div> - {/if} + {`@render` packageName(product.PackageName)}Also applies to: 186-190
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/projects/components/ProjectCard.svelte` around lines 135 - 139, Duplicate package-name markup in ProjectCard.svelte (the {`#if` product.PackageName} ... {`@render` highlight(product.PackageName)} block) should be extracted into a small reusable component/snippet (e.g., PackageName.svelte or an inline <script> exported component) that accepts the package name and renders the same wrapper + {`@render` highlight(...)} output; replace both occurrences (the blocks around product.PackageName at lines shown and the second occurrence) with the new component (e.g., <PackageName name={product.PackageName}/> or <PackageName {product}/>), keeping the same classes ("wrap-anywhere ml-8 opacity-70 font-bold italic") and using the existing highlight function to avoid duplication and future drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/projects/components/ProjectCard.svelte`:
- Around line 33-45: The highlight snippet in ProjectCard.svelte only finds and
renders the first match (uses matchStart/matchEnd prefix/match/suffix), so
change the logic inside the {`#snippet` highlight(content: string)} block to find
and render all occurrences of search in content: compute all match ranges (e.g.,
using a case-insensitive global search based on
search.toLocaleLowerCase(getLocale()) or iteratively using indexOf in a loop),
then render the sequence of segments and highlighted spans for each match
instead of a single prefix/match/suffix; update or replace the
matchStart/matchEnd/prefix/match/suffix usage with an iteration over matches so
every occurrence is wrapped in <span class="highlight">.
---
Nitpick comments:
In `@src/lib/projects/components/ProjectCard.svelte`:
- Around line 135-139: Duplicate package-name markup in ProjectCard.svelte (the
{`#if` product.PackageName} ... {`@render` highlight(product.PackageName)} block)
should be extracted into a small reusable component/snippet (e.g.,
PackageName.svelte or an inline <script> exported component) that accepts the
package name and renders the same wrapper + {`@render` highlight(...)} output;
replace both occurrences (the blocks around product.PackageName at lines shown
and the second occurrence) with the new component (e.g., <PackageName
name={product.PackageName}/> or <PackageName {product}/>), keeping the same
classes ("wrap-anywhere ml-8 opacity-70 font-bold italic") and using the
existing highlight function to avoid duplication and future drift.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2cc368cd-6136-4ecb-b324-c53fb99856b4
📒 Files selected for processing (1)
src/lib/projects/components/ProjectCard.svelte
Adds case insensitive search for application type based on the search string containing the following substrings: sab, scrip, rab, read, dab, dict, kab, keyb
3108949 to
db676c2
Compare
|
Rebased so (formerly) upstream db changes don't cause review issues |
Changes:
Summary by CodeRabbit
New Features
Documentation / Localization