Skip to content

Comments

feat(helppanel): init spur fixes#236

Open
aferd wants to merge 6 commits intoRedHatInsights:masterfrom
aferd:RHCLOUD-45014
Open

feat(helppanel): init spur fixes#236
aferd wants to merge 6 commits intoRedHatInsights:masterfrom
aferd:RHCLOUD-45014

Conversation

@aferd
Copy link
Collaborator

@aferd aferd commented Feb 13, 2026

https://issues.redhat.com/browse/RHCLOUD-45014

Screenshot 2026-02-13 at 11 02 46 AM

✅ 1. Update text to Chat with an assistant and update icon
✅ 2. fix buggy background
3. Apps need to update their frontend.yml configs with API endpoints in order for us to show them in the APIs tab. Not sure how we want to proceed with getting that done.
✅ 4. use compact version for toggle group
✅ 5. fix width
✅ 6. same buggy background
✅ 7. update bundle toggle to say RHEL and not insights

Screen.Recording.2026-02-13.at.1.34.23.PM.mov

@aferd aferd marked this pull request as draft February 13, 2026 15:50
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 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

Adds i18n to help-panel labels and sub-tab titles, introduces an AiExperienceIcon component and replaces AskRedHatIcon usage, computes user-friendly bundle display names with deduplication for API docs, applies a compact prop to several ToggleGroups, expands help-panel white-background styling, updates FiltersMetadata, and modifies Jest test setup and config + tests.

Changes

Cohort / File(s) Summary
Internationalization & messages
src/components/HelpPanel/HelpPanelContent.tsx, src/components/HelpPanel/HelpPanelCustomTabs.tsx, src/Messages.ts
Added react-intl usage (useIntl), introduced messages chatWithAssistant, redHatStatusPage, apiDocumentation; replaced static button labels with intl.formatMessage; made sub-tab title resolution intl-aware.
AI icon & icon swaps
src/components/common/AiExperienceIcon.tsx, src/components/HelpPanel/HelpPanelContent.tsx
New exported AiExperienceIcon component; swapped AskRedHatIcon usages to AiExperienceIcon in help panel buttons.
API bundle naming & dedupe
src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx
Added getBundleDisplayName using FiltersMetadata/available bundles, replaced previous title derivation, and added deduplication logic to merge API docs by frontend name (merging services and choosing latest URL).
LearnPanel bundle context
src/components/HelpPanel/HelpPanelTabs/LearnPanel.tsx
Removed local bundleTitle/bundleId state; read bundleId and availableBundles from chrome APIs and derive displayBundleName; switched home-page checks to use displayBundleName.
ToggleGroup compactness (UI only)
src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx, src/components/HelpPanel/HelpPanelTabs/LearnPanel.tsx, src/components/HelpPanel/HelpPanelTabs/SearchPanel/..., src/components/HelpPanel/HelpPanelTabs/SearchPanel/SearchResults.tsx
Passed isCompact to multiple ToggleGroup usages to enable denser UI when not on the home page; presentation-only change.
Styling / Layout
src/components/HelpPanel/HelpPanelCustomTabs.scss
Broadened white-background theming across notification drawer/help-panel selectors; ensured content container and subtabs use primary background; adjusted DataList width/margins to avoid showing drawer background during scroll.
Filters metadata
src/utils/FiltersCategoryInterface.ts
Added insights: 'RHEL' entry to FiltersMetadata.
Jest setup & config
config/jest.setup.js, jest.config.js
Added runtime polyfill for globalThis.crypto.randomUUID in test setup; adjusted Jest SWC transform mapping and parser settings.
Tests
src/components/HelpPanel/HelpPanelCustomTabs.test.tsx
New unit tests for HelpPanelCustomTabs (IntlProvider wrapper, mocked feature flags and tab container, DOM assertions for tabs/subtabs/content).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat(helppanel): init spur fixes' is vague and uses non-descriptive terms like 'spur fixes' that don't convey specific information about the changeset. Use a more descriptive title that summarizes the main changes, such as 'feat(helppanel): add i18n support, update icons, and fix UI layout' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description relates to the changeset by referencing a Jira issue and providing a checklist of completed tasks that align with the code changes, despite being formatted informally.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link

@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

🤖 Fix all issues with AI agents
In `@src/components/HelpPanel/HelpPanelContent.tsx`:
- Line 76: In the HelpPanelContent component update the user-facing button
labels that read "Chat with an assitant" to the correct spelling "Chat with an
assistant"; locate the JSX strings in HelpPanelContent.tsx (both occurrences
referenced in the review at lines 76 and 89) and replace the misspelled text so
both buttons display "assistant" consistently.

@aferd aferd marked this pull request as ready for review February 13, 2026 18:35
Copy link

@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: 2

🤖 Fix all issues with AI agents
In `@src/components/common/AiExperienceIcon.tsx`:
- Around line 9-19: The AiExperienceIcon component renders a decorative SVG that
should be ignored by assistive tech; update the <svg> element in
AiExperienceIcon (which uses props className, width, height and iconPath) to
include aria-hidden="true" so screen readers won’t announce it (optionally also
add focusable="false" for legacy browsers).

In `@src/components/HelpPanel/HelpPanelCustomTabs.scss`:
- Around line 8-35: The PF6-only override leaves PF5 drawer headers grey and the
negative margins on .pf-v6-c-data-list can cause horizontal scrolling; add the
PF5 selector .pf-c-drawer__head alongside .pf-v6-c-drawer__head (and/or target
.lr-c-help-panel-custom-tabs .pf-c-drawer__head) to set the white background,
and prevent horizontal overflow by changing the negative margin/width strategy
on [data-ouia-component-id="help-panel-content-container"] .pf-v6-c-data-list
(either clamp the margin-inline with max(..., 0) or replace the calc-based width
with a safe max-width/min-width approach, or add overflow-x: hidden to
[data-ouia-component-id="help-panel-content-container"]) so the layout doesn’t
produce a horizontal scrollbar.
🧹 Nitpick comments (1)
src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx (1)

32-43: Consider reusing the shared bundle display‑name helper to avoid drift.

There’s already a getBundleDisplayName in src/utils/bundleUtils.ts. Wrapping it here keeps the chrome title fallback while centralizing the mapping logic.

♻️ Suggested refactor
-import { FiltersMetadata } from '../../../utils/FiltersCategoryInterface';
+import { getBundleDisplayName as getBundleDisplayNameFromMetadata } from '../../../utils/bundleUtils';

-const getBundleDisplayName = (
-  bundleId: string,
-  chromeTitle: string | undefined
-): string => {
-  const mapped = FiltersMetadata[bundleId];
-  if (mapped) return mapped.split(' (')[0];
-  if (chromeTitle) return chromeTitle;
-  return bundleId.charAt(0).toUpperCase() + bundleId.slice(1);
-};
+const getBundleDisplayName = (
+  bundleId: string,
+  chromeTitle: string | undefined
+): string =>
+  getBundleDisplayNameFromMetadata(bundleId, { allowFallback: false }) ??
+  chromeTitle ??
+  getBundleDisplayNameFromMetadata(bundleId);

Also applies to: 181-184

Copy link
Collaborator

@apinkert apinkert left a comment

Choose a reason for hiding this comment

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

LGTM

@aferd aferd requested a review from apinkert February 16, 2026 14:59
Copy link
Collaborator

@apinkert apinkert left a comment

Choose a reason for hiding this comment

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

nice

Copy link
Contributor

@karelhala karelhala left a comment

Choose a reason for hiding this comment

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

Can you please add some unit tests and playwright tests? You can also add some component tests if you'd want.

@aferd aferd requested a review from karelhala February 17, 2026 14:34
Copy link

@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.

🧹 Nitpick comments (1)
src/components/HelpPanel/HelpPanelCustomTabs.test.tsx (1)

11-17: Consider making useFlag mock more explicit.

The current mock always returns true regardless of which flag is queried. While this works for these structural tests, it could mask issues if component behavior varies by flag.

♻️ Proposed improvement for more explicit flag mocking
 jest.mock('@unleash/proxy-client-react', () => ({
-  useFlag: () => true,
+  useFlag: (flag: string) => {
+    const enabledFlags = [
+      'platform.chrome.help-panel_search',
+      'platform.chrome.help-panel_knowledge-base',
+    ];
+    return enabledFlags.includes(flag);
+  },
   useFlags: () => [
     { name: 'platform.chrome.help-panel_search', enabled: true },
     { name: 'platform.chrome.help-panel_knowledge-base', enabled: true },
   ],
 }));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/HelpPanel/HelpPanelCustomTabs.test.tsx` around lines 11 - 17,
The mock for useFlag is too generic—change the jest.mock implementation so
useFlag accepts a flag name and returns a value based on an explicit map instead
of always true; e.g., implement useFlag: (name) => flagMap[name] ?? false and
define flagMap entries for 'platform.chrome.help-panel_search' and
'platform.chrome.help-panel_knowledge-base' (keep useFlags as-is or derive it
from the same map) so tests reflect per-flag behavior and avoid masking
flag-specific bugs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/HelpPanel/HelpPanelCustomTabs.test.tsx`:
- Around line 11-17: The mock for useFlag is too generic—change the jest.mock
implementation so useFlag accepts a flag name and returns a value based on an
explicit map instead of always true; e.g., implement useFlag: (name) =>
flagMap[name] ?? false and define flagMap entries for
'platform.chrome.help-panel_search' and
'platform.chrome.help-panel_knowledge-base' (keep useFlags as-is or derive it
from the same map) so tests reflect per-flag behavior and avoid masking
flag-specific bugs.

@aferd
Copy link
Collaborator Author

aferd commented Feb 19, 2026

/retest

@aferd aferd requested a review from apinkert February 20, 2026 13:47
Copy link
Contributor

@karelhala karelhala left a comment

Choose a reason for hiding this comment

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

Codewise looks really good! Thank you for adding the unit tests for HelpCustomTabs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for adding these tests! Can you also add some tests on interacting with the UI?

Comment on lines +35 to +43
const getBundleDisplayName = (
bundleId: string,
chromeTitle: string | undefined
): string => {
const mapped = FiltersMetadata[bundleId];
if (mapped) return mapped.split(' (')[0];
if (chromeTitle) return chromeTitle;
return bundleId.charAt(0).toUpperCase() + bundleId.slice(1);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This function would be better outside of the component so it's not constantly recreated on each re-render.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add unit tests for the new items?

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.

3 participants