Skip to content

[Customer Portal][FE][Web] Refactor Auth Flow: Replace /login with Public /home Landing Page & Clean Up Legacy Components - #367

Merged
Rashmika998 merged 8 commits into
wso2-open-operations:customer-portal-milestone-1from
dileepapeiris:feat-add-new-landing-page
Mar 19, 2026
Merged

Rashmika998 merged 8 commits into
wso2-open-operations:customer-portal-milestone-1from
dileepapeiris:feat-add-new-landing-page

Conversation

@dileepapeiris

@dileepapeiris dileepapeiris commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

This pull request refactors the customer portal's authentication flow and landing experience by removing the dedicated login page and introducing a new public landing page at /home. It also updates routing logic and header behavior to reflect these changes, and removes obsolete login page components. Test cases are updated to match the new routing conventions.

Routing and authentication changes:

  • Replaced the /login route and LoginPage component with a new /home route and HomePage component in App.tsx, making /home the public entry point and updating the fallback navigation to redirect to /home instead of / [1] [2] [3] [4].
  • Updated header logic in Actions.tsx to use isPublicLandingPage for /home, ensuring that header actions and dropdowns are not shown on the public landing page.

Removal of login page components:

  • Deleted all code for LoginBackground.tsx, LoginBox.tsx, LoginFooter.tsx, and LoginSlogan.tsx, as these are no longer needed with the removal of the login page [1] [2] [3] [4].

Header and navigation test updates:

  • Updated header tests to use the new project routing convention (/projects/:projectId/dashboard) and to reflect the new structure of project data returned from the API, ensuring tests remain accurate and robust after routing changes [1] [2] [3] [4] [5] [6] [7] [8] [9].

New home page assets:

  • Added HomePageArrowIcon.tsx, a new SVG icon component for CTAs on the home page.

Code style improvements:

  • Minor formatting improvements in imports for Actions.tsx.
  • Reformatted mock project data in header tests for readability.

Summary by CodeRabbit

  • New Features

    • Home page promoted as primary landing page with integrated sign-in.
    • New home-page arrow icon added.
  • Updates

    • Sign-in CTAs ("Create Support Ticket," "Browse Resources," "Access Customer Portal") now trigger authentication.
    • Routing and idle-timeout redirects now target the home page.
    • Header help dropdown visibility adjusted for the home route.
  • Removals

    • Legacy login page and its background, slogan, box, footer, particle animation, and related tests removed.
  • Tests

    • Project-list tests updated to reflect paginated API responses.

Remove LoginPage import and /login route, add HomePage import and register /home as the public entry. Update fallback Navigate to redirect to /home. Delete the unused login-screen-inverted.svg asset to clean up resources related to the old login page.
Hide GetHelp dropdown on the public landing page (/home) instead of the login page and rename the local flag accordingly; also tidy imports in Actions.tsx. Update Header.test.tsx to match route changes (/projects/:id/...) and adapt mocked project API responses to the paginated shape (pages array). Adjust mock import to preserve actual exports and reformat test fixtures. Add HomePageArrowIcon component (SVG) used for home page CTAs.
Delete obsolete login-screen.svg and its associated unit tests (LoginBackground.test.tsx, LoginFooter.test.tsx) from apps/customer-portal/webapp. Cleans up an unused login page asset and tests; verify no remaining imports reference these files.
Integrate Asgardeo sign-in into the HomePage: import useAsgardeo, add signIn handler (handleLogin) and wire CTAs to call it instead of using anchor hrefs. Apply JSX/formatting cleanups and style prop object formatting across HomePage. Remove the now-unused LoginPage.tsx. Update IdleTimeoutProvider to navigate to "/home" after sign-out (replacing previous "/login" redirects). These changes centralize the login flow and ensure redirects go to the home route after sign-out.
Delete LoginBackground.tsx, LoginBox.tsx, and LoginSlogan.test.tsx from apps/customer-portal/webapp/src/components/login-page. These files were removed as part of a cleanup/refactor of the login page implementation.
Delete unused login page components (LoginSlogan and ParticleBackground) and update AuthGuard to redirect unauthenticated users to /home instead of /login. Also update the JSDoc to reflect the new redirect behavior.
Delete apps/customer-portal/webapp/src/components/login-page/LoginFooter.tsx. Removes the obsolete login footer component (copyright notice and Privacy/Terms links) as part of UI cleanup in the customer-portal webapp.
@dileepapeiris dileepapeiris self-assigned this Mar 19, 2026
@coderabbitai

coderabbitai Bot commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR replaces the dedicated /login page with a public /home route, removes legacy login-page components and tests, updates routing/redirects (App, AuthGuard, IdleTimeoutProvider), adapts header visibility logic, integrates Asgardeo sign-in into HomePage CTAs, and adds a HomePage arrow SVG component.

Changes

Cohort / File(s) Summary
Routing & Guards
apps/customer-portal/webapp/src/App.tsx, apps/customer-portal/webapp/src/layouts/AuthGuard.tsx, apps/customer-portal/webapp/src/providers/IdleTimeoutProvider.tsx
Removed /login route, added/redirected to /home, updated wildcard fallback to /home, and changed idle/logout navigation to navigate("/home").
Header Logic
apps/customer-portal/webapp/src/components/common/header/Actions.tsx
Adjusted pathname checks to treat /home as the public landing (controls visibility of GetHelpDropdown and Divider); import formatting updated.
Header Tests
apps/customer-portal/webapp/src/components/common/header/__tests__/Header.test.tsx
Updated project API mock shape to paginated data.pages and adapted route expectations to /projects/{projectId}/dashboard paths.
Home Page
apps/customer-portal/webapp/src/pages/HomePage.tsx
Integrated useAsgardeo signIn with local isSigningIn guard; wired hero CTAs to call handleLogin instead of dummy links; styling/JSX reformats.
New UI Component
apps/customer-portal/webapp/src/components/home-page/HomePageArrowIcon.tsx
Added HomePageArrowIcon SVG component with optional size prop and transition styling.
Login Page & Subcomponents Removed
apps/customer-portal/webapp/src/pages/LoginPage.tsx, apps/customer-portal/webapp/src/components/login-page/*
Deleted LoginPage and all login-page subcomponents (LoginBox, LoginBackground, LoginSlogan, LoginFooter, ParticleBackground) and their tests.

Sequence Diagram(s)

sequenceDiagram
    participant Browser as Browser
    participant Router as App/Router
    participant Guard as AuthGuard
    participant Home as HomePage
    participant Auth as Asgardeo

    Browser->>Router: Request unknown /some/path
    Router->>Guard: Evaluate route (protected?)
    Guard-->>Router: Redirect -> /home
    Router->>Browser: Serve /home

    Browser->>Home: Click hero CTA
    Home->>Auth: call signIn()
    Auth-->>Home: auth flow (redirect / callback)
    Home-->>Browser: navigate post-auth
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Type/Task

Suggested reviewers

  • Rashmika998
  • v15a1
  • shayanmalinda

Poem

🐰 Hops the rabbit, quick and spry,
Home's the doorway in the sky,
Old login gone, new arrows lead,
A gentle sign-in, swift as speed—
Hooray for routes that let us fly! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers routing changes, component removal, test updates, and new assets, but lacks most template sections like Purpose, Goals, Release notes, Documentation, and Security checks. Add Purpose/Goals section with issue links, release notes, documentation impact statement, and security verification checklist to meet template requirements.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: refactoring the auth flow by replacing /login with /home and removing legacy login components.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 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.

@dileepapeiris dileepapeiris added Type/New Feature Represents a request or task for a new feature Type/Improvement Marks enhancements or improvements to existing features Type/UX Refers to user experience-related tasks or issues App/Customer Portal Area/Frontend Platform/Web labels Mar 19, 2026
@dileepapeiris dileepapeiris changed the title Feat add new landing page [Customer Portal][FE][Web] Refactor Auth Flow: Replace /login with Public /home Landing Page & Clean Up Legacy Components Mar 19, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
apps/customer-portal/webapp/src/pages/HomePage.tsx (1)

94-109: Remove component="a" when using onClick instead of href.

The button has component="a" but no href attribute. Since authentication is triggered via onClick, this combination is semantically incorrect—it renders as an anchor without a valid link destination. Either remove component="a" or use a <button> explicitly.

♻️ Proposed fix
             <Button
               variant="contained"
               color="warning"
-              component="a"
               onClick={handleLogin}
               endIcon={<ArrowIcon />}

Apply the same change to the other CTA buttons on lines 111-133 and 367-383.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/webapp/src/pages/HomePage.tsx` around lines 94 - 109,
The Button rendering "Create Support Ticket" is using component="a" while
relying on onClick (handleLogin) rather than an href; remove component="a" so
the Button renders as a proper button element (or replace with an explicit
<button> variant) and keep the onClick={handleLogin} intact; apply the same
change to the other CTA Buttons that use component="a" with onClick (the other
instances referenced around the same component, e.g., the CTAs at the other
sections) to ensure semantic correctness and avoid rendering anchors without
hrefs.
apps/customer-portal/webapp/src/providers/IdleTimeoutProvider.tsx (1)

52-57: Consider logging sign-out failures in onIdle.

The .finally() ensures navigation happens regardless of sign-out success, which is correct. However, if signOut() rejects, the error is silently swallowed. Consider adding error logging for observability.

💡 Optional: Add error logging
 const onIdle = () => {
   if (isSignedIn && !isLoading) {
     setSessionWarningOpen(false);
-    signOut().finally(() => navigate("/home"));
+    signOut()
+      .catch((err) => logger.error("Sign-out failed during idle timeout", err))
+      .finally(() => navigate("/home"));
   }
 };

This would require importing and using the logger hook.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/webapp/src/providers/IdleTimeoutProvider.tsx` around
lines 52 - 57, The onIdle handler currently calls signOut().finally(() =>
navigate("/home")) which silences any rejection; update onIdle to attach a
.catch that logs sign-out failures using the app's logger hook (import and use
the same logger hook used elsewhere in this file), then keep the .finally to
always call navigate("/home"); reference the onIdle function and the signOut()
call so the change is limited to adding error logging before the existing
finally block and ensuring setSessionWarningOpen(false) remains unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/customer-portal/webapp/src/components/home-page/HomePageArrowIcon.tsx`:
- Around line 29-52: The HomePageArrowIcon component is unused and duplicates
the inline ArrowIcon defined in HomePage.tsx; either delete HomePageArrowIcon
(remove the file and any exports) or consolidate by importing HomePageArrowIcon
into HomePage.tsx and replacing the local ArrowIcon definition and usages (the
inline ArrowIcon at ~lines 26-39 and its usage at line ~99) with the imported
HomePageArrowIcon to avoid duplication and keep a single source of truth.

In `@apps/customer-portal/webapp/src/pages/HomePage.tsx`:
- Around line 65-67: handleLogin currently calls signIn() without error handling
or a loading flag; add a boolean state like isSigningIn, set it true before
calling signIn and false in a finally block, wrap signIn() in try/catch to
handle/rethrow or report errors (e.g., processLogger/console or a UI toast) and
prevent unhandled rejections, and use disabled={isSigningIn} on the CTA buttons
to prevent multiple clicks; update references to handleLogin and signIn
accordingly to wire the new state and error handling.

---

Nitpick comments:
In `@apps/customer-portal/webapp/src/pages/HomePage.tsx`:
- Around line 94-109: The Button rendering "Create Support Ticket" is using
component="a" while relying on onClick (handleLogin) rather than an href; remove
component="a" so the Button renders as a proper button element (or replace with
an explicit <button> variant) and keep the onClick={handleLogin} intact; apply
the same change to the other CTA Buttons that use component="a" with onClick
(the other instances referenced around the same component, e.g., the CTAs at the
other sections) to ensure semantic correctness and avoid rendering anchors
without hrefs.

In `@apps/customer-portal/webapp/src/providers/IdleTimeoutProvider.tsx`:
- Around line 52-57: The onIdle handler currently calls signOut().finally(() =>
navigate("/home")) which silences any rejection; update onIdle to attach a
.catch that logs sign-out failures using the app's logger hook (import and use
the same logger hook used elsewhere in this file), then keep the .finally to
always call navigate("/home"); reference the onIdle function and the signOut()
call so the change is limited to adding error logging before the existing
finally block and ensuring setSessionWarningOpen(false) remains unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3446d6fe-0358-4557-a55b-2f0ecc0b7414

📥 Commits

Reviewing files that changed from the base of the PR and between a2ac991 and 448333c.

⛔ Files ignored due to path filters (2)
  • apps/customer-portal/webapp/src/assets/images/login-page/login-screen-inverted.svg is excluded by !**/*.svg
  • apps/customer-portal/webapp/src/assets/images/login-page/login-screen.svg is excluded by !**/*.svg
📒 Files selected for processing (16)
  • apps/customer-portal/webapp/src/App.tsx
  • apps/customer-portal/webapp/src/components/common/header/Actions.tsx
  • apps/customer-portal/webapp/src/components/common/header/__tests__/Header.test.tsx
  • apps/customer-portal/webapp/src/components/home-page/HomePageArrowIcon.tsx
  • apps/customer-portal/webapp/src/components/login-page/LoginBackground.tsx
  • apps/customer-portal/webapp/src/components/login-page/LoginBox.tsx
  • apps/customer-portal/webapp/src/components/login-page/LoginFooter.tsx
  • apps/customer-portal/webapp/src/components/login-page/LoginSlogan.tsx
  • apps/customer-portal/webapp/src/components/login-page/ParticleBackground.tsx
  • apps/customer-portal/webapp/src/components/login-page/__tests__/LoginBackground.test.tsx
  • apps/customer-portal/webapp/src/components/login-page/__tests__/LoginFooter.test.tsx
  • apps/customer-portal/webapp/src/components/login-page/__tests__/LoginSlogan.test.tsx
  • apps/customer-portal/webapp/src/layouts/AuthGuard.tsx
  • apps/customer-portal/webapp/src/pages/HomePage.tsx
  • apps/customer-portal/webapp/src/pages/LoginPage.tsx
  • apps/customer-portal/webapp/src/providers/IdleTimeoutProvider.tsx
💤 Files with no reviewable changes (9)
  • apps/customer-portal/webapp/src/components/login-page/tests/LoginFooter.test.tsx
  • apps/customer-portal/webapp/src/components/login-page/tests/LoginSlogan.test.tsx
  • apps/customer-portal/webapp/src/components/login-page/LoginBox.tsx
  • apps/customer-portal/webapp/src/components/login-page/LoginBackground.tsx
  • apps/customer-portal/webapp/src/pages/LoginPage.tsx
  • apps/customer-portal/webapp/src/components/login-page/ParticleBackground.tsx
  • apps/customer-portal/webapp/src/components/login-page/LoginFooter.tsx
  • apps/customer-portal/webapp/src/components/login-page/tests/LoginBackground.test.tsx
  • apps/customer-portal/webapp/src/components/login-page/LoginSlogan.tsx

Comment thread apps/customer-portal/webapp/src/pages/HomePage.tsx
Add local isSigningIn state and useLogger to prevent multiple concurrent sign-in attempts. The sign-in handler now guards against re-entry, sets a pending flag, and catches errors to log them and reset the flag. Also update imports to include useState and useLogger.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/customer-portal/webapp/src/pages/HomePage.tsx (1)

121-142: ⚠️ Potential issue | 🟡 Minor

Align the “Browse Resources” CTA with its new behavior.

Line 125 now starts signIn() instead of taking the user to resources, so the label no longer matches the action. If this button is meant to stay auth-first, please rename it; otherwise point it at the public resources section below.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/webapp/src/pages/HomePage.tsx` around lines 121 - 142,
The "Browse Resources" button's label no longer matches its behavior because its
click now triggers signIn() via the handleLogin flow; update the HomePage.tsx
Button (the element using handleLogin and endIcon ArrowIcon) to either (A) keep
the auth-first behavior and change the visible label to something like "Sign in
to Browse" or "Sign in", or (B) keep the "Browse Resources" label and change the
handler from handleLogin/signIn to route or scroll to the public resources
section (e.g., use the router push to "/resources" or call a scrollIntoView to
the resources container) so the action matches the text; update any tests or
aria-labels accordingly to reflect the new label/behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@apps/customer-portal/webapp/src/pages/HomePage.tsx`:
- Around line 121-142: The "Browse Resources" button's label no longer matches
its behavior because its click now triggers signIn() via the handleLogin flow;
update the HomePage.tsx Button (the element using handleLogin and endIcon
ArrowIcon) to either (A) keep the auth-first behavior and change the visible
label to something like "Sign in to Browse" or "Sign in", or (B) keep the
"Browse Resources" label and change the handler from handleLogin/signIn to route
or scroll to the public resources section (e.g., use the router push to
"/resources" or call a scrollIntoView to the resources container) so the action
matches the text; update any tests or aria-labels accordingly to reflect the new
label/behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b25203d5-a15e-40b0-bf9a-42cfb872d62f

📥 Commits

Reviewing files that changed from the base of the PR and between 448333c and f346dd7.

📒 Files selected for processing (1)
  • apps/customer-portal/webapp/src/pages/HomePage.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App/Customer Portal Area/Frontend Platform/Web Type/Improvement Marks enhancements or improvements to existing features Type/New Feature Represents a request or task for a new feature Type/UX Refers to user experience-related tasks or issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants