Skip to content

[OSDEV-2375] Reorder and restyle heading elements#901

Merged
VadimKovalenkoSNF merged 4 commits intomainfrom
OSDEV-2375-reorder-heading-elements
Mar 5, 2026
Merged

[OSDEV-2375] Reorder and restyle heading elements#901
VadimKovalenkoSNF merged 4 commits intomainfrom
OSDEV-2375-reorder-heading-elements

Conversation

@VadimKovalenkoSNF
Copy link
Contributor

@VadimKovalenkoSNF VadimKovalenkoSNF commented Mar 5, 2026

[PL Redesign]: Reorder and restyle heading elements.
Follow-up PR for OSDEV-2375
image

@VadimKovalenkoSNF VadimKovalenkoSNF self-assigned this Mar 5, 2026
@barecheck
Copy link

barecheck bot commented Mar 5, 2026

React App | Jest test suite - Code coverage report

Total: 41.45%

Your code coverage diff: 0.02% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Mar 5, 2026

Dedupe Hub App | Unittest test suite - Code coverage report

Total: 55.73%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Mar 5, 2026

Countries App | Unittest test suite - Code coverage report

Total: 100%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

Extracts OS ID UI from LocationTitle into a new OsIdBadge component, removes OS ID rendering and related styles from LocationTitle, integrates OsIdBadge into ProductionLocationDetailsContent, adjusts spacing and styles, and moves OS ID tests into a new OsIdBadge test file.

Changes

Cohort / File(s) Summary
Tests
src/react/src/__tests__/components/LocationTitle.test.jsx, src/react/src/__tests__/components/OsIdBadge.test.jsx
Removed OS ID-related assertions/mocks from LocationTitle tests; added OsIdBadge tests covering heading, label/value, info dialog, and copy/link button presence based on osId.
LocationTitle component & styles
src/react/src/components/ProductionLocation/Heading/LocationTitle/LocationTitle.jsx, src/react/src/components/ProductionLocation/Heading/LocationTitle/styles.js
Removed OS ID UI, tooltip, copy/link actions and related imports; simplified title rendering to location name only; removed numerous OS ID-specific style keys and added titleAccent, adjusted container padding.
New OsIdBadge feature
src/react/src/components/ProductionLocation/Heading/osIdBadge/OsIdBadge.jsx, src/react/src/components/ProductionLocation/Heading/osIdBadge/styles.js, src/react/src/components/ProductionLocation/Heading/osIdBadge/constants.js
Added ProductionLocationDetailsOsIdBadge component, styles, and constants. Renders OS ID label/value, Learn More dialog (external URL), and action controls for copying OS ID and copying a link (with toast feedback).
Integration into details content
src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/ProductionLocationDetailsContent.jsx, src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/styles.js
Imported and rendered OsIdBadge, deriving osId via get(data, 'properties.os_id', ''); updated container styles to add md breakpoint left padding.
Layout & spacing tweaks
src/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsx, src/react/src/components/ProductionLocation/Heading/ClaimFlag/styles.js, src/react/src/components/ProductionLocation/Heading/ClosureStatus/styles.js
Removed spacing={8} from top-level Grid container; reduced vertical margins in ClaimFlag and ClosureStatus styles for adjusted spacing.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant UI as OsIdBadge (component)
    participant Clipboard as CopyToClipboard / CopySearch
    participant Toast as toast (react-toastify)
    participant Dialog as DialogTooltip

    rect rgba(30,144,255,0.5)
    User->>UI: Click "Copy OS ID"
    UI->>Clipboard: copy(osId)
    Clipboard-->>UI: copy success
    UI->>Toast: show("Copied OS ID")
    Toast-->>User: visible notification
    end

    rect rgba(34,139,34,0.5)
    User->>UI: Click "Learn more" info button
    UI->>Dialog: open(url: OS_ID_LEARN_MORE_URL)
    Dialog-->>User: render dialog with link
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • protsack-stephan
  • vlad-shapik
  • roman-stolar
🚥 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 accurately summarizes the main changes: reordering and restyling of heading elements, which aligns with the modifications to LocationTitle, OsIdBadge, and spacing adjustments across heading components.
Description check ✅ Passed The pull request description clearly relates to the changeset, describing the reordering and restyling of heading elements as part of the PL Redesign.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch OSDEV-2375-reorder-heading-elements

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.

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

🧹 Nitpick comments (4)
src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/ProductionLocationDetailsContent.jsx (1)

34-34: Minor cleanup: remove redundant fallback.

Line 34 already provides a default via get(..., ''); trailing || '' is unnecessary.

♻️ Proposed refactor
-    const osId = get(data, 'properties.os_id', '') || '';
+    const osId = get(data, 'properties.os_id', '');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/ProductionLocationDetailsContent.jsx`
at line 34, The assignment to osId uses get(data, 'properties.os_id', '') which
already supplies a default, so remove the redundant fallback "|| ''" in the
expression that defines osId (the const osId declaration referencing get and
'properties.os_id') to simplify the line; ensure the resulting line keeps the
same behavior by relying solely on get's default.
src/react/src/components/ProductionLocation/Heading/osIdBadge/styles.js (1)

16-16: Use the local spacing fallback consistently.

Line 16 bypasses the spacing variable and directly uses theme.spacing.unit; this weakens the fallback introduced on Line 6.

♻️ Proposed refactor
-            marginBottom: theme.spacing.unit * 2,
+            marginBottom: spacing * 2,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/react/src/components/ProductionLocation/Heading/osIdBadge/styles.js` at
line 16, The marginBottom declaration currently uses theme.spacing.unit
directly, bypassing the local spacing fallback; update the styles object so
marginBottom uses the existing spacing variable (i.e., replace
theme.spacing.unit * 2 with spacing * 2) to consistently honor the fallback
introduced earlier (refer to the spacing variable and the marginBottom property
in styles.js).
src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/styles.js (1)

4-6: Prefer theme spacing token over hardcoded 40px.

Using theme.spacing.unit * 5 here keeps spacing consistent if the global spacing scale changes.

♻️ Proposed refactor
         container: Object.freeze({
             [theme.breakpoints.up('md')]: {
-                paddingLeft: '40px',
+                paddingLeft: theme.spacing.unit * 5,
             },
         }),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/styles.js`
around lines 4 - 6, Replace the hardcoded paddingLeft value inside the
ProductionLocationDetailsContent styles where you have
[theme.breakpoints.up('md')]: { paddingLeft: '40px' } with the theme spacing
token (e.g. paddingLeft: theme.spacing.unit * 5 or paddingLeft: theme.spacing(5)
depending on our MUI version) so the component uses the global spacing scale;
update the style definition in the same styles module where the breakpoint rule
is declared.
src/react/src/__tests__/components/LocationTitle.test.jsx (1)

37-45: Use toBeEmptyDOMElement() for clarity, not because toHaveTextContent('') is non-assertive.

Jest-dom special-cases toHaveTextContent('') and explicitly fails when the element has non-empty text content. The matcher is already assertive. However, jest-dom's own documentation recommends toBeEmptyDOMElement() for checking truly empty DOM elements, which is more explicit about intent.

Suggested alternative
-        expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('');
+        expect(screen.getByRole('heading', { level: 1 })).toBeEmptyDOMElement();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/react/src/__tests__/components/LocationTitle.test.jsx` around lines 37 -
45, Replace the assertion that checks for an empty heading in the LocationTitle
test: instead of asserting that the heading has empty text via
screen.getByRole('heading', { level: 1 }) toHaveTextContent(''), call
toBeEmptyDOMElement() on that same queried element; update the expectation in
the test that uses renderLocationTitle({ data }) so it asserts emptiness with
toBeEmptyDOMElement() (keep the same getByRole call and the surrounding test
setup).
🤖 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/react/src/components/ProductionLocation/Heading/osIdBadge/OsIdBadge.jsx`:
- Around line 20-27: The wrapper element around the Typography h2
(className=osIdValueWithTooltip) uses a <span>, which is invalid because <h2>
(heading content) cannot be a child of phrasing content; replace the span
wrapper with a block-level container (e.g., a div) for both occurrences in
OsIdBadge.jsx (the element that wraps the Typography with
className=osIdValueWithTooltip and the second occurrence around line 54) so the
Typography (h2) is nested inside a block container while preserving className
and styling.

---

Nitpick comments:
In `@src/react/src/__tests__/components/LocationTitle.test.jsx`:
- Around line 37-45: Replace the assertion that checks for an empty heading in
the LocationTitle test: instead of asserting that the heading has empty text via
screen.getByRole('heading', { level: 1 }) toHaveTextContent(''), call
toBeEmptyDOMElement() on that same queried element; update the expectation in
the test that uses renderLocationTitle({ data }) so it asserts emptiness with
toBeEmptyDOMElement() (keep the same getByRole call and the surrounding test
setup).

In `@src/react/src/components/ProductionLocation/Heading/osIdBadge/styles.js`:
- Line 16: The marginBottom declaration currently uses theme.spacing.unit
directly, bypassing the local spacing fallback; update the styles object so
marginBottom uses the existing spacing variable (i.e., replace
theme.spacing.unit * 2 with spacing * 2) to consistently honor the fallback
introduced earlier (refer to the spacing variable and the marginBottom property
in styles.js).

In
`@src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/ProductionLocationDetailsContent.jsx`:
- Line 34: The assignment to osId uses get(data, 'properties.os_id', '') which
already supplies a default, so remove the redundant fallback "|| ''" in the
expression that defines osId (the const osId declaration referencing get and
'properties.os_id') to simplify the line; ensure the resulting line keeps the
same behavior by relying solely on get's default.

In
`@src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/styles.js`:
- Around line 4-6: Replace the hardcoded paddingLeft value inside the
ProductionLocationDetailsContent styles where you have
[theme.breakpoints.up('md')]: { paddingLeft: '40px' } with the theme spacing
token (e.g. paddingLeft: theme.spacing.unit * 5 or paddingLeft: theme.spacing(5)
depending on our MUI version) so the component uses the global spacing scale;
update the style definition in the same styles module where the breakpoint rule
is declared.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8d757748-dc71-44e9-bb21-9ce9276fbf77

📥 Commits

Reviewing files that changed from the base of the PR and between 10385a9 and 48a27d0.

📒 Files selected for processing (12)
  • src/react/src/__tests__/components/LocationTitle.test.jsx
  • src/react/src/__tests__/components/OsIdBadge.test.jsx
  • src/react/src/components/ProductionLocation/Heading/ClaimFlag/styles.js
  • src/react/src/components/ProductionLocation/Heading/ClosureStatus/styles.js
  • src/react/src/components/ProductionLocation/Heading/LocationTitle/LocationTitle.jsx
  • src/react/src/components/ProductionLocation/Heading/LocationTitle/styles.js
  • src/react/src/components/ProductionLocation/Heading/osIdBadge/OsIdBadge.jsx
  • src/react/src/components/ProductionLocation/Heading/osIdBadge/constants.js
  • src/react/src/components/ProductionLocation/Heading/osIdBadge/styles.js
  • src/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsx
  • src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/ProductionLocationDetailsContent.jsx
  • src/react/src/components/ProductionLocation/ProductionLocationDetailsContent/styles.js

@VadimKovalenkoSNF VadimKovalenkoSNF enabled auto-merge (squash) March 5, 2026 07:48
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

@barecheck
Copy link

barecheck bot commented Mar 5, 2026

Contricleaner App | Unittest test suite - Code coverage report

Total: 98.75%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Mar 5, 2026

Django App | Unittest test suite - Code coverage report

Total: 81.97%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

Copy link
Collaborator

@protsack-stephan protsack-stephan left a comment

Choose a reason for hiding this comment

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

Looks good!

@VadimKovalenkoSNF VadimKovalenkoSNF merged commit b7b747e into main Mar 5, 2026
21 checks passed
@VadimKovalenkoSNF VadimKovalenkoSNF deleted the OSDEV-2375-reorder-heading-elements branch March 5, 2026 10:49
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