feat: Hide UI elements in embedded mode
Summary
Implements conditional rendering of standalone-only UI elements when running in embedded/iframe mode. Respects hideLogoutButton, hideNewProjectButton, hideNewFlowButton, and hideStarterProjects flags.
Changes
- Hide logout button from account menu
- Hide new flow creation button from header
- Hide new project/folder button from sidebar
- Hide starter projects tab from templates modal
All controlled by utility store flags populated from server configuration.
Type
Feature/UX
Related
Part 4 of 4 in LE-906 P2 Fixes split Depends on: PR1 (config plumbing must merge first)
Notes
Pure frontend changes with no breaking changes. Works with any value of embedded_mode flag; integrators can enable individual hide flags as needed.
Summary by CodeRabbit
- New Features
- Added configuration options to conditionally hide the logout button in the account menu.
- Added configuration option to hide the new project/folder creation button in the sidebar.
- Added configuration option to hide the starter projects tab and related content in the templates modal.
[!IMPORTANT]
Review skipped
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID:
88fd7383-39a2-411c-b221-d082a7865605You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
Walkthrough
Three frontend components now conditionally render UI elements based on feature flags read from useUtilityStore: AccountMenu hides the logout button, HeaderButtons hides the add-project button, and TemplatesModal hides starter projects and redirects tab navigation when those flags are enabled.
Changes
Utility Store UI Feature Flags
| Layer / File(s) | Summary |
|---|---|
AccountMenu logout button hiding src/frontend/src/components/core/appHeaderComponent/components/AccountMenu/index.tsx |
Imports useUtilityStore, reads hideLogoutButton flag, and updates the logout button rendering condition to require hideLogoutButton to be false alongside the existing autoLogin check. |
HeaderButtons add-project button hiding src/frontend/src/components/core/folderSidebarComponent/components/sideBarFolderButtons/components/header-buttons.tsx |
Reads hideNewProjectButton from useUtilityStore and wraps the AddFolderButton in a conditional so it is omitted entirely when the flag is true. |
TemplatesModal starter projects hiding and tab redirection src/frontend/src/modals/templatesModal/index.tsx |
Imports useUtilityStore, reads hideStarterProjects flag, derives an effectiveTab that remaps get-started to all-templates when hidden, conditionally includes the get-started category entry, and updates modal rendering to use effectiveTab instead of currentTab. |
🎯 2 (Simple) | ⏱️ ~10 minutes
[!IMPORTANT]
Pre-merge checks failed
Please resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 3 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Test Coverage For New Implementations | ❌ Error | No test files created for AccountMenu, HeaderButtons, or TemplatesModal. No tests added to utilityStore.test.ts for hideLogoutButton, hideNewProjectButton, hideStarterProjects. | Add tests directories and test files for each component following project pattern (*.test.tsx); add tests to utilityStore.test.ts for new hide-related boolean properties. |
| 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. |
| Test Quality And Coverage | ⚠️ Warning | PR adds UI hiding features without tests. AccountMenu, HeaderButtons, TemplatesModal components use new utility store flags but no test files were created for these components. | Create test files for AccountMenu, HeaderButtons, and TemplatesModal verifying conditional rendering when hide flags are true/false. Mock useUtilityStore to test both enabled and disabled states. |
| Test File Naming And Structure | ⚠️ Warning | No test files were added for three modified components that contain conditional rendering logic based on utility store flags hideLogoutButton, hideNewProjectButton, and hideStarterProjects. | Add test files following the __tests__/<ComponentName>.test.tsx pattern for AccountMenu, header-buttons, and TemplatesModal to cover new conditional rendering logic with positive and negative scenarios. |
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main change: conditional rendering to hide UI elements when in embedded/iframe mode. It clearly summarizes the primary purpose of the changeset. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Excessive Mock Usage Warning | ✅ Passed | No test files exist for the modified components (AccountMenu, HeaderButtons, TemplatesModal), so there are no test files with excessive mocks to review. The check is not applicable to this PR. |
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Commit unit tests in branch
feature/le-906-pr4-embedded-ui
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 @coderabbitai help to get the list of available commands and usage tips.
Codecov Report
:x: Patch coverage is 60.26201% with 91 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 57.54%. Comparing base (2e41b7f) to head (98a50c5).
:warning: Report is 1 commits behind head on release-1.10.0.
Additional details and impacted files
@@ Coverage Diff @@
## release-1.10.0 #13099 +/- ##
==================================================
- Coverage 57.58% 57.54% -0.05%
==================================================
Files 2264 2264
Lines 216006 216058 +52
Branches 30550 30530 -20
==================================================
- Hits 124395 124334 -61
- Misses 90196 90309 +113
Partials 1415 1415
| Flag | Coverage Δ | |
|---|---|---|
| backend | 64.68% <ø> (-0.01%) |
:arrow_down: |
| frontend | 56.89% <57.07%> (-0.07%) |
:arrow_down: |
| lfx | 52.86% <100.00%> (+0.02%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| ...ppHeaderComponent/components/AccountMenu/index.tsx | 91.66% <100.00%> (+63.94%) |
:arrow_up: |
| ...sideBarFolderButtons/components/header-buttons.tsx | 79.67% <100.00%> (+42.92%) |
:arrow_up: |
| src/frontend/src/modals/templatesModal/index.tsx | 96.42% <100.00%> (+70.46%) |
:arrow_up: |
| ...end/src/pages/MainPage/components/header/index.tsx | 92.09% <100.00%> (+0.09%) |
:arrow_up: |
| src/frontend/src/stores/utilityStore.ts | 100.00% <100.00%> (ø) |
|
| src/lfx/src/lfx/services/settings/base.py | 77.09% <100.00%> (+0.70%) |
:arrow_up: |
| ...c/controllers/API/queries/config/use-get-config.ts | 70.55% <73.52%> (+4.11%) |
:arrow_up: |
| src/frontend/src/types/zustand/utility/index.ts | 0.00% <0.00%> (ø) |
|
| ...end/src/pages/MainPage/pages/emptyFolder/index.tsx | 38.88% <15.78%> (+0.65%) |
:arrow_up: |
| ...ntend/src/pages/MainPage/pages/emptyPage/index.tsx | 0.00% <0.00%> (ø) |
|
| ... and 1 more |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
✅ Test Coverage Advisor
No source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉
Advisory check only — never blocks merge.