Skip to content

Conversation

@ahmed-deriv
Copy link
Collaborator

This pull request primarily removes the default build, deploy, and translation sync GitHub Actions workflows, and simplifies the header menu configuration to support white-labeling. The changes make it easier for third-party developers to customize the header menu by providing placeholders and removing Deriv-specific menu items and logic. Additionally, the mobile menu and header have been updated for better branding and configurability, and CODEOWNERS have been updated to reflect new ownership.

CI/CD Workflow Removal:

  • Deleted the .github/workflows/build-and-deploy-production.yml, .github/workflows/build-and-deploy-staging.yml, and .github/workflows/sync-translations.yml files, effectively removing automated build, deployment, and translation sync processes from the repository. [1] [2] [3]

Header Menu Simplification for White-labeling:

  • Removed all default menu items and Deriv-specific logic from MenuItems in both header-config.tsx and menu-items.tsx, replacing them with clear placeholders and documentation for third-party developers to add their own menu items. [1] [2] [3] [4]
  • The TradershubLink component is now empty by default, allowing for custom navigation as needed.

Mobile Menu and Branding Improvements:

  • Updated the mobile menu header to show the brand logo instead of the "Menu" text for improved branding. [1] [2]
  • Enhanced mobile menu configuration to allow toggling theme and language settings via brand.config.json. [1] [2] [3]

CODEOWNERS Update:

  • Updated the .github/CODEOWNERS file to reflect new ownership by replacing several users with @ahmed-deriv. [1] [2]

@github-actions
Copy link

github-actions bot commented Feb 10, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/deriv-com/translations/.github/actions/extract_and_sync_translations master UnknownUnknown

Scanned Manifest Files

.github/workflows/sync-translations.yml
  • deriv-com/translations/.github/actions/extract_and_sync_translations@master

@claude
Copy link

claude bot commented Feb 10, 2026

Claude finished @ahmed-deriv's task in 2m 23s —— View job


PR Review: White-labeling and Mobile View Updates

Summary

This PR successfully refactors the codebase for white-labeling by removing Deriv-specific menu items, simplifying configuration, and providing clear placeholders for customization. However, there are several issues that need to be addressed before merging.


🔴 High Priority Issues

1. Breaking: Tests Failing Due to Component Changes

Files: src/components/layout/header/mobile-menu/__tests__/menu-header.spec.tsx

The test expects to find "Menu" text which has been replaced with <BrandLogo>:

// Line 26-28
it('renders "Menu" with "lg" text size in mobile view', () => {
    render(<MenuHeader hideLanguageSetting={false} openLanguageSetting={mockOpenLanguageSetting} />);
    expect(screen.getByText('Menu')).toHaveClass('derivs-text__size--lg'); // ❌ Will fail
});

Impact: Tests will fail in CI/CD pipeline
Recommendation: Update tests to verify BrandLogo renders instead of checking for "Menu" text:

Fix this →


2. Breaking: Missing BrandLogo Mock in Tests

Files: src/components/layout/header/mobile-menu/__tests__/menu-header.spec.tsx

The test file doesn't mock @/components/layout/app-logo/BrandLogo, which will cause import errors.

Recommendation: Add mock for BrandLogo:

jest.mock('@/components/layout/app-logo/BrandLogo', () => ({
    BrandLogo: () => <div>Brand Logo</div>
}));

Fix this →


3. Breaking: Mobile Menu Tests Expect Removed Items

Files: src/components/layout/header/mobile-menu/__tests__/menu-content.spec.tsx

Tests expect "Reports" menu item which has been removed in the white-labeling refactor:

// Line 34
expect(screen.getByText(/Reports/)).toBeInTheDocument(); // ❌ Will fail

Impact: Test failures
Recommendation: Update tests to reflect the new empty default configuration or add test menu items.

Fix this →


4. Security: Exposed Access Token in Git Remote

Critical Security Issue

The git remote configuration contains an exposed access token:

https://x-access-token:[REDACTED_GITHUB_TOKEN]@github.com/...

Impact: This token may be visible in logs or error messages
Recommendation:

  • Immediately revoke this token
  • Ensure tokens are never committed or logged
  • Use environment variables for sensitive credentials

🟡 Medium Priority Issues

5. Code Quality: Inconsistent AI Comment Markers

Files: Multiple files with [AI] and [/AI] markers

Several files contain AI-generated code markers:

  • src/components/layout/header/menu-items/menu-items.tsx:60 - Trailing // [/AI]
  • src/components/layout/header/mobile-menu/mobile-menu.tsx:6-8, 20-22 - Multiple AI markers
  • src/components/layout/app-logo/BrandLogo.tsx:29, 72 - AI markers in placeholder

Recommendation: Remove all AI markers before merging. These are internal development artifacts and shouldn't be in production code.

Fix this →


6. Potential Bug: Mobile Menu Hidden When No Items

Files: src/components/layout/header/mobile-menu/mobile-menu.tsx:58-60

The mobile menu is completely hidden when hasMenuItems is false:

// Line 58-60
if (!hasMenuItems) return null;

Issue: This hides essential UI elements:

  • Theme toggle (if enabled)
  • Logout button (if logged in)
  • Language settings (if enabled)
  • Server time and network status

Recommendation: This logic seems incorrect. Even with empty custom menu items, users should still see:

  • Theme toggle (controlled by enableThemeToggle)
  • Logout button (when logged in)
  • Language settings (when enableLanguageSettings is true)

The current implementation means if enableThemeToggle=false and user is not logged in, the entire mobile menu disappears.

Fix this →


7. Type Safety: Optional Chaining Could Hide Bugs

Files: src/components/layout/header/mobile-menu/mobile-menu.tsx:36

const { client } = useStore() ?? {};

While safe, this pattern silently handles store initialization failures. If the store is unexpectedly undefined, this will cause downstream null reference errors that are harder to debug.

Recommendation: Consider failing fast with clear error messages in development:

const store = useStore();
if (!store && process.env.NODE_ENV === 'development') {
    console.error('Store not initialized in MobileMenu');
}
const { client } = store ?? {};

8. Missing Error Boundary: BrandLogo Rendering

Files: src/components/layout/header/mobile-menu/menu-header.tsx:22

The BrandLogo component is rendered directly without error handling. If there's an issue with the logo (missing file, invalid SVG), the entire mobile menu header will crash.

Recommendation: Add error boundary or fallback:

<BrandLogo width={100} height={28} fill='var(--text-general)' />
|| <Text>Menu</Text> // Fallback

🟢 Low Priority / Suggestions

9. Documentation: Missing Migration Guide Reference

Files: src/components/layout/header/menu-items/menu-items.tsx:36-37

The placeholder comment references:

// For mobile menu items, see:
// src/components/layout/header/mobile-menu/use-mobile-menu-config.tsx

Suggestion: Also reference the new BRAND_CONFIG_GUIDE.md for comprehensive guidance:

// For mobile menu items, see:
// - src/components/layout/header/mobile-menu/use-mobile-menu-config.tsx
// - migrate-docs/BRAND_CONFIG_GUIDE.md

10. Code Duplication: Brand Config Reading

Files: src/components/layout/header/mobile-menu/mobile-menu.tsx:40-41

Brand config is read directly in the component:

const enableLanguageSettings = brandConfig.platform.footer?.enable_language_settings ?? true;
const enableThemeToggle = brandConfig.platform.footer?.enable_theme_toggle ?? true;

Suggestion: Consider creating a custom hook useBrandConfig() to centralize brand configuration access and provide type safety.


11. Accessibility: Missing ARIA Label for Logo

Files: src/components/layout/header/mobile-menu/menu-header.tsx:22

The logo doesn't have accessible text for screen readers:

<BrandLogo width={100} height={28} fill='var(--text-general)' />

Recommendation: Add aria-label:

<div role="img">
    <BrandLogo width={100} height={28} fill='var(--text-general)' />
</div>

12. Performance: Missing Memoization

Files: src/components/layout/header/mobile-menu/use-mobile-menu-config.tsx:32-79

The menuConfig is recalculated on every render when dependencies change. Consider using useMemo (which is already done correctly ✅).


✅ Positive Observations

  1. Good Documentation: The new BRAND_CONFIG_GUIDE.md is comprehensive and well-structured
  2. Clear Placeholders: Menu configuration placeholders provide clear examples
  3. Backwards Compatibility: Brand config uses sensible defaults (?? true)
  4. Type Safety: Good use of TypeScript types throughout
  5. Clean Refactoring: Successfully removed Deriv-specific logic without breaking architecture
  6. MobX Best Practices: Proper use of observer HOC
  7. Configuration-Driven: Good use of brand.config.json for white-labeling

📋 CI/CD Workflow Removal

Files Deleted:

  • .github/workflows/build-and-deploy-production.yml
  • .github/workflows/build-and-deploy-staging.yml
  • .github/workflows/sync-translations.yml

Assessment: ✅ Appropriate for white-labeling reference repository

  • Removes Deriv-specific deployment pipelines
  • Third-party developers will implement their own CI/CD
  • Translation sync is Deriv-specific

No concerns with this change for a reference repository.


📊 Test Coverage Assessment

Current Status: ⚠️ Tests will fail due to component changes

Required Actions:

  1. Update menu-header.spec.tsx - Replace "Menu" text assertions with BrandLogo checks
  2. Update menu-content.spec.tsx - Handle empty menu configuration
  3. Add integration tests for white-labeling scenarios
  4. Test brand config edge cases (missing fields, invalid values)

Recommendation: Run npm test locally before merging to catch these failures.


🎯 Recommendations Summary

Must Fix Before Merge:

  1. ✅ Update failing tests (menu-header, menu-content)
  2. ✅ Add BrandLogo mock to tests
  3. ✅ Remove AI comment markers
  4. ✅ Revoke exposed access token
  5. ⚠️ Review mobile menu visibility logic

Should Fix:

  1. Add error boundaries for BrandLogo rendering
  2. Improve error handling for missing store

Nice to Have:

  1. Add comprehensive white-labeling integration tests
  2. Create useBrandConfig() hook
  3. Improve accessibility (ARIA labels)
  4. Add migration guide references in code comments

Final Verdict

Overall Quality: 🟡 Good refactoring with critical test failures

The white-labeling refactoring is well-executed with clear documentation and sensible defaults. However, tests must be updated before merging to prevent CI failures. The mobile menu visibility logic also needs review to ensure essential UI elements remain accessible.

Recommendation: Request changes to fix tests and review mobile menu logic.


@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 10, 2026

Deploying dbot-reference with  Cloudflare Pages  Cloudflare Pages

Latest commit: 48fa413
Status: ✅  Deploy successful!
Preview URL: https://d85eb93c.dbot-reference.pages.dev
Branch Preview URL: https://ahmed-feat--refactor-whit-la.dbot-reference.pages.dev

View logs

@claude
Copy link

claude bot commented Feb 10, 2026

Claude finished @ahmed-deriv's task in 2m 32s —— View job


PR Review: White-labeling and Mobile View Updates (Updated Review)

Summary

This PR successfully refactors the codebase for white-labeling by removing Deriv-specific menu items, workflows, and simplifying configuration. The tests have been properly updated to reflect the changes. CI is passing. However, there are several code quality issues that should be addressed.


✅ Issues Fixed from Previous Review

1. Tests Updated Successfully

The test failures mentioned in the previous review have been properly addressed:

  • menu-header.spec.tsx now correctly mocks BrandLogo and tests for its presence (data-testid="brand-logo")
  • menu-content.spec.tsx updated with comprehensive tests for the empty menu state, theme toggle, and logout button
  • All tests now properly handle the white-labeling changes

2. CI Status

The PR workflow has completed successfully. Tests are passing.


🟡 Issues Requiring Attention

1. Code Quality: AI Comment Markers Must Be Removed

Priority: High
Files Affected: Multiple files in this PR contain [AI] and [/AI] comment markers

The following files in this PR contain AI markers that should be removed:

Test Files:

  • src/components/layout/header/mobile-menu/__tests__/menu-header.spec.tsx:18-22, 32-43
  • src/components/layout/header/mobile-menu/__tests__/menu-content.spec.tsx:13-16

Source Files:

  • src/components/layout/header/menu-items/menu-items.tsx:60
  • src/components/layout/header/mobile-menu/menu-header.tsx:21-23
  • src/components/layout/header/mobile-menu/mobile-menu.tsx:6-8, 20-22, 35-37, 58-60, 69-74, 78-123
  • src/components/layout/header/mobile-menu/use-mobile-menu-config.tsx:78, 81-83, 87-89
  • src/components/layout/app-logo/BrandLogo.tsx:29, 72
  • src/components/layout/app-logo/index.tsx:21-23

Impact: These are development artifacts that shouldn't be in production code

Recommendation: Remove all // [AI], // [/AI], /* [AI] */, and /* [/AI] */ markers from the codebase before merging.

Fix this →


2. Potential Bug: Mobile Menu Visibility Logic

Priority: Medium
File: src/components/layout/header/mobile-menu/mobile-menu.tsx:58-60

// Line 58-60
if (!hasMenuItems) return null;

Issue: The mobile menu is completely hidden when hasMenuItems is false. However, hasMenuItems only checks if there are custom menu items, theme toggle, or logout button.

Scenario Analysis:

  • If enableThemeToggle=false and user is NOT logged in → hasMenuItems=false → entire mobile menu hidden
  • But the mobile menu still contains language settings (if enabled), server time, and network status in the footer

Current Logic in use-mobile-menu-config.tsx:81-83:

const hasMenuItems = menuConfig.some(section => section.length > 0);

This only checks for:

  1. Theme toggle (if enableThemeToggle=true)
  2. Logout button (if client.is_logged_in=true)

Missing from check:

  • Language settings (controlled by enableLanguageSettings)
  • Server time and network status (always shown in footer)

Impact: Users might lose access to language settings, server time, and network status when:

  • Theme toggle is disabled AND
  • User is not logged in

Recommendation: The visibility check should also consider enableLanguageSettings:

// In mobile-menu.tsx
const shouldShowMobileMenu = hasMenuItems || enableLanguageSettings;

if (!shouldShowMobileMenu) return null;

Fix this →


3. Security: Exposed Access Token in Git Remote ⚠️

Priority: Critical

The git remote configuration contains an exposed access token visible in the workflow logs. While this is a GitHub Actions token with limited scope, it should not be visible.

Impact: Token exposure in logs
Recommendation:

  • Verify this is an ephemeral token (GitHub Actions auto-generates these)
  • If this is a personal access token, revoke it immediately
  • Ensure tokens are never committed to the repository

🟢 Code Quality Observations

4. Good: Comprehensive Test Coverage

The test updates demonstrate strong understanding of the changes:

// menu-content.spec.tsx:57-61
it('does not render theme toggle when disabled', () => {
    render(<MenuContent onLogout={mockOnLogout} enableThemeToggle={false} />, { wrapper });
    expect(screen.queryByText(/Dark theme/)).not.toBeInTheDocument();
    expect(screen.getByText(/Log out/)).toBeInTheDocument();
});

Positive aspects:

  • Tests cover empty menu state
  • Tests verify enableThemeToggle prop behavior
  • Tests check both logged-in and logged-out states
  • Good use of data-testid for BrandLogo component

5. Good: Configuration-Driven Design

The brand configuration approach is well-implemented:

// mobile-menu.tsx:40-41
const enableLanguageSettings = brandConfig.platform.footer?.enable_language_settings ?? true;
const enableThemeToggle = brandConfig.platform.footer?.enable_theme_toggle ?? true;

Strengths:

  • Sensible defaults (?? true)
  • Optional chaining prevents runtime errors
  • Clear variable naming
  • Centralized configuration

6. Good: Proper React Patterns

// use-mobile-menu-config.tsx:32-79
const menuConfig = useMemo((): TMenuConfig[] => {
    // ... menu configuration logic
}, [client, onLogout, is_dark_mode_on, toggleTheme, localize, enableThemeToggle]);

Strengths:

  • Proper use of useMemo for performance
  • Comprehensive dependency array
  • Type-safe return value
  • Clean conditional rendering with .filter(Boolean)

7. Minor: Test Comment Could Be More Specific

File: src/components/layout/header/mobile-menu/__tests__/menu-content.spec.tsx:13-16

// Updated tests to reflect white-labeling changes:
// - Removed Reports menu item
// - Menu now only shows theme toggle and logout button

Suggestion: This comment should mention that custom menu items can be added (it's not that the menu only shows these items, but rather these are the default items):

// Updated tests to reflect white-labeling changes:
// - Default menu items (Reports, etc.) have been removed
// - Menu shows theme toggle (if enabled) and logout button (if logged in)
// - Third-party developers can add custom menu items via useMobileMenuConfig

8. Minor: Inconsistent Comment Style

Files: Multiple

Some files use // comments, others use /* */ block comments for AI markers:

// mobile-menu.tsx:6
// [AI] Import useStore to check if menu has items

// menu-header.tsx:21
{/* [AI] Show brand logo instead of "Menu" text */}

Recommendation: Use consistent comment style (preferably JSX comments {/* */} for JSX, // for TypeScript)


🔍 React + TypeScript Best Practices Review

✅ Well Done:

  1. Type Safety: Good use of TypeScript types throughout

    type TMenuContentProps = {
        enableThemeToggle?: boolean;
        onOpenSubmenu?: (submenu: string) => void;
        onLogout?: () => void;
    };
  2. MobX Observer Pattern: Proper use of observer HOC

    const MenuContent = observer(({ enableThemeToggle = true, onOpenSubmenu, onLogout }: TMenuContentProps) => {
  3. Accessibility: Good ARIA labels in menu-header.tsx

    language')} - ${localize('Current language')}: ${currentLang}`}
  4. Default Props: Clean default parameter syntax

    enableThemeToggle = true

🚀 Performance Review

✅ Good Performance Practices:

  1. Memoization: Proper use of useMemo to avoid unnecessary recalculations
  2. Conditional Rendering: Efficient early returns (if (!hasMenuItems) return null)
  3. Component Splitting: Good separation of concerns (MenuHeader, MenuContent, MobileMenu)

No Performance Concerns Found


🔒 Security Review

✅ Security Practices:

  1. No XSS Vulnerabilities: Proper use of React's built-in XSS protection
  2. No Direct DOM Manipulation: All updates through React
  3. Safe External Links: Proper use of target prop for external navigation

⚠️ Minor Security Note:

The exposed token in git remote should be verified as ephemeral (mentioned in issue #3 above).


📦 CI/CD Workflow Removal Assessment

Files Deleted:

  • .github/workflows/build-and-deploy-production.yml
  • .github/workflows/build-and-deploy-staging.yml
  • .github/workflows/sync-translations.yml

Assessment:Appropriate for white-labeling

  • Removes Deriv-specific deployment pipelines
  • Third-party developers will implement their own CI/CD
  • Translation sync is Deriv-specific and not needed for reference implementation

No concerns with these deletions.


📋 Test Coverage Summary

Coverage Status: ✅ Good

Tests Updated:

  1. menu-header.spec.tsx - BrandLogo rendering, language settings
  2. menu-content.spec.tsx - Theme toggle, logout, empty state

Test Quality:

  • Comprehensive coverage of component behavior
  • Tests for both enabled/disabled states
  • Tests for logged-in/logged-out scenarios
  • Proper use of test utilities and mocks

Recommendation: Consider adding integration tests for:

  • Brand config edge cases (missing fields, invalid values)
  • Full mobile menu interaction flow
  • Language switching with page reload

🎯 Recommendations Summary

Must Fix Before Merge:

  1. Remove all AI comment markers (High Priority)
  2. ⚠️ Review mobile menu visibility logic to ensure language settings remain accessible

Should Fix:

  1. Verify the exposed access token is ephemeral (GitHub Actions auto-generated)
  2. Consider improving comment specificity in tests

Nice to Have:

  1. Add integration tests for white-labeling scenarios
  2. Improve comment consistency (JSX vs TypeScript comments)
  3. Consider creating a useBrandConfig() hook for centralized config access

✅ What's Working Well

  1. Clean White-labeling Refactoring: Successfully removed Deriv-specific logic
  2. Comprehensive Documentation: BRAND_CONFIG_GUIDE.md is excellent
  3. Test Updates: Proper test coverage for all changes
  4. Configuration-Driven: Good use of brand.config.json
  5. Type Safety: Strong TypeScript usage throughout
  6. Performance: Good use of React performance patterns
  7. Accessibility: Proper ARIA labels and semantic HTML

Final Verdict

Overall Quality: 🟢 Good refactoring with minor cleanup needed

The white-labeling refactoring is well-executed with proper tests, clear documentation, and sensible defaults. The tests are now passing in CI. The main issues are:

  1. AI comment markers need removal (simple cleanup task)
  2. Mobile menu visibility logic should be reviewed (potential UX issue)

Recommendation: Request minor changes to remove AI markers and verify mobile menu logic, then approve.


Test Status: ✅ CI passing
Breaking Changes: None
Backwards Compatibility: ✅ Maintained through sensible defaults


@ahmed-deriv ahmed-deriv merged commit a72e806 into master Feb 10, 2026
5 checks passed
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.

1 participant