Repository navigation
merge landing page - #5806
merge landing page#5806refeiner wants to merge 3 commits into
Conversation
- redesign home page with modular section components - add new sections: Hero, Capability, Enterprise, Playground, Trust - add EndpointTicker and SectionHeader components - update i18n translations for all supported locales - update .gitignore to exclude docs/dev artifacts
WalkthroughThis PR refactors the Home page from a monolithic component into five section components (Hero, Capability, Trust, Playground, Enterprise) with new CSS animations and i18n strings across 7 locales. It also comments out all self-registration UI entry points and fixes three build errors from dependency upgrades (Semi CSS import, LinkedIn icon, Air file-watcher config). ChangesBuild & Dev Tooling Fixes
Self-Registration UI Removal
Home Page Redesign
Sequence Diagram(s)sequenceDiagram
participant User
participant HomeIndex
participant HeroSection
participant EndpointTicker
participant Clipboard
User->>HomeIndex: visits /
HomeIndex->>HeroSection: render(serverAddress, endpointItems, isMobile, ...)
HeroSection->>EndpointTicker: render(serverAddress, endpointItems)
loop every 3 seconds
EndpointTicker->>EndpointTicker: advance endpointIndex
end
User->>EndpointTicker: clicks copy button
EndpointTicker->>Clipboard: copy(serverAddress)
Clipboard-->>EndpointTicker: success
EndpointTicker-->>User: showSuccess toast
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
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 Warning |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.gitignore:
- Around line 32-33: The Air development workflow is inconsistent because the
repo ignores .air.toml while the docs still instruct developers to create it and
there is no tracked shared template. Update the workflow by either committing a
shared .air.toml configuration or adding a tracked .air.toml.example and keeping
the real .air.toml ignored, then align any documentation that references the
setup so developers know which file to use.
In `@docs/dev/2026-04-09-refactor-disable-self-registration.md`:
- Around line 34-36: The restore-path breadcrumbs in the LoginForm documentation
are outdated: the component now uses renderOAuthOptions() instead of
renderOAuthLoginForm(), and the second hidden registration-link block is around
the newer location near the email login section rather than the old referenced
line. Update the doc text so it points maintainers to the current symbol names
in LoginForm.jsx and the correct hidden-link blocks, keeping the “how to
restore” guidance accurate and easy to find.
In `@web/src/components/topup/index.jsx`:
- Around line 536-546: The invite card in topup/index.jsx is still rendered even
though getAffLink() and its mount effect are disabled, leaving InvitationCard
with an empty affLink and working copy controls. Update the InvitationCard
render path to use the same self-registration/registration-enabled flag that
guards getAffLink(), and hide or disable the entire card (or at minimum the link
and copy action) when invites are unavailable so users can’t copy a blank link
or see a success toast from an empty value.
In `@web/src/pages/Home/components/EndpointTicker.jsx`:
- Around line 46-51: The icon-only copy control in EndpointTicker’s Button is
missing an accessible name, so add an explicit label for the copy action using
the Button props (for example an aria-label or equivalent) while keeping the
existing handleCopy behavior and IconCopy icon unchanged.
In `@web/src/pages/Home/Home.css`:
- Around line 3-24: Rename the keyframes in Home.css from camelCase to
kebab-case to satisfy the keyframes-name-pattern rule. Update the `@keyframes`
declarations for fadeInUp, floatSlow, and typingCursor to kebab-case names, and
make sure every matching animation: reference in the Home styles uses the same
new names so the animations still resolve correctly.
In `@web/src/pages/Home/index.jsx`:
- Around line 111-113: The home page iframe sync only runs once because the
`useEffect` around `displayHomePageContent()` has an empty dependency list, so
theme/locale updates never reach URL-based homepages. Update the effect in
`Home/index.jsx` to re-run `displayHomePageContent` when the active theme or
language changes, using the relevant values such as `actualTheme` and
`i18n.language` in the dependency list. Make sure the same
`displayHomePageContent` path is used so iframe-backed homepages receive the
latest messaging after user preference changes.
In `@web/src/pages/Home/sections/HeroSection.jsx`:
- Around line 116-136: The external CTA handlers in HeroSection currently use
window.open with '_blank' without protecting against tab-nabbing. Update both
the GitHub button and the docsLink button in HeroSection.jsx to open with
noopener,noreferrer (or otherwise explicitly clear opener) so the new tabs
cannot access window.opener, especially for the config-driven docsLink path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cfa29607-2ded-49b2-8a83-b825ab7e7bc3
⛔ Files ignored due to path filters (1)
web/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (28)
.gitignoredocs/dev/2026-04-09-bugfix-build-errors.mddocs/dev/2026-04-09-refactor-disable-self-registration.mdweb/src/App.jsxweb/src/components/auth/LoginForm.jsxweb/src/components/layout/Footer.jsxweb/src/components/layout/headerbar/UserArea.jsxweb/src/components/topup/InvitationCard.jsxweb/src/components/topup/index.jsxweb/src/helpers/render.jsxweb/src/i18n/locales/en.jsonweb/src/i18n/locales/fr.jsonweb/src/i18n/locales/ja.jsonweb/src/i18n/locales/ru.jsonweb/src/i18n/locales/vi.jsonweb/src/i18n/locales/zh-CN.jsonweb/src/i18n/locales/zh-TW.jsonweb/src/index.jsxweb/src/pages/Home/Home.cssweb/src/pages/Home/components/EndpointTicker.jsxweb/src/pages/Home/components/SectionHeader.jsxweb/src/pages/Home/index.jsxweb/src/pages/Home/sections/CapabilitySection.jsxweb/src/pages/Home/sections/EnterpriseSection.jsxweb/src/pages/Home/sections/HeroSection.jsxweb/src/pages/Home/sections/PlaygroundSection.jsxweb/src/pages/Home/sections/TrustSection.jsx首页设计.md
| tmp/main | ||
| .air.toml |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if .air.toml exists and whether it's tracked
git ls-files .air.toml
cat .air.toml 2>/dev/null || echo "File not found"Repository: QuantumNous/new-api
Length of output: 172
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== .gitignore context ==\n'
if [ -f .gitignore ]; then
nl -ba .gitignore | sed -n '24,40p'
fi
printf '\n== .air.toml presence/tracking ==\n'
git ls-files -- .air.toml || true
[ -f .air.toml ] && { echo "exists"; sed -n '1,120p' .air.toml; } || echo "missing"
printf '\n== references to .air.toml ==\n'
rg -n --hidden --glob '!.git' '\.air\.toml|air\.toml' . || trueRepository: QuantumNous/new-api
Length of output: 223
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== .gitignore lines ==\n'
if [ -f .gitignore ]; then
awk 'NR>=24 && NR<=40 { printf "%4d %s\n", NR, $0 }' .gitignore
fi
printf '\n== tracked .air.toml files ==\n'
git ls-files -- .air.toml .air.toml.example .air.toml.sample || true
printf '\n== references to air config ==\n'
rg -n --hidden --glob '!.git' '\.air\.toml|air\.toml|exclude_dir\s*=' . || trueRepository: QuantumNous/new-api
Length of output: 674
Clarify the .air.toml workflow
The docs still tell developers to create .air.toml, but it’s ignored here and there’s no committed .air.toml/.example in the repo. Either commit the shared Air config or add a tracked .air.toml.example and keep the real file ignored.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.gitignore around lines 32 - 33, The Air development workflow is
inconsistent because the repo ignores .air.toml while the docs still instruct
developers to create it and there is no tracked shared template. Update the
workflow by either committing a shared .air.toml configuration or adding a
tracked .air.toml.example and keeping the real .air.toml ignored, then align any
documentation that references the setup so developers know which file to use.
| ### 2. 注释登录页注册链接 (`LoginForm.jsx`) | ||
|
|
||
| 两处注册入口分别位于 `renderOAuthLoginForm()` 和 `renderEmailLoginForm()` 中的底部"没有账户?注册"链接,均替换为注释标记。 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Update the LoginForm references to match the current code.
This log points maintainers to renderOAuthLoginForm() and L852, but the current component uses renderOAuthOptions() and the second hidden-link block is around Line 840. Since this doc is supposed to preserve a restore path, these breadcrumbs need to be accurate.
Also applies to: 51-55
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/dev/2026-04-09-refactor-disable-self-registration.md` around lines 34 -
36, The restore-path breadcrumbs in the LoginForm documentation are outdated:
the component now uses renderOAuthOptions() instead of renderOAuthLoginForm(),
and the second hidden registration-link block is around the newer location near
the email login section rather than the old referenced line. Update the doc text
so it points maintainers to the current symbol names in LoginForm.jsx and the
correct hidden-link blocks, keeping the “how to restore” guidance accurate and
easy to find.
| // 获取邀请链接 — Registration disabled, invite link won't work | ||
| // const getAffLink = async () => { | ||
| // const res = await API.get('/api/user/aff'); | ||
| // const { success, message, data } = res.data; | ||
| // if (success) { | ||
| // let link = `${window.location.origin}/register?aff=${data}`; | ||
| // setAffLink(link); | ||
| // } else { | ||
| // showError(message); | ||
| // } | ||
| // }; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Hide or disable the invite card together with this fetch path.
With getAffLink() and its mount effect disabled here, InvitationCard still renders with an empty affLink and an active copy action, so users can copy a blank string and still see a success toast. If self-registration is off, gate the whole card (or at least the link/copy controls) behind the same flag instead of only removing the fetch path.
Also applies to: 588-592
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/components/topup/index.jsx` around lines 536 - 546, The invite card
in topup/index.jsx is still rendered even though getAffLink() and its mount
effect are disabled, leaving InvitationCard with an empty affLink and working
copy controls. Update the InvitationCard render path to use the same
self-registration/registration-enabled flag that guards getAffLink(), and hide
or disable the entire card (or at minimum the link and copy action) when invites
are unavailable so users can’t copy a blank link or see a success toast from an
empty value.
| <Button | ||
| type='primary' | ||
| onClick={handleCopy} | ||
| icon={<IconCopy />} | ||
| className='!rounded-full' | ||
| /> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Give the copy button an accessible name.
Line 46 renders an icon-only control with no text or aria-label, so screen readers just get an unnamed button here. Add an explicit label for the copy action.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/pages/Home/components/EndpointTicker.jsx` around lines 46 - 51, The
icon-only copy control in EndpointTicker’s Button is missing an accessible name,
so add an explicit label for the copy action using the Button props (for example
an aria-label or equivalent) while keeping the existing handleCopy behavior and
IconCopy icon unchanged.
| @keyframes fadeInUp { | ||
| from { | ||
| opacity: 0; | ||
| transform: translateY(24px); | ||
| } | ||
| to { | ||
| opacity: 1; | ||
| transform: translateY(0); | ||
| } | ||
| } | ||
|
|
||
| @keyframes floatSlow { | ||
| 0%, | ||
| 100% { | ||
| transform: translateY(0); | ||
| } | ||
| 50% { | ||
| transform: translateY(-18px); | ||
| } | ||
| } | ||
|
|
||
| @keyframes typingCursor { |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Rename these keyframes to kebab-case.
Stylelint is already flagging fadeInUp, floatSlow, and typingCursor, so this file will fail the configured keyframes-name-pattern check until the declarations and matching animation: references use kebab-case.
Also applies to: 78-80, 109-115, 130-132
🧰 Tools
🪛 Stylelint (17.13.0)
[error] 3-3: Expected keyframe name "fadeInUp" to be kebab-case (keyframes-name-pattern)
(keyframes-name-pattern)
[error] 14-14: Expected keyframe name "floatSlow" to be kebab-case (keyframes-name-pattern)
(keyframes-name-pattern)
[error] 24-24: Expected keyframe name "typingCursor" to be kebab-case (keyframes-name-pattern)
(keyframes-name-pattern)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/pages/Home/Home.css` around lines 3 - 24, Rename the keyframes in
Home.css from camelCase to kebab-case to satisfy the keyframes-name-pattern
rule. Update the `@keyframes` declarations for fadeInUp, floatSlow, and
typingCursor to kebab-case names, and make sure every matching animation:
reference in the Home styles uses the same new names so the animations still
resolve correctly.
Source: Linters/SAST tools
| useEffect(() => { | ||
| displayHomePageContent().then(); | ||
| displayHomePageContent(); | ||
| }, []); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep iframe-backed homepages synced after theme/locale changes.
This only runs once, but the iframe messaging path in displayHomePageContent() uses the current actualTheme and i18n.language only during the initial load. If the user switches theme or language later, URL-based homepages stay stale until a full reload.
Suggested fix
useEffect(() => {
displayHomePageContent();
}, []);
+
+ useEffect(() => {
+ if (!homePageContent.startsWith('https://')) return;
+ const iframe = document.querySelector('iframe');
+ if (!iframe?.contentWindow) return;
+ iframe.contentWindow.postMessage({ themeMode: actualTheme }, '*');
+ iframe.contentWindow.postMessage({ lang: i18n.language }, '*');
+ }, [actualTheme, i18n.language, homePageContent]);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| useEffect(() => { | |
| displayHomePageContent().then(); | |
| displayHomePageContent(); | |
| }, []); | |
| useEffect(() => { | |
| displayHomePageContent(); | |
| }, []); | |
| useEffect(() => { | |
| if (!homePageContent.startsWith('https://')) return; | |
| const iframe = document.querySelector('iframe'); | |
| if (!iframe?.contentWindow) return; | |
| iframe.contentWindow.postMessage({ themeMode: actualTheme }, '*'); | |
| iframe.contentWindow.postMessage({ lang: i18n.language }, '*'); | |
| }, [actualTheme, i18n.language, homePageContent]); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/pages/Home/index.jsx` around lines 111 - 113, The home page iframe
sync only runs once because the `useEffect` around `displayHomePageContent()`
has an empty dependency list, so theme/locale updates never reach URL-based
homepages. Update the effect in `Home/index.jsx` to re-run
`displayHomePageContent` when the active theme or language changes, using the
relevant values such as `actualTheme` and `i18n.language` in the dependency
list. Make sure the same `displayHomePageContent` path is used so iframe-backed
homepages receive the latest messaging after user preference changes.
| {isDemoSiteMode && statusVersion ? ( | ||
| <Button | ||
| size={isMobile ? 'default' : 'large'} | ||
| className='flex items-center !rounded-3xl px-6 py-2' | ||
| icon={<IconGithubLogo />} | ||
| onClick={() => | ||
| window.open( | ||
| 'https://github.com/QuantumNous/new-api', | ||
| '_blank', | ||
| ) | ||
| } | ||
| > | ||
| {statusVersion} | ||
| </Button> | ||
| ) : ( | ||
| docsLink && ( | ||
| <Button | ||
| size={isMobile ? 'default' : 'large'} | ||
| className='flex items-center !rounded-3xl px-6 py-2' | ||
| icon={<IconFile />} | ||
| onClick={() => window.open(docsLink, '_blank')} |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n--- HeroSection.jsx ---\n'
sed -n '1,220p' web/src/pages/Home/sections/HeroSection.jsx | cat -n
printf '\n--- Home index.jsx docsLink source ---\n'
sed -n '1,220p' web/src/pages/Home/index.jsx | cat -n
printf '\n--- Search for other window.open usages in web/src/pages/Home ---\n'
rg -n "window\.open\(" web/src/pages/Home -SRepository: QuantumNous/new-api
Length of output: 14004
Harden the external CTA opens in HeroSection.jsx.
Both window.open(..., '_blank') calls leave window.opener available; add noopener,noreferrer (or otherwise clear opener) so these tabs can’t tab-nab the page. This applies to both the GitHub and docs links, and the docsLink path is config-driven.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/pages/Home/sections/HeroSection.jsx` around lines 116 - 136, The
external CTA handlers in HeroSection currently use window.open with '_blank'
without protecting against tab-nabbing. Update both the GitHub button and the
docsLink button in HeroSection.jsx to open with noopener,noreferrer (or
otherwise explicitly clear opener) so the new tabs cannot access window.opener,
especially for the config-driven docsLink path.
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
Summary by CodeRabbit
New Features
Bug Fixes
Documentation