Skip to content

feat(ui-admin): require auth for all admin pages and fix header text …#372

Merged
jasonmorais merged 2 commits intomainfrom
jason/admin-portal-auth
Apr 17, 2026
Merged

feat(ui-admin): require auth for all admin pages and fix header text …#372
jasonmorais merged 2 commits intomainfrom
jason/admin-portal-auth

Conversation

@jasonmorais
Copy link
Copy Markdown
Contributor

@jasonmorais jasonmorais commented Apr 17, 2026

…size

  • Wrap AppRoutes in RequireAuth with redirectPath=/login so all admin pages require authentication including the home page
  • Update listing-operations and user-operations redirect paths from / to /login
  • Remove redundant RequireAuth wrapper from messages route in app-routes.tsx
  • Remove unused isAuthenticated prop from App component and its caller
  • Fix admin header .brandName font-size from 1.1rem to 24px, add line-height: 32px, and update color to match canonical .logoText style

Summary by Sourcery

Enforce authentication across all admin routes and align the admin header branding styles with the canonical design.

Enhancements:

  • Require authentication for all admin routes by wrapping the main AppRoutes tree in a shared RequireAuth component with a /login redirect.
  • Simplify routing configuration by removing a redundant per-route RequireAuth wrapper on the messages route and the unused isAuthenticated prop from the App component and its container.
  • Update admin header brandName typography and color to match the canonical logo text styling across viewports.

…size

- Wrap AppRoutes in RequireAuth with redirectPath=/login so all admin
  pages require authentication including the home page
- Update listing-operations and user-operations redirect paths from / to /login
- Remove redundant RequireAuth wrapper from messages route in app-routes.tsx
- Remove unused isAuthenticated prop from App component and its caller
- Fix admin header .brandName font-size from 1.1rem to 24px, add
  line-height: 32px, and update color to match canonical .logoText style

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jasonmorais jasonmorais requested a review from a team April 17, 2026 14:34
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 17, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Wraps all admin routes (including the root) with a shared RequireAuth guard redirecting to /login, simplifies App component props/callers, removes a redundant inner auth wrapper from the messages route, and aligns the admin header brandName styling with the canonical logo text styles.

Sequence diagram for updated admin route authentication flow

sequenceDiagram
    actor AdminUser
    participant Browser
    participant App
    participant RequireAuth
    participant AppRoutes
    participant MessagesRoutes
    participant LoginPage as AdminLogin

    AdminUser->>Browser: Navigate to /messages
    Browser->>App: Load React app
    App->>RequireAuth: Render appSection with redirectPath /login
    RequireAuth->>RequireAuth: Check auth state
    alt not authenticated
        RequireAuth-->>Browser: Redirect to /login
        Browser->>LoginPage: Render AdminLogin
    else authenticated
        RequireAuth->>AppRoutes: Render child routes
        AppRoutes->>MessagesRoutes: Render messages/* route without inner guard
        MessagesRoutes-->>AdminUser: Show messages UI
    end
Loading

Class diagram for updated admin routing and auth components

classDiagram
    class AppContainer {
      +AppContainer()
    }

    class App {
      +App()
    }

    class RequireAuth {
      +redirectPath string
      +children ReactNode
    }

    class AppRoutes {
      +AppRoutes()
    }

    class ListingOperationsRoutes {
      +ListingOperationsRoutes()
    }

    class UserOperationsRoutes {
      +UserOperationsRoutes()
    }

    class MessagesRoutes {
      +MessagesRoutes()
    }

    class AdminLogin {
      +AdminLogin()
    }

    class AuthRedirect {
      +AuthRedirect()
    }

    AppContainer --> App : renders
    App o--> RequireAuth : appSection
    App o--> RequireAuth : listingOperationsSection
    App o--> RequireAuth : userOperationsSection
    App --> AdminLogin : /login route
    App --> AuthRedirect : /auth-redirect route
    App --> AppRoutes : protected root routes
    App --> ListingOperationsRoutes : protected listing routes
    App --> UserOperationsRoutes : protected user routes

    AppRoutes --> MessagesRoutes : messages/* route without RequireAuth
    RequireAuth --> AppRoutes : children when authenticated
    RequireAuth --> ListingOperationsRoutes : children when authenticated
    RequireAuth --> UserOperationsRoutes : children when authenticated

    note for AppContainer "No longer passes isAuthenticated prop to App"
    note for App "Has no props; all routes now protected via top-level RequireAuth with redirectPath /login"
Loading

File-Level Changes

Change Details Files
Enforce authentication on all core admin routes via a shared RequireAuth wrapper and consistent redirect behavior.
  • Introduce a shared appSection that wraps AppRoutes in RequireAuth with redirectPath set to /login.
  • Change the main /* route to render the new appSection instead of AppRoutes directly so the admin home page is protected.
  • Update listing and user operations sections to use redirectPath=/login instead of redirecting to the root / path.
apps/ui-admin/src/app.tsx
Remove redundant/obsolete authentication wiring now that routing is wrapped at a higher level.
  • Delete the isAuthenticated prop from the App component signature and its interface.
  • Update AppContainer to stop passing isAuthenticated into App, both for unauthenticated and authenticated cases.
  • Remove the nested RequireAuth wrapper from the messages/* route since the parent App is now guarded.
apps/ui-admin/src/app.tsx
apps/ui-admin/src/app.container.tsx
packages/sthrift/ui-admin-route-root/src/app-routes.tsx
Adjust admin header brandName typography to match design system logo text styling across breakpoints.
  • Increase base .brandName font-size from 1.1rem to 24px, add line-height: 32px, and switch color to var(--color-primary).
  • On narrow viewports, adjust .brandName font-size from 1rem to 20px to keep responsive sizing coherent.
packages/sthrift/ui-admin-route-shared/src/admin-header.module.css

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@jasonmorais jasonmorais merged commit 2a9cf0b into main Apr 17, 2026
10 checks passed
@jasonmorais jasonmorais deleted the jason/admin-portal-auth branch April 17, 2026 15:54
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