Skip to content

feat(new-webui): Add global theming config and adjust sider appearance.#937

Merged
kirkrodrigues merged 12 commits into
y-scope:mainfrom
junhaoliao:antd-theme
May 30, 2025
Merged

feat(new-webui): Add global theming config and adjust sider appearance.#937
kirkrodrigues merged 12 commits into
y-scope:mainfrom
junhaoliao:antd-theme

Conversation

@junhaoliao

@junhaoliao junhaoliao commented May 28, 2025

Copy link
Copy Markdown
Member

Description

  1. Add theme support and config.
  2. Adjust sider appearance.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  1. Verified that the components' appearance matches the theme config object.
  2. Verified that the sider appearance is updated as specified.

Summary by CodeRabbit

  • New Features
    • Introduced a consistent app-wide theme, including custom font, primary colour, and border radius.
  • Style
    • Updated sidebar width for improved layout.
    • Adjusted logo styling in the sidebar for better spacing and appearance.

@junhaoliao junhaoliao requested a review from a team as a code owner May 28, 2025 20:50
@junhaoliao junhaoliao requested a review from davemarco May 28, 2025 20:50
@coderabbitai

coderabbitai Bot commented May 28, 2025

Copy link
Copy Markdown
Contributor
## Walkthrough

The changes introduce a new Ant Design theme configuration and update the main application component to wrap the router with a `ConfigProvider` using this theme. Additionally, layout styling was adjusted by changing the sidebar width from string to number and modifying padding and height rules for the logo area. No component signatures or control flow were altered.

## Changes

| File(s)                                                     | Change Summary                                                                                       |
|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
| .../client/src/AntdApp.tsx                                  | Wrapped `RouterProvider` with Ant Design `ConfigProvider` using imported `THEME_CONFIG`.            |
| .../client/src/theme.tsx                                    | Added new file defining and exporting `THEME_CONFIG` for Ant Design theming.                        |
| .../client/src/components/Layout/MainLayout.tsx             | Changed Sider width from string `"150"` to numeric `150`.                                           |
| .../client/src/components/Layout/MainLayout.module.css      | Removed fixed height on `.siderLogo`; added `padding-inline: 15%` and `padding-block: 16px`.        |
| .../client/src/pages/SearchPage/SearchResults/SearchResultsTable/index.tsx | Modified React import to use named imports (`useEffect`, `useRef`, `useState`) instead of default. |

## Possibly related PRs

- y-scope/clp#791: Introduced the `AntApp` component and Ant Design dependency, which the current PR extends by adding theming support.
- y-scope/clp#797: Established the initial routing setup with `RouterProvider` in `AntdApp.tsx`, upon which the current PR builds by adding theming.

## Suggested reviewers

- davemarco
- kirkrodrigues

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 107f394 and b840845.

📒 Files selected for processing (4)
  • components/log-viewer-webui/client/src/components/Layout/MainLayout.module.css (1 hunks)
  • components/log-viewer-webui/client/src/components/Layout/MainLayout.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/theme.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/index.tsx
  • components/log-viewer-webui/client/src/theme.tsx
  • components/log-viewer-webui/client/src/components/Layout/MainLayout.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
🔇 Additional comments (2)
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/index.tsx (1)

1-5: LGTM! Modern React import approach.

The updated import statement correctly modernizes the React imports by removing the default import and only importing the specific hooks that are used in the component.

components/log-viewer-webui/client/src/theme.tsx (1)

1-18: LGTM! Well-structured theme configuration.

The theme configuration properly addresses the past review comment by using the public API for ThemeConfig. The use of Object.freeze() ensures immutability, and the theme values (Inter font, blue primary colour, subtle border radius) provide a clean, modern appearance. Enabling CSS variables and disabling hashed class names supports better theme customization.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@junhaoliao junhaoliao requested a review from kirkrodrigues May 28, 2025 20:50
@junhaoliao junhaoliao changed the title feat(new-webui): Add theme support with a toggle menu. feat(new-webui): Add theme support with a toggle menu. May 28, 2025
@junhaoliao junhaoliao changed the title feat(new-webui): Add theme support with a toggle menu. feat(new-webui): Add theme support with a toggle menu. May 28, 2025
@junhaoliao junhaoliao changed the title feat(new-webui): Add theme support with a toggle menu. feat(new-webui): Add global theming support. May 28, 2025

@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: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56906ab and ac7f02b.

📒 Files selected for processing (2)
  • components/log-viewer-webui/client/src/AntdApp.tsx (2 hunks)
  • components/log-viewer-webui/client/src/theme.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/AntdApp.tsx
  • components/log-viewer-webui/client/src/theme.tsx
🔇 Additional comments (2)
components/log-viewer-webui/client/src/theme.tsx (1)

7-15: Immutable configuration
Freezing the theme configuration with Object.freeze is a robust way to guard against accidental mutations at runtime. Nice use of immutability for a global config object.

components/log-viewer-webui/client/src/AntdApp.tsx (1)

16-24: Verify dynamic theme integration
Right now ConfigProvider is passed the static THEME_CONFIG. To support toggling between light, dark and system modes, ensure that the runtime theme—particularly the correct algorithm setting—is computed (e.g. from localStorage or prefers-color-scheme) and fed into ConfigProvider here.

Comment thread components/log-viewer-webui/client/src/theme.tsx Outdated
import router from "./router";
import THEME_CONFIG from "./theme";

import "@ant-design/v5-patch-for-react-19";

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.

🧹 Nitpick (assertive)

Ensure patch import precedence
Consider moving the import of @ant-design/v5-patch-for-react-19 to the very top of this file, before any other imports, so that the patch takes effect before Ant Design and related modules are loaded.

🤖 Prompt for AI Agents
In components/log-viewer-webui/client/src/AntdApp.tsx at line 8, move the import
of "@ant-design/v5-patch-for-react-19" to the very top of the file, before any
other imports, to ensure the patch is applied before Ant Design and related
modules are loaded.

Comment on lines 16 to 24
const AntApp = () => {
return <RouterProvider router={router}/>;
return (
<ConfigProvider
theme={THEME_CONFIG}
>
<RouterProvider router={router}/>
</ConfigProvider>
);
};

@coderabbitai coderabbitai Bot May 28, 2025

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.

🧹 Nitpick (assertive)

Add explicit component return type
Since this is a TSX file, you may want to annotate AntApp with an explicit return type (: JSX.Element) for clarity and stricter typing:

const AntApp = (): JSX.Element => {  }
🤖 Prompt for AI Agents
In components/log-viewer-webui/client/src/AntdApp.tsx around lines 16 to 24, the
AntApp component lacks an explicit return type annotation. Add the return type
annotation `: JSX.Element` to the AntApp function declaration to improve clarity
and enforce stricter typing in this TSX file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

unnecessary for components in JSX / TSX sources

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.

@junhaoliao, understood! I'll remember this preference for future reviews of React components in your codebase.


✏️ Learnings added
Learnt from: junhaoliao
PR: y-scope/clp#937
File: components/log-viewer-webui/client/src/AntdApp.tsx:16-24
Timestamp: 2025-05-29T20:33:40.631Z
Learning: In components/log-viewer-webui React codebase: Return type annotations (like `: JSX.Element`) are unnecessary and not preferred for React components in JSX/TSX files.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment on lines +3 to +6
import {ConfigProvider} from "antd";

import router from "./router";
import THEME_CONFIG from "./theme";

@coderabbitai coderabbitai Bot May 28, 2025

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.

🧹 Nitpick (assertive)

Improve import grouping
Group external dependencies (e.g. react-router, antd) separately from local imports (./router, ./theme) and maintain a consistent ordering (alphabetical or logical) to enhance readability.

🤖 Prompt for AI Agents
In components/log-viewer-webui/client/src/AntdApp.tsx around lines 3 to 6, the
import statements are not grouped properly. Separate external dependencies like
"antd" from local imports such as "./router" and "./theme". Arrange each group
in a consistent order, either alphabetically or logically, to improve code
readability and maintainability.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this needs to be fixed in https://github.com/y-scope/eslint-config-yscope

@coderabbitai create an issue there

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.

🧩 Analysis chain

@junhaoliao junhaoliao changed the title feat(new-webui): Add global theming support. feat(new-webui): Add global theming support and adjust sider appearance. May 28, 2025
@junhaoliao junhaoliao changed the title feat(new-webui): Add global theming support and adjust sider appearance. feat(new-webui): Add global theming config and adjust sider appearance. May 28, 2025
davemarco
davemarco previously approved these changes May 29, 2025

@davemarco davemarco 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.

Code looks good to me. I am okay with styles as well

@davemarco

Copy link
Copy Markdown
Contributor

Note should probably wait until final UI pr are merged, before merging this. kirk may also have comments on style

Comment thread components/log-viewer-webui/client/src/components/Layout/MainLayout.module.css Outdated
Comment thread components/log-viewer-webui/client/src/components/Layout/MainLayout.tsx Outdated
Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com>
kirkrodrigues
kirkrodrigues previously approved these changes May 29, 2025
@@ -1,4 +1,4 @@
import React, {
import {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we want to fix this in this PR? I'm not necessarily against it, it's just it would be weird to write (fixes #942) in the title.

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.

I can fix it in timelinePR i think it is more appropriate there

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in #948

@kirkrodrigues kirkrodrigues merged commit 0b2c5a7 into y-scope:main May 30, 2025
5 checks passed
@junhaoliao junhaoliao deleted the antd-theme branch May 7, 2026 19:46
junhaoliao added a commit to junhaoliao/clp that referenced this pull request May 17, 2026
…e. (y-scope#937)

Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com>
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