Skip to content

Allow project search by type, Improve search visuals#1473

Merged
chrisvire merged 9 commits intodevelopfrom
feature/search-app-type
Mar 20, 2026
Merged

Allow project search by type, Improve search visuals#1473
chrisvire merged 9 commits intodevelopfrom
feature/search-app-type

Conversation

@FyreByrd
Copy link
Contributor

@FyreByrd FyreByrd commented Mar 4, 2026

Changes:

  • Adds dropdown in directory and project list to filter by application type
  • Displays package name in ProjectCard (since this is a searchable field)
  • Highlights searched strings
Screenshot 2026-03-11 at 2 13 05 PM

Summary by CodeRabbit

  • New Features

    • Project Type (e.g., SAB) is now searchable in the project directory.
    • Search queries are passed into project cards so matching terms are highlighted for easier scanning.
  • Documentation / Localization

    • Directory help text updated across supported locales to include Project Type among searchable fields.

@FyreByrd FyreByrd requested a review from chrisvire March 4, 2026 15:46
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds "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 search prop into ProjectCard to enable highlighted search-term rendering.

Changes

Cohort / File(s) Summary
Localization
src/lib/locales/en-US.json, src/lib/locales/es-419.json, src/lib/locales/fr-FR.json
Inserted "Project Type (e.g. SAB)" into the directory_searchHelp strings for English, Spanish, and French, positioned after "Project Name".
Server-side project filtering
src/lib/projects/server.ts
Added typeFilter(search: string) to map tokens to ApplicationType; updated projectFilter to detect an inferred TypeId and include it in Prisma OR filters; imported ApplicationType.
Project data projection
src/lib/projects/index.ts
Added PackageName to product selection and to the pruneProjects mapping; adjusted exported PrunedProject typing to match the new projection.
Project card UI & routing
src/lib/projects/components/ProjectCard.svelte, src/routes/(authenticated)/directory/+page.svelte, src/routes/(authenticated)/projects/[filter=projectSelector]/[[orgId=idNumber]]/+page.svelte
Added optional search?: string prop to ProjectCard; implemented highlighted rendering for matched terms (title, owner/org/group, language, package); added .highlight CSS; pages now pass current search form value into each ProjectCard.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • chrisvire

Poem

🐰 I sniff for "SAB" in fields of hay,
I tuck "Project Type" just after name today.
Languages, owners, packages all gleam,
Highlights sparkle where the searchlights beam.
Hoppity hops — a clearer project dream!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Allow project search by type, Improve search visuals' accurately describes the two main changes: adding application-type search functionality and enhancing search term highlighting in the UI.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/search-app-type
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@FyreByrd FyreByrd changed the title Allow project search by type Allow project search by type, Improve search visuals Mar 4, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0dc6a76 and 6246ff6.

📒 Files selected for processing (1)
  • src/lib/projects/components/ProjectCard.svelte

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6246ff6 and 59503d0.

📒 Files selected for processing (1)
  • src/lib/projects/components/ProjectCard.svelte

@FyreByrd FyreByrd force-pushed the feature/search-app-type branch from 3108949 to db676c2 Compare March 18, 2026 15:17
@FyreByrd
Copy link
Contributor Author

FyreByrd commented Mar 18, 2026

Rebased so (formerly) upstream db changes don't cause review issues

Copy link
Member

@chrisvire chrisvire left a comment

Choose a reason for hiding this comment

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

👍

@chrisvire chrisvire merged commit fb608c3 into develop Mar 20, 2026
8 checks passed
@chrisvire chrisvire deleted the feature/search-app-type branch March 20, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants