Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/web/src/components/HomeHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,7 @@ function getPluginQueryPreview(plugin: InstalledPluginRecord): string {
return trimmed.length > 96 ? `${trimmed.slice(0, 96)}…` : trimmed;
}


interface RailGroupProps {
group: ChipGroup;
activeChipId: string | null;
Expand Down
30 changes: 15 additions & 15 deletions apps/web/src/components/home-hero/chips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import type { IconName } from '../Icon';
// independently of the default-binding mapping.
export type ChipScenarioPluginId =
| DefaultScenarioPluginId
| 'example-hyperframes';
| 'example-hyperframes'
| 'example-live-artifact';

export type ChipAction =
| {
Expand All @@ -60,19 +61,27 @@ export type ChipAction =
// narrow viewports without horizontal scrolling.
export type ChipGroup = 'create' | 'migrate';

export interface HomeHeroChip {
export interface CreateChip {
id: string;
label: string;
icon: IconName;
group: ChipGroup;
hint?: string;
icon: IconName;
group: 'create';
action: ChipAction;
}

export interface MigrateChip {
id: string;
icon: IconName;
group: 'migrate';
hint: string;
action: ChipAction;
}

export type HomeHeroChip = CreateChip | MigrateChip;

export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
{
id: 'prototype',
label: 'Prototype',
icon: 'palette',
group: 'create',
// Prototype now binds to the bundled `example-web-prototype` plugin,
Expand All @@ -92,7 +101,6 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
},
{
id: 'live-artifact',
label: 'Live artifact',
icon: 'refresh',
group: 'create',
hint: 'Build a refreshable artifact backed by connector or local data.',
Expand All @@ -109,7 +117,6 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
},
{
id: 'deck',
label: 'Slide deck',
icon: 'present',
group: 'create',
// Slide deck binds to `example-simple-deck`, which ships a 353-line
Expand All @@ -130,7 +137,6 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
},
{
id: 'image',
label: 'Image',
icon: 'image',
group: 'create',
action: {
Expand All @@ -147,7 +153,6 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
},
{
id: 'video',
label: 'Video',
icon: 'play',
group: 'create',
action: {
Expand All @@ -164,7 +169,6 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
},
{
id: 'hyperframes',
label: 'HyperFrames',
icon: 'orbit',
group: 'create',
hint: 'Author HTML-based motion: captions, audio-reactive visuals, scene transitions.',
Expand All @@ -176,7 +180,6 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
},
{
id: 'audio',
label: 'Audio',
icon: 'mic',
group: 'create',
action: {
Expand All @@ -193,15 +196,13 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
},
{
id: 'create-plugin',
label: 'Create plugin',
icon: 'edit',
group: 'migrate',
hint: 'Author a reusable Open Design plugin and add it to My plugins.',
action: { kind: 'create-plugin' },
},
{
id: 'figma',
label: 'From Figma',
icon: 'import',
group: 'migrate',
hint: 'Migrate a Figma frame into the active design system.',
Expand All @@ -217,7 +218,6 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [
},
{
id: 'template',
label: 'From template',
icon: 'file-code',
group: 'migrate',
hint: 'Start from a bundled template.',
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/i18n/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ export const zhCN: Dict = {
'recentProjects.title': '最近项目',
'recentProjects.viewAll': '查看全部',
'recentProjects.empty': '还没有项目 — 输入 Prompt 即可开始。',
'pluginsHome.title': 'Community',

'pluginsHome.title': '官方入门',
'pluginsHome.subtitle': '当前运行环境内置的 Open Design 工作流。选择一个加载 starter prompt,或浏览插件市场查看更多。',
'pluginsHome.browseRegistry': '浏览插件市场',
'pluginsHome.count': '{filtered} / {total}',
Expand Down
54 changes: 54 additions & 0 deletions apps/web/tests/components/HomeHero.rail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { cleanup, fireEvent, render, screen } from '@testing-library/react';
import { afterEach, describe, expect, it, vi } from 'vitest';
import type { InstalledPluginRecord } from '@open-design/contracts';

import { I18nProvider } from '../../src/i18n';
import { HomeHero } from '../../src/components/HomeHero';
import {
HOME_HERO_CHIPS,
Expand Down Expand Up @@ -246,4 +247,57 @@ describe('HomeHero intent rail', () => {
},
});
});

it('renders localized chip labels and tooltips in zh-CN', () => {
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.

This regression test only asserts one always-visible create-chip label (prototype) and one tooltip (hyperframes), and it never opens the More shortcuts menu. That means the zh-CN copy for the changed migrate shortcuts (create-plugin, figma, template) can regress without this suite failing, even though the PR body says no mixed English homepage UI remains. Please extend this test to open home-hero-shortcuts-trigger under zh-CN and assert the localized labels/titles for the shortcut chips as well, so the homepage-localization guarantee is covered across both rail rows.

🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.

render(
<I18nProvider initial="zh-CN">
<HomeHero
prompt=""
onPromptChange={() => undefined}
onSubmit={() => undefined}
activePluginTitle={null}
activeChipId={null}
onClearActivePlugin={() => undefined}
pluginOptions={[]}
pluginsLoading={false}
pendingPluginId={null}
pendingChipId={null}
onPickPlugin={vi.fn()}
onPickChip={vi.fn()}
contextItemCount={0}
error={null}
/>
</I18nProvider>
);

// Prototype chip label should be zh-CN
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.

This zh-CN regression test still skips the other always-visible create chip, live-artifact. The current homepage renderer localizes that chip through homeHeroChipLabel() / homeHeroChipTitle() (homeHero.chip.liveArtifact and homeHero.chip.liveArtifactHint), and this same PR also touches its chip contract by adding example-live-artifact to ChipScenarioPluginId in apps/web/src/components/home-hero/chips.ts. Because the assertions here only cover prototype, hyperframes, and the migrate shortcuts, a future regression in the live-artifact zh-CN label or tooltip would still pass even though the PR body says no mixed-language homepage UI remains. Please add home-hero-rail-live-artifact text and title assertions in this test so the visible create-chip set is covered end to end.

🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.

const prototypeChip = screen.getByTestId('home-hero-rail-prototype');
expect(prototypeChip.textContent).toContain('原型');

// Live artifact chip label and tooltip should be zh-CN
const liveArtifact = screen.getByTestId('home-hero-rail-live-artifact');
expect(liveArtifact.textContent).toContain('实时制品');
expect(liveArtifact.getAttribute('title')).toBe('构建可实时预览的交互式 HTML/CSS/JS 制品。');

// HyperFrames tooltip should be the zh-CN string
const hyperframes = screen.getByTestId('home-hero-rail-hyperframes');
expect(hyperframes.getAttribute('title')).toBe(
'创作基于 HTML 的动态内容:字幕、音频响应视觉和场景转场。'
);

// Open shortcuts menu to expose migrate chips
fireEvent.click(screen.getByTestId('home-hero-shortcuts-trigger'));

// Migrate chip labels should be zh-CN
expect(screen.getByTestId('home-hero-rail-create-plugin').textContent).toContain('创建插件');
expect(screen.getByTestId('home-hero-rail-figma').textContent).toContain('来自 Figma');
expect(screen.getByTestId('home-hero-rail-template').textContent).toContain('来自模板');

// Migrate chip tooltips should be zh-CN
expect(screen.getByTestId('home-hero-rail-create-plugin').getAttribute('title')).toBe('创作可复用的 Open Design 插件,并添加到我的插件。');
expect(screen.getByTestId('home-hero-rail-figma').getAttribute('title')).toBe('将 Figma 画框迁移到当前设计体系。');
expect(screen.getByTestId('home-hero-rail-template').getAttribute('title')).toBe('从内置模板开始。');

});

});
Loading