Skip to content

feat(pages): redesign hero with two-column layout and three install channels#408

Open
hezheng-max wants to merge 1 commit into
alibaba:mainfrom
hezheng-max:fix/terminal-padding
Open

feat(pages): redesign hero with two-column layout and three install channels#408
hezheng-max wants to merge 1 commit into
alibaba:mainfrom
hezheng-max:fix/terminal-padding

Conversation

@hezheng-max

Copy link
Copy Markdown
Contributor

Overview

Redesign the landing page Hero section into a desktop two-column layout and upgrade the single top install badge into three install channels.

Changes

  • Layout: Desktop two-column layout (text + install channels + buttons on the left, Terminal demo on the right); tablet/mobile keep single-column stacking
  • Install channels: Replace the top pill badge with three install methods
    • Npm Download: npm i -g @alibaba-group/open-code-review
    • macOS / Linux: curl -fsSL .../install.sh | sh
    • Windows PowerShell: irm .../install.ps1 | iex
  • Brand icons: Add npm / apple / linux / windows SVG icons (#ffffff 90% opacity); the macOS/Linux row interleaves the apple and linux icons around the ' / '
  • i18n: Add hero.installNpm / hero.installUnix / hero.installWindows for en / zh / ja
  • Typography: English title tuned to three lines; content paddingTop adjusted

Robustness

  • The macOS/Linux label uses safe splitting (?? '' fallback + graceful degradation) to avoid a crash if a translation lacks '/'
  • The copy button copies the full command (not the ellipsis-truncated display text)

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 5 issue(s) in this PR.

  • ✅ Successfully posted inline: 5 comment(s)

Comment thread pages/src/i18n/zh.ts
'hero.terminal': '终端',
'hero.copied': '已复制',
'hero.copyFailed': '复制失败',
'hero.installNpm': 'Npm 下载',

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.

"Npm" should be "npm" (all lowercase). The official npm branding always uses lowercase "npm". This is also inconsistent with the command shown below it (npm i -g ...) which correctly uses lowercase.

Suggestion:

Suggested change
'hero.installNpm': 'Npm 下载',
'hero.installNpm': 'npm 下载',

Comment thread pages/src/i18n/en.ts
'hero.terminal': 'Terminal',
'hero.copied': 'Copied!',
'hero.copyFailed': 'Copy failed',
'hero.installNpm': 'Npm Download',

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.

The conventional spelling is "npm" (all lowercase), not "Npm". This is consistent across the official npm documentation and the command itself (npm i -g ...). The same issue exists in the ja.ts and zh.ts translations.

Suggestion:

Suggested change
'hero.installNpm': 'Npm Download',
'hero.installNpm': 'npm Download',

Comment on lines +303 to +306
{ch.key === 'unix' ? (() => {
const parts = t(ch.labelKey).split('/');
const macLabel = (parts[0] ?? '').trim();
const linuxLabel = (parts[1] ?? '').trim();

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.

Fragile i18n parsing logic: Splitting the translated string on '/' to separate macOS and Linux labels is brittle. If any future translation uses a different separator, omits the slash, or contains additional slashes (e.g., in descriptive text), the UI will render incorrectly. Consider using separate i18n keys instead (e.g., hero.installMac and hero.installLinux) to avoid relying on string parsing of translated content.

Comment on lines +123 to +124
{ key: 'unix', labelKey: 'hero.installUnix', cmd: 'curl -fsSL https://raw.githubusercontent.com/alibaba/open-code-review/main/install.sh | sh', icons: [appleIcon, linuxIcon] },
{ key: 'windows', labelKey: 'hero.installWindows', cmd: 'irm https://raw.githubusercontent.com/alibaba/open-code-review/main/install.ps1 | iex', icons: [windowsIcon] },

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.

Hardcoded URLs: These installation script URLs (raw.githubusercontent.com/...) are business-critical resource paths embedded directly in component code. If the repository path changes or environment-specific URLs are needed, this requires a code change. Consider extracting these into a configuration file or constants module for easier maintenance.

width: '100vw',
marginLeft: 'calc(-50vw + 50%)',
height: isMobile ? 850 : isTablet ? 830 : 990,
height: isMobile ? 1000 : isTablet ? 900 : 860,

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.

Nested ternary expression: This nested ternary (isMobile ? ... : isTablet ? ... : ...) violates the code quality rule prohibiting nested ternaries. The project already has a pattern for avoiding this — see useResponsiveStyle.ts which uses if/else-if/else blocks. Consider creating a similar helper or using if/else logic to determine the height value.

…hannels

- Change hero from centered stack to desktop two-column layout (text left, terminal right)
- Replace top install badge with three install channels: npm, macOS/Linux, Windows PowerShell
- Add brand icons (npm/apple/linux/windows) with #ffffff 90% opacity
- Interleave apple/linux icons within the macOS / Linux label
- Add i18n keys hero.installNpm/installUnix/installWindows for en/zh/ja
- Adjust hero title to three lines (en) and content paddingTop
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